|
@@ -14,7 +14,7 @@ var homeData = new Vue({
|
|
supplierImage:'',//供应商banner
|
|
supplierImage:'',//供应商banner
|
|
supplierWwwLink:'',//供应商banner 链接
|
|
supplierWwwLink:'',//供应商banner 链接
|
|
supplierList:[],//供应商列表
|
|
supplierList:[],//供应商列表
|
|
- topMenuList:[],
|
|
|
|
|
|
+ // topMenuList:[],
|
|
showflag:false,
|
|
showflag:false,
|
|
},
|
|
},
|
|
filters: {
|
|
filters: {
|
|
@@ -49,7 +49,6 @@ var homeData = new Vue({
|
|
},
|
|
},
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
-
|
|
|
|
zhuanti:function(){
|
|
zhuanti:function(){
|
|
this.showflag=false;
|
|
this.showflag=false;
|
|
window.location.href='/activity/activityTopic.html?id=306&name=美博会';
|
|
window.location.href='/activity/activityTopic.html?id=306&name=美博会';
|
|
@@ -62,18 +61,18 @@ var homeData = new Vue({
|
|
localStorage.setItem('lockTime',Date.now());
|
|
localStorage.setItem('lockTime',Date.now());
|
|
localStorage.setItem('isActivityStatus',true);
|
|
localStorage.setItem('isActivityStatus',true);
|
|
},
|
|
},
|
|
- GetBanners: function(){
|
|
|
|
- var _self = this;
|
|
|
|
- PublicApi.GetHomeBanner({},function(response){
|
|
|
|
- if(response.code == 0){
|
|
|
|
- _self.images = response.data;
|
|
|
|
- _self.listLoading =false;
|
|
|
|
- _self.SwiperBanner();
|
|
|
|
- }else{
|
|
|
|
- CAIMEI.Alert(response.msg, '确定');
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
|
|
+ // GetBanners: function(){
|
|
|
|
+ // var _self = this;
|
|
|
|
+ // PublicApi.GetHomeBanner({},function(response){
|
|
|
|
+ // if(response.code == 0){
|
|
|
|
+ // _self.images = response.data;
|
|
|
|
+ // _self.listLoading =false;
|
|
|
|
+ // _self.SwiperBanner();
|
|
|
|
+ // }else{
|
|
|
|
+ // CAIMEI.Alert(response.msg, '确定');
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ // },
|
|
SwiperBanner: function(){
|
|
SwiperBanner: function(){
|
|
setTimeout(function(){
|
|
setTimeout(function(){
|
|
if (isPC) {
|
|
if (isPC) {
|
|
@@ -107,72 +106,84 @@ var homeData = new Vue({
|
|
}
|
|
}
|
|
},300);
|
|
},300);
|
|
},
|
|
},
|
|
- GetNavigationMenu :function(){//获取顶部导航分类
|
|
|
|
|
|
+ // GetNavigationMenu :function(){//获取顶部导航分类
|
|
|
|
+ // var _self = this;
|
|
|
|
+ // PublicApi.GetNavigationMenu({source:1},function(response){
|
|
|
|
+ // if(response.code == 0){
|
|
|
|
+ // _self.topMenuList = response.data.topMenuList;
|
|
|
|
+ // }else{
|
|
|
|
+ // CAIMEI.Alert(response.msg, '确定');
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ // },
|
|
|
|
+ GetHomeFloorData: function(){
|
|
var _self = this;
|
|
var _self = this;
|
|
- PublicApi.GetNavigationMenu({source:1},function(response){
|
|
|
|
- if(response.code == 0){
|
|
|
|
- _self.topMenuList = response.data.topMenuList;
|
|
|
|
- }else{
|
|
|
|
- CAIMEI.Alert(response.msg, '确定');
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ // 预设静态数据
|
|
|
|
+ var staticJson = $("#floorJson").val();
|
|
|
|
+ if (staticJson) {
|
|
|
|
+ var staticData = JSON.parse(staticJson);
|
|
|
|
+ _self.setFloorData(staticData);
|
|
|
|
+ }
|
|
|
|
+ // 如果没有静态数据(重新请求) 或 用户登录(重新请求获取价格)
|
|
|
|
+ if (!staticJson || GLOBAL_USER_ID>0){
|
|
|
|
+ PublicApi.GetHomeData({userId:GLOBAL_USER_ID,source:1},function(response){
|
|
|
|
+ if(response.code == 0){
|
|
|
|
+ var data = response.data;
|
|
|
|
+ _self.setFloorData(data);
|
|
|
|
+ }else{
|
|
|
|
+ CAIMEI.Alert(response.msg, '确定');
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- GetHomeFloorData: function(){
|
|
|
|
|
|
+ setFloorData: function(data){
|
|
var _self = this;
|
|
var _self = this;
|
|
- PublicApi.GetHomeData({userId:GLOBAL_USER_ID,source:1},function(response){
|
|
|
|
- if(response.code == 0){
|
|
|
|
- var data = response.data;
|
|
|
|
- // var floorList = [];
|
|
|
|
- _self.pageList = data.homePageFloor;
|
|
|
|
- _self.liveList = data.liveList;
|
|
|
|
- _self.supplierList = data.supplierImage.qualitySupplierList;
|
|
|
|
- _self.supplierImage = data.supplierImage.wwwImage;
|
|
|
|
- _self.supplierWwwLink = data.supplierImage.wwwLink;
|
|
|
|
- _self.pageList.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.listLoading = false;
|
|
|
|
+ _self.pageList = data.homePageFloor;
|
|
|
|
+ // _self.liveList = data.liveList;
|
|
|
|
+ _self.supplierList = data.supplierImage.qualitySupplierList;
|
|
|
|
+ _self.supplierImage = data.supplierImage.wwwImage;
|
|
|
|
+ _self.supplierWwwLink = data.supplierImage.wwwLink;
|
|
|
|
+ _self.pageList.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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- });
|
|
|
|
- console.log(_self.pageList)
|
|
|
|
- _self.GetHomeRightData();
|
|
|
|
- setTimeout(function() {
|
|
|
|
- // 设置侧边导航数据
|
|
|
|
- _self.SetAsideNav();
|
|
|
|
- _self.SwiperFloor();
|
|
|
|
- },500);
|
|
|
|
- }else{
|
|
|
|
- CAIMEI.Alert(response.msg, '确定');
|
|
|
|
|
|
+ }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.GetHomeRightData();
|
|
|
|
+ setTimeout(function() {
|
|
|
|
+ // 设置侧边导航数据
|
|
|
|
+ _self.SetAsideNav();
|
|
|
|
+ _self.SwiperFloor();
|
|
|
|
+ },500);
|
|
|
|
+ console.log(_self.pageList)
|
|
},
|
|
},
|
|
GetHomeRightData: function(){
|
|
GetHomeRightData: function(){
|
|
var _self = this;
|
|
var _self = this;
|
|
@@ -211,6 +222,7 @@ var homeData = new Vue({
|
|
SetAsideNav: function(){
|
|
SetAsideNav: function(){
|
|
var _self = this;
|
|
var _self = this;
|
|
var titArr = $('.section_page_title').find('h1');
|
|
var titArr = $('.section_page_title').find('h1');
|
|
|
|
+ _self.asideNav = [];
|
|
for (var i=0; i<titArr.length; i++){
|
|
for (var i=0; i<titArr.length; i++){
|
|
_self.asideNav.push({
|
|
_self.asideNav.push({
|
|
id: $(titArr[i]).attr("data-id"),
|
|
id: $(titArr[i]).attr("data-id"),
|
|
@@ -280,8 +292,8 @@ var homeData = new Vue({
|
|
if(userInfo){
|
|
if(userInfo){
|
|
this.userId = JSON.parse(userInfo).userId;
|
|
this.userId = JSON.parse(userInfo).userId;
|
|
}
|
|
}
|
|
- this.GetBanners();
|
|
|
|
- this.GetNavigationMenu();
|
|
|
|
|
|
+ this.SwiperBanner();
|
|
|
|
+ // this.GetNavigationMenu();
|
|
this.GetHomeFloorData();
|
|
this.GetHomeFloorData();
|
|
},
|
|
},
|
|
mounted: function() {
|
|
mounted: function() {
|