feat(parser): 写了个解析

This commit is contained in:
BTMuli
2023-04-02 16:34:53 +08:00
parent d3f7b4be13
commit 68c077326e
10 changed files with 214 additions and 31 deletions

View File

@@ -21,19 +21,29 @@
<div class="anno-cover" @click="toPost(item)">
<img :src="item.banner" alt="cover" />
</div>
<v-card-title>{{ item.title }}</v-card-title>
<v-card-title>
{{ item.title }}
</v-card-title>
<v-card-subtitle>{{ item.subtitle }}</v-card-subtitle>
<v-card-actions>
<v-btn @click="toPost(item)" class="card-btn">
<v-btn @click="toPost(item)" class="anno-btn">
<template v-slot:prepend>
<img src="../assets/icons/arrow-right.svg" alt="right" />
<img :src="item.tag_icon || '../assets/icons/arrow-right.svg'" alt="right" />
</template>
查看
</v-btn>
<v-card-subtitle
><v-icon>mdi-calendar</v-icon> {{ item.start_time.split(" ")[0] }} -
<v-card-subtitle v-show="!appStore.devMode">
<v-icon>mdi-calendar</v-icon>
{{ item.start_time.split(" ")[0] }} -
{{ item.end_time.split(" ")[0] }}</v-card-subtitle
>
<v-card-subtitle v-show="appStore.devMode">id: {{ item.id }}</v-card-subtitle>
<v-btn v-show="appStore.devMode" class="card-btn" @click="toJson(item)">
<template v-slot:prepend>
<img src="../assets/icons/arrow-right.svg" alt="right" />
</template>
查看数据
</v-btn>
</v-card-actions>
</v-card>
</div>
@@ -47,17 +57,24 @@
<v-card-title>{{ item.title }}</v-card-title>
<v-card-subtitle>{{ item.subtitle }}</v-card-subtitle>
<v-card-actions>
<v-btn @click="toPost(item)" class="card-btn">
<v-btn @click="toPost(item)" class="anno-btn">
<template v-slot:prepend>
<img src="../assets/icons/arrow-right.svg" alt="right" />
<img :src="item.tag_icon || '../assets/icons/arrow-right.svg'" alt="right" />
</template>
查看
</v-btn>
<v-card-subtitle>
<v-card-subtitle v-show="!appStore.devMode">
<v-icon>mdi-calendar</v-icon>
{{ item.start_time.split(" ")[0] }} -
{{ item.end_time.split(" ")[0] }}</v-card-subtitle
>
<v-card-subtitle v-show="appStore.devMode">id: {{ item.id }}</v-card-subtitle>
<v-btn v-show="appStore.devMode" class="card-btn" @click="toJson(item)">
<template v-slot:prepend>
<img src="../assets/icons/arrow-right.svg" alt="right" />
</template>
查看数据
</v-btn>
</v-card-actions>
</v-card>
</div>
@@ -77,6 +94,10 @@ import GenshinOper from "../plugins/Genshin";
import { createTGWindow } from "../utils/TGWindow";
// interface
import { AnnoListData, AnnoListCard } from "../plugins/Genshin/interface/announcement";
import useAppStore from "../store/modules/app";
// store
const appStore = useAppStore();
// loading
const loading = ref(true);
@@ -94,7 +115,7 @@ const annoData = ref({} as AnnoListData);
onMounted(async () => {
loadingTitle.value = "正在获取公告数据";
annoData.value = await GenshinOper.Announcement.get.list();
annoData.value = await GenshinOper.Announcement.getList();
loadingTitle.value = "正在转换公告数据";
const listCards = GenshinOper.Announcement.card(annoData.value);
const activityCard = listCards.filter(item => item.type_label === "活动公告");
@@ -121,6 +142,16 @@ async function toPost(item: AnnoListCard) {
}).href;
createTGWindow(path, "游戏内公告", item.title, 960, 720, false);
}
async function toJson(item: AnnoListCard) {
const path = router.resolve({
name: "游戏内公告JSON",
params: {
anno_id: item.id,
},
}).href;
createTGWindow(path, "游戏内公告-JSON", item.title, 960, 720, false);
}
</script>
<style lang="css" scoped>
@@ -155,6 +186,16 @@ async function toPost(item: AnnoListCard) {
transition: all 0.3s linear;
}
.anno-btn {
background: #546d8b;
color: #faf7e8;
}
.anno-btn img {
height: 30px;
width: 30px;
}
/* switch */
.switch-btn {
font-family: Genshin, serif;