From bce2fea4e542f2a9d78b07c0d8b627bdfec7c986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=9D=E5=B0=98?= <237809796@qq.com> Date: Wed, 1 Jul 2026 00:48:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E5=92=8C=E5=88=86=E7=A6=BB=E7=AA=97=E5=8F=A3=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E5=B4=A9=E6=BA=83(TDZ=20+=20=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E6=9D=83=E9=99=90=E9=80=9A=E9=85=8D=E7=AC=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AdvancedSection clampApprovalTimeout 常量移到 reactive 之前(打包后 const 初始化顺序 TDZ) - @/i18n 去掉对 @/stores/appSettings 的 import,改直读 localStorage - Tauri capability 加 ai-detached-* / fe-detached-* 通配符(分离窗口 listen 权限) --- src-tauri/capabilities/default.json | 2 +- src/components/settings/AdvancedSection.vue | 18 ++++++++---------- src/components/settings/AppearanceSection.vue | 5 +++-- src/i18n/index.ts | 14 ++++++++------ 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 7323f4b..290a225 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -1,7 +1,7 @@ { "identifier": "default", "description": "DevFlow default permissions", - "windows": ["main", "ai-detached"], + "windows": ["main", "ai-detached", "ai-detached-*", "fe-detached-*"], "permissions": [ "core:default", "core:event:default", diff --git a/src/components/settings/AdvancedSection.vue b/src/components/settings/AdvancedSection.vue index a749966..7ceb18d 100644 --- a/src/components/settings/AdvancedSection.vue +++ b/src/components/settings/AdvancedSection.vue @@ -86,8 +86,14 @@ onMounted(async () => { // 字段。此处用 msg 拼标题+内容,dangerLabel 作确认按钮文案,自渲染独立弹层(上方模板)。 const { confirmState, confirmDialog, answerConfirm } = useConfirm() -// 三档合法值 + 脏值白名单兜底:KV 被外部改库为非法值(空串/非三档)时回退 low, -// 防 option);脏值回退默认 15min。 +// 必须在 settings reactive 之前定义,防打包后初始化顺序导致 TDZ。 +const VALID_APPROVAL_TIMEOUTS = [0, 300_000, 900_000, 1_800_000, 3_600_000] +function clampApprovalTimeout(raw: number): number { + return VALID_APPROVAL_TIMEOUTS.includes(raw) ? raw : 900_000 +} + +// 三档合法值 + 脏值白名单兜底 const VALID_MODES = ['low', 'medium', 'all'] as const type AutoMode = (typeof VALID_MODES)[number] function clampMode(raw: string): AutoMode { @@ -145,14 +151,6 @@ function markSaved() { rowLogLevel.value?.markSaved() } -// 审批超时合法选项白名单(对齐 无匹配 option 致控件空白。允许的取值:0/5/15/30/60 分钟对应毫秒数。 -const VALID_APPROVAL_TIMEOUTS = [0, 300_000, 900_000, 1_800_000, 3_600_000] -function clampApprovalTimeout(raw: number): number { - return VALID_APPROVAL_TIMEOUTS.includes(raw) ? raw : 900_000 -} - -// 审批超时下拉变更:落 KV(df-approval-timeout,ms)+ 显「已保存」反馈。 // 下一笔发起的审批即生效(aiShared.startApprovalTimer 每次实时读),已在跑的计时器沿用旧值。 function onApprovalTimeoutChange() { appSettings.set('df-approval-timeout', settings.approvalTimeout) diff --git a/src/components/settings/AppearanceSection.vue b/src/components/settings/AppearanceSection.vue index 235a796..0da24dd 100644 --- a/src/components/settings/AppearanceSection.vue +++ b/src/components/settings/AppearanceSection.vue @@ -43,8 +43,8 @@