♻️ 公告页的窗口创建逻辑也顺便改一下

This commit is contained in:
BTMuli
2023-12-20 00:47:26 +08:00
parent 0d5d77e2bd
commit 568b0b5db7
4 changed files with 23 additions and 25 deletions

View File

@@ -28,7 +28,9 @@ import { useRoute } from "vue-router";
import TSwitchTheme from "../components/app/t-switchTheme.vue";
import TShareBtn from "../components/main/t-shareBtn.vue";
import ToLoading from "../components/overlay/to-loading.vue";
import { useAppStore } from "../store/modules/app";
import { saveImgLocal } from "../utils/TGShare";
import { createTGWindow } from "../utils/TGWindow";
import TGRequest from "../web/request/TGRequest";
import TGUtils from "../web/utils/TGUtils";
@@ -59,7 +61,6 @@ onMounted(async () => {
}
// 获取数据
loadingTitle.value = "正在获取数据...";
loading.value = true;
try {
annoData.value = await TGRequest.Anno.getContent(annoId);
loadingTitle.value = "正在渲染数据...";
@@ -75,6 +76,11 @@ onMounted(async () => {
await appWindow.setTitle(`Anno_${annoId} Parsing Error`);
return;
}
// 打开 json
const isDev = useAppStore().devMode ?? false;
if (isDev) {
createAnnoJson(annoId);
}
setTimeout(() => {
loading.value = false;
}, 200);
@@ -90,5 +96,11 @@ watch(loadShare, (value) => {
loading.value = false;
}
});
function createAnnoJson(annoId: number) {
const jsonPath = `/anno_detail/${annoId}`;
const jsonTitle = `Anno_${annoId}_JSON`;
createTGWindow(jsonPath, "Dev_JSON", jsonTitle, 960, 720, false, false);
}
</script>
<style lang="css" src="../assets/css/anno-parser.css" scoped></style>

View File

@@ -166,7 +166,7 @@ onMounted(async () => {
// 打开 json
const isDev = useAppStore().devMode ?? false;
if (isDev) {
createPostJson(postId.toString());
createPostJson(postId);
}
await nextTick(() => {
loading.value = false;
@@ -236,7 +236,7 @@ function parseContent(content: string): string {
return JSON.stringify(result);
}
function createPostJson(postId: string): void {
function createPostJson(postId: number): void {
const jsonPath = `/post_detail_json/${postId}`;
const jsonTitle = `Post_${postId}_JSON`;
createTGWindow(jsonPath, "Dev_JSON", jsonTitle, 960, 720, false, false);