mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
🌱 添加 wiki 窗口创建逻辑
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user