From ac6dbe0cdfb02aece98527b6dee5afd59e29f8f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Thu, 14 Nov 2024 18:01:38 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20showSnackbar=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .npmrc | 1 - eslint.config.js => eslint.config.mjs | 0 src/App.vue | 25 +- src/components/app/t-pinWin.vue | 3 +- src/components/config/tc-dataDir.vue | 62 +++-- src/components/config/tc-gameBadge.vue | 14 +- src/components/config/tc-info.vue | 5 +- src/components/config/tc-userBadge.vue | 70 +++--- src/components/func/confirm.vue | 61 ++--- src/components/func/snackbar.ts | 43 +++- src/components/func/snackbar.vue | 47 ++-- src/components/gachaRecord/gro-history.vue | 24 +- src/components/home/t-pool.vue | 12 +- src/components/home/t-position.vue | 6 +- src/components/main/t-gamenav.vue | 26 +-- src/components/overlay/to-arcBrith.vue | 9 +- src/components/overlay/to-channel.vue | 5 +- src/components/overlay/to-collectPost.vue | 41 +--- src/components/overlay/to-livecode.vue | 2 +- src/components/overlay/to-postCollect.vue | 66 ++---- src/components/post/tb-collect.vue | 25 +- src/components/post/to-postSearch.vue | 12 +- src/components/post/tp-emoticon.vue | 4 +- src/components/post/tp-linkCard.vue | 6 +- src/components/post/tp-text.vue | 4 +- src/components/post/tp-uid.vue | 2 +- src/components/post/tp-vod.vue | 2 +- src/components/post/tpo-collection.vue | 12 +- src/components/post/tpo-image.vue | 22 +- src/components/post/tpo-lottery.vue | 5 +- src/components/postReply/tpr-debug.vue | 15 +- src/components/postReply/tpr-main.vue | 17 +- src/components/postReply/tpr-reply.vue | 19 +- src/components/userAchi/tua-achi-list.vue | 15 +- src/components/userAchi/tua-achi.vue | 16 +- src/components/userAchi/tua-series.vue | 5 +- src/components/wiki/twc-character.vue | 6 +- src/components/wiki/twc-materials.vue | 22 +- src/components/wiki/twc-weapon.vue | 6 +- src/pages/User/Abyss.vue | 52 ++--- src/pages/User/Characters.vue | 40 ++-- src/pages/User/Combat.vue | 26 +-- src/pages/User/Gacha.vue | 82 +++---- src/pages/User/Record.vue | 14 +- src/pages/WIKI/Character.vue | 10 +- src/pages/WIKI/Material.vue | 13 +- src/pages/WIKI/Namecard.vue | 20 +- src/pages/WIKI/Weapon.vue | 10 +- src/pages/common/Achievements.vue | 60 ++--- src/pages/common/Announcements.vue | 38 +-- src/pages/common/Config.vue | 153 ++++--------- src/pages/common/Home.vue | 15 +- src/pages/common/News.vue | 15 +- src/pages/common/PostCollect.vue | 216 +++++------------- src/pages/common/Posts.vue | 20 +- src/plugins/Mys/index.ts | 5 +- src/plugins/Mys/request/doCaptchaLogin.ts | 5 +- src/plugins/Mys/request/getGachaData.ts | 23 -- .../request/{getPositionData.ts => obcReq.ts} | 53 +++-- src/store/modules/user.ts | 8 +- src/types/Component/Snackbar.d.ts | 8 +- src/utils/TGClient.ts | 9 +- src/utils/TGShare.ts | 10 +- src/utils/TGShell.ts | 8 +- src/utils/UIAF.ts | 16 +- src/utils/UIGF.ts | 17 +- src/utils/dataBS.ts | 20 +- src/utils/linkParser.ts | 5 +- tsconfig.json | 2 +- 69 files changed, 613 insertions(+), 1097 deletions(-) delete mode 100644 .npmrc rename eslint.config.js => eslint.config.mjs (100%) delete mode 100644 src/plugins/Mys/request/getGachaData.ts rename src/plugins/Mys/request/{getPositionData.ts => obcReq.ts} (59%) diff --git a/.npmrc b/.npmrc deleted file mode 100644 index e5e442ba..00000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/ \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.mjs similarity index 100% rename from eslint.config.js rename to eslint.config.mjs diff --git a/src/App.vue b/src/App.vue index e9e92973..bce60f0c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -60,7 +60,7 @@ onBeforeMount(async () => { async function checkResize(): Promise { const screen = await TauriWindow.currentMonitor(); if (screen === null) { - showSnackbar({ text: "获取屏幕信息失败!", color: "error", timeout: 3000 }); + showSnackbar.error("获取屏幕信息失败!", 3000); return; } const windowCur = await webviewWindow.getCurrentWebviewWindow(); @@ -153,7 +153,7 @@ async function checkUserLoad(): Promise { // 检测用户数据 const uidDB = await TSUserAccount.account.getAllUid(); if (uidDB.length === 0 && appStore.isLogin) { - showSnackbar({ text: "未检测到可用UID,请重新登录!", color: "warn" }); + showSnackbar.warn("未检测到可用UID,请重新登录!"); appStore.isLogin = false; return; } @@ -164,7 +164,7 @@ async function checkUserLoad(): Promise { } const curAccount = await TSUserAccount.account.getAccount(userStore.uid.value); if (curAccount === false) { - showSnackbar({ text: `未获取到${userStore.uid.value}账号数据`, color: "error" }); + showSnackbar.error(`未获取到${userStore.uid.value}的账号数据!`); await TGLogger.Error(`[App][listenOnInit] 获取${userStore.uid.value}账号数据失败`); await new Promise((resolve) => setTimeout(resolve, 1000)); } else { @@ -173,7 +173,7 @@ async function checkUserLoad(): Promise { } const curGameAccount = await TSUserAccount.game.getCurAccount(userStore.uid.value); if (curGameAccount === false) { - showSnackbar({ text: `未获取到${userStore.uid.value}游戏数据`, color: "error" }); + showSnackbar.error(`未获取到${userStore.uid.value}的游戏数据!`); await TGLogger.Error(`[App][listenOnInit] 获取${userStore.uid.value}游戏数据失败`); await new Promise((resolve) => setTimeout(resolve, 1000)); } else { @@ -184,13 +184,11 @@ async function checkUserLoad(): Promise { async function getDeepLink(): Promise { return await event.listen("active_deep_link", async (e: Event) => { const windowGet = new webviewWindow.WebviewWindow("TeyvatGuide"); - if (await windowGet.isMinimized()) { - await windowGet.unminimize(); - } + if (await windowGet.isMinimized()) await windowGet.unminimize(); await windowGet.setFocus(); const payload = parseDeepLink(e.payload); if (payload === false) { - showSnackbar({ text: "无效的 deep link!", color: "error", timeout: 3000 }); + showSnackbar.error("无效的 deep link!", 3000); await TGLogger.Error(`[App][getDeepLink] 无效的 deep link! ${JSON.stringify(e.payload)}`); return; } @@ -224,7 +222,7 @@ async function handleDeepLink(payload: string): Promise { if (payload.startsWith("router?path=")) { const routerPath = payload.replace("router?path=", ""); if (router.currentRoute.value.path === routerPath) { - showSnackbar({ text: "已在当前页面!", color: "warn", timeout: 3000 }); + showSnackbar.warn("已在当前页面!", 3000); return; } await router.push(routerPath); @@ -244,6 +242,7 @@ async function toUIAF(link: string) { // 检测更新 async function checkUpdate(): Promise { + // @ts-expect-error-next-line const isProdEnv = import.meta.env.MODE === "production"; const needUpdate = await TGSqlite.checkUpdate(); if (needUpdate && isProdEnv) { @@ -253,16 +252,12 @@ async function checkUpdate(): Promise { text: "是否更新数据库数据?(请确保成就数据已导出)", }); if (!confirm) { - showSnackbar({ - text: "请到设置页手动更新数据库!", - color: "error", - timeout: 3000, - }); + showSnackbar.error("请到设置页手动更新数据库!", 3000); return; } appStore.buildTime = getBuildTime(); await TGSqlite.update(); - showSnackbar({ text: "数据库已更新!", color: "success", timeout: 3000 }); + showSnackbar.success("数据库已更新!", 3000); window.open("https://app.btmuli.ink/docs/TeyvatGuide/changelogs.html"); } } diff --git a/src/components/app/t-pinWin.vue b/src/components/app/t-pinWin.vue index f684acb3..88dace1d 100644 --- a/src/components/app/t-pinWin.vue +++ b/src/components/app/t-pinWin.vue @@ -24,8 +24,7 @@ onMounted(async () => { async function switchPin(): Promise { isPined.value = !isPined.value; await getCurrentWindow().setAlwaysOnTop(isPined.value); - const text = isPined.value ? "已将窗口置顶!" : "已经取消窗口置顶!"; - showSnackbar({ text: text, color: "success" }); + showSnackbar.success(isPined.value ? "已将窗口置顶!" : "已经取消窗口置顶!"); }