🌈 style(eslint): 第三次格式化

camecase 回头在部分文件 ignore 掉,不然不兼容之前的版本及外部接口

(cherry picked from commit 740b4698e916ce0f7911f5eac934183a94288e61)
This commit is contained in:
BTMuli
2023-04-06 14:58:05 +08:00
parent b3956e6b7f
commit 0cdf2c80b9
27 changed files with 1527 additions and 1502 deletions

View File

@@ -1,5 +1,5 @@
<template> <template>
<div v-if="isMain"> <div v-if="isMain">
<v-layout> <v-layout>
<!-- 侧边栏菜单 --> <!-- 侧边栏菜单 -->
<TSidebar /> <TSidebar />
@@ -10,8 +10,8 @@
</v-container> </v-container>
</v-main> </v-main>
</v-layout> </v-layout>
</div> </div>
<div v-else> <div v-else>
<v-layout> <v-layout>
<!-- 主体内容 --> <!-- 主体内容 -->
<v-main class="app-main"> <v-main class="app-main">
@@ -20,8 +20,8 @@
</v-container> </v-container>
</v-main> </v-main>
</v-layout> </v-layout>
</div> </div>
<TBackTop /> <TBackTop />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@@ -43,7 +43,7 @@ const isMain = ref(true as boolean);
onMounted(async () => { onMounted(async () => {
// 获取当前窗口 // 获取当前窗口
const win = await window.getCurrent(); const win = window.getCurrent();
isMain.value = win.label === "tauri-genshin"; isMain.value = win.label === "tauri-genshin";
if (isMain.value) { if (isMain.value) {
const title = "Tauri.Genshin v" + (await app.getVersion()) + " Alpha"; const title = "Tauri.Genshin v" + (await app.getVersion()) + " Alpha";

View File

@@ -1,9 +1,9 @@
<template> <template>
<transition name="fade"> <transition name="fade">
<div v-show="canTop" class="back-top" @click="handleScrollTop"> <div v-show="canTop" class="back-top" @click="handleScrollTop">
<img src="../assets/icons/arrow-top.svg" alt="back-icon"> <img src="../assets/icons/arrow-top.svg" alt="back-icon">
</div> </div>
</transition> </transition>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// vue // vue

View File

@@ -1,5 +1,5 @@
<template> <template>
<v-list class="calendar-card"> <v-list class="calendar-card">
<v-list-item> <v-list-item>
<v-list-item-title style="color: #fec90b; margin-left: 10px; margin-bottom: 10px; font-family: Genshin, serif"> <v-list-item-title style="color: #fec90b; margin-left: 10px; margin-bottom: 10px; font-family: Genshin, serif">
<v-icon color="#EBD49E"> <v-icon color="#EBD49E">
@@ -22,17 +22,29 @@
<div v-if="!loading" class="calendar-grid"> <div v-if="!loading" class="calendar-grid">
<v-card title="天赋培养" class="calendar-single"> <v-card title="天赋培养" class="calendar-single">
<v-card-text class="calendar-icons"> <v-card-text class="calendar-icons">
<v-img v-for="item in showCharacters" :key="item.id" :src="item.cover" class="calendar-icon" @click="showContent(item)" /> <v-img
v-for="item in showCharacters"
:key="item.id"
:src="item.cover"
class="calendar-icon"
@click="showContent(item)"
/>
</v-card-text> </v-card-text>
</v-card> </v-card>
<v-card title="武器突破" class="calendar-single"> <v-card title="武器突破" class="calendar-single">
<v-card-text class="calendar-icons"> <v-card-text class="calendar-icons">
<v-img v-for="item in showWeapons" :key="item.id" :src="item.cover" class="calendar-icon" @click="showContent(item)" /> <v-img
v-for="item in showWeapons"
:key="item.id"
:src="item.cover"
class="calendar-icon"
@click="showContent(item)"
/>
</v-card-text> </v-card-text>
</v-card> </v-card>
</div> </div>
</v-list-item> </v-list-item>
</v-list> </v-list>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// vue // vue

View File

@@ -1,5 +1,5 @@
<template> <template>
<v-overlay v-model="visible"> <v-overlay v-model="visible">
<div class="confirm-div"> <div class="confirm-div">
<div class="confirm-box"> <div class="confirm-box">
<div class="confirm-title"> <div class="confirm-title">
@@ -21,7 +21,7 @@
</div> </div>
</div> </div>
</div> </div>
</v-overlay> </v-overlay>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="loading-div"> <div class="loading-div">
<div class="loading-content"> <div class="loading-content">
<div class="loading-title"> <div class="loading-title">
{{ title }} {{ title }}
@@ -18,7 +18,7 @@
{{ content }} {{ content }}
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
interface LoadingProps { interface LoadingProps {
@@ -29,16 +29,13 @@ interface LoadingProps {
position?: string; position?: string;
} }
withDefaults( withDefaults(defineProps<LoadingProps>(), {
defineProps<LoadingProps>(),
{
title: "加载中", title: "加载中",
subtitle: "", subtitle: "",
content: "", content: "",
empty: false, empty: false,
position: "absolute", position: "absolute",
}, });
);
</script> </script>
<style lang="css" scoped> <style lang="css" scoped>
.loading-div { .loading-div {

View File

@@ -1,12 +1,16 @@
<template> <template>
<v-list class="pool-card"> <v-list class="pool-card">
<v-list-item> <v-list-item>
<v-list-item-title style="color: #fec90b; margin-left: 10px; font-family: Genshin, serif"> <v-list-item-title style="color: #fec90b; margin-left: 10px; font-family: Genshin, serif">
<img src="../assets/icons/icon-wish.svg" alt="wish" class="pool-wish-icon"> <img src="../assets/icons/icon-wish.svg" alt="wish" class="pool-wish-icon">
限时祈愿 限时祈愿
</v-list-item-title> </v-list-item-title>
<div v-if="!loading" class="pool-grid"> <div v-if="!loading" class="pool-grid">
<v-card v-for="pool in poolCards" :key="pool.post_id" style="background: #faf7e8; color: #546d8b; border-radius: 10px"> <v-card
v-for="pool in poolCards"
:key="pool.post_id"
style="background: #faf7e8; color: #546d8b; border-radius: 10px"
>
<v-list style="background: #faf7e8; color: #546d8b"> <v-list style="background: #faf7e8; color: #546d8b">
<v-list-item :title="pool.title" :subtitle="pool.subtitle"> <v-list-item :title="pool.title" :subtitle="pool.subtitle">
<template #prepend> <template #prepend>
@@ -39,7 +43,7 @@
</v-card> </v-card>
</div> </div>
</v-list-item> </v-list-item>
</v-list> </v-list>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// vue // vue
@@ -120,14 +124,14 @@ function checkCover (data: GachaData[]) {
return false; return false;
} }
return data.every((item) => { return data.every((item) => {
const post_id = item.activity_url.split("/").pop(); const postId = item.activity_url.split("/").pop();
if (!post_id || isNaN(Number(post_id))) { if (!postId || isNaN(Number(postId))) {
return false; return false;
} }
if (!Object.keys(cover).includes(post_id)) { if (!Object.keys(cover).includes(postId)) {
return false; return false;
} else { } else {
const coverUrl = Object.keys(cover).find((key) => key === post_id); const coverUrl = Object.keys(cover).find((key) => key === postId);
return coverUrl !== "/source/UI/empty.webp"; return coverUrl !== "/source/UI/empty.webp";
} }
}); });
@@ -148,6 +152,7 @@ function toPost (pool: GachaCard) {
const path = router.resolve({ const path = router.resolve({
name: "帖子详情", name: "帖子详情",
params: { params: {
// eslint-disable-next-line camelcase
post_id: pool.post_id.toString(), post_id: pool.post_id.toString(),
}, },
}).href; }).href;

View File

@@ -1,12 +1,16 @@
<template> <template>
<v-list class="position-card"> <v-list class="position-card">
<v-list-item> <v-list-item>
<v-list-item-title style="color: #fec90b; margin-left: 10px; font-family: Genshin, serif"> <v-list-item-title style="color: #fec90b; margin-left: 10px; font-family: Genshin, serif">
<img src="../assets/icons/board.svg" alt="act" class="position-act-icon"> <img src="../assets/icons/board.svg" alt="act" class="position-act-icon">
近期活动 近期活动
</v-list-item-title> </v-list-item-title>
<div v-if="!loading" class="position-grid"> <div v-if="!loading" class="position-grid">
<v-card v-for="card in positionCards" :key="card.post_id" style="background: #faf7e8; color: #546d8b; border-radius: 10px"> <v-card
v-for="card in positionCards"
:key="card.post_id"
style="background: #faf7e8; color: #546d8b; border-radius: 10px"
>
<v-list style="background: #faf7e8; color: #546d8b"> <v-list style="background: #faf7e8; color: #546d8b">
<v-list-item :title="card.title" :subtitle="card.abstract"> <v-list-item :title="card.title" :subtitle="card.abstract">
<template #prepend> <template #prepend>
@@ -41,7 +45,7 @@
</v-card> </v-card>
</div> </div>
</v-list-item> </v-list-item>
</v-list> </v-list>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// vue // vue
@@ -105,12 +109,12 @@ function getLastPositionTime (time: number) {
} }
async function toPost (card: PositionCard) { async function toPost (card: PositionCard) {
const post_id = card.post_id;
// 获取路由路径 // 获取路由路径
const path = router.resolve({ const path = router.resolve({
name: "帖子详情", name: "帖子详情",
params: { params: {
post_id, // eslint-disable-next-line camelcase
post_id: card.post_id,
}, },
}).href; }).href;
// 打开新窗口 // 打开新窗口

View File

@@ -1,5 +1,5 @@
<template> <template>
<v-navigation-drawer permanent :rail="rail" style="background: #485466; color: #faf7e8"> <v-navigation-drawer permanent :rail="rail" style="background: #485466; color: #faf7e8">
<v-list v-model:opened="open" class="side-list" density="compact" nav> <v-list v-model:opened="open" class="side-list" density="compact" nav>
<!-- 负责收缩侧边栏 --> <!-- 负责收缩侧边栏 -->
<v-list-item @click="collapse"> <v-list-item @click="collapse">
@@ -104,7 +104,7 @@
</template> </template>
</v-list-item> </v-list-item>
</v-list> </v-list>
</v-navigation-drawer> </v-navigation-drawer>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>

View File

@@ -1,6 +1,6 @@
<template> <template>
<!-- 顶部操作栏 --> <!-- 顶部操作栏 -->
<v-app-bar style="background: rgb(0 0 0 / 50%); color: #f4d8a8; font-family: Genshin, serif"> <v-app-bar style="background: rgb(0 0 0 / 50%); color: #f4d8a8; font-family: Genshin, serif">
<template #prepend> <template #prepend>
<span style="font-size: 30px">{{ title }}</span> <span style="font-size: 30px">{{ title }}</span>
</template> </template>
@@ -21,11 +21,11 @@
导出 导出
</v-btn> </v-btn>
</template> </template>
</v-app-bar> </v-app-bar>
<div v-show="loading"> <div v-show="loading">
<TLoading :title="loadingTitle" /> <TLoading :title="loadingTitle" />
</div> </div>
<div v-show="!loading" class="wrap"> <div v-show="!loading" class="wrap">
<!-- 左侧菜单 --> <!-- 左侧菜单 -->
<div class="left-wrap"> <div class="left-wrap">
<v-list v-for="(series, index) in seriesList" :key="series.id" class="card-left" @click="selectSeries(index)"> <v-list v-for="(series, index) in seriesList" :key="series.id" class="card-left" @click="selectSeries(index)">
@@ -96,7 +96,7 @@
<v-snackbar v-model="snackbar" timeout="1500" color="#F5810A" top> <v-snackbar v-model="snackbar" timeout="1500" color="#F5810A" top>
{{ snackbarText }} {{ snackbarText }}
</v-snackbar> </v-snackbar>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@@ -271,7 +271,7 @@ async function importJson () {
const localTime = localData.completed_time; const localTime = localData.completed_time;
// 如果本地数据不存在,或者本地数据的 timeStamp 小于远程数据的 timeStamp更新数据 // 如果本地数据不存在,或者本地数据的 timeStamp 小于远程数据的 timeStamp更新数据
if (data.timestamp !== 0) { if (data.timestamp !== 0) {
const fin_time = new Date(data.timestamp * 1000).toLocaleString("zh", { const finishTime = new Date(data.timestamp * 1000).toLocaleString("zh", {
year: "numeric", year: "numeric",
month: "2-digit", month: "2-digit",
day: "2-digit", day: "2-digit",
@@ -279,8 +279,9 @@ async function importJson () {
minute: "2-digit", minute: "2-digit",
second: "2-digit", second: "2-digit",
}); });
if (fin_time !== localTime || localData.progress !== data.current) { if (finishTime !== localTime || localData.progress !== data.current) {
localData.completed_time = fin_time; // eslint-disable-next-line camelcase
localData.completed_time = finishTime;
localData.progress = data.current; localData.progress = data.current;
localData.completed = true; localData.completed = true;
// 更新数据 // 更新数据
@@ -288,6 +289,7 @@ async function importJson () {
} }
} else { } else {
if (localData.progress !== data.current) { if (localData.progress !== data.current) {
// eslint-disable-next-line camelcase
localData.completed_time = ""; localData.completed_time = "";
localData.progress = data.current; localData.progress = data.current;
localData.completed = false; localData.completed = false;
@@ -303,6 +305,7 @@ async function importJson () {
seriesDB.map(async (data) => { seriesDB.map(async (data) => {
const seriesId = data.id; const seriesId = data.id;
const achievementsDB = await ReadTGDataByIndex("Achievements", "series", seriesId); const achievementsDB = await ReadTGDataByIndex("Achievements", "series", seriesId);
// eslint-disable-next-line camelcase
data.completed_count = achievementsDB.filter((data) => { data.completed_count = achievementsDB.filter((data) => {
return data.completed === true; return data.completed === true;
}).length; }).length;
@@ -311,13 +314,13 @@ async function importJson () {
); );
loadingTitle.value = "正在刷新数据"; loadingTitle.value = "正在刷新数据";
seriesDB = await ReadAllTGData("AchievementSeries"); seriesDB = await ReadAllTGData("AchievementSeries");
const fin_achievements = seriesDB.reduce((a, b) => { const finishAchievments = seriesDB.reduce((a, b) => {
return a + b.completed_count; return a + b.completed_count;
}, 0); }, 0);
const total_achievements = seriesDB.reduce((a, b) => { const totalAchievements = seriesDB.reduce((a, b) => {
return a + b.total_count; return a + b.total_count;
}, 0); }, 0);
achievementsStore.flushData(total_achievements, fin_achievements); achievementsStore.flushData(totalAchievements, finishAchievments);
// 刷新数据 // 刷新数据
await loadData(); await loadData();
} }
@@ -361,7 +364,7 @@ async function exportJson () {
}; };
}); });
UIAF_DATA.info = await UiafOper.getUiafInfo(); UIAF_DATA.info = await UiafOper.getUiafInfo();
const is_save = await dialog.save({ const isSave = await dialog.save({
filters: [ filters: [
{ {
name: "achievements", name: "achievements",
@@ -369,8 +372,8 @@ async function exportJson () {
}, },
], ],
}); });
if (is_save) { if (isSave) {
await fs.writeTextFile(is_save, JSON.stringify(UIAF_DATA)); await fs.writeTextFile(isSave, JSON.stringify(UIAF_DATA));
} }
} }
</script> </script>

View File

@@ -1,8 +1,8 @@
<template> <template>
<div v-if="loading"> <div v-if="loading">
<TLoading :title="loadingTitle" /> <TLoading :title="loadingTitle" />
</div> </div>
<div v-else> <div v-else>
<v-tabs v-model="tab" align-tabs="start" class="global-font mb-2"> <v-tabs v-model="tab" align-tabs="start" class="global-font mb-2">
<v-tab value="activity" title="活动公告" /> <v-tab value="activity" title="活动公告" />
<v-tab value="game" title="游戏公告" /> <v-tab value="game" title="游戏公告" />
@@ -84,7 +84,7 @@
</div> </div>
</v-window-item> </v-window-item>
</v-window> </v-window>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@@ -140,6 +140,7 @@ async function toPost (item: AnnoListCard) {
const path = router.resolve({ const path = router.resolve({
name: "游戏内公告", name: "游戏内公告",
params: { params: {
// eslint-disable-next-line camelcase
anno_id: item.id, anno_id: item.id,
}, },
}).href; }).href;
@@ -150,6 +151,7 @@ async function toJson (item: AnnoListCard) {
const path = router.resolve({ const path = router.resolve({
name: "游戏内公告JSON", name: "游戏内公告JSON",
params: { params: {
// eslint-disable-next-line camelcase
anno_id: item.id, anno_id: item.id,
}, },
}).href; }).href;

View File

@@ -1,8 +1,8 @@
<template> <template>
<div v-if="loading"> <div v-if="loading">
<TLoading /> <TLoading />
</div> </div>
<div v-else> <div v-else>
<v-list class="config-list"> <v-list class="config-list">
<v-list-subheader inset class="config-header"> <v-list-subheader inset class="config-header">
应用信息 应用信息
@@ -121,7 +121,7 @@
</v-snackbar> </v-snackbar>
<!-- 确认弹窗 --> <!-- 确认弹窗 -->
<TConfirm v-model="confirmShow" :title="confirmText" @confirm="doConfirm(confirmOper)" /> <TConfirm v-model="confirmShow" :title="confirmText" @confirm="doConfirm(confirmOper)" />
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>

View File

@@ -1,8 +1,8 @@
<template> <template>
<div v-if="loading"> <div v-if="loading">
<TLoading title="正在加载卡牌列表" /> <TLoading title="正在加载卡牌列表" />
</div> </div>
<div v-else> <div v-else>
<v-tabs v-model="tab" align-tabs="start" class="global-font"> <v-tabs v-model="tab" align-tabs="start" class="global-font">
<div v-show="!doSearch"> <div v-show="!doSearch">
<v-tab value="character" title="角色牌" /> <v-tab value="character" title="角色牌" />
@@ -87,7 +87,7 @@
<v-snackbar v-model="snackbar" timeout="1500" color="error"> <v-snackbar v-model="snackbar" timeout="1500" color="error">
未找到相关卡牌 未找到相关卡牌
</v-snackbar> </v-snackbar>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// vue // vue
@@ -125,9 +125,9 @@ async function loadData () {
CardsInfoM.value = CardsInfo.filter((item) => item.type === "魔物牌") as MonsterCard[]; CardsInfoM.value = CardsInfo.filter((item) => item.type === "魔物牌") as MonsterCard[];
loading.value = false; loading.value = false;
} }
function toOuter (card_name: string, card_id: number) { function toOuter (cardName: string, cardId: number) {
const url = OBC_CONTENT_API.replace("{content_id}", card_id.toString()); const url = OBC_CONTENT_API.replace("{content_id}", cardId.toString());
createTGWindow(url, "GCG", card_name, 1200, 800, true); createTGWindow(url, "GCG", cardName, 1200, 800, true);
} }
async function searchCard () { async function searchCard () {
loading.value = true; loading.value = true;

View File

@@ -1,6 +1,6 @@
<template> <template>
<TLoading v-if="loading" :title="loadingTitle" :subtitle="loadingSubtitle" /> <TLoading v-if="loading" :title="loadingTitle" :subtitle="loadingSubtitle" />
<component :is="item" v-for="item in components" v-show="!loading" :key="item" :ref="setItemRef" /> <component :is="item" v-for="item in components" v-show="!loading" :key="item" :ref="setItemRef" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>

View File

@@ -53,11 +53,7 @@ export async function getNoticeList (gid: string = "2", pageSize: number = 20, l
* @param {number} lastId 上一次请求的最后一条数据的 id * @param {number} lastId 上一次请求的最后一条数据的 id
* @return {Promise<NewsData>} * @return {Promise<NewsData>}
*/ */
export async function getActivityList ( export async function getActivityList (gid: string = "2", pageSize: number = 20, lastId: number = 0): Promise<NewsData> {
gid: string = "2",
pageSize: number = 20,
lastId: number = 0,
): Promise<NewsData> {
const url = NEWS_LIST_API.replace("{page_size}", pageSize.toString()) const url = NEWS_LIST_API.replace("{page_size}", pageSize.toString())
.replace("{gid}", gid) .replace("{gid}", gid)
.replace("{news_type}", NewsType.ACTIVITY) .replace("{news_type}", NewsType.ACTIVITY)

View File

@@ -1,8 +1,8 @@
<template> <template>
<div v-if="loading"> <div v-if="loading">
<TLoading :empty="loadingEmpty" :title="loadingTitle" /> <TLoading :empty="loadingEmpty" :title="loadingTitle" />
</div> </div>
<div v-else class="dev-json"> <div v-else class="dev-json">
<div class="anno-title"> <div class="anno-title">
活动列表 JSON 活动列表 JSON
</div> </div>
@@ -11,7 +11,7 @@
活动内容 JSON 活动内容 JSON
</div> </div>
<JsonViewer :value="jsonContent" copyable boxed /> <JsonViewer :value="jsonContent" copyable boxed />
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// vue // vue
@@ -32,14 +32,14 @@ const loadingTitle = ref("正在加载");
const loadingEmpty = ref(false as boolean); const loadingEmpty = ref(false as boolean);
// 数据 // 数据
const anno_id = Number(useRoute().params.anno_id); const annoId = Number(useRoute().params.anno_id);
let jsonList = reactive({}); let jsonList = reactive({});
let jsonContent = reactive({}); let jsonContent = reactive({});
onMounted(async () => { onMounted(async () => {
await appWindow.show(); await appWindow.show();
// 检查数据 // 检查数据
if (!anno_id) { if (!annoId) {
loadingEmpty.value = true; loadingEmpty.value = true;
loadingTitle.value = "未找到数据"; loadingTitle.value = "未找到数据";
return; return;
@@ -49,10 +49,10 @@ onMounted(async () => {
const listData = await GenshinOper.Announcement.getList(); const listData = await GenshinOper.Announcement.getList();
listData.list.map((item: Announcement) => { listData.list.map((item: Announcement) => {
return item.list.map((single: AnnoListItem) => { return item.list.map((single: AnnoListItem) => {
return single.ann_id === anno_id ? (jsonList = single) : null; return single.ann_id === annoId ? (jsonList = single) : null;
}); });
}); });
jsonContent = await GenshinOper.Announcement.getContent(anno_id); jsonContent = await GenshinOper.Announcement.getContent(annoId);
setTimeout(() => { setTimeout(() => {
loading.value = false; loading.value = false;
}, 200); }, 200);

View File

@@ -1,9 +1,9 @@
<!-- eslint-disable vue/no-v-html --> <!-- eslint-disable vue/no-v-html -->
<template> <template>
<div v-if="loading" class="loading"> <div v-if="loading" class="loading">
<TLoading :title="loadingTitle" :empty="loadingEmpty" /> <TLoading :title="loadingTitle" :empty="loadingEmpty" />
</div> </div>
<div v-else class="anno-body"> <div v-else class="anno-body">
<div class="anno-title"> <div class="anno-title">
{{ annoData.title }} {{ annoData.title }}
</div> </div>
@@ -12,7 +12,7 @@
</div> </div>
<img :src="annoData.banner" alt="cover" class="anno-img"> <img :src="annoData.banner" alt="cover" class="anno-img">
<div class="anno-content" v-html="annoHtml" /> <div class="anno-content" v-html="annoHtml" />
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// vue // vue
@@ -32,14 +32,14 @@ const loadingTitle = ref("正在加载");
const loadingEmpty = ref(false as boolean); const loadingEmpty = ref(false as boolean);
// 数据 // 数据
const anno_id = Number(useRoute().params.anno_id); const annoId = Number(useRoute().params.anno_id);
const annoData = ref({} as AnnoContentItem); const annoData = ref({} as AnnoContentItem);
const annoHtml = ref(""); const annoHtml = ref("");
onMounted(async () => { onMounted(async () => {
await appWindow.show(); await appWindow.show();
// 检查数据 // 检查数据
if (!anno_id) { if (!annoId) {
loadingEmpty.value = true; loadingEmpty.value = true;
loadingTitle.value = "未找到数据"; loadingTitle.value = "未找到数据";
return; return;
@@ -47,7 +47,7 @@ onMounted(async () => {
// 获取数据 // 获取数据
loadingTitle.value = "正在获取数据..."; loadingTitle.value = "正在获取数据...";
try { try {
annoData.value = await GenshinOper.Announcement.getContent(anno_id); annoData.value = await GenshinOper.Announcement.getContent(annoId);
loadingTitle.value = "正在渲染数据..."; loadingTitle.value = "正在渲染数据...";
annoHtml.value = GenshinOper.Announcement.parser(annoData.value.content); annoHtml.value = GenshinOper.Announcement.parser(annoData.value.content);
} catch (error) { } catch (error) {

View File

@@ -1,8 +1,8 @@
<template> <template>
<div v-if="loading"> <div v-if="loading">
<TLoading :empty="loadingEmpty" :title="loadingTitle" /> <TLoading :empty="loadingEmpty" :title="loadingTitle" />
</div> </div>
<div v-else> <div v-else>
<div class="lottery-div"> <div class="lottery-div">
<div class="lottery-title"> <div class="lottery-title">
抽奖详情 {{ timeStatus }} 抽奖详情 {{ timeStatus }}
@@ -63,7 +63,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// vue // vue
@@ -89,7 +89,7 @@ const loadingEmpty = ref(false as boolean);
const appStore = useAppStore(); const appStore = useAppStore();
// 数据 // 数据
const lottery_id = useRoute().params.lottery_id as string; const lotteryId = useRoute().params.lottery_id as string;
const lotteryCard = ref({} as LotteryCard); const lotteryCard = ref({} as LotteryCard);
const showJson = ref(false as boolean); const showJson = ref(false as boolean);
let jsonData = reactive({} as LotteryData); let jsonData = reactive({} as LotteryData);
@@ -102,14 +102,14 @@ function backPost () {
onMounted(async () => { onMounted(async () => {
await appWindow.show(); await appWindow.show();
// 检查数据 // 检查数据
if (!lottery_id) { if (!lotteryId) {
loadingEmpty.value = true; loadingEmpty.value = true;
loadingTitle.value = "未找到数据"; loadingTitle.value = "未找到数据";
return; return;
} }
// 获取数据 // 获取数据
loadingTitle.value = "正在获取数据..."; loadingTitle.value = "正在获取数据...";
jsonData = await MysOper.Lottery.get(lottery_id); jsonData = await MysOper.Lottery.get(lotteryId);
if (!jsonData) { if (!jsonData) {
loadingEmpty.value = true; loadingEmpty.value = true;
loadingTitle.value = "未找到数据"; loadingTitle.value = "未找到数据";

View File

@@ -1,8 +1,8 @@
<template> <template>
<div v-if="loading"> <div v-if="loading">
<TLoading :title="loadingTitle" /> <TLoading :title="loadingTitle" />
</div> </div>
<div v-else> <div v-else>
<v-tabs v-model="tab" align-tabs="start" class="news-tabs"> <v-tabs v-model="tab" align-tabs="start" class="news-tabs">
<v-tab value="notice" title="公告" /> <v-tab value="notice" title="公告" />
<v-tab value="activity" title="活动" /> <v-tab value="activity" title="活动" />
@@ -54,7 +54,7 @@
<template #append> <template #append>
<img src="../assets/icons/arrow-left.svg" alt="right"> <img src="../assets/icons/arrow-left.svg" alt="right">
</template> </template>
已加载{{ rawData.notice.last_id }}加载更多 已加载{{ rawData.notice.lastId }}加载更多
</v-btn> </v-btn>
</div> </div>
</v-window-item> </v-window-item>
@@ -97,7 +97,7 @@
<template #append> <template #append>
<img src="../assets/icons/arrow-left.svg" alt="right"> <img src="../assets/icons/arrow-left.svg" alt="right">
</template> </template>
已加载:{{ rawData.activity.last_id }}加载更多 已加载:{{ rawData.activity.lastId }}加载更多
</v-btn> </v-btn>
</div> </div>
</v-window-item> </v-window-item>
@@ -129,7 +129,7 @@
<template #append> <template #append>
<img src="../assets/icons/arrow-left.svg" alt="right"> <img src="../assets/icons/arrow-left.svg" alt="right">
</template> </template>
已加载{{ rawData.news.last_id }}加载更多 已加载{{ rawData.news.lastId }}加载更多
</v-btn> </v-btn>
</div> </div>
</v-window-item> </v-window-item>
@@ -137,7 +137,7 @@
<v-snackbar v-model="snackbar" timeout="1500" :color="snackbarColor"> <v-snackbar v-model="snackbar" timeout="1500" :color="snackbarColor">
{{ snackbarText }} {{ snackbarText }}
</v-snackbar> </v-snackbar>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@@ -152,7 +152,7 @@ import MysOper from "../plugins/Mys";
// utils // utils
import { createTGWindow } from "../utils/TGWindow"; import { createTGWindow } from "../utils/TGWindow";
// interface // interface
import { NewsCard } from "../plugins/Mys/interface/news"; import { NewsCard, NewsData } from "../plugins/Mys/interface/news";
// 路由 // 路由
const router = useRouter(); const router = useRouter();
@@ -184,33 +184,33 @@ const postData = ref({
}); });
const rawData = ref({ const rawData = ref({
notice: { notice: {
is_last: false, isLast: false,
last_id: 0, lastId: 0,
}, },
activity: { activity: {
is_last: false, isLast: false,
last_id: 0, lastId: 0,
}, },
news: { news: {
is_last: false, isLast: false,
last_id: 0, lastId: 0,
}, },
}); });
onMounted(async () => { onMounted(async () => {
loadingTitle.value = "正在获取公告数据..."; loadingTitle.value = "正在获取公告数据...";
const noticeData = await MysOper.News.get.notice(gid); const noticeData = await MysOper.News.get.notice(gid);
rawData.value.notice.is_last = noticeData.is_last; rawData.value.notice.isLast = noticeData.is_last;
rawData.value.notice.last_id = noticeData.list.length; rawData.value.notice.lastId = noticeData.list.length;
loadingTitle.value = "正在获取活动数据..."; loadingTitle.value = "正在获取活动数据...";
const activityData = await MysOper.News.get.activity(gid); const activityData = await MysOper.News.get.activity(gid);
rawData.value.activity.is_last = activityData.is_last; rawData.value.activity.isLast = activityData.is_last;
rawData.value.activity.last_id = activityData.list.length; rawData.value.activity.lastId = activityData.list.length;
if (showNews.value) { if (showNews.value) {
loadingTitle.value = "正在获取新闻数据..."; loadingTitle.value = "正在获取新闻数据...";
const newsData = await MysOper.News.get.news(gid); const newsData = await MysOper.News.get.news(gid);
rawData.value.news.is_last = newsData.is_last; rawData.value.news.isLast = newsData.is_last;
rawData.value.news.last_id = newsData.list.length; rawData.value.news.lastId = newsData.list.length;
postData.value = { postData.value = {
notice: MysOper.News.card.notice(noticeData), notice: MysOper.News.card.notice(noticeData),
activity: MysOper.News.card.activity(activityData), activity: MysOper.News.card.activity(activityData),
@@ -234,50 +234,52 @@ async function switchAnno () {
// 加载更多 // 加载更多
async function loadMore (data: string) { async function loadMore (data: string) {
loadingSub.value = true; loadingSub.value = true;
let getData: NewsData;
let getCard: NewsCard[];
switch (data) { switch (data) {
case "notice": case "notice":
if (rawData.value.notice.is_last) { if (rawData.value.notice.isLast) {
snackbarText.value = "已经是最后一页了"; snackbarText.value = "已经是最后一页了";
snackbarColor.value = "#35acce"; snackbarColor.value = "#35acce";
snackbar.value = true; snackbar.value = true;
loadingSub.value = false; loadingSub.value = false;
return; return;
} }
const getNotice = await MysOper.News.get.notice(gid, 20, rawData.value.notice.last_id); getData = await MysOper.News.get.notice(gid, 20, rawData.value.notice.lastId);
rawData.value.notice.last_id = rawData.value.notice.last_id + getNotice.list.length; rawData.value.notice.lastId = rawData.value.notice.lastId + getData.list.length;
rawData.value.notice.is_last = getNotice.is_last; rawData.value.notice.isLast = getData.is_last;
const noticeCard = MysOper.News.card.notice(getNotice); getCard = MysOper.News.card.notice(getData);
postData.value.notice = postData.value.notice.concat(noticeCard); postData.value.notice = postData.value.notice.concat(getCard);
loadingSub.value = false; loadingSub.value = false;
break; break;
case "activity": case "activity":
if (rawData.value.activity.is_last) { if (rawData.value.activity.isLast) {
snackbarText.value = "已经是最后一页了"; snackbarText.value = "已经是最后一页了";
snackbarColor.value = "#35acce"; snackbarColor.value = "#35acce";
snackbar.value = true; snackbar.value = true;
loadingSub.value = false; loadingSub.value = false;
return; return;
} }
const getActivity = await MysOper.News.get.activity(gid, 20, rawData.value.activity.last_id); getData = await MysOper.News.get.activity(gid, 20, rawData.value.activity.lastId);
rawData.value.activity.last_id = rawData.value.activity.last_id + getActivity.list.length; rawData.value.activity.lastId = rawData.value.activity.lastId + getData.list.length;
rawData.value.activity.is_last = getActivity.is_last; rawData.value.activity.isLast = getData.is_last;
const activityCard = MysOper.News.card.activity(getActivity); getCard = MysOper.News.card.activity(getData);
postData.value.activity = postData.value.activity.concat(activityCard); postData.value.activity = postData.value.activity.concat(getCard);
loadingSub.value = false; loadingSub.value = false;
break; break;
case "news": case "news":
if (rawData.value.news.is_last) { if (rawData.value.news.isLast) {
snackbarText.value = "已经是最后一页了"; snackbarText.value = "已经是最后一页了";
snackbarColor.value = "#35acce"; snackbarColor.value = "#35acce";
snackbar.value = true; snackbar.value = true;
loadingSub.value = false; loadingSub.value = false;
return; return;
} }
const getNews = await MysOper.News.get.news(gid, 20, rawData.value.news.last_id); getData = await MysOper.News.get.news(gid, 20, rawData.value.news.lastId);
rawData.value.news.last_id = rawData.value.news.last_id + getNews.list.length; rawData.value.news.lastId = rawData.value.news.lastId + getData.list.length;
rawData.value.news.is_last = getNews.is_last; rawData.value.news.isLast = getData.is_last;
const newsCard = MysOper.News.card.news(getNews); getCard = MysOper.News.card.news(getData);
postData.value.news = postData.value.news.concat(newsCard); postData.value.news = postData.value.news.concat(getCard);
loadingSub.value = false; loadingSub.value = false;
break; break;
default: default:
@@ -290,6 +292,7 @@ async function toPost (item: NewsCard | string) {
const path = router.resolve({ const path = router.resolve({
name: "帖子详情", name: "帖子详情",
params: { params: {
// eslint-disable-next-line camelcase
post_id: item, post_id: item,
}, },
}).href; }).href;
@@ -298,6 +301,7 @@ async function toPost (item: NewsCard | string) {
const path = router.resolve({ const path = router.resolve({
name: "帖子详情", name: "帖子详情",
params: { params: {
// eslint-disable-next-line camelcase
post_id: item.post_id.toString(), post_id: item.post_id.toString(),
}, },
}).href; }).href;
@@ -309,6 +313,7 @@ async function toJson (item: NewsCard | string) {
const path = router.resolve({ const path = router.resolve({
name: "帖子详情JSON", name: "帖子详情JSON",
params: { params: {
// eslint-disable-next-line camelcase
post_id: item, post_id: item,
}, },
}).href; }).href;
@@ -317,6 +322,7 @@ async function toJson (item: NewsCard | string) {
const path = router.resolve({ const path = router.resolve({
name: "帖子详情JSON", name: "帖子详情JSON",
params: { params: {
// eslint-disable-next-line camelcase
post_id: item.post_id.toString(), post_id: item.post_id.toString(),
}, },
}).href; }).href;

View File

@@ -1,10 +1,10 @@
<template> <template>
<div v-if="loading"> <div v-if="loading">
<TLoading :empty="loadingEmpty" :title="loadingTitle" /> <TLoading :empty="loadingEmpty" :title="loadingTitle" />
</div> </div>
<div v-else class="dev-json"> <div v-else class="dev-json">
<JsonViewer :value="jsonData" copyable boxed /> <JsonViewer :value="jsonData" copyable boxed />
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// vue // vue
@@ -23,20 +23,20 @@ const loadingTitle = ref("正在加载");
const loadingEmpty = ref(false as boolean); const loadingEmpty = ref(false as boolean);
// 数据 // 数据
const post_id = Number(useRoute().params.post_id); const postId = Number(useRoute().params.post_id);
let jsonData = reactive({}); let jsonData = reactive({});
onMounted(async () => { onMounted(async () => {
await appWindow.show(); await appWindow.show();
// 检查数据 // 检查数据
if (!post_id) { if (!postId) {
loadingEmpty.value = true; loadingEmpty.value = true;
loadingTitle.value = "未找到数据"; loadingTitle.value = "未找到数据";
return; return;
} }
// 获取数据 // 获取数据
loadingTitle.value = "正在获取数据..."; loadingTitle.value = "正在获取数据...";
jsonData = await MysOper.Post.get(post_id); jsonData = await MysOper.Post.get(postId);
setTimeout(() => { setTimeout(() => {
loading.value = false; loading.value = false;
}, 200); }, 200);

View File

@@ -1,9 +1,9 @@
<!-- eslint-disable vue/no-v-html --> <!-- eslint-disable vue/no-v-html -->
<template> <template>
<div v-if="loading"> <div v-if="loading">
<TLoading :empty="loadingEmpty" :title="loadingTitle" /> <TLoading :empty="loadingEmpty" :title="loadingTitle" />
</div> </div>
<div v-else class="mys-post-body" v-html="postHtml" /> <div v-else class="mys-post-body" v-html="postHtml" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// vue // vue
@@ -21,13 +21,13 @@ const loadingTitle = ref("正在加载");
const loadingEmpty = ref(false as boolean); const loadingEmpty = ref(false as boolean);
// 数据 // 数据
const post_id = Number(useRoute().params.post_id); const postId = Number(useRoute().params.post_id);
const postHtml = ref(""); const postHtml = ref("");
onMounted(async () => { onMounted(async () => {
await appWindow.show(); await appWindow.show();
// 检查数据 // 检查数据
if (!post_id) { if (!postId) {
loadingEmpty.value = true; loadingEmpty.value = true;
loadingTitle.value = "未找到数据"; loadingTitle.value = "未找到数据";
await appWindow.setTitle("未找到数据"); await appWindow.setTitle("未找到数据");
@@ -36,7 +36,7 @@ onMounted(async () => {
// 获取数据 // 获取数据
loadingTitle.value = "正在获取数据..."; loadingTitle.value = "正在获取数据...";
try { try {
const postData = await MysOper.Post.get(post_id); const postData = await MysOper.Post.get(postId);
loadingTitle.value = "正在渲染数据..."; loadingTitle.value = "正在渲染数据...";
postHtml.value = MysOper.Post.parser(postData); postHtml.value = MysOper.Post.parser(postData);
await appWindow.setTitle(postData.post.subject); await appWindow.setTitle(postData.post.subject);