This commit is contained in:
2026-04-09 16:04:11 +08:00
parent 588ec60948
commit 3ce26322e0

View File

@@ -158,22 +158,48 @@ export default {
success: (res) => { success: (res) => {
// console.log(res) // console.log(res)
if (res.needAuthorization) { if (res.needAuthorization) {
// 检查本地存储中是否已经同意过隐私政策
const privacyAgreed = uni.getStorageSync('privacyAgreed');
if (!privacyAgreed) {
this.popUp() this.popUp()
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗 // 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
this.closeOtherPagePopUp(this.disPopUp) this.closeOtherPagePopUp(this.disPopUp)
} else { } else {
this.$emit('agree') this.$emit('agree')
} }
} else {
this.$emit('agree')
}
}, },
}); });
} else { } else {
this.$emit('agree') // 检查本地存储中是否已经同意过隐私政策
const privacyAgreed = uni.getStorageSync('privacyAgreed');
if (privacyAgreed) {
this.$emit('agree');
} else {
this.popUp()
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
this.closeOtherPagePopUp(this.disPopUp)
}
} }
// #endif // #endif
// #ifdef QUICKAPP-WEBVIEW // #ifdef QUICKAPP-WEBVIEW
this.getPrivacySettingByQuickApp(); this.getPrivacySettingByQuickApp();
// #endif // #endif
// #ifdef H5 || WEB
// 检查本地存储中是否已经同意过隐私政策
const privacyAgreed = uni.getStorageSync('privacyAgreed');
if (privacyAgreed) {
this.$emit('agree');
} else {
this.popUp()
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
this.closeOtherPagePopUp(this.disPopUp)
}
// #endif
}, },
//初始化监听程序 //初始化监听程序
curPageShow() { curPageShow() {
@@ -261,6 +287,8 @@ export default {
this.privacyResolves.clear() this.privacyResolves.clear()
//关闭弹窗 //关闭弹窗
this.disPopUp() this.disPopUp()
// 保存用户授权状态到本地存储,无论同意还是不同意,都不再重复弹出
uni.setStorageSync('privacyAgreed', true);
//退出小程序 //退出小程序
uni.showModal({ uni.showModal({
content: '未同意隐私协议,无法使用相关功能', content: '未同意隐私协议,无法使用相关功能',
@@ -281,10 +309,8 @@ export default {
//关闭弹窗 //关闭弹窗
this.disPopUp() this.disPopUp()
// #ifdef QUICKAPP-WEBVIEW || H5 || WEB // 保存用户授权状态到本地存储,用于所有环境
// 保存用户授权状态到本地存储,用于快应用Webview组件中的H5方式处理
uni.setStorageSync('privacyAgreed', true); uni.setStorageSync('privacyAgreed', true);
// #endif
this.$emit('agree') this.$emit('agree')
}, },
//打开弹窗 //打开弹窗