chore:弹出用户隐私
This commit is contained in:
@@ -41,7 +41,11 @@ const localDevConfig = ({
|
||||
'local-2': { // 测试平台
|
||||
uniacid: 2,
|
||||
domain: 'http://localhost:8050/',
|
||||
},
|
||||
})['2811']; // 选择要使用的环境配置
|
||||
},
|
||||
'47': {
|
||||
uniacid: 47,
|
||||
domain: 'https://5g.aigc-quickapp.com/',
|
||||
},
|
||||
})['47']; // 选择要使用的环境配置
|
||||
|
||||
export default localDevConfig;
|
||||
@@ -1,27 +1,25 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
minScrollTop: 100, // 设置回到顶端按钮显示要求,最小页面滚动距离
|
||||
wechatQrcode: '', // 公众号二维码
|
||||
minScrollTop: 100,
|
||||
wechatQrcode: '',
|
||||
diyRoute: '/pages/index/index'
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
// #ifdef H5
|
||||
// H5地图选择位置回调数据
|
||||
if (option.module && option.module == 'locationPicker') {
|
||||
option.name = ''; // 清空地址
|
||||
option.name = '';
|
||||
}
|
||||
// #endif
|
||||
this.name = option.name || 'DIY_VIEW_INDEX'; // 根据店铺运营模式,打开平台(shop)或者连锁门店(stroe)页面,接口会自行判断
|
||||
|
||||
this.name = option.name || 'DIY_VIEW_INDEX';
|
||||
},
|
||||
onShow() {
|
||||
// 获取关注公众号二维码
|
||||
this.getFollowQrcode();
|
||||
// 页面显示时,检查是否需要弹窗
|
||||
this.checkAndShowPrivacy();
|
||||
},
|
||||
mounted() {
|
||||
// 监听图片、文字、商品列表等组件的点击事件
|
||||
this.unsubscribe = this.$eventBus?.onMany([
|
||||
'rubik-cube-tap',
|
||||
'picture-tap',
|
||||
@@ -37,10 +35,29 @@ export default {
|
||||
], this._handleDiyGroupInteractionEvent);
|
||||
},
|
||||
beforeDestroy() {
|
||||
// 移除图片点击事件监听
|
||||
if (this.unsubscribe) this.unsubscribe();
|
||||
},
|
||||
methods: {
|
||||
// --- 新增:检查并显示隐私弹窗 ---
|
||||
checkAndShowPrivacy() {
|
||||
// 1. 为了测试,先强制清除缓存(正式发布时请删除下面这行)
|
||||
uni.removeStorageSync('privacyAgreed');
|
||||
|
||||
// 2. 获取缓存状态
|
||||
const hasAgreed = uni.getStorageSync('privacyAgreed');
|
||||
|
||||
// 3. 如果没有同意过,且组件已加载,强制调用组件的 popUp 方法
|
||||
if (!hasAgreed) {
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.privacyPopup) {
|
||||
console.log('强制调用 privacyPopup.popUp()');
|
||||
// 直接调用组件里的 popUp 方法,把 showPop 设为 true
|
||||
this.$refs.privacyPopup.popUp();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 关注公众号
|
||||
getFollowQrcode() {
|
||||
if (!this.$util.isWeiXin()) return;
|
||||
@@ -62,20 +79,14 @@ export default {
|
||||
// 统一处理点击及触摸事件
|
||||
_handleDiyGroupInteractionEvent(payload) {
|
||||
// #ifdef H5
|
||||
// 如果是 H5 环境,直接返回 true 继续传播
|
||||
return true;
|
||||
// #endif
|
||||
|
||||
// 如果已登录,直接返回 true 继续传播
|
||||
if (this.storeToken) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 打开登录弹窗
|
||||
// console.log('==> _handleDiyGroupInteractionEvent, 未登录,打开登录弹窗', { payload })
|
||||
this.$refs.login?.open();
|
||||
|
||||
// 阻止事件继续传播
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user