From 2747cb49ae63218090259e1d3e4b2b0d6b39ebd3 Mon Sep 17 00:00:00 2001 From: jinhhanhan <1683105490@qq.com> Date: Wed, 8 Apr 2026 18:20:03 +0800 Subject: [PATCH] =?UTF-8?q?chore=EF=BC=9A=E5=BC=B9=E5=87=BA=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=9A=90=E7=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .local.config.js | 8 +++++-- pages/index/public/js/index.js | 41 +++++++++++++++++++++------------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/.local.config.js b/.local.config.js index 6386cb0..33e9652 100644 --- a/.local.config.js +++ b/.local.config.js @@ -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; \ No newline at end of file diff --git a/pages/index/public/js/index.js b/pages/index/public/js/index.js index 71f7513..f8896df 100644 --- a/pages/index/public/js/index.js +++ b/pages/index/public/js/index.js @@ -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; } }