/*
$(function () {




    $.ajax({
        url:url+"/encyclopedia/encyclopedia/listForPage",
        dataType: "json",
        type: "get",
        success: function (response, status, xhr) {
            console.log(response)
            var arr = [];
            for ( var i=0; i <response.length ; i++){
                console.log(arr)
                if (response.length>0 && response[i].type=='百科') {
                    // console.log( arr)
                  arr.push(response[i]);

            }
            }
            $("#LBT5").html(arr[0].jumpurl);
            $("#LAT5").attr('src',arr[0].img);
            $("#LBT6").html(arr[1].jumpurl);
            $("#LAT6").attr('src', arr[1].img);
            $("#LBT7").html(arr[2].jumpurl);
            $("#LAT7").attr('src', arr[2].img);
        }
    });


});*/

var vue = new Vue({
    el:'#rightSwiper',
    data:{
        pictures:'',
        len:0
    },
    mounted(){
        this.getPictures();
    },
    methods:{
        getPictures(){
            var that = this;
            $.ajax({
                url:url+"/encyclopedia/encyclopedia/listForPage",
                dataType: "json",
                type: "get",
                success: function (response, status, xhr) {
                    $.each(response,function (i,item) {
                        if(item.type=="百科"){
                            that.len++;
                            that.pictures+="<div class='swiper-slide width100' style='height: 124px' title='"+item.jumpurl+"'>" +
                                "<a href='"+item.tourl+"' target='_blank'><div class='width100 text_align_center'>" +
                                "<img class='width80' style='height: 98px;' src='"+formatImgUrl(item.img)+"'>" +
                                "</div>" +
                                "<div class='width80 text_align_center one_line'>"+item.jumpurl+"</div></a>"+
                                "</div>";
                        }
                    });
                    $('.swiper-wrapper').html(that.pictures);
                    if(that.len>=3){
                        var mySwiper = new Swiper('.swiper-container', {
                            autoplay: true,//可选选项,自动滑动
                            loop:true,
                            direction:'vertical',
                            slidesPerView: 3
                        });
                    }
                }
            });
        }
    }
});