mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-16 09:58:13 +08:00
🎨 一些优化
* 优化公告解析逻辑 * 咨讯页loading显示版块名称 * 移除无用文件
This commit is contained in:
@@ -64,7 +64,7 @@ import { useAppStore } from "../../store/modules/app.js";
|
||||
import TGLogger from "../../utils/TGLogger.js";
|
||||
import { AnnoLang, AnnoServer } from "../../web/request/getAnno.js";
|
||||
import TGRequest from "../../web/request/TGRequest.js";
|
||||
import TGUtils from "../../web/utils/TGUtils.js";
|
||||
import { getAnnoCard } from "../../web/utils/getAnnoCard.js";
|
||||
import { decodeRegExp } from "../../web/utils/tools.js";
|
||||
|
||||
type AnnoSelect = { text: string; value: string };
|
||||
@@ -145,7 +145,7 @@ async function loadData(): Promise<void> {
|
||||
`服务器:${getRegionName(curRegion.value)},语言:${getLangName(curLang.value)}`,
|
||||
);
|
||||
const annoData = await TGRequest.Anno.getList(curRegion.value, curLang.value);
|
||||
const listCards = TGUtils.Anno.getCard(annoData);
|
||||
const listCards = getAnnoCard(annoData);
|
||||
await Promise.all(
|
||||
listCards.map(async (item) => {
|
||||
if (item.typeLabel === AnnoType.game) return;
|
||||
|
||||
@@ -69,6 +69,7 @@ import Mys from "../../plugins/Mys/index.js";
|
||||
import { useAppStore } from "../../store/modules/app.js";
|
||||
import TGLogger from "../../utils/TGLogger.js";
|
||||
import { createPost } from "../../utils/TGWindow.js";
|
||||
import { getGameName } from "../../web/utils/tools.js";
|
||||
|
||||
// 类型定义
|
||||
enum NewsType {
|
||||
@@ -92,6 +93,7 @@ type RawData = {
|
||||
// 路由
|
||||
const router = useRouter();
|
||||
const gid = <string>useRoute().params.gid;
|
||||
const gameName = getGameName(Number(gid));
|
||||
// loading
|
||||
const loading = ref<boolean>(false);
|
||||
|
||||
@@ -146,12 +148,12 @@ async function firstLoad(key: NewsKey, refresh: boolean = false): Promise<void>
|
||||
postData.value[key] = [];
|
||||
rawData.value[key].lastId = 0;
|
||||
}
|
||||
showLoading.start(`正在获取${rawData.value[key].name}数据...`);
|
||||
showLoading.start(`正在获取${gameName}${rawData.value[key].name}数据...`);
|
||||
const getData = await Mys.Painter.getNewsList(gid, NewsType[key]);
|
||||
rawData.value[key].isLast = getData.is_last;
|
||||
rawData.value[key].lastId = getData.list.length;
|
||||
postData.value[key] = getData.list;
|
||||
showLoading.update(`正在渲染${rawData.value[key].name}数据...`);
|
||||
showLoading.update(`正在渲染${gameName}${rawData.value[key].name}数据...`);
|
||||
await nextTick(() => showLoading.end());
|
||||
await TGLogger.Info(`[News][${gid}][firstLoad] 获取${rawData.value[key].name}数据成功`);
|
||||
}
|
||||
@@ -169,7 +171,7 @@ async function loadMore(key: NewsKey): Promise<void> {
|
||||
loading.value = false;
|
||||
return;
|
||||
}
|
||||
showLoading.start(`正在获取${rawData.value[key].name}数据...`);
|
||||
showLoading.start(`正在获取${gameName}${rawData.value[key].name}数据...`);
|
||||
const getData = await Mys.Painter.getNewsList(gid, NewsType[key], 20, rawData.value[key].lastId);
|
||||
rawData.value[key].lastId = rawData.value[key].lastId + getData.list.length;
|
||||
rawData.value[key].isLast = getData.is_last;
|
||||
|
||||
@@ -73,6 +73,7 @@ import ToPostSearch from "../../components/post/to-postSearch.vue";
|
||||
import Mys from "../../plugins/Mys/index.js";
|
||||
import TGLogger from "../../utils/TGLogger.js";
|
||||
import { createPost } from "../../utils/TGWindow.js";
|
||||
import { getGameName } from "../../web/utils/tools.js";
|
||||
|
||||
type SortSelect = {
|
||||
text: string;
|
||||
@@ -184,9 +185,9 @@ const search = ref<string>("");
|
||||
const showSearch = ref<boolean>(false);
|
||||
|
||||
onMounted(async () => {
|
||||
showLoading.start("正在获取帖子数据...");
|
||||
if (gid && typeof gid === "string") curGid.value = Number(gid);
|
||||
if (forum && typeof forum === "string") curForum.value = Number(forum);
|
||||
showLoading.start(`正在获取${getGameName(curGid.value)}帖子数据...`);
|
||||
const gameLabel = getGameLabel(curGid.value);
|
||||
const forumLabel = getForumLabel(curGid.value, curForum.value);
|
||||
await TGLogger.Info(`[Posts][${gameLabel}][onMounted][${forumLabel}] 打开帖子列表`);
|
||||
|
||||
Reference in New Issue
Block a user