Compare commits

...

10 Commits

Author SHA1 Message Date
bc6d243362 chore: 2026-04-09 15:30:32 +08:00
a285706112 chore:用户隐私协议点击不同意后不会在弹出了 2026-04-09 14:56:49 +08:00
9c04c031ab chore:删除原来的多余的调动弹窗的代码 2026-04-09 10:40:43 +08:00
0ce929f8a1 chore:点击同意后,用户隐私不在弹出 2026-04-09 10:04:29 +08:00
61ab9f11bd chore:H5只弹一次,点击同意后就不弹了 2026-04-09 09:35:08 +08:00
2747cb49ae chore:弹出用户隐私 2026-04-08 18:20:03 +08:00
b23c21d05b Merge pull request 'fix/lang' (#4) from fix/lang into main
Reviewed-on: #4
2026-02-04 09:12:58 +00:00
65a24f25bb fix(lang): 提取getCurrentLocale为独立函数并优化代码格式
将getCurrentLocale方法提取为独立函数以避免重复代码
移除多余的空格并保持代码风格一致
2026-02-04 17:10:12 +08:00
2a0935b581 Merge pull request 'docs: 更新readme文档结构和内容' (#2) from dev/1.0 into main
Reviewed-on: #2
2026-01-24 09:41:36 +00:00
b31197a8b4 Merge pull request 'dev/1.0' (#1) from dev/1.0 into main
Reviewed-on: #1
2026-01-24 09:24:05 +00:00
5 changed files with 149 additions and 102 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

@@ -54,6 +54,14 @@ function loadLangPackSync(lang, path) {
} }
} }
/**
* 获得当前本地语言
* @returns
*/
function getCurrentLocale() {
return uni.getStorageSync('lang') || "zh-cn";
}
export default { export default {
langList: langConfig.langList, langList: langConfig.langList,
@@ -61,9 +69,7 @@ export default {
* 获得当前本地语言 * 获得当前本地语言
* @returns * @returns
*/ */
getCurrentLocale() { getCurrentLocale,
return uni.getStorageSync('lang') || "zh-cn";
},
/** /**
* * 解析多语言 * * 解析多语言
@@ -73,7 +79,7 @@ export default {
let _page = getCurrentPages()[getCurrentPages().length - 1]; let _page = getCurrentPages()[getCurrentPages().length - 1];
if (!_page) return; if (!_page) return;
const locale = this.getCurrentLocale(); // 获得当前本地语言 const locale = getCurrentLocale(); // 获得当前本地语言
let value = ''; // 存放解析后的语言值 let value = ''; // 存放解析后的语言值
let langPath = ''; // 存放当前页面语言包路径 let langPath = ''; // 存放当前页面语言包路径
@@ -141,7 +147,7 @@ export default {
if (!_page) return; if (!_page) return;
uni.setStorageSync("lang", value); uni.setStorageSync("lang", value);
const locale = this.getCurrentLocale(); const locale = getCurrentLocale();
// 清空已加载的语言包缓存 // 清空已加载的语言包缓存
for (let key in loadedLangPacks) { for (let key in loadedLangPacks) {
@@ -161,7 +167,7 @@ export default {
let _page = getCurrentPages()[getCurrentPages().length - 1]; let _page = getCurrentPages()[getCurrentPages().length - 1];
if (!_page) return; if (!_page) return;
const locale = this.getCurrentLocale(); const locale = getCurrentLocale();
this.title(this.lang("title")); this.title(this.lang("title"));

View File

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

View File

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

View File

@@ -1,82 +1,93 @@
export default { export default {
data() { data() {
return { return {
minScrollTop: 100, // 设置回到顶端按钮显示要求,最小页面滚动距离 minScrollTop: 100, // 设置回到顶端按钮显示要求,最小页面滚动距离
wechatQrcode: '', // 公众号二维码 wechatQrcode: '', // 公众号二维码
diyRoute: '/pages/index/index' diyRoute: '/pages/index/index'
}; };
}, },
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 // #endif
this.name = option.name || 'DIY_VIEW_INDEX'; // 根据店铺运营模式,打开平台(shop)或者连锁门店(stroe)页面,接口会自行判断 this.name = option.name || 'DIY_VIEW_INDEX'; // 根据店铺运营模式,打开平台(shop)或者连锁门店(stroe)页面,接口会自行判断
}, },
onShow() { onShow() {
// 获取关注公众号二维码 // 获取关注公众号二维码
this.getFollowQrcode(); this.getFollowQrcode();
}, // 检查隐私设置并显示弹窗
mounted() { this.checkPrivacySetting();
// 监听图片、文字、商品列表等组件的点击事件 },
this.unsubscribe = this.$eventBus?.onMany([ mounted() {
'rubik-cube-tap', // 监听图片、文字、商品列表等组件的点击事件
'picture-tap', this.unsubscribe = this.$eventBus?.onMany([
'text-tap', 'rubik-cube-tap',
'goods-list-tap', 'picture-tap',
'presale-tap', 'text-tap',
'notes-tap', 'goods-list-tap',
'merch-list-tap', 'presale-tap',
'map-tap', 'notes-tap',
'img-ads-tap', 'merch-list-tap',
'many-goods-list-tap', 'map-tap',
'search-tap', 'img-ads-tap',
], this._handleDiyGroupInteractionEvent); 'many-goods-list-tap',
}, 'search-tap',
beforeDestroy() { ], this._handleDiyGroupInteractionEvent);
// 移除图片点击事件监听 },
if (this.unsubscribe) this.unsubscribe(); beforeDestroy() {
}, // 移除图片点击事件监听
methods: { if (this.unsubscribe) this.unsubscribe();
// 关注公众号 },
getFollowQrcode() { methods: {
if (!this.$util.isWeiXin()) return; // 检查隐私设置
this.$api.sendRequest({ checkPrivacySetting() {
url: '/wechat/api/wechat/followqrcode', // 延迟执行,确保组件已经挂载
success: res => { setTimeout(() => {
if (res.code >= 0 && res.data) { if (this.$refs.privacyPopup) {
this.wechatQrcode = res.data.qrcode; this.$refs.privacyPopup.proactive();
} }
} }, 100);
}); },
}, // 关注公众号
officialAccountsOpen() { getFollowQrcode() {
this.$refs.officialAccountsPopup.open(); if (!this.$util.isWeiXin()) return;
}, this.$api.sendRequest({
officialAccountsClose() { url: '/wechat/api/wechat/followqrcode',
this.$refs.officialAccountsPopup.close(); success: res => {
}, if (res.code >= 0 && res.data) {
// 统一处理点击及触摸事件 this.wechatQrcode = res.data.qrcode;
_handleDiyGroupInteractionEvent(payload) { }
// #ifdef H5 }
// 如果是 H5 环境,直接返回 true 继续传播 });
return true; },
// #endif officialAccountsOpen() {
this.$refs.officialAccountsPopup.open();
},
officialAccountsClose() {
this.$refs.officialAccountsPopup.close();
},
// 统一处理点击及触摸事件
_handleDiyGroupInteractionEvent(payload) {
// #ifdef H5
// 如果是 H5 环境,直接返回 true 继续传播
return true;
// #endif
// 如果已登录,直接返回 true 继续传播 // 如果已登录,直接返回 true 继续传播
if (this.storeToken) { if (this.storeToken) {
return true; return true;
} }
// 打开登录弹窗 // 打开登录弹窗
// console.log('==> _handleDiyGroupInteractionEvent, 未登录,打开登录弹窗', { payload }) // console.log('==> _handleDiyGroupInteractionEvent, 未登录,打开登录弹窗', { payload })
this.$refs.login?.open(); this.$refs.login?.open();
// 阻止事件继续传播 // 阻止事件继续传播
return false; return false;
} }
} }
} }