window.onload=function(){
$('#myCarousel').html(`
`)
let href = window.location.href,http = window.location.host,api='';
let pre = /.html|\#|\?/,
r1 = href.match(pre);
if(pre.test(href)){
let p1 = href.split(r1);
api=p1[0].split('/').pop();
}else{
api=href.split('/').pop();
}
$.ajax({
method:'get',
dataType:'json',
url: globalConfig.context + "/api/portal/banners/list",
data:{
apiUrl:api,
client:0
}
}).done(data=>{
let theData=data.data,bannerDott=[],bannerImgs=[];
theData.map((item,index)=>{
bannerDott.push(`
`);
bannerImgs.push(`
`);
})
$('.carousel-indicators').html(bannerDott.length>1?bannerDott.join(''):'');
$('.carousel-inner').html(bannerImgs.join(''));
if(theData.length>1){
$('#myCarousel').append(`
‹
›
`)
}
})
}