拆分 EQPage 页面,新增分享码功能,修复 bug,优化性能

This commit is contained in:
eafonyang
2026-06-15 18:39:07 +08:00
parent 1b0b447eee
commit a045db235a
15 changed files with 3198 additions and 1181 deletions
+40
View File
@@ -0,0 +1,40 @@
import type { PeqEqUi } from "./types";
export type ShareApiAction = "create" | "query" | "accept" | "list";
export function resolveShareApiMessage(
action: ShareApiAction,
res: { code: number; msg?: string },
eqUi: PeqEqUi,
): string {
if (res.code === 200) return "";
if (action === "list") {
return eqUi.mySharesLoadFail ?? "Failed to load share list";
}
if (res.code === 0) {
if (action === "create") {
return eqUi.shareActiveExists ?? eqUi.shareCreateFail ?? "Failed to generate share code";
}
return eqUi.importCodeNotFound ?? "Share code not found or expired";
}
if (res.code === 400) {
return eqUi.shareInvalidParams ?? eqUi.shareCreateFail ?? "Invalid request";
}
if (res.code === 500) {
return eqUi.shareSystemError ?? eqUi.shareCreateFail ?? "System error";
}
if (action === "create") {
return eqUi.shareCreateFail ?? "Failed to generate share code";
}
if (action === "accept") {
return eqUi.importFail ?? eqUi.importCodeNotFound ?? "Failed to import EQ";
}
return eqUi.importCodeNotFound ?? "Share code not found or expired";
}