mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
♻️ 窗口创建逻辑变更
This commit is contained in:
@@ -73,7 +73,7 @@ export function createTGWindow(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 打开帖子
|
* @description 打开帖子
|
||||||
* @since Beta v0.3.7
|
* @since Beta v0.3.8
|
||||||
* @param {TGApp.Plugins.Mys.News.RenderCard | string | number | TGApp.Plugins.Mys.Forum.RenderCard} item 帖子内容或ID
|
* @param {TGApp.Plugins.Mys.News.RenderCard | string | number | TGApp.Plugins.Mys.Forum.RenderCard} item 帖子内容或ID
|
||||||
* @param {string} title 帖子标题
|
* @param {string} title 帖子标题
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
@@ -82,22 +82,15 @@ export function createPost(
|
|||||||
item: TGApp.Plugins.Mys.News.RenderCard | string | number | TGApp.Plugins.Mys.Forum.RenderCard,
|
item: TGApp.Plugins.Mys.News.RenderCard | string | number | TGApp.Plugins.Mys.Forum.RenderCard,
|
||||||
title?: string,
|
title?: string,
|
||||||
): void {
|
): void {
|
||||||
let postId, postTitle, jsonTitle;
|
let postId, postTitle;
|
||||||
if (typeof item === "string" || typeof item === "number") {
|
if (typeof item === "string" || typeof item === "number") {
|
||||||
postId = item.toString();
|
postId = item.toString();
|
||||||
postTitle = title ? `Post_${postId} ${title}` : `Post_${postId}`;
|
postTitle = title ? `Post_${postId} ${title}` : `Post_${postId}`;
|
||||||
jsonTitle = title ? `Post_${postId}_JSON ${title}` : `Post_${postId}_JSON`;
|
|
||||||
} else {
|
} else {
|
||||||
postId = item.postId.toString();
|
postId = item.postId.toString();
|
||||||
postTitle = `Post_${postId} ${item.title}`;
|
postTitle = `Post_${postId} ${item.title}`;
|
||||||
jsonTitle = `Post_${postId}_JSON ${item.title}`;
|
|
||||||
}
|
}
|
||||||
const postPath = `/post_detail/${postId}`;
|
const postPath = `/post_detail/${postId}`;
|
||||||
const jsonPath = `/post_detail_json/${postId}`;
|
|
||||||
const isDev = useAppStore().devMode ?? false;
|
|
||||||
if (isDev) {
|
|
||||||
createTGWindow(jsonPath, "Dev_JSON", jsonTitle, 960, 720, false, false);
|
|
||||||
}
|
|
||||||
createTGWindow(postPath, "Sub_window", postTitle, 960, 720, false, false);
|
createTGWindow(postPath, "Sub_window", postTitle, 960, 720, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ import TShareBtn from "../components/main/t-shareBtn.vue";
|
|||||||
import ToLoading from "../components/overlay/to-loading.vue";
|
import ToLoading from "../components/overlay/to-loading.vue";
|
||||||
import TpParser from "../components/post/tp-parser.vue";
|
import TpParser from "../components/post/tp-parser.vue";
|
||||||
import Mys from "../plugins/Mys";
|
import Mys from "../plugins/Mys";
|
||||||
|
import { useAppStore } from "../store/modules/app";
|
||||||
|
import { createTGWindow } from "../utils/TGWindow";
|
||||||
|
|
||||||
interface PostRender {
|
interface PostRender {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -161,6 +163,11 @@ onMounted(async () => {
|
|||||||
await appWindow.setTitle(`Post_${postId} Parsing Error`);
|
await appWindow.setTitle(`Post_${postId} Parsing Error`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 打开 json
|
||||||
|
const isDev = useAppStore().devMode ?? false;
|
||||||
|
if (isDev) {
|
||||||
|
createPostJson(postId.toString());
|
||||||
|
}
|
||||||
await nextTick(() => {
|
await nextTick(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
@@ -228,6 +235,12 @@ function parseContent(content: string): string {
|
|||||||
});
|
});
|
||||||
return JSON.stringify(result);
|
return JSON.stringify(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createPostJson(postId: string): void {
|
||||||
|
const jsonPath = `/post_detail_json/${postId}`;
|
||||||
|
const jsonTitle = `Post_${postId}_JSON`;
|
||||||
|
createTGWindow(jsonPath, "Dev_JSON", jsonTitle, 960, 720, false, false);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="css" scoped>
|
<style lang="css" scoped>
|
||||||
.tp-post-body {
|
.tp-post-body {
|
||||||
|
|||||||
Reference in New Issue
Block a user