|  | @@ -0,0 +1,47 @@
 | 
	
		
			
				|  |  | +window.onload=function(){
 | 
	
		
			
				|  |  | +    $('#myCarousel').html(`
 | 
	
		
			
				|  |  | +        <ol class="carousel-indicators"></ol>
 | 
	
		
			
				|  |  | +        <div class="carousel-inner"></div>
 | 
	
		
			
				|  |  | +    `)
 | 
	
		
			
				|  |  | +    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{
 | 
	
		
			
				|  |  | +        let urlArr = href.split('/');
 | 
	
		
			
				|  |  | +        api=href.split('/').pop();
 | 
	
		
			
				|  |  | +           
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    console.log(api)
 | 
	
		
			
				|  |  | +    $.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(`
 | 
	
		
			
				|  |  | +                <li data-target="#myCarousel" data-slide-to=${index} class="${index?'':'active'}"></li>
 | 
	
		
			
				|  |  | +            `);
 | 
	
		
			
				|  |  | +            bannerImgs.push(`
 | 
	
		
			
				|  |  | +            <div class="${index?'item':'item active'}">
 | 
	
		
			
				|  |  | +                <a href="${item.forwardUrl?'http://'+http+item.forwardUrl:'javascript:;'}"><img src="${'http://'+http+item.imgUrl}" alt="${item.text}"></a>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +            `);
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +        $('.carousel-indicators').html(bannerDott.length>1?bannerDott.join(''):'');
 | 
	
		
			
				|  |  | +        $('.carousel-inner').html(bannerImgs.join(''));
 | 
	
		
			
				|  |  | +        if(theData.length>1){
 | 
	
		
			
				|  |  | +            $('#myCarousel').append(`
 | 
	
		
			
				|  |  | +                <a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
 | 
	
		
			
				|  |  | +                <a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
 | 
	
		
			
				|  |  | +            `)
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +}
 |