diff --git a/src/components/main/t-annocard.vue b/src/components/main/t-annocard.vue new file mode 100644 index 00000000..7643acdf --- /dev/null +++ b/src/components/main/t-annocard.vue @@ -0,0 +1,193 @@ + + + + + + + + mdi-clock-time-four-outline + {{ props.modelValue.timeStr }} + + + + + {{ parseTitle(props.modelValue.subtitle) }} + + + + mdi-tag + {{ props.modelValue.tagLabel }} + + {{ props.modelValue.id }} + + + + diff --git a/src/pages/common/Announcements.vue b/src/pages/common/Announcements.vue index bd798b0d..f917be7f 100644 --- a/src/pages/common/Announcements.vue +++ b/src/pages/common/Announcements.vue @@ -42,22 +42,13 @@ - - - - - - mdi-clock-time-four-outline - {{ item.timeStr }} - - - - {{ parseTitle(item.subtitle) }} - - - {{ item.tagLabel }} - - + @@ -68,10 +59,10 @@ import { nextTick, onMounted, ref, watch } from "vue"; import { useRouter } from "vue-router"; import showSnackbar from "../../components/func/snackbar.js"; +import TAnnocard from "../../components/main/t-annocard.vue"; import ToLoading from "../../components/overlay/to-loading.vue"; import { useAppStore } from "../../store/modules/app.js"; import TGLogger from "../../utils/TGLogger.js"; -import { createTGWindow } from "../../utils/TGWindow.js"; import { AnnoLang, AnnoServer } from "../../web/request/getAnno.js"; import TGRequest from "../../web/request/TGRequest.js"; import TGUtils from "../../web/utils/TGUtils.js"; @@ -235,22 +226,10 @@ function getAnnoTime(content: string): string | false { return false; } -function parseTitle(title: string): string { - const dom = new DOMParser().parseFromString(title, "text/html"); - return dom.body.innerText; -} - async function switchNews(): Promise { await TGLogger.Info("[Announcements][switchNews] 切换米游社咨讯"); await router.push("/news/2"); } - -async function createAnno(item: TGApp.App.Announcement.ListCard): Promise { - const annoPath = `/anno_detail/${curRegion.value}/${item.id}/${curLang.value}`; - const annoTitle = `Anno_${item.id} ${item.title}`; - await TGLogger.Info(`[Announcements][createAnno][${item.id}] 打开公告窗口`); - await createTGWindow(annoPath, "Sub_window", annoTitle, 960, 720, false, false); -}