From 3ce26322e024b59397419b010990df99bd78f899 Mon Sep 17 00:00:00 2001 From: jinhhanhan <1683105490@qq.com> Date: Thu, 9 Apr 2026 16:04:11 +0800 Subject: [PATCH] =?UTF-8?q?chore=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/privacy-popup/privacy-popup.vue | 40 ++++++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) 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') }, //打开弹窗