77
| <![CDATA[<script>
fetchData('/educacao/news/?page=1&perpage=11&highlight=1').then(response => {
const sliderList = document.querySelector('#slider .splide__list');
const boxNewsFirst = document.querySelector('.news-bottom.first');
const boxNewsSecond = document.querySelector('.news-bottom.second');
let slide = '';
let newsFirst = '';
let newsSecond = '';
let x = 0;
response.data.forEach(obj => {
let {idNoticia, nomeCategoria, tituloNoticia, fotoPrincipal} = obj;
if(x < 7)
slide += `<li class="splide__slide">
<a href="${ '/noticia/' + idNoticia + '/' + slugify(tituloNoticia)}">
<span class="title">${tituloNoticia}</span>
<img data-splide-lazy="${env.URL_TMP}arquivosNoticiasInterna/${fotoPrincipal}" alt="${tituloNoticia}">
</a>
</li>`;
else if(x < 9)
newsFirst += `<article class="second">
<a href="${ '/noticia/' + idNoticia + '/' + slugify(tituloNoticia)}">
<img src="${env.URL_TMP}arquivosNoticiasInterna/${fotoPrincipal}" alt="${tituloNoticia}">
<span class="title">${tituloNoticia}</span>
</a>
</article>`;
else
newsSecond += `<article class="second">
<a href="${ '/noticia/' + idNoticia + '/' + slugify(tituloNoticia)}">
<img src="${env.URL_TMP}arquivosNoticiasInterna/${fotoPrincipal}" alt="${tituloNoticia}">
<span class="title">${tituloNoticia}</span>
</a>
</article>`;
x ++;
});
sliderList.innerHTML = slide;
boxNewsFirst.innerHTML = newsFirst;
boxNewsSecond.innerHTML = newsSecond;
new Splide('#slider', {
autoplay: true,
interval: 3000,
rewind: true,
type: 'slide',
/* arrows: false, */
lazyLoad: 'nearby'
}).mount();
});
</script>]]>
|