Files
lucky_shop/pages/index/public/js/index.js

63 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
export default {
data() {
return {
minScrollTop: 100, // 设置回到顶端按钮显示要求,最小页面滚动距离
wechatQrcode: '', // 公众号二维码
diyRoute: '/pages/index/index'
};
},
onLoad(option) {
// #ifdef H5
// H5地图选择位置回调数据
if (option.module && option.module == 'locationPicker') {
option.name = ''; // 清空地址
}
// #endif
this.name = option.name || 'DIY_VIEW_INDEX'; // 根据店铺运营模式打开平台shop或者连锁门店stroe页面接口会自行判断
},
onShow() {
// 获取关注公众号二维码
this.getFollowQrcode();
},
mounted() {
// 监听图片点击事件
this.unsubscribe = this.$eventBus?.on('pictureTap', this._handleDiyGroupInteractionEvent);
},
beforeDestroy() {
// 移除图片点击事件监听
if (this.unsubscribe) this.unsubscribe();
},
methods: {
// 关注公众号
getFollowQrcode() {
if (!this.$util.isWeiXin()) return;
this.$api.sendRequest({
url: '/wechat/api/wechat/followqrcode',
success: res => {
if (res.code >= 0 && res.data) {
this.wechatQrcode = res.data.qrcode;
}
}
});
},
officialAccountsOpen() {
this.$refs.officialAccountsPopup.open();
},
officialAccountsClose() {
this.$refs.officialAccountsPopup.close();
},
// 统一处理点击及触摸事件
_handleDiyGroupInteractionEvent(payload) {
if (this.storeToken) {
return;
}
// 打开登录弹窗
this.$refs.login?.open();
// 阻止事件继续传播
return false;
}
}
}