|
@@ -9,9 +9,9 @@ var activeApp = (function () {
|
|
|
isRequest: true,
|
|
|
isLoading: true,
|
|
|
// showScrollTop: false,
|
|
|
- activityEntryVisiable:false,
|
|
|
- contactVisiable:false,
|
|
|
- scrollTopSize:0,
|
|
|
+ activityEntryVisiable: false,
|
|
|
+ contactVisiable: false,
|
|
|
+ scrollTopSize: 0,
|
|
|
msg: 'hello world',
|
|
|
src: './img/test.jpg',
|
|
|
// 显示个数
|
|
@@ -27,35 +27,62 @@ var activeApp = (function () {
|
|
|
userId: '',
|
|
|
source: 1
|
|
|
},
|
|
|
- selectVideoTabMap: {}
|
|
|
+ selectVideoTabMap: {},
|
|
|
+ //用户权限
|
|
|
+ globalUserData: '',
|
|
|
+ GLOBAL_USER_ID: 0,
|
|
|
+ GLOBAL_USER_IDENTITY: 0,//2-会员机构;3-供应商;4-普通机构
|
|
|
+ GLOBAL_SHOP_ID: 0,
|
|
|
},
|
|
|
mounted: function mounted() {
|
|
|
this.pageLoaded();
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
created: function created() {
|
|
|
+ this.initUserInfo();
|
|
|
this.getFloorData();
|
|
|
- },
|
|
|
- computed:{
|
|
|
- showScrollTop: function() {
|
|
|
+ }
|
|
|
+ ,
|
|
|
+ computed: {
|
|
|
+ showScrollTop: function () {
|
|
|
return this.scrollTopSize > 600
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
watch: {
|
|
|
isMobile: function isMobile() {
|
|
|
// if (this.needReload) window.location.reload()
|
|
|
this.isLoading = true;
|
|
|
window.location.reload();
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
filters: {
|
|
|
+ NumFormat: function NumFormat(value) {//处理金额
|
|
|
+ return Number(value).toFixed(2);
|
|
|
+ }
|
|
|
+ ,
|
|
|
tabTime: function tabTime(val) {
|
|
|
// 2021-08-16 00:00:00
|
|
|
var first = val.split(' ')[0];
|
|
|
var second = first.split('-');
|
|
|
return second[1] + '-' + second[2];
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
methods: {
|
|
|
+ //促销活动类型数据处理
|
|
|
+ PromotionsFormat: function (promo) {
|
|
|
+ if (promo !== null) {
|
|
|
+ if (promo.type === 1 && promo.mode === 1) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ ,
|
|
|
// 创建tab与轮播图的对应关系
|
|
|
makeVideoFetchMap: function makeVideoFetchMap() {
|
|
|
var videoList = [22, 23, 24, 25];
|
|
@@ -66,7 +93,8 @@ var activeApp = (function () {
|
|
|
}
|
|
|
});
|
|
|
this.selectVideoTabMap = videoMap;
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
|
|
|
// tab点击事件
|
|
|
handleTabClick: function handleTabClick(type, index, val) {
|
|
@@ -79,15 +107,18 @@ var activeApp = (function () {
|
|
|
utils.responsive('.aspect', 'scalc');
|
|
|
console.log('轮播图切换');
|
|
|
});
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
|
|
|
// 当前选中的轮播图
|
|
|
currentVideoSwiper: function currentVideoSwiper(type, index) {
|
|
|
return this.selectVideoTabMap[type + '-' + index];
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
getFloorImageListType: function getFloorImageListType(index) {
|
|
|
return index === 0 ? 'floorImageList' : 'floorImageList' + (index + 1);
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
|
|
|
// 获取楼层信息
|
|
|
getFloorData: function getFloorData() {
|
|
@@ -101,21 +132,24 @@ var activeApp = (function () {
|
|
|
that.pageInfo = res.data.page;
|
|
|
that.isRequest = false;
|
|
|
that.makeVideoFetchMap();
|
|
|
- that.activityEntryVisiable = that.initActivityEntry(res.data.page.redPacketBeginTime,res.data.page.redPacketEndTime);
|
|
|
+ that.activityEntryVisiable = that.initActivityEntry(res.data.page.redPacketBeginTime, res.data.page.redPacketEndTime);
|
|
|
that.contactVisiable = res.data.page.infoBarStatus === 1;
|
|
|
}
|
|
|
})
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
// 初始化红包入口状态
|
|
|
- initActivityEntry: function initActivityEntry(begin,end){
|
|
|
+ initActivityEntry: function initActivityEntry(begin, end) {
|
|
|
const nowTime = new Date().getTime();
|
|
|
const beginTime = new Date(begin).getTime();
|
|
|
const endTime = new Date(end).getTime();
|
|
|
- return nowTime>=beginTime && nowTime<=endTime
|
|
|
- },
|
|
|
+ return nowTime >= beginTime && nowTime <= endTime
|
|
|
+ }
|
|
|
+ ,
|
|
|
fetchTemplate: function fetchTemplate(list, type) {
|
|
|
return list.indexOf(parseInt(type)) !== -1;
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
|
|
|
// 获取直播状态
|
|
|
makeVideoStatus: function makeVideoStatus(floorData, index) {
|
|
@@ -134,7 +168,8 @@ var activeApp = (function () {
|
|
|
if (nowDate - oneDay > displayDate) {
|
|
|
return 2; // 已结束
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
|
|
|
// 使用产品楼层的布局
|
|
|
getProductScalcMap: function getProductScalcMap(templateId) {
|
|
@@ -144,7 +179,8 @@ var activeApp = (function () {
|
|
|
scalc: scalcLayout[current].scalc,
|
|
|
col: scalcLayout[current].col
|
|
|
};
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
// 使用文章楼层的布局
|
|
|
getArticleScalcMap: function getArticleScalcMap(templateId) {
|
|
|
var current = this.isMobile ? 'mobile' : 'pc';
|
|
@@ -153,7 +189,8 @@ var activeApp = (function () {
|
|
|
scalc: scalcLayout[current],
|
|
|
swiper: scalcLayout['swiper']
|
|
|
};
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
// 使用图片楼层的布局
|
|
|
getImageScalcMap: function getImageScalcMap(templateId) {
|
|
|
var current = this.isMobile ? 'mobile' : 'pc';
|
|
@@ -162,7 +199,8 @@ var activeApp = (function () {
|
|
|
scalc: scalcLayout[current],
|
|
|
swiper: scalcLayout['swiper']
|
|
|
};
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
// 使用直播楼层的布局
|
|
|
getVideoScalcMap: function getVideoScalcMap(templateId) {
|
|
|
var current = this.isMobile ? 'mobile' : 'pc';
|
|
@@ -171,15 +209,18 @@ var activeApp = (function () {
|
|
|
scalc: scalcLayout[current],
|
|
|
swiper: scalcLayout['swiper']
|
|
|
};
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
// 处理link
|
|
|
reallink: function reallink(link) {
|
|
|
return link ? link : 'javascript:void(0)';
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
handleToggleActive: function handleToggleActive(flag) {
|
|
|
console.log(flag);
|
|
|
this.isActive = flag;
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
// 页面挂载完毕
|
|
|
pageLoaded: function pageLoaded() {
|
|
|
// 轮播图配置
|
|
@@ -195,10 +236,10 @@ var activeApp = (function () {
|
|
|
var timer = setInterval(function () {
|
|
|
if (!that.isRequest) {
|
|
|
that.swiperList = utils.createSwiper(options);
|
|
|
- console.log(that.swiperList);
|
|
|
+ // console.log(that.swiperList);
|
|
|
console.log('轮播图创建完毕...');
|
|
|
that.initCountMap(countMapping);
|
|
|
- console.log(this.countMap);
|
|
|
+ // console.log(that.countMap);
|
|
|
console.log('商品列表处理完毕...');
|
|
|
utils.responsive('.aspect', 'scalc');
|
|
|
that.isLoading = false;
|
|
@@ -216,11 +257,30 @@ var activeApp = (function () {
|
|
|
}, 200);
|
|
|
activeApp.$set(activeApp.$data, 'isMobile', window.innerWidth < 560);
|
|
|
});
|
|
|
- window.addEventListener('scroll', function(event){
|
|
|
+ window.addEventListener('scroll', function (event) {
|
|
|
that.scrollTopSize = $('body').scrollTop();
|
|
|
});
|
|
|
console.log('窗口resize事件注册完毕...');
|
|
|
}
|
|
|
+ ,
|
|
|
+ // 初始化用户信息
|
|
|
+ initUserInfo: function initUserInfo() {
|
|
|
+ var userInfo = localStorage.getItem('userInfo');
|
|
|
+ if (!userInfo) {
|
|
|
+ console.log('用户未登录...');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.globalUserData = JSON.parse(localStorage.getItem('userInfo'));
|
|
|
+ this.GLOBAL_USER_ID = this.globalUserData.userId * 1;
|
|
|
+ this.GLOBAL_USER_IDENTITY = this.globalUserData.userIdentity * 1;
|
|
|
+ this.GLOBAL_SHOP_ID = this.globalUserData.shopId * 1;
|
|
|
+ this.params.userId = this.globalUserData.userId;
|
|
|
+ if (this.GLOBAL_USER_ID === 5261 || this.GLOBAL_USER_ID === 10947 || this.GLOBAL_USER_ID === 11579) {
|
|
|
+ this.GLOBAL_USER_IDENTITY = 1;
|
|
|
+ }
|
|
|
+ console.log('已获取用户登录信息')
|
|
|
+ }
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
+ ;
|
|
|
})();
|