Vue.config.devtools = true;
var v = new Vue({
    el:".container",
    data:function () {
        return {
            cata:[
                {name:"会议列表",active:1,id:1},
                {name:"详情",active:0,id:2}
            ],
            list:[],
            info:{
                sysRecommendDTOs: []
            },
            isLogin: 0,
            memToken: '',
            memHeadImg: '',
            userJf:-1,
            conferId:-1,
            playIndex:-1,
            integralType:"",
            integralCount:""
        }
    },
    created:function (){
        if($.cookie("memToken")){
            this.memToken = $.cookie("memToken");
            this.isLogin=1;
        }
        if($.cookie("memHeadImg")){
            this.memHeadImg = $.cookie("memHeadImg");
        }
        this.conferId = $("#conferId").val();
        this.findUserIntegral();
        this.getIndexData();
        if (typeof (fromlogin) != "undefined" && fromlogin == "1") {
            jifen();
        }
    },
    mounted:function (){
        setTimeout(() => {
            $(".loading-item").fadeOut(200);
        },500)
        setTimeout(() => {
            var mySwiper = new Swiper('.swiper-container', {
                direction: 'horizontal', // 水平切换选项
                loop: true, // 循环模式选项
                observerParents: true,
                observer: true,
                autoplay: {
                    disableOnInteraction: false,  //触碰后自动轮播也不会停止
                    delay: 2000,
                },
                // 如果需要分页器
                pagination: {
                    el: '.swiper-pagination',
                },

                // 如果需要前进后退按钮
                navigation: {
                    nextEl: '.swiper-button-next',
                    prevEl: '.swiper-button-prev',
                },

                // 如果需要滚动条
                scrollbar: {
                    el: '.swiper-scrollbar',
                },

            })
        }, 1000);
    },
    methods:{
        addUser (id){
            if(!checkLogin()){
                // goLogin();
                return false;
            }
            window.location.href=serverHttp+"/meeting/addUser?from=H5&conferId="+id;
        },
        copyPhone (){
            var aux = document.createElement("input");
            aux.setAttribute('readonly', 'readonly');
            aux.value = "17621769788";
            document.body.appendChild(aux);
            aux.setSelectionRange(0, 9999);
            aux.select();
            document.execCommand("copy");
            document.body.removeChild(aux);
            alert("复制成功");
        },
        findUserIntegral () {
            var that = this;
            $.ajax({
                type: 'POST',
                url: serverHttp + "/user/findUserIntegral",
                data: {
                    memToken: that.memToken
                },
                success: function (data) {
                    if (data.code == 200) {
                        that.userJf = data.data;
                    }
                },
                error: function (data) {
                }
            });
        },
        getIndexData () {
            //id：分类id id = -1 是全部分类
            var that = this;
            $.ajax({
                type : 'POST',
                url : serverHttp+"/meeting/getDetailData",
                data : {
                    conferId:that.conferId
                },
                success : function(data) {
                    if (data.code == 200) {
                        that.info = data.data;
                        $(document).attr("title", that.info.title);
                    }
                },
                error : function(data) {

                }
            });
        },
        meetingDetails(id){
            window.location.href=serverHttp+"/meeting/details?from=H5&conferId="+id;
        },
        chooseTab (i){
            const that = this;
            for (var item of that.cata) {
                if (item.active == 1) {
                    item.active = 0
                }
            }
            that.cata[i].active = 1;
        },
    }
})
