From 4a646c2c4e40a09963400dea6e28a47a58623dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Mon, 10 Mar 2025 14:54:40 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E4=BC=98=E5=8C=96=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/app/t-gameNav.vue | 39 ++--------------------- src/components/app/to-livecode.vue | 4 +-- src/pages/common/PostForum.vue | 50 +++++++++++++----------------- 3 files changed, 26 insertions(+), 67 deletions(-) diff --git a/src/components/app/t-gameNav.vue b/src/components/app/t-gameNav.vue index 5ce0842b..149af81a 100644 --- a/src/components/app/t-gameNav.vue +++ b/src/components/app/t-gameNav.vue @@ -112,53 +112,20 @@ async function toNav(item: TGApp.BBS.Navigator.Navigator): Promise { // 处理 protocol async function toBBS(link: URL): Promise { if (link.protocol == "mihoyobbs:") { - if (link.pathname.startsWith("//article")) { + if (link.hostname === "article") { const postId = link.pathname.split("/").pop(); await createPost(postId); return; } - if (link.pathname.startsWith("//forum")) { + if (link.hostname === "forum") { const forumId = link.pathname.split("/").pop(); - const localPath = getLocalPath(forumId); - if (localPath === "") { - showSnackbar.warn(`不支持的链接:${link.href}`); - return; - } + const localPath = `/posts/forum/${props.modelValue}/${forumId}`; await emit("active_deep_link", `router?path=${localPath}`); return; } } showSnackbar.warn(`不支持的链接:${link.href}`); } - -// todo 动态获取版块列表 -function getLocalPath(forum?: string): string { - if (!forum) return ""; - const forumLocalMap: Record = { - "31": "/news/3", // 崩坏2 官方 - "6": "/news/1", // 崩坏3 官方 - "28": "/news/2", // 原神官方 - "33": "/news/4", // 未定官方 - "58": "/news/8", // 绝区零官方 - "36": "/news/5", // 大别野公告 - }; - if (forumLocalMap[forum]) return forumLocalMap[forum]; - const ysForums = ["26", "43", "29", "49", "50"]; - const srForums = ["52", "61", "56", "62"]; - const bh3Forums = ["1", "14", "4", "41"]; - const bh2Forums = ["30", "51", "40"]; - const wdForums = ["37", "60", "42", "38"]; - const zzzForums = ["57", "59", "64", "65"]; - const dbyForums = ["54", "35", "34", "39", "47", "48", "55", "36"]; - if (ysForums.includes(forum)) return `/posts/forum/2/${forum}`; - if (srForums.includes(forum)) return `/posts/forum/6/${forum}`; - if (bh3Forums.includes(forum)) return `/posts/forum/1/${forum}`; - if (bh2Forums.includes(forum)) return `/posts/forum/3/${forum}`; - if (wdForums.includes(forum)) return `/posts/forum/4/${forum}`; - if (zzzForums.includes(forum)) return `/posts/forum/8/${forum}`; - if (dbyForums.includes(forum)) return `/posts/forum/5/${forum}`; - return ""; -}