From c40b3c6ff0458084ed2d106f28789f28d90d634f Mon Sep 17 00:00:00 2001 From: BTMuli Date: Thu, 23 Oct 2025 22:40:30 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20=E5=85=AC=E5=91=8A?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=83=E6=98=9F=E5=A5=87=E5=9F=9F=E5=88=86?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/enum/anno.ts | 9 ++++++--- src/pages/common/PageAnno.vue | 17 +++++++++++++---- src/types/BBS/Announcement.d.ts | 6 ++++-- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/enum/anno.ts b/src/enum/anno.ts index c14f62c9..668e9833 100644 --- a/src/enum/anno.ts +++ b/src/enum/anno.ts @@ -1,7 +1,7 @@ /** * @file src/enum/anno.ts * @description 游戏内公告相关枚举 - * @since Beta v0.8.0 + * @since Beta v0.8.4 */ /** @@ -37,17 +37,18 @@ export function getAnnoLangDesc(lang: TGApp.BBS.Announcement.AnnoLangEnum): stri /** * @description 公告类型 - * @since Beta v0.7.7 + * @since Beta v0.8.4 * @const AnnoTypeEnum */ export const AnnoTypeEnum: typeof TGApp.BBS.Announcement.AnnoType = { ACTIVITY: "activity", GAME: "game", + UGC: "ugc", }; /** * @description 获取公告类型描述 - * @since Beta v0.7.7 + * @since Beta v0.8.4 * @param {TGApp.BBS.Announcement.AnnoTypeEnum} type 公告类型 * @return {string} 公告类型描述 */ @@ -57,5 +58,7 @@ export function getAnnoTypeDesc(type: TGApp.BBS.Announcement.AnnoTypeEnum): stri return "活动公告"; case AnnoTypeEnum.GAME: return "游戏公告"; + case AnnoTypeEnum.UGC: + return "千星奇域"; } } diff --git a/src/pages/common/PageAnno.vue b/src/pages/common/PageAnno.vue index e54b7fc7..cfb7b668 100644 --- a/src/pages/common/PageAnno.vue +++ b/src/pages/common/PageAnno.vue @@ -89,13 +89,14 @@ const langList: ReadonlyArray> = const tabList: ReadonlyArray> = [ AnnoTypeEnum.ACTIVITY, AnnoTypeEnum.GAME, + AnnoTypeEnum.UGC, ].map((i) => ({ text: getAnnoTypeDesc(i), value: i })); const { server, lang } = storeToRefs(useAppStore()); const router = useRouter(); const tab = ref(AnnoTypeEnum.ACTIVITY); -const annoCards = shallowRef({ activity: [], game: [] }); +const annoCards = shallowRef({ activity: [], game: [], ugc: [] }); const isReq = ref(false); watch( @@ -134,6 +135,7 @@ async function loadData(): Promise { const detailResp = await hk4eReq.anno.detail(server.value, AnnoLangEnum.CHS); const actCards: Array = []; const gameCards: Array = []; + const ugcCards: Array = []; for (const list of listResp.list) { for (const item of list.list) { const detail = detailResp.find((i) => i.ann_id === item.ann_id); @@ -143,13 +145,15 @@ async function loadData(): Promise { actCards.push(card); } else if (card.typeLabel === "game") { gameCards.push(card); + } else if (card.typeLabel === "ugc") { + ugcCards.push(card); } } else { await TGLogger.Warn(`[Announcements][loadData] 未找到公告详情:${item.ann_id}`); } } } - annoCards.value = { activity: actCards, game: gameCards }; + annoCards.value = { activity: actCards, game: gameCards, ugc: ugcCards }; await showLoading.end(); isReq.value = false; } @@ -177,12 +181,17 @@ function getAnnoCard( const timeStart = anno.start_time.split(" ")[0]; const timeEnd = anno.end_time.split(" ")[0]; const time = `${timeStart} ~ ${timeEnd}`; + const labelMap: Record = { + 1: AnnoTypeEnum.ACTIVITY, + 2: AnnoTypeEnum.GAME, + 26: AnnoTypeEnum.UGC, + }; return { id: anno.ann_id, title: anno.title, subtitle: anno.subtitle.replace(/
/g, " "), banner: anno.banner, - typeLabel: anno.type === 2 ? "game" : "activity", + typeLabel: labelMap[anno.type], tagIcon: anno.tag_icon, tagLabel: getAnnoTag(anno.tag_label), timeStr: time, @@ -233,7 +242,7 @@ async function switchNews(): Promise { display: grid; font-family: var(--font-title); grid-auto-rows: auto; - grid-gap: 8px; + gap: 8px; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); } diff --git a/src/types/BBS/Announcement.d.ts b/src/types/BBS/Announcement.d.ts index cf9b46a5..45bfb86a 100644 --- a/src/types/BBS/Announcement.d.ts +++ b/src/types/BBS/Announcement.d.ts @@ -1,7 +1,7 @@ /** * @file types/BBS/Announcement.d.ts * @description 从 BBS 获取到的游戏内公告类型定义文件 - * @since Beta v0.8.0 + * @since Beta v0.8.4 */ declare namespace TGApp.BBS.Announcement { @@ -30,14 +30,16 @@ declare namespace TGApp.BBS.Announcement { /** * @description 公告类型 - * @since Beta v0.7.7 + * @since Beta v0.8.4 * @const AnnoType * @property {string} "activity" - 活动公告 * @property {string} "game" - 游戏公告 + * @property {string} "ugc" - 千星奇域公告 */ const AnnoType = { ACTIVITY: "activity", GAME: "game", + UGC: "ugc", }; /**