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/components/privacy-popup/privacy-popup.vue b/components/privacy-popup/privacy-popup.vue index 0a53959..35fb347 100644 --- a/components/privacy-popup/privacy-popup.vue +++ b/components/privacy-popup/privacy-popup.vue @@ -158,22 +158,48 @@ export default { success: (res) => { // console.log(res) if (res.needAuthorization) { - this.popUp() - // 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗 - this.closeOtherPagePopUp(this.disPopUp) + // 检查本地存储中是否已经同意过隐私政策 + const privacyAgreed = uni.getStorageSync('privacyAgreed'); + if (!privacyAgreed) { + this.popUp() + // 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗 + this.closeOtherPagePopUp(this.disPopUp) + } else { + this.$emit('agree') + } } else { this.$emit('agree') } }, }); } else { - this.$emit('agree') + // 检查本地存储中是否已经同意过隐私政策 + const privacyAgreed = uni.getStorageSync('privacyAgreed'); + if (privacyAgreed) { + this.$emit('agree'); + } else { + this.popUp() + // 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗 + this.closeOtherPagePopUp(this.disPopUp) + } } // #endif // #ifdef QUICKAPP-WEBVIEW this.getPrivacySettingByQuickApp(); // #endif + + // #ifdef H5 || WEB + // 检查本地存储中是否已经同意过隐私政策 + const privacyAgreed = uni.getStorageSync('privacyAgreed'); + if (privacyAgreed) { + this.$emit('agree'); + } else { + this.popUp() + // 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗 + this.closeOtherPagePopUp(this.disPopUp) + } + // #endif }, //初始化监听程序 curPageShow() { @@ -261,6 +287,8 @@ export default { this.privacyResolves.clear() //关闭弹窗 this.disPopUp() + // 保存用户授权状态到本地存储,无论同意还是不同意,都不再重复弹出 + uni.setStorageSync('privacyAgreed', true); //退出小程序 uni.showModal({ content: '未同意隐私协议,无法使用相关功能', @@ -281,10 +309,8 @@ export default { //关闭弹窗 this.disPopUp() - // #ifdef QUICKAPP-WEBVIEW || H5 || WEB - // 保存用户授权状态到本地存储,用于快应用Webview组件中的H5方式处理 + // 保存用户授权状态到本地存储,用于所有环境 uni.setStorageSync('privacyAgreed', true); - // #endif this.$emit('agree') }, //打开弹窗 diff --git a/manifest.json b/manifest.json index 4beada8..6a72520 100644 --- a/manifest.json +++ b/manifest.json @@ -104,7 +104,7 @@ }, "router" : { "mode" : "history", - "base" : "/hwappx/2811/" + "base" : "/hwappx/common/" }, "title" : "", "devServer" : { diff --git a/pages/index/public/js/index.js b/pages/index/public/js/index.js index 71f7513..be26fbb 100644 --- a/pages/index/public/js/index.js +++ b/pages/index/public/js/index.js @@ -1,82 +1,93 @@ -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)页面,接口会自行判断 +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?.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: { - // 关注公众号 - 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 + }, + 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 - // 如果已登录,直接返回 true 继续传播 - if (this.storeToken) { - return true; - } + // 如果已登录,直接返回 true 继续传播 + if (this.storeToken) { + return true; + } - // 打开登录弹窗 - // console.log('==> _handleDiyGroupInteractionEvent, 未登录,打开登录弹窗', { payload }) - this.$refs.login?.open(); + // 打开登录弹窗 + // console.log('==> _handleDiyGroupInteractionEvent, 未登录,打开登录弹窗', { payload }) + this.$refs.login?.open(); - // 阻止事件继续传播 - return false; - } - } -} \ No newline at end of file + // 阻止事件继续传播 + return false; + } + } + } \ No newline at end of file