From 7825fb0ec6be1fac41a888c471b6fd1ccee43c0a Mon Sep 17 00:00:00 2001 From: cysamurai Date: Thu, 14 May 2026 11:41:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- broadcast-client/src/views/ConfigView.vue | 10 +- call-client/src-tauri/src/commands/update.rs | 4 +- call-client/src/host/dialog.ts | 28 ++++ call-client/src/views/LoginView.vue | 151 +++++++------------ call-client/src/views/MainView.vue | 4 +- call-client/src/views/ServerSetupView.vue | 3 +- 6 files changed, 100 insertions(+), 100 deletions(-) diff --git a/broadcast-client/src/views/ConfigView.vue b/broadcast-client/src/views/ConfigView.vue index 9ba6867..339d076 100644 --- a/broadcast-client/src/views/ConfigView.vue +++ b/broadcast-client/src/views/ConfigView.vue @@ -489,6 +489,7 @@ import { nextTick, onMounted, onUnmounted, reactive, ref, watch } from "vue"; import { appWindow, currentMonitor } from "@tauri-apps/api/window"; import { getVersion } from "@tauri-apps/api/app"; import { invoke } from "@tauri-apps/api/tauri"; +import { message as nativeDialogMessage } from "@tauri-apps/api/dialog"; import { listen, type UnlistenFn } from "@tauri-apps/api/event"; import { ElMessage, ElMessageBox, ElDialog, ElProgress } from "element-plus"; import type { @@ -947,7 +948,14 @@ async function handleCheckUpdate() { ); } catch (error) { console.error("[update] 检查更新失败", error); - ElMessage.error(`检查更新失败:${String(error)}`); + try { + await nativeDialogMessage(`检查更新失败:${String(error)}`, { + title: "检查更新", + type: "error", + }); + } catch { + // 原生对话框不可用时忽略 + } } finally { checkingUpdate.value = false; } diff --git a/call-client/src-tauri/src/commands/update.rs b/call-client/src-tauri/src/commands/update.rs index 0b783af..17c3552 100644 --- a/call-client/src-tauri/src/commands/update.rs +++ b/call-client/src-tauri/src/commands/update.rs @@ -239,6 +239,8 @@ pub fn check_apt_update( #[cfg(target_os = "linux")] { let output = Command::new("apt-cache") + .env("LC_ALL", "C") + .env("LANGUAGE", "C") .arg("policy") .arg(&package_name) .output() @@ -290,7 +292,7 @@ pub fn check_apt_update( let _ = app_log( "info".to_string(), format!( - "检查更新: apt-cache policy 子进程结束 success=true package={} exitCode={:?} stdout字节={} stderr字节={}", + "检查更新: apt-cache policy 子进程结束 success=true package={} exitCode={:?} stdout字节={} stderr字节={} (LC_ALL=C 以解析英文 Installed/Candidate 标签)", package_name, output.status.code(), stdout.len(), diff --git a/call-client/src/host/dialog.ts b/call-client/src/host/dialog.ts index bb7b04f..1be9b39 100644 --- a/call-client/src/host/dialog.ts +++ b/call-client/src/host/dialog.ts @@ -104,3 +104,31 @@ export async function showErrorNativeWithLog( ): Promise { return showErrorNative(content, title, { logActions: "file" }); } + +/** + * 原生信息提示(单按钮),用于非错误类说明。 + */ +export async function showInfoNative( + content: string, + title = "提示", +): Promise { + try { + await message(content, { title, type: "info" }); + } catch (error) { + throw new Error(`打开提示框失败: ${String(error)}`); + } +} + +/** + * 原生警告提示(非 Element 浮层),用于校验提示等。 + */ +export async function showWarningNative( + content: string, + title = "提示", +): Promise { + try { + await message(content, { title, type: "warning" }); + } catch (error) { + throw new Error(`打开警告提示框失败: ${String(error)}`); + } +} diff --git a/call-client/src/views/LoginView.vue b/call-client/src/views/LoginView.vue index 09b039d..ddfe9dd 100644 --- a/call-client/src/views/LoginView.vue +++ b/call-client/src/views/LoginView.vue @@ -1,13 +1,13 @@