var instrueMent = new Vue({ el:'#instrueMent', data:{ listLoading:true, categorylist:[], hotlist:[], recommendPage: 1, floorList: [], userId:0, typeSort:'', showflag:false, params:{ pageId:'', userId:'', source:1 }, nav_linkName:'' }, filters:{ NumFormat:function(value) {//处理金额 return Number(value).toFixed(2); }, }, created: function() { }, methods:{ PromotionsFormat:function(promo){//促销活动类型数据处理 if(promo!=null){ if(promo.type == 1 && promo.mode == 1){ return true }else{ return false } } return false }, closeup:function(){ this.showflag = false; document.body.style.overflow=''; }, showNav:function(){ var _this = this; _this.showflag = !_this.showflag; if (_this.showflag){ document.body.style.overflow='hidden'; }else { document.body.style.overflow=''; } }, toserch:function(item){ window.location.href='/product/instruelist.html?bigTypeID='+item.bigTypeID+'&typeSort='+this.typeSort+'&name='+this.nav_linkName }, seeMore:function(page){ page.isPageMore = !page.isPageMore; }, GetHomeFloorData: function(){ var _self = this; ProductApi.GethomeData(_self.params,function (res) { if (res.code == 0 ) { var data = res.data; _self.hotlist = data.hotSearchList; _self.floorList = data.floorList; _self.typeSort = data.typeSort; _self.listLoading =false; _self.floorList.forEach(function(page){ if(page.floorContent) { if(isPC){ if(page.floorContent.templateType == '1' || page.floorContent.templateType == '3'){ if (page.floorImageList.length>7){ page.isPageMore = true; } }else if(page.floorContent.templateType == '2' || page.floorContent.templateType == '4' || page.floorContent.templateType == '7'){ if (page.floorImageList.length>5){ page.isPageMore = true; } }else if(page.floorContent.templateType == '5'){ if (page.floorImageList.length>10){ page.isPageMore = true; } } }else { if(page.floorContent.templateType == '1' || page.floorContent.templateType == '3'){ if (page.floorImageList.length>3){ page.isPageMore = true; } }else if(page.floorContent.templateType == '2' || page.floorContent.templateType == '4'){ if (page.floorImageList.length>2){ page.isPageMore = true; } }else if(page.floorContent.templateType == '5'){ if (page.floorImageList.length>4){ page.isPageMore = true; } } } } }); _self.SwiperNanner(); _self.getClassify(); }else { CAIMEI.Alert(res.msg, '确定'); } }) }, getClassify: function() { var _self = this; PublicApi.GetProductClassify({typeSort:_self.typeSort, source: 'www'}, function (res) { if (res.code == 0) { _self.categorylist = res.data; } else { CAIMEI.Alert(res.msg, '确定', false); } }) }, SwiperNanner: function(){ setTimeout(function(){ // 图片懒加载 $("img[data-original]").lazyload(); },500); setTimeout(function(){ if (isPC) { $('.swiper-container').slide({ mainCell:".swiper-wrapper" ,titCell:".swiper-pagination span" ,effect: "leftLoop" ,interTime: 3000 ,autoPlay: true ,scroll:5 ,vis:5 }); } else { var swiper = new Swiper('.swiper-container', { slidesPerView: 2, slidesPerColumn: 2, spaceBetween:0, slidesPerGroup: 2, autoplay: { delay: 3000, disableOnInteraction: false }, pagination: { el: '.swiper-pagination' } }); } },500); } }, mounted: function(){ var _self = this; _self.nav_linkName = decodeURI(CAIMEI.getUrlParam('name')); console.log(_self.nav_linkName); var userInfo = localStorage.getItem('userInfo'); if(userInfo){ this.params.userId = JSON.parse(userInfo).userId; } this.params.pageId = getUrlParam('id'); this.GetHomeFloorData(); } })