Compare commits
12 Commits
release/v1
...
release/v1
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e480d35df | |||
| bc6d243362 | |||
| a285706112 | |||
| 9c04c031ab | |||
| 0ce929f8a1 | |||
| 61ab9f11bd | |||
| 2747cb49ae | |||
| 9c8ebf8d74 | |||
| b23c21d05b | |||
| 65a24f25bb | |||
| 2a0935b581 | |||
| b31197a8b4 |
@@ -41,8 +41,7 @@ const localDevConfig = ({
|
|||||||
'local-2': { // 测试平台
|
'local-2': { // 测试平台
|
||||||
uniacid: 2,
|
uniacid: 2,
|
||||||
domain: 'http://localhost:8050/',
|
domain: 'http://localhost:8050/',
|
||||||
},
|
'47': { // 修改弹窗
|
||||||
'47': { // 修改弹窗
|
|
||||||
uniacid: 47,
|
uniacid: 47,
|
||||||
domain: 'https://5g.aigc-quickapp.com/',
|
domain: 'https://5g.aigc-quickapp.com/',
|
||||||
},
|
},
|
||||||
@@ -51,5 +50,4 @@ const localDevConfig = ({
|
|||||||
domain: 'https://xcx.aigc-quickapp.com/',
|
domain: 'https://xcx.aigc-quickapp.com/',
|
||||||
},
|
},
|
||||||
})['47']; // 选择要使用的环境配置
|
})['47']; // 选择要使用的环境配置
|
||||||
|
|
||||||
export default localDevConfig;
|
export default localDevConfig;
|
||||||
@@ -54,11 +54,14 @@ function loadLangPackSync(lang, path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得当前本地语言
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
function getCurrentLocale() {
|
function getCurrentLocale() {
|
||||||
return uni.getStorageSync('lang') || "zh-cn";
|
return uni.getStorageSync('lang') || "zh-cn";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
langList: langConfig.langList,
|
langList: langConfig.langList,
|
||||||
|
|
||||||
|
|||||||
@@ -158,22 +158,48 @@ export default {
|
|||||||
success: (res) => {
|
success: (res) => {
|
||||||
// console.log(res)
|
// console.log(res)
|
||||||
if (res.needAuthorization) {
|
if (res.needAuthorization) {
|
||||||
this.popUp()
|
// 检查本地存储中是否已经同意过隐私政策
|
||||||
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
|
const privacyAgreed = uni.getStorageSync('privacyAgreed');
|
||||||
this.closeOtherPagePopUp(this.disPopUp)
|
if (!privacyAgreed) {
|
||||||
|
this.popUp()
|
||||||
|
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
|
||||||
|
this.closeOtherPagePopUp(this.disPopUp)
|
||||||
|
} else {
|
||||||
|
this.$emit('agree')
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$emit('agree')
|
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')
|
||||||
},
|
},
|
||||||
//打开弹窗
|
//打开弹窗
|
||||||
|
|||||||
@@ -1,119 +1,95 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
minScrollTop: 100, // 设置回到顶端按钮显示要求,最小页面滚动距离
|
minScrollTop: 100, // 设置回到顶端按钮显示要求,最小页面滚动距离
|
||||||
wechatQrcode: '', // 公众号二维码
|
wechatQrcode: "", // 公众号二维码
|
||||||
diyRoute: '/pages/index/index',
|
diyRoute: "/pages/index/index",
|
||||||
showPrivacyModal: false // 新增:控制隐私弹窗显示的变量
|
};
|
||||||
};
|
},
|
||||||
},
|
onLoad(option) {
|
||||||
onLoad(option) {
|
// #ifdef H5
|
||||||
// #ifdef H5
|
// H5地图选择位置回调数据
|
||||||
// H5地图选择位置回调数据
|
if (option.module && option.module == "locationPicker") {
|
||||||
if (option.module && option.module == 'locationPicker') {
|
option.name = ""; // 清空地址
|
||||||
option.name = ''; // 清空地址
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
this.name = option.name || 'DIY_VIEW_INDEX'; // 根据店铺运营模式,打开平台(shop)或者连锁门店(stroe)页面,接口会自行判断
|
|
||||||
|
|
||||||
},
|
|
||||||
onShow() {
|
|
||||||
// 获取关注公众号二维码
|
|
||||||
this.getFollowQrcode();
|
|
||||||
|
|
||||||
// 打开隐私弹窗
|
|
||||||
this.openPrivacyModal();
|
|
||||||
},
|
|
||||||
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);
|
|
||||||
},
|
|
||||||
|
|
||||||
// 新增:打开隐私弹窗的方法
|
|
||||||
openPrivacyModal() {
|
|
||||||
// 延迟一点执行,防止页面加载卡顿
|
|
||||||
setTimeout(() => {
|
|
||||||
this.showPrivacyModal = true;
|
|
||||||
}, 500);
|
|
||||||
},
|
|
||||||
|
|
||||||
// 新增:处理用户点击“同意并继续”
|
|
||||||
handlePrivacyAgree() {
|
|
||||||
this.showPrivacyModal = false;
|
|
||||||
// 这里可以添加保存到本地存储的逻辑,表示用户已同意
|
|
||||||
uni.setStorageSync('hasAgreedPrivacy', true);
|
|
||||||
},
|
|
||||||
|
|
||||||
// 新增:处理用户点击“不同意”
|
|
||||||
handlePrivacyDisagree() {
|
|
||||||
this.showPrivacyModal = false;
|
|
||||||
// 如果不同意,通常退出小程序或关闭页面
|
|
||||||
uni.navigateBack({
|
|
||||||
delta: 1
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// 关注公众号
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 打开登录弹窗
|
|
||||||
// console.log('==> _handleDiyGroupInteractionEvent, 未登录,打开登录弹窗', { payload })
|
|
||||||
this.$refs.login?.open();
|
|
||||||
|
|
||||||
// 阻止事件继续传播
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// #endif
|
||||||
|
this.name = option.name || "DIY_VIEW_INDEX"; // 根据店铺运营模式,打开平台(shop)或者连锁门店(stroe)页面,接口会自行判断
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开登录弹窗
|
||||||
|
// console.log('==> _handleDiyGroupInteractionEvent, 未登录,打开登录弹窗', { payload })
|
||||||
|
this.$refs.login?.open();
|
||||||
|
|
||||||
|
// 阻止事件继续传播
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user