This commit is contained in:
fengchuanhn@gmail.com
2026-05-21 02:40:08 +08:00
parent 14cf9b7bf5
commit 426a69cd69
14 changed files with 754 additions and 45 deletions

View File

@@ -1,27 +1,35 @@
import { invoke } from "@tauri-apps/api/core";
/**
* 经 Rust 读取本地 oem 文件中的 ID并请求公开品牌 API。
* @returns {Promise<{
* oemId: number,
* softwareName: string,
* logoUrl: string | null,
* wechat: string | null,
* wechatQrcode: string | null,
* }>}
*/
export async function fetchSoftwareInfo() {
const empty = {
oemId: 1,
softwareName: "",
logoUrl: null,
wechat: null,
wechatQrcode: null,
};
try {
const data = await invoke("get_software_info");
if (!data || typeof data !== "object") {
return { oemId: 1, softwareName: "", logoUrl: null, wechat: null };
return empty;
}
return {
oemId: data.oemId ?? 1,
softwareName: data.softwareName ?? "",
logoUrl: data.logoUrl || null,
wechat: data.wechat || null,
wechatQrcode: data.wechatQrcodeUrl || null,
};
} catch {
return { oemId: 1, softwareName: "", logoUrl: null, wechat: null };
return empty;
}
}