From 62b4b44f881b4222e9112b4e6c956f9c3fe9c659 Mon Sep 17 00:00:00 2001 From: jing <1683105490@qq.com> Date: Sun, 20 Sep 2026 14:06:28 +0800 Subject: [PATCH] =?UTF-8?q?chore=20:=E7=9C=9F=E6=9C=BA=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/js/lang.js | 37 +++++++------------ .../goods-detail-view/goods-detail-view.vue | 2 +- pages_tool/ai-chat/ai-chat-message.vue | 4 +- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/common/js/lang.js b/common/js/lang.js index 6735224..d120e7f 100644 --- a/common/js/lang.js +++ b/common/js/lang.js @@ -489,36 +489,27 @@ function isBundleComplete(tree) { return false; } - // 2) tree 不能是空对象(空对象没有 common 也没有 components, 显然不可用) + // 2) tree 不能是空对象(空对象没有任何可用文案, 显然不可用) const treeKeys = Object.keys(tree); if (treeKeys.length === 0) { return false; } - // 3) tree 必须有 common 节点(基础文案, 几乎所有 UI 都依赖) - if (!tree.common || typeof tree.common !== 'object') { - return false; + // === 粗粒度校验(与上方设计哲学一致) === + // 不再硬性要求 common / components 节点必须同时存在。 + // 远端可能在某些时刻少发某个节点(部署期间、缓存未刷新、租户未配置 common 等), + // 此时仍应让 boot 成功写入 remoteTreeCache, 缺失字段由 $lang() 自然回落为空, + // UI 降级显示(空文案/空按钮文字), 而不是让整个 boot 失败导致整站变英文 / raw key。 + + // 软校验: components.privacyPopup(节点存在才检查, 避免 tree.components 为 undefined 时报错) + const privacyPopup = tree.components && tree.components.privacyPopup; + if (privacyPopup && typeof privacyPopup === 'object') { + // defaultAppNameMp 存在性仅作诊断, 不阻止 boot + if (typeof privacyPopup.defaultAppNameMp !== 'string' || !privacyPopup.defaultAppNameMp) { + // 软校验不阻止 boot, 仅记录(暂无控制台输出, 避免污染生产) + } } - // 4) tree 必须有 components 节点(组件级文案) - if (!tree.components || typeof tree.components !== 'object') { - return false; - } - - // === 以下为软校验(只 warn 不 return false) === - // 设计: 不再因为"缺某个 key"就让整个 boot 失败 - // 缺失的字段让 $lang() 自然返回空, UI 降级显示 - - // 软校验 1: components.privacyPopup - const privacyPopup = tree.components.privacyPopup; - if (!privacyPopup || typeof privacyPopup !== 'object') { - // 软校验不阻止 boot, 仅记录(暂无控制台输出, 避免污染生产) - } else if (typeof privacyPopup.defaultAppNameMp !== 'string' || !privacyPopup.defaultAppNameMp) { - // 软校验不阻止 boot, 仅记录(暂无控制台输出, 避免污染生产) - } - - // 软校验 2: 哪些 key 看起来像隐私弹窗,但在错误位置?(诊断) - // 此处仅保留注释说明, 不在生产代码中输出 return true; } diff --git a/pages_goods/_components/goods-detail-view/goods-detail-view.vue b/pages_goods/_components/goods-detail-view/goods-detail-view.vue index 83f7aee..c7a9fc8 100644 --- a/pages_goods/_components/goods-detail-view/goods-detail-view.vue +++ b/pages_goods/_components/goods-detail-view/goods-detail-view.vue @@ -13,7 +13,7 @@ - + diff --git a/pages_tool/ai-chat/ai-chat-message.vue b/pages_tool/ai-chat/ai-chat-message.vue index 58c7c21..2e79ca6 100644 --- a/pages_tool/ai-chat/ai-chat-message.vue +++ b/pages_tool/ai-chat/ai-chat-message.vue @@ -371,7 +371,7 @@ 出现时输入框自动向上撑高, 删除后恢复原高度。 图片与文件走同一套 pending 逻辑: 选完先在这里预览, 等用户点发送再随文字一起发出 --> - + 上传中 失败 @@ -380,7 +380,7 @@ × - + {{ f.type === 'video' ? '🎬' : (f.type === 'audio' ? '🎵' : '📄') }}