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 () => {
|
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";
|
||||||
|
|||||||
@@ -22,12 +22,24 @@
|
|||||||
<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>
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -6,7 +6,11 @@
|
|||||||
限时祈愿
|
限时祈愿
|
||||||
</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>
|
||||||
@@ -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;
|
||||||
|
|||||||
@@ -6,7 +6,11 @@
|
|||||||
近期活动
|
近期活动
|
||||||
</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>
|
||||||
@@ -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;
|
||||||
// 打开新窗口
|
// 打开新窗口
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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 = "未找到数据";
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -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;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user