diff --git a/.local.config.js b/.local.config.js index b733ec7..28cf028 100644 --- a/.local.config.js +++ b/.local.config.js @@ -6,6 +6,10 @@ const localDevConfig = ({ uniacid: 460, domain: 'https://xcx30.5g-quickapp.com/', }, + '576-xcx30.5g': { // 活性石灰装备 + uniacid: 576, + domain: 'https://xcx30.5g-quickapp.com/', + }, '2285': { // 数码喷墨墨水 uniacid: 2285, domain: 'https://xcx.aigc-quickapp.com/', diff --git a/.local.config.js.example b/.local.config.js.example index b733ec7..28cf028 100644 --- a/.local.config.js.example +++ b/.local.config.js.example @@ -6,6 +6,10 @@ const localDevConfig = ({ uniacid: 460, domain: 'https://xcx30.5g-quickapp.com/', }, + '576-xcx30.5g': { // 活性石灰装备 + uniacid: 576, + domain: 'https://xcx30.5g-quickapp.com/', + }, '2285': { // 数码喷墨墨水 uniacid: 2285, domain: 'https://xcx.aigc-quickapp.com/', diff --git a/common/js/lang.js b/common/js/lang.js index bc03c0b..5fec1bf 100644 --- a/common/js/lang.js +++ b/common/js/lang.js @@ -1,8 +1,8 @@ import { langConfig } from './config-external.js'; -var locale = uni.getStorageSync('lang') || "zh-cn"; //设置语言 + // 缓存已加载的语言包 -var loadedLangPacks = {}; +const loadedLangPacks = {}; // 处理页面目录映射 function processRoutePath(route) { @@ -64,6 +64,8 @@ export default { let _this = getCurrentPages()[getCurrentPages().length - 1]; if (!_this) return; + const locale = uni.getStorageSync('lang') || "zh-cn"; //设置语言 + var value = ''; try { //公共语言包(同步加载) @@ -72,7 +74,7 @@ export default { //当前页面语言包(同步加载) let route = _this.route; let langPath = processRoutePath(route); - // console.log(`当前页面语言包路径: ${langPath}`); + console.log(`当前语言: ${locale}, 当前页面语言包路径: ${langPath}`); // 加载当前页面语言包 let currentPageLang = loadLangPackSync(locale, langPath); @@ -113,7 +115,7 @@ export default { if (value == undefined || (value == 'title' && field == 'title')) value = ''; // field // 多语言调试,注释后可以关闭控制台输出 - // console.log(`字段: ${field}, 值: ${value}`) + console.log(`字段: ${field}, 值: ${value}`) return value; }, /** @@ -126,10 +128,14 @@ export default { if (!_this) return; uni.setStorageSync("lang", value); - locale = uni.getStorageSync('lang') || "zh-cn"; //设置语言 + const locale = uni.getStorageSync('lang') || "zh-cn"; //设置语言 // 清空已加载的语言包缓存 - loadedLangPacks = {}; + for (let key in loadedLangPacks) { + if (!key.startsWith(locale)) { + delete loadedLangPacks[key]; + } + } this.refresh(); @@ -141,7 +147,7 @@ export default { refresh() { let _this = getCurrentPages()[getCurrentPages().length - 1]; if (!_this) return; - locale = uni.getStorageSync('lang') || "zh-cn"; //设置语言 + const locale = uni.getStorageSync('lang') || "zh-cn"; //设置语言 this.title(this.lang("title")); diff --git a/lang/zh-cn/common.js b/lang/zh-cn/common.js index c19bb2c..b9edf32 100644 --- a/lang/zh-cn/common.js +++ b/lang/zh-cn/common.js @@ -19,5 +19,12 @@ export const lang = { currencySymbol: '¥', submit: '提交', searchTip: '请输入搜索关键词' - } + }, + + + waitpay: '待付款', + waitsend: '待发货', + waitconfirm: '待收货', + activist: '售后', + completed: '已完成', }