【优化】优化首页及自定义首页海报获取状态。

This commit is contained in:
大灰灰
2022-12-27 23:48:15 +08:00
parent a84f3e137a
commit 7e38cfed74
2 changed files with 48 additions and 50 deletions

View File

@@ -25,7 +25,7 @@
<!--返回顶部组件--> <!--返回顶部组件-->
<u-back-top :scroll-top="scrollTop" :duration="500"></u-back-top> <u-back-top :scroll-top="scrollTop" :duration="500"></u-back-top>
<!--弹出框--> <!--弹出框-->
<coreshop-modal-img :show="modalShow" :src="$globalConstVars.apiFilesUrl+'/static/images/empty/reward.png'" @imgTap="imgTap" @closeTap="closeTap" /> <coreshop-modal-img :show="modalShow" :src="indexPopupWindowImageUrl" @imgTap="imgTap" @closeTap="closeTap" />
<!-- 登录提示 --> <!-- 登录提示 -->
<coreshop-login-modal></coreshop-login-modal> <coreshop-login-modal></coreshop-login-modal>
</view> </view>
@@ -35,7 +35,6 @@
export default { export default {
data() { data() {
return { return {
swiperItems: [],
currentIndex: 0, currentIndex: 0,
opacity: 0, opacity: 0,
scrollTop: 0, scrollTop: 0,
@@ -44,7 +43,9 @@
kefupara: '', //客服传递资料 kefupara: '', //客服传递资料
copy: false, copy: false,
shareUrl: this.$globalConstVars.shareUrl, shareUrl: this.$globalConstVars.shareUrl,
modalShow: true, isScorll: false,
homeTitle: '',
modalShow: false,
}; };
}, },
updated() { updated() {
@@ -72,11 +73,22 @@
} }
}, },
appTitle() { appTitle() {
return this.$store.state.config.shopName; this.homeTitle = this.$store.state.config.shopName;
return this.homeTitle || '';
}, },
// 获取店铺联系人手机号 // 获取店铺联系人手机号
shopMobile() { shopMobile() {
return this.$store.state.config.shopMobile || 0; return this.$store.state.config.shopMobile || 0;
},
modalShowData() {
this.modalShow = this.$store.state.config.showIndexPopupWindow == 1;
return this.$store.state.config.showIndexPopupWindow == 1;
},
indexPopupWindowHrefUrl() {
return this.$store.state.config.indexPopupWindowHrefUrl;
},
indexPopupWindowImageUrl() {
return this.$store.state.config.indexPopupWindowImageUrl;
} }
}, },
onLoad(e) { onLoad(e) {
@@ -89,18 +101,29 @@
methods: { methods: {
imgTap() { imgTap() {
this.modalShow = false; this.modalShow = false;
uni.navigateTo({ var val = this.indexPopupWindowHrefUrl;
url: "/pages/reward/reward" if (this.indexPopupWindowHrefUrl.indexOf('http') != -1) {
}); // #ifdef APP-PLUS || APP-PLUS-NVUE || MP
this.$u.route('/pages/webview/webview', { src: val });
// #endif
} else {
// #ifdef APP-PLUS || APP-PLUS-NVUE || MP
if (val == '/pages/index/default/default' || val == '/pages/category/index/index' || val == '/pages/index/cart/cart' || val == '/pages/index/member/member') {
this.$u.route({ type: 'switchTab', url: val });
return;
} else if (val.indexOf('/pages/coupon/coupon?id=') > -1) {
var id = val.replace('/pages/coupon/coupon?id=', "");
this.receiveCoupon(id)
} else {
this.$u.route(val);
return;
}
// #endif
}
}, },
closeTap() { closeTap() {
this.modalShow = false; this.modalShow = false;
}, },
goSearch() {
uni.navigateTo({
url: '/pages/search/search'
});
},
// 首页初始化获取数据 // 首页初始化获取数据
initData() { initData() {
uni.showLoading({ uni.showLoading({
@@ -110,26 +133,6 @@
this.$u.api.getPageConfig({ code: this.pageCode }).then(res => { this.$u.api.getPageConfig({ code: this.pageCode }).then(res => {
if (res.status == true) { if (res.status == true) {
this.pageData = res.data.items; this.pageData = res.data.items;
if (res.data.items.length > 0) {
for (var i = 0; i < res.data.items.length; i++) {
if (res.data.items[i].widgetCode == 'topImgSlide') {
var data = res.data.items[i].parameters.list;
for (var i = 0; i < data.length; i++) {
let moder = {
image: data[i].image,
bg: data[i].bg,
opentype: 'click',
url: '',
title: data[i].linkType,
linkType: data[i].linkType,
linkValue: data[i].linkValue,
}
this.swiperItems.push(moder);
}
}
}
}
} }
setTimeout(function () { setTimeout(function () {
uni.hideLoading(); uni.hideLoading();
@@ -155,9 +158,6 @@
} }
this.getShareUrl(); this.getShareUrl();
}, },
swiperChange(e) {
this.currentIndex = e;
},
//在线客服 //在线客服
showChat() { showChat() {
// #ifdef APP-PLUS || APP-PLUS-NVUE // #ifdef APP-PLUS || APP-PLUS-NVUE
@@ -179,13 +179,9 @@
this.$u.api.share(data).then(res => { this.$u.api.share(data).then(res => {
this.shareUrl = res.data this.shareUrl = res.data
}); });
}, }
taped: function (e) {
this.showSliderInfo(this.swiperItems[e].linkType, this.swiperItems[e].linkValue);
},
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.swiperItems = [];
this.initData(); this.initData();
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
}, },
@@ -205,6 +201,7 @@
} }
}, },
onPageScroll: function (e) { onPageScroll: function (e) {
this.isScorll = e.scrollTop > 100 ? true : false;
this.scrollTop = e.scrollTop; this.scrollTop = e.scrollTop;
if (e.scrollTop <= 100) { if (e.scrollTop <= 100) {
this.opacity = e.scrollTop / 100; this.opacity = e.scrollTop / 100;

View File

@@ -38,7 +38,6 @@
currentIndex: 0, currentIndex: 0,
opacity: 0, opacity: 0,
scrollTop: 0, scrollTop: 0,
imageUrl: '/static/images/ShareImage.png', //店铺分享图片
pageData: [], pageData: [],
pageCode: 'mobile_home', //页面布局编码 pageCode: 'mobile_home', //页面布局编码
kefupara: '', //客服传递资料 kefupara: '', //客服传递资料
@@ -47,19 +46,11 @@
isScorll: false, isScorll: false,
homeTitle: '', homeTitle: '',
modalShow: false, modalShow: false,
indexPopupWindowHrefUrl: '',
indexPopupWindowImageUrl: '',
}; };
}, },
updated() { updated() {
this.copy = true; this.copy = true;
}, },
mounted() {
this.modalShow = this.$store.state.config.showIndexPopupWindow == 1;
this.indexPopupWindowHrefUrl = this.$store.state.config.indexPopupWindowHrefUrl;
this.indexPopupWindowImageUrl = this.$store.state.config.indexPopupWindowImageUrl;
},
computed: { computed: {
...mapState({ ...mapState({
hasLogin: state => state.hasLogin, hasLogin: state => state.hasLogin,
@@ -88,6 +79,16 @@
// 获取店铺联系人手机号 // 获取店铺联系人手机号
shopMobile() { shopMobile() {
return this.$store.state.config.shopMobile || 0; return this.$store.state.config.shopMobile || 0;
},
modalShowData() {
this.modalShow = this.$store.state.config.showIndexPopupWindow == 1;
return this.$store.state.config.showIndexPopupWindow == 1;
},
indexPopupWindowHrefUrl() {
return this.$store.state.config.indexPopupWindowHrefUrl;
},
indexPopupWindowImageUrl() {
return this.$store.state.config.indexPopupWindowImageUrl;
} }
}, },
onLoad(e) { onLoad(e) {
@@ -174,7 +175,7 @@
this.$u.api.share(data).then(res => { this.$u.api.share(data).then(res => {
this.shareUrl = res.data this.shareUrl = res.data
}); });
}, }
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.initData(); this.initData();