From 49a47a16ee0b9f8002fad19e581abe6ce0338523 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Fri, 15 Dec 2023 17:08:44 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=B1=20=E6=B7=BB=E5=8A=A0=20wiki=20?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=88=9B=E5=BB=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/WIKI/Character.vue | 9 ++++++++- src/utils/TGWindow.ts | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/pages/WIKI/Character.vue b/src/pages/WIKI/Character.vue index 1bfe30c8..ce52c686 100644 --- a/src/pages/WIKI/Character.vue +++ b/src/pages/WIKI/Character.vue @@ -13,18 +13,25 @@ import { ref, computed } from "vue"; import TibWikiAvatar from "../../components/itembox/tib-wiki-avatar.vue"; import { AppCharacterData } from "../../data"; import Mys from "../../plugins/Mys"; -import { createTGWindow } from "../../utils/TGWindow"; +import { useAppStore } from "../../store/modules/app"; +import { createTGWindow, createWiki } from "../../utils/TGWindow"; // snackbar const snackbar = ref(false); // data const cardsInfo = computed(() => AppCharacterData); +const appStore = useAppStore(); function toOuter(item: TGApp.App.Character.WikiBriefInfo): void { if (item.contentId === 0) { snackbar.value = true; return; } + // 如果是调试环境,打开 wiki 页面 + if (appStore.devMode) { + createWiki("Character", item.id.toString()); + return; + } const url = Mys.Api.Obc.replace("{contentId}", item.contentId.toString()); createTGWindow(url, "Sub_window", `Content_${item.contentId} ${item.name}`, 1200, 800, true); } diff --git a/src/utils/TGWindow.ts b/src/utils/TGWindow.ts index 64556cf6..dfdd651b 100644 --- a/src/utils/TGWindow.ts +++ b/src/utils/TGWindow.ts @@ -1,7 +1,7 @@ /** * @file utils/TGWindow.ts * @description 窗口创建相关工具函数 - * @since Beta v0.3.7 + * @since Beta v0.3.8 */ import { invoke, window as TauriWindow } from "@tauri-apps/api"; @@ -118,3 +118,17 @@ export function createAnno(item: TGApp.App.Announcement.ListCard): void { } createTGWindow(annoPath, "Sub_window", annoTitle, 960, 720, false, false); } + +/** + * @description 打开 Wiki + * @since Beta v0.3.8 + * @param {string} dir 目录 + * @param {string} name 文件名 + * @returns {void} + */ +export function createWiki(dir: string, name: string): void { + // if(dir !== "Character") return; + const dirName = dir === "GCG" ? dir : dir.toLowerCase(); + const wikiPath = `/wiki/detail/${dirName}/${name}`; + createTGWindow(wikiPath, "Sub_window", `Wiki_${dirName}_${name}`, 960, 720, false, false); +}