Compare commits

..

6 Commits

4 changed files with 129 additions and 88 deletions

View File

@@ -42,6 +42,10 @@ const localDevConfig = ({
uniacid: 2, uniacid: 2,
domain: 'http://localhost:8050/', domain: 'http://localhost:8050/',
}, },
})['2811']; // 选择要使用的环境配置 '47': {
uniacid: 47,
domain: 'https://5g.aigc-quickapp.com/',
},
})['47']; // 选择要使用的环境配置
export default localDevConfig; export default localDevConfig;

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')
}, },
//打开弹窗 //打开弹窗

View File

@@ -104,7 +104,7 @@
}, },
"router" : { "router" : {
"mode" : "history", "mode" : "history",
"base" : "/hwappx/2811/" "base" : "/hwappx/common/"
}, },
"title" : "", "title" : "",
"devServer" : { "devServer" : {

View File

@@ -19,6 +19,8 @@ export default {
onShow() { onShow() {
// 获取关注公众号二维码 // 获取关注公众号二维码
this.getFollowQrcode(); this.getFollowQrcode();
// 检查隐私设置并显示弹窗
this.checkPrivacySetting();
}, },
mounted() { mounted() {
// 监听图片、文字、商品列表等组件的点击事件 // 监听图片、文字、商品列表等组件的点击事件
@@ -41,6 +43,15 @@ export default {
if (this.unsubscribe) this.unsubscribe(); if (this.unsubscribe) this.unsubscribe();
}, },
methods: { methods: {
// 检查隐私设置
checkPrivacySetting() {
// 延迟执行,确保组件已经挂载
setTimeout(() => {
if (this.$refs.privacyPopup) {
this.$refs.privacyPopup.proactive();
}
}, 100);
},
// 关注公众号 // 关注公众号
getFollowQrcode() { getFollowQrcode() {
if (!this.$util.isWeiXin()) return; if (!this.$util.isWeiXin()) return;