mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
🌈 style(eslint): 第三次格式化
camecase 回头在部分文件 ignore 掉,不然不兼容之前的版本及外部接口 (cherry picked from commit 740b4698e916ce0f7911f5eac934183a94288e61)
This commit is contained in:
@@ -43,7 +43,7 @@ const isMain = ref(true as boolean);
|
||||
|
||||
onMounted(async () => {
|
||||
// 获取当前窗口
|
||||
const win = await window.getCurrent();
|
||||
const win = window.getCurrent();
|
||||
isMain.value = win.label === "tauri-genshin";
|
||||
if (isMain.value) {
|
||||
const title = "Tauri.Genshin v" + (await app.getVersion()) + " Alpha";
|
||||
|
||||
@@ -22,12 +22,24 @@
|
||||
<div v-if="!loading" class="calendar-grid">
|
||||
<v-card title="天赋培养" class="calendar-single">
|
||||
<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>
|
||||
<v-card title="武器突破" class="calendar-single">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
@@ -29,16 +29,13 @@ interface LoadingProps {
|
||||
position?: string;
|
||||
}
|
||||
|
||||
withDefaults(
|
||||
defineProps<LoadingProps>(),
|
||||
{
|
||||
withDefaults(defineProps<LoadingProps>(), {
|
||||
title: "加载中",
|
||||
subtitle: "",
|
||||
content: "",
|
||||
empty: false,
|
||||
position: "absolute",
|
||||
},
|
||||
);
|
||||
});
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
.loading-div {
|
||||
|
||||
@@ -6,7 +6,11 @@
|
||||
限时祈愿
|
||||
</v-list-item-title>
|
||||
<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-item :title="pool.title" :subtitle="pool.subtitle">
|
||||
<template #prepend>
|
||||
@@ -120,14 +124,14 @@ function checkCover (data: GachaData[]) {
|
||||
return false;
|
||||
}
|
||||
return data.every((item) => {
|
||||
const post_id = item.activity_url.split("/").pop();
|
||||
if (!post_id || isNaN(Number(post_id))) {
|
||||
const postId = item.activity_url.split("/").pop();
|
||||
if (!postId || isNaN(Number(postId))) {
|
||||
return false;
|
||||
}
|
||||
if (!Object.keys(cover).includes(post_id)) {
|
||||
if (!Object.keys(cover).includes(postId)) {
|
||||
return false;
|
||||
} 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";
|
||||
}
|
||||
});
|
||||
@@ -148,6 +152,7 @@ function toPost (pool: GachaCard) {
|
||||
const path = router.resolve({
|
||||
name: "帖子详情",
|
||||
params: {
|
||||
// eslint-disable-next-line camelcase
|
||||
post_id: pool.post_id.toString(),
|
||||
},
|
||||
}).href;
|
||||
|
||||
@@ -6,7 +6,11 @@
|
||||
近期活动
|
||||
</v-list-item-title>
|
||||
<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-item :title="card.title" :subtitle="card.abstract">
|
||||
<template #prepend>
|
||||
@@ -105,12 +109,12 @@ function getLastPositionTime (time: number) {
|
||||
}
|
||||
|
||||
async function toPost (card: PositionCard) {
|
||||
const post_id = card.post_id;
|
||||
// 获取路由路径
|
||||
const path = router.resolve({
|
||||
name: "帖子详情",
|
||||
params: {
|
||||
post_id,
|
||||
// eslint-disable-next-line camelcase
|
||||
post_id: card.post_id,
|
||||
},
|
||||
}).href;
|
||||
// 打开新窗口
|
||||
|
||||
@@ -271,7 +271,7 @@ async function importJson () {
|
||||
const localTime = localData.completed_time;
|
||||
// 如果本地数据不存在,或者本地数据的 timeStamp 小于远程数据的 timeStamp,更新数据
|
||||
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",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
@@ -279,8 +279,9 @@ async function importJson () {
|
||||
minute: "2-digit",
|
||||
second: "2-digit",
|
||||
});
|
||||
if (fin_time !== localTime || localData.progress !== data.current) {
|
||||
localData.completed_time = fin_time;
|
||||
if (finishTime !== localTime || localData.progress !== data.current) {
|
||||
// eslint-disable-next-line camelcase
|
||||
localData.completed_time = finishTime;
|
||||
localData.progress = data.current;
|
||||
localData.completed = true;
|
||||
// 更新数据
|
||||
@@ -288,6 +289,7 @@ async function importJson () {
|
||||
}
|
||||
} else {
|
||||
if (localData.progress !== data.current) {
|
||||
// eslint-disable-next-line camelcase
|
||||
localData.completed_time = "";
|
||||
localData.progress = data.current;
|
||||
localData.completed = false;
|
||||
@@ -303,6 +305,7 @@ async function importJson () {
|
||||
seriesDB.map(async (data) => {
|
||||
const seriesId = data.id;
|
||||
const achievementsDB = await ReadTGDataByIndex("Achievements", "series", seriesId);
|
||||
// eslint-disable-next-line camelcase
|
||||
data.completed_count = achievementsDB.filter((data) => {
|
||||
return data.completed === true;
|
||||
}).length;
|
||||
@@ -311,13 +314,13 @@ async function importJson () {
|
||||
);
|
||||
loadingTitle.value = "正在刷新数据";
|
||||
seriesDB = await ReadAllTGData("AchievementSeries");
|
||||
const fin_achievements = seriesDB.reduce((a, b) => {
|
||||
const finishAchievments = seriesDB.reduce((a, b) => {
|
||||
return a + b.completed_count;
|
||||
}, 0);
|
||||
const total_achievements = seriesDB.reduce((a, b) => {
|
||||
const totalAchievements = seriesDB.reduce((a, b) => {
|
||||
return a + b.total_count;
|
||||
}, 0);
|
||||
achievementsStore.flushData(total_achievements, fin_achievements);
|
||||
achievementsStore.flushData(totalAchievements, finishAchievments);
|
||||
// 刷新数据
|
||||
await loadData();
|
||||
}
|
||||
@@ -361,7 +364,7 @@ async function exportJson () {
|
||||
};
|
||||
});
|
||||
UIAF_DATA.info = await UiafOper.getUiafInfo();
|
||||
const is_save = await dialog.save({
|
||||
const isSave = await dialog.save({
|
||||
filters: [
|
||||
{
|
||||
name: "achievements",
|
||||
@@ -369,8 +372,8 @@ async function exportJson () {
|
||||
},
|
||||
],
|
||||
});
|
||||
if (is_save) {
|
||||
await fs.writeTextFile(is_save, JSON.stringify(UIAF_DATA));
|
||||
if (isSave) {
|
||||
await fs.writeTextFile(isSave, JSON.stringify(UIAF_DATA));
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -140,6 +140,7 @@ async function toPost (item: AnnoListCard) {
|
||||
const path = router.resolve({
|
||||
name: "游戏内公告",
|
||||
params: {
|
||||
// eslint-disable-next-line camelcase
|
||||
anno_id: item.id,
|
||||
},
|
||||
}).href;
|
||||
@@ -150,6 +151,7 @@ async function toJson (item: AnnoListCard) {
|
||||
const path = router.resolve({
|
||||
name: "游戏内公告(JSON)",
|
||||
params: {
|
||||
// eslint-disable-next-line camelcase
|
||||
anno_id: item.id,
|
||||
},
|
||||
}).href;
|
||||
|
||||
@@ -125,9 +125,9 @@ async function loadData () {
|
||||
CardsInfoM.value = CardsInfo.filter((item) => item.type === "魔物牌") as MonsterCard[];
|
||||
loading.value = false;
|
||||
}
|
||||
function toOuter (card_name: string, card_id: number) {
|
||||
const url = OBC_CONTENT_API.replace("{content_id}", card_id.toString());
|
||||
createTGWindow(url, "GCG", card_name, 1200, 800, true);
|
||||
function toOuter (cardName: string, cardId: number) {
|
||||
const url = OBC_CONTENT_API.replace("{content_id}", cardId.toString());
|
||||
createTGWindow(url, "GCG", cardName, 1200, 800, true);
|
||||
}
|
||||
async function searchCard () {
|
||||
loading.value = true;
|
||||
|
||||
@@ -53,11 +53,7 @@ export async function getNoticeList (gid: string = "2", pageSize: number = 20, l
|
||||
* @param {number} lastId 上一次请求的最后一条数据的 id
|
||||
* @return {Promise<NewsData>}
|
||||
*/
|
||||
export async function getActivityList (
|
||||
gid: string = "2",
|
||||
pageSize: number = 20,
|
||||
lastId: number = 0,
|
||||
): Promise<NewsData> {
|
||||
export async function getActivityList (gid: string = "2", pageSize: number = 20, lastId: number = 0): Promise<NewsData> {
|
||||
const url = NEWS_LIST_API.replace("{page_size}", pageSize.toString())
|
||||
.replace("{gid}", gid)
|
||||
.replace("{news_type}", NewsType.ACTIVITY)
|
||||
|
||||
@@ -32,14 +32,14 @@ const loadingTitle = ref("正在加载");
|
||||
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 jsonContent = reactive({});
|
||||
|
||||
onMounted(async () => {
|
||||
await appWindow.show();
|
||||
// 检查数据
|
||||
if (!anno_id) {
|
||||
if (!annoId) {
|
||||
loadingEmpty.value = true;
|
||||
loadingTitle.value = "未找到数据";
|
||||
return;
|
||||
@@ -49,10 +49,10 @@ onMounted(async () => {
|
||||
const listData = await GenshinOper.Announcement.getList();
|
||||
listData.list.map((item: Announcement) => {
|
||||
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(() => {
|
||||
loading.value = false;
|
||||
}, 200);
|
||||
|
||||
@@ -32,14 +32,14 @@ const loadingTitle = ref("正在加载");
|
||||
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 annoHtml = ref("");
|
||||
|
||||
onMounted(async () => {
|
||||
await appWindow.show();
|
||||
// 检查数据
|
||||
if (!anno_id) {
|
||||
if (!annoId) {
|
||||
loadingEmpty.value = true;
|
||||
loadingTitle.value = "未找到数据";
|
||||
return;
|
||||
@@ -47,7 +47,7 @@ onMounted(async () => {
|
||||
// 获取数据
|
||||
loadingTitle.value = "正在获取数据...";
|
||||
try {
|
||||
annoData.value = await GenshinOper.Announcement.getContent(anno_id);
|
||||
annoData.value = await GenshinOper.Announcement.getContent(annoId);
|
||||
loadingTitle.value = "正在渲染数据...";
|
||||
annoHtml.value = GenshinOper.Announcement.parser(annoData.value.content);
|
||||
} catch (error) {
|
||||
|
||||
@@ -89,7 +89,7 @@ const loadingEmpty = ref(false as boolean);
|
||||
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 showJson = ref(false as boolean);
|
||||
let jsonData = reactive({} as LotteryData);
|
||||
@@ -102,14 +102,14 @@ function backPost () {
|
||||
onMounted(async () => {
|
||||
await appWindow.show();
|
||||
// 检查数据
|
||||
if (!lottery_id) {
|
||||
if (!lotteryId) {
|
||||
loadingEmpty.value = true;
|
||||
loadingTitle.value = "未找到数据";
|
||||
return;
|
||||
}
|
||||
// 获取数据
|
||||
loadingTitle.value = "正在获取数据...";
|
||||
jsonData = await MysOper.Lottery.get(lottery_id);
|
||||
jsonData = await MysOper.Lottery.get(lotteryId);
|
||||
if (!jsonData) {
|
||||
loadingEmpty.value = true;
|
||||
loadingTitle.value = "未找到数据";
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<template #append>
|
||||
<img src="../assets/icons/arrow-left.svg" alt="right">
|
||||
</template>
|
||||
已加载:{{ rawData.notice.last_id }},加载更多
|
||||
已加载:{{ rawData.notice.lastId }},加载更多
|
||||
</v-btn>
|
||||
</div>
|
||||
</v-window-item>
|
||||
@@ -97,7 +97,7 @@
|
||||
<template #append>
|
||||
<img src="../assets/icons/arrow-left.svg" alt="right">
|
||||
</template>
|
||||
已加载:{{ rawData.activity.last_id }},加载更多
|
||||
已加载:{{ rawData.activity.lastId }},加载更多
|
||||
</v-btn>
|
||||
</div>
|
||||
</v-window-item>
|
||||
@@ -129,7 +129,7 @@
|
||||
<template #append>
|
||||
<img src="../assets/icons/arrow-left.svg" alt="right">
|
||||
</template>
|
||||
已加载:{{ rawData.news.last_id }},加载更多
|
||||
已加载:{{ rawData.news.lastId }},加载更多
|
||||
</v-btn>
|
||||
</div>
|
||||
</v-window-item>
|
||||
@@ -152,7 +152,7 @@ import MysOper from "../plugins/Mys";
|
||||
// utils
|
||||
import { createTGWindow } from "../utils/TGWindow";
|
||||
// interface
|
||||
import { NewsCard } from "../plugins/Mys/interface/news";
|
||||
import { NewsCard, NewsData } from "../plugins/Mys/interface/news";
|
||||
|
||||
// 路由
|
||||
const router = useRouter();
|
||||
@@ -184,33 +184,33 @@ const postData = ref({
|
||||
});
|
||||
const rawData = ref({
|
||||
notice: {
|
||||
is_last: false,
|
||||
last_id: 0,
|
||||
isLast: false,
|
||||
lastId: 0,
|
||||
},
|
||||
activity: {
|
||||
is_last: false,
|
||||
last_id: 0,
|
||||
isLast: false,
|
||||
lastId: 0,
|
||||
},
|
||||
news: {
|
||||
is_last: false,
|
||||
last_id: 0,
|
||||
isLast: false,
|
||||
lastId: 0,
|
||||
},
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
loadingTitle.value = "正在获取公告数据...";
|
||||
const noticeData = await MysOper.News.get.notice(gid);
|
||||
rawData.value.notice.is_last = noticeData.is_last;
|
||||
rawData.value.notice.last_id = noticeData.list.length;
|
||||
rawData.value.notice.isLast = noticeData.is_last;
|
||||
rawData.value.notice.lastId = noticeData.list.length;
|
||||
loadingTitle.value = "正在获取活动数据...";
|
||||
const activityData = await MysOper.News.get.activity(gid);
|
||||
rawData.value.activity.is_last = activityData.is_last;
|
||||
rawData.value.activity.last_id = activityData.list.length;
|
||||
rawData.value.activity.isLast = activityData.is_last;
|
||||
rawData.value.activity.lastId = activityData.list.length;
|
||||
if (showNews.value) {
|
||||
loadingTitle.value = "正在获取新闻数据...";
|
||||
const newsData = await MysOper.News.get.news(gid);
|
||||
rawData.value.news.is_last = newsData.is_last;
|
||||
rawData.value.news.last_id = newsData.list.length;
|
||||
rawData.value.news.isLast = newsData.is_last;
|
||||
rawData.value.news.lastId = newsData.list.length;
|
||||
postData.value = {
|
||||
notice: MysOper.News.card.notice(noticeData),
|
||||
activity: MysOper.News.card.activity(activityData),
|
||||
@@ -234,50 +234,52 @@ async function switchAnno () {
|
||||
// 加载更多
|
||||
async function loadMore (data: string) {
|
||||
loadingSub.value = true;
|
||||
let getData: NewsData;
|
||||
let getCard: NewsCard[];
|
||||
switch (data) {
|
||||
case "notice":
|
||||
if (rawData.value.notice.is_last) {
|
||||
if (rawData.value.notice.isLast) {
|
||||
snackbarText.value = "已经是最后一页了";
|
||||
snackbarColor.value = "#35acce";
|
||||
snackbar.value = true;
|
||||
loadingSub.value = false;
|
||||
return;
|
||||
}
|
||||
const getNotice = await MysOper.News.get.notice(gid, 20, rawData.value.notice.last_id);
|
||||
rawData.value.notice.last_id = rawData.value.notice.last_id + getNotice.list.length;
|
||||
rawData.value.notice.is_last = getNotice.is_last;
|
||||
const noticeCard = MysOper.News.card.notice(getNotice);
|
||||
postData.value.notice = postData.value.notice.concat(noticeCard);
|
||||
getData = await MysOper.News.get.notice(gid, 20, rawData.value.notice.lastId);
|
||||
rawData.value.notice.lastId = rawData.value.notice.lastId + getData.list.length;
|
||||
rawData.value.notice.isLast = getData.is_last;
|
||||
getCard = MysOper.News.card.notice(getData);
|
||||
postData.value.notice = postData.value.notice.concat(getCard);
|
||||
loadingSub.value = false;
|
||||
break;
|
||||
case "activity":
|
||||
if (rawData.value.activity.is_last) {
|
||||
if (rawData.value.activity.isLast) {
|
||||
snackbarText.value = "已经是最后一页了";
|
||||
snackbarColor.value = "#35acce";
|
||||
snackbar.value = true;
|
||||
loadingSub.value = false;
|
||||
return;
|
||||
}
|
||||
const getActivity = await MysOper.News.get.activity(gid, 20, rawData.value.activity.last_id);
|
||||
rawData.value.activity.last_id = rawData.value.activity.last_id + getActivity.list.length;
|
||||
rawData.value.activity.is_last = getActivity.is_last;
|
||||
const activityCard = MysOper.News.card.activity(getActivity);
|
||||
postData.value.activity = postData.value.activity.concat(activityCard);
|
||||
getData = await MysOper.News.get.activity(gid, 20, rawData.value.activity.lastId);
|
||||
rawData.value.activity.lastId = rawData.value.activity.lastId + getData.list.length;
|
||||
rawData.value.activity.isLast = getData.is_last;
|
||||
getCard = MysOper.News.card.activity(getData);
|
||||
postData.value.activity = postData.value.activity.concat(getCard);
|
||||
loadingSub.value = false;
|
||||
break;
|
||||
case "news":
|
||||
if (rawData.value.news.is_last) {
|
||||
if (rawData.value.news.isLast) {
|
||||
snackbarText.value = "已经是最后一页了";
|
||||
snackbarColor.value = "#35acce";
|
||||
snackbar.value = true;
|
||||
loadingSub.value = false;
|
||||
return;
|
||||
}
|
||||
const getNews = await MysOper.News.get.news(gid, 20, rawData.value.news.last_id);
|
||||
rawData.value.news.last_id = rawData.value.news.last_id + getNews.list.length;
|
||||
rawData.value.news.is_last = getNews.is_last;
|
||||
const newsCard = MysOper.News.card.news(getNews);
|
||||
postData.value.news = postData.value.news.concat(newsCard);
|
||||
getData = await MysOper.News.get.news(gid, 20, rawData.value.news.lastId);
|
||||
rawData.value.news.lastId = rawData.value.news.lastId + getData.list.length;
|
||||
rawData.value.news.isLast = getData.is_last;
|
||||
getCard = MysOper.News.card.news(getData);
|
||||
postData.value.news = postData.value.news.concat(getCard);
|
||||
loadingSub.value = false;
|
||||
break;
|
||||
default:
|
||||
@@ -290,6 +292,7 @@ async function toPost (item: NewsCard | string) {
|
||||
const path = router.resolve({
|
||||
name: "帖子详情",
|
||||
params: {
|
||||
// eslint-disable-next-line camelcase
|
||||
post_id: item,
|
||||
},
|
||||
}).href;
|
||||
@@ -298,6 +301,7 @@ async function toPost (item: NewsCard | string) {
|
||||
const path = router.resolve({
|
||||
name: "帖子详情",
|
||||
params: {
|
||||
// eslint-disable-next-line camelcase
|
||||
post_id: item.post_id.toString(),
|
||||
},
|
||||
}).href;
|
||||
@@ -309,6 +313,7 @@ async function toJson (item: NewsCard | string) {
|
||||
const path = router.resolve({
|
||||
name: "帖子详情(JSON)",
|
||||
params: {
|
||||
// eslint-disable-next-line camelcase
|
||||
post_id: item,
|
||||
},
|
||||
}).href;
|
||||
@@ -317,6 +322,7 @@ async function toJson (item: NewsCard | string) {
|
||||
const path = router.resolve({
|
||||
name: "帖子详情(JSON)",
|
||||
params: {
|
||||
// eslint-disable-next-line camelcase
|
||||
post_id: item.post_id.toString(),
|
||||
},
|
||||
}).href;
|
||||
|
||||
@@ -23,20 +23,20 @@ const loadingTitle = ref("正在加载");
|
||||
const loadingEmpty = ref(false as boolean);
|
||||
|
||||
// 数据
|
||||
const post_id = Number(useRoute().params.post_id);
|
||||
const postId = Number(useRoute().params.post_id);
|
||||
let jsonData = reactive({});
|
||||
|
||||
onMounted(async () => {
|
||||
await appWindow.show();
|
||||
// 检查数据
|
||||
if (!post_id) {
|
||||
if (!postId) {
|
||||
loadingEmpty.value = true;
|
||||
loadingTitle.value = "未找到数据";
|
||||
return;
|
||||
}
|
||||
// 获取数据
|
||||
loadingTitle.value = "正在获取数据...";
|
||||
jsonData = await MysOper.Post.get(post_id);
|
||||
jsonData = await MysOper.Post.get(postId);
|
||||
setTimeout(() => {
|
||||
loading.value = false;
|
||||
}, 200);
|
||||
|
||||
@@ -21,13 +21,13 @@ const loadingTitle = ref("正在加载");
|
||||
const loadingEmpty = ref(false as boolean);
|
||||
|
||||
// 数据
|
||||
const post_id = Number(useRoute().params.post_id);
|
||||
const postId = Number(useRoute().params.post_id);
|
||||
const postHtml = ref("");
|
||||
|
||||
onMounted(async () => {
|
||||
await appWindow.show();
|
||||
// 检查数据
|
||||
if (!post_id) {
|
||||
if (!postId) {
|
||||
loadingEmpty.value = true;
|
||||
loadingTitle.value = "未找到数据";
|
||||
await appWindow.setTitle("未找到数据");
|
||||
@@ -36,7 +36,7 @@ onMounted(async () => {
|
||||
// 获取数据
|
||||
loadingTitle.value = "正在获取数据...";
|
||||
try {
|
||||
const postData = await MysOper.Post.get(post_id);
|
||||
const postData = await MysOper.Post.get(postId);
|
||||
loadingTitle.value = "正在渲染数据...";
|
||||
postHtml.value = MysOper.Post.parser(postData);
|
||||
await appWindow.setTitle(postData.post.subject);
|
||||
|
||||
Reference in New Issue
Block a user