chore:删除原来的多余的调动弹窗的代码

This commit is contained in:
2026-04-09 10:40:43 +08:00
parent 0ce929f8a1
commit 9c04c031ab

View File

@@ -1,86 +1,93 @@
export default {
data() {
return {
minScrollTop: 100,
wechatQrcode: '',
diyRoute: '/pages/index/index',
hasCheckedPrivacy: false
};
},
onLoad(option) {
// #ifdef H5
if (option.module && option.module == 'locationPicker') {
option.name = '';
}
// #endif
this.name = option.name || 'DIY_VIEW_INDEX';
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)页面,接口会自行判断
// 页面加载时检查
this.checkPrivacy();
},
onShow() {
this.getFollowQrcode();
},
mounted() {
this.unsubscribe = this.$eventBus?.onMany(
[
'rubik-cube-tap',
'picture-tap',
'text-tap',
'goods-list-tap',
'presale-tap',
'notes-tap',
'merch-list-tap',
'map-tap',
'img-ads-tap',
'many-goods-list-tap',
'search-tap'
],
this.handleTap
);
},
methods: {
handleTap(type, item) {
},
getFollowQrcode() {
},
checkPrivacy() {
if (this.hasCheckedPrivacy) {
return;
}
},
onShow() {
// 获取关注公众号二维码
this.getFollowQrcode();
// 检查隐私设置并显示弹窗
this.checkPrivacySetting();
},
mounted() {
// 监听图片、文字、商品列表等组件的点击事件
this.unsubscribe = this.$eventBus?.onMany([
'rubik-cube-tap',
'picture-tap',
'text-tap',
'goods-list-tap',
'presale-tap',
'notes-tap',
'merch-list-tap',
'map-tap',
'img-ads-tap',
'many-goods-list-tap',
'search-tap',
], this._handleDiyGroupInteractionEvent);
},
beforeDestroy() {
// 移除图片点击事件监听
if (this.unsubscribe) this.unsubscribe();
},
methods: {
// 检查隐私设置
checkPrivacySetting() {
// 延迟执行,确保组件已经挂载
setTimeout(() => {
if (this.$refs.privacyPopup) {
this.$refs.privacyPopup.proactive();
}
}, 100);
},
// 关注公众号
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) {
// #ifdef H5
// 如果是 H5 环境,直接返回 true 继续传播
return true;
// #endif
const agreed = uni.getStorageSync('privacyAgreed');
// 如果已登录,直接返回 true 继续传播
if (this.storeToken) {
return true;
}
if (agreed) {
// 打开登录弹窗
// console.log('==> _handleDiyGroupInteractionEvent, 未登录,打开登录弹窗', { payload })
this.$refs.login?.open();
this.hasCheckedPrivacy = true;
console.log(' 隐私协议已同意,不再弹出');
} else {
this.hasCheckedPrivacy = true;
console.log(' 未同意隐私协议,强制弹窗');
this.$nextTick(() => {
const privacyPopup = this.$refs.privacyPopup;
if (privacyPopup) {
privacyPopup.popUp();
} else {
console.error(' 找不到 privacyPopup 组件引用');
}
});
}
},
onAgreePrivacy() {
console.log(' 用户点击了同意');
uni.setStorageSync('privacyAgreed', true);
this.hasCheckedPrivacy = true;
},
onDisagreePrivacy() {
console.log(' 用户拒绝了隐私协议');
}
}
}
// 阻止事件继续传播
return false;
}
}
}