♻️ loading组件重构

This commit is contained in:
目棃
2024-12-16 11:13:30 +08:00
parent 1f167845a4
commit 24e3f11c4a
33 changed files with 482 additions and 428 deletions

View File

@@ -58,7 +58,7 @@ import showSnackbar from "@comp/func/snackbar.js";
import TuaAchiList from "@comp/userAchi/tua-achi-list.vue";
import TuaSeries from "@comp/userAchi/tua-series.vue";
import TSUserAchi from "@Sqlite/modules/userAchi.js";
import { path } from "@tauri-apps/api";
import { path, window } from "@tauri-apps/api";
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
import { open, save } from "@tauri-apps/plugin-dialog";
import { writeTextFile } from "@tauri-apps/plugin-fs";
@@ -92,13 +92,15 @@ const title = computed<string>(() => {
});
onMounted(async () => {
showLoading.start("正在加载成就数据...");
await showLoading.start("正在加载成就数据");
await TGLogger.Info("[Achievements][onMounted] 打开成就页面");
await showLoading.update("正在读取UID列表");
uidList.value = await TSUserAchi.getAllUid();
if (uidList.value.length === 0) uidList.value = [0];
uidCur.value = uidList.value[0];
await showLoading.update("正在获取成就概况");
await refreshOverview();
showLoading.end();
await showLoading.end();
if (route.query.app && typeof route.query.app === "string") {
await handleImportOuter(route.query.app);
}
@@ -131,8 +133,13 @@ async function importJson(): Promise<void> {
await TGLogger.Info("[Achievements][importJson] 已取消文件选择");
return;
}
await showLoading.start("正在导入数据", "正在验证数据");
const check = await verifyUiafData(selectedFile);
if (!check) return;
if (!check) {
await showLoading.end();
return;
}
await showLoading.end();
let uidInput = await showDialog.input("请输入存档UID", "UID:", uidCur.value.toString());
if (uidInput === false) {
showSnackbar.cancel("已取消存档导入");
@@ -143,18 +150,13 @@ async function importJson(): Promise<void> {
showSnackbar.warn("请输入合法数字");
return;
}
showLoading.start("正在导入数据", "正在解析数据");
await showLoading.start("正在导入数据", `存档UID${uidInput}`);
const remoteRaw = await readUiafData(selectedFile);
await TGLogger.Info("[Achievements][importJson] 读取 UIAF 数据成功");
await TGLogger.Info(`[Achievements][importJson] 导入来源:${remoteRaw.info.export_app}`);
await TGLogger.Info(`[Achievements][importJson] 导入版本:${remoteRaw.info.export_app_version}`);
await TGLogger.Info(`[Achievements][importJson] 导入时间:${remoteRaw.info.export_timestamp}`);
await TGLogger.Info(`[Achievements][importJson] 导入数据:${remoteRaw.list.length}`);
await TGLogger.Info(`[Achievements][importJson] 导入存档:${uidInput}`);
showLoading.update("正在导入数据", "正在合并数据");
await TSUserAchi.mergeUiaf(remoteRaw.list, Number(uidInput));
showLoading.end();
setTimeout(() => window.location.reload(), 1000);
await showLoading.end();
showSnackbar.success("导入成功,即将刷新页面");
await new Promise<void>((resolve) => setTimeout(resolve, 1500));
window.location.reload();
}
async function exportJson(): Promise<void> {
@@ -192,10 +194,15 @@ async function handleImportOuter(app: string): Promise<void> {
showSnackbar.cancel("已取消导入");
return;
}
// 读取 剪贴板
await showLoading.start("正在导入数据", "正在读取剪贴板");
const clipboard = await window.navigator.clipboard.readText();
await showLoading.update("正在验证数据");
const check = await verifyUiafDataClipboard();
if (!check) return;
if (!check) {
await showLoading.end();
return;
}
await showLoading.end();
let uidInput = await showDialog.input("请输入存档UID", "UID:", uidCur.value.toString());
if (uidInput === false) {
showSnackbar.cancel("已取消存档导入");
@@ -207,12 +214,13 @@ async function handleImportOuter(app: string): Promise<void> {
return;
}
const data: TGApp.Plugins.UIAF.Data = JSON.parse(clipboard);
showLoading.start("正在导入数据", "正在解析数据");
await showLoading.start("正在导入数据", `存档UID${uidInput}`);
await TSUserAchi.mergeUiaf(data.list, Number(uidInput));
showLoading.end();
await showLoading.end();
showSnackbar.success("导入成功,即将刷新页面");
await TGLogger.Info("[Achievements][handleImportOuter] 导入成功");
setTimeout(async () => await router.push("/achievements"), 1500);
await new Promise<void>((resolve) => setTimeout(resolve, 1500));
await router.push("/achievements");
}
async function createUid(): Promise<void> {

View File

@@ -120,25 +120,25 @@ onMounted(async () => {
});
async function loadData(): Promise<void> {
showLoading.start(
await showLoading.start(
"正在获取公告数据",
`服务器:${getRegionName(server.value)},语言:${getLangName(lang.value)}`,
);
const annoData = await Hk4eApi.anno.list(server.value, lang.value);
const listCards = getAnnoCard(annoData);
await Promise.all(
listCards.map(async (item) => {
if (item.typeLabel === AnnoType.game) return;
const detail = await Hk4eApi.anno.content(item.id, server.value, "zh-cn");
const timeStr = getAnnoTime(detail.content);
if (timeStr !== false) item.timeStr = timeStr;
}),
);
await showLoading.update("", { title: "正在解析游戏内公告时间" });
for (const item of listCards) {
if (item.typeLabel === AnnoType.game) continue;
const detail = await Hk4eApi.anno.content(item.id, server.value, "zh-cn");
const timeStr = getAnnoTime(detail.content);
if (timeStr !== false) item.timeStr = timeStr;
await showLoading.update(`[${item.id}]${item.subtitle}:${item.timeStr}`);
}
annoCards.value = {
activity: listCards.filter((item) => item.typeLabel === AnnoType.activity),
game: listCards.filter((item) => item.typeLabel === AnnoType.game),
};
showLoading.end();
await showLoading.end();
}
function getRegionName(value: AnnoServer): string {

View File

@@ -155,7 +155,7 @@ const isNeedResize = ref<boolean>(needResize.value !== "false");
const cacheSize = ref<number>(0);
onMounted(async () => {
showLoading.start("正在获取应用信息...");
await showLoading.start("正在加载设置页面", "正在获取缓存大小");
await TGLogger.Info("[Config] 打开设置页面");
const cacheDir = await getCacheDir();
if (cacheDir === false) return;
@@ -164,8 +164,9 @@ onMounted(async () => {
const size: number = await core.invoke("get_dir_size", { path: dir });
cacheBSize += size;
}
await showLoading.update(`缓存大小:${bytesToSize(cacheBSize)}`);
cacheSize.value = cacheBSize;
showLoading.end();
await showLoading.end();
});
// 备份数据
@@ -189,9 +190,9 @@ async function confirmBackup(): Promise<void> {
await TGLogger.Info(`[Config][confirmBackup] 选择备份路径 ${dir.toString()}`);
saveDir = dir;
} else await TGLogger.Info(`[Config][confirmBackup] 备份到默认路径 ${saveDir}`);
showLoading.start("正在备份数据...");
await showLoading.start("正在备份数据");
await backUpUserData(saveDir);
showLoading.end();
await showLoading.end();
showSnackbar.success("数据已备份!");
await TGLogger.Info("[Config][confirmBackup] 备份完成");
}
@@ -217,9 +218,9 @@ async function confirmRestore(): Promise<void> {
await TGLogger.Info(`[Config][confirmRestore] 选择恢复路径 ${dir.toString()}`);
saveDir = dir;
} else await TGLogger.Info(`[Config][confirmRestore] 恢复到默认路径 ${saveDir}`);
showLoading.start("正在恢复数据...");
await showLoading.start("正在恢复数据");
await restoreUserData(saveDir);
showLoading.end();
await showLoading.end();
showSnackbar.success("数据已恢复!");
await TGLogger.Info("[Config][confirmRestore] 恢复完成");
}
@@ -231,12 +232,13 @@ async function confirmUpdate(title?: string): Promise<void> {
showSnackbar.cancel("已取消更新数据库");
return;
}
showLoading.start("正在更新数据库...");
await showLoading.start("正在更新数据库", "");
await TGSqlite.update();
buildTime.value = getBuildTime();
showLoading.end();
showSnackbar.success("数据库已更新!");
await showLoading.end();
showSnackbar.success("数据库已更新!即将刷新页面");
await TGLogger.Info("[Config][confirmUpdate] 数据库更新完成");
await new Promise<void>((resolve) => setTimeout(resolve, 1500));
window.location.reload();
}
@@ -333,13 +335,14 @@ async function confirmDelCache(): Promise<void> {
return;
}
let cacheBSize: number = 0;
showLoading.start("正在检测缓存...");
await showLoading.start("正在检测缓存");
for (const dir of CacheDir) {
const size: number = await core.invoke("get_dir_size", { path: dir });
cacheBSize += size;
}
await showLoading.update(`缓存大小:${bytesToSize(cacheBSize)}`);
cacheSize.value = cacheBSize;
showLoading.end();
await showLoading.end();
const delCheck = await showDialog.check(
"确认清除缓存吗?",
`当前缓存大小为 ${bytesToSize(cacheBSize)}`,
@@ -349,15 +352,16 @@ async function confirmDelCache(): Promise<void> {
await TGLogger.Info("[Config][confirmDelCache] 取消清除缓存");
return;
}
showLoading.start("正在清除缓存...");
await showLoading.start("正在清除缓存");
for (const dir of CacheDir) {
showLoading.update("正在清除缓存...", dir);
await showLoading.update(dir);
await remove(dir, { recursive: true });
}
showLoading.end();
await showLoading.end();
await TGLogger.Info("[Config][confirmDelCache] 缓存清除完成");
showSnackbar.success("缓存已清除!即将退出应用!");
setTimeout(async () => await exit(), 1000);
await new Promise<void>((resolve) => setTimeout(resolve, 1500));
await exit();
}
// 恢复默认设置
@@ -372,8 +376,9 @@ async function confirmResetApp(): Promise<void> {
appStore.init();
homeStore.init();
await TGLogger.Info("[Config][confirmResetApp] 恢复默认设置完成");
showSnackbar.success("已恢复默认配置!即将刷新页面...");
setTimeout(() => window.location.reload(), 1500);
showSnackbar.success("已恢复默认配置!即将刷新页面");
await new Promise<void>((resolve) => setTimeout(resolve, 1500));
window.location.reload();
}
// 前置
@@ -405,12 +410,13 @@ async function confirmResetDB(title?: string): Promise<void> {
await TGLogger.Info("[Config][confirmResetDB] 取消重置数据库");
return;
}
showLoading.start("正在重置数据库...");
await showLoading.start("正在重置数据库");
await TGSqlite.reset();
showLoading.end();
await showLoading.end();
await TGLogger.Info("[Config][confirmResetDB] 数据库重置完成");
showSnackbar.success("数据库已重置!请进行再次检查。");
setTimeout(() => window.location.reload(), 1500);
showSnackbar.success("数据库已重置!即将刷新页面");
await new Promise<void>((resolve) => setTimeout(resolve, 1500));
window.location.reload();
}
// 开启 dev 模式

View File

@@ -72,7 +72,6 @@ const gameSelectList = TGConstant.BBS.CHANNELS;
const curGid = ref<string>(gameSelectList[0].gid);
onMounted(async () => {
showLoading.start("正在加载首页...");
// @ts-expect-error-next-line The import.meta meta-property is not allowed in files which will build into CommonJS output.
const isProdEnv = import.meta.env.MODE === "production";
if (isProdEnv && devMode.value) devMode.value = false;
@@ -81,14 +80,13 @@ onMounted(async () => {
watch(
() => components.value,
(cur, old) => {
async (cur, old) => {
const newComp = cur.filter((i) => !old.includes(i));
if (newComp.length === 0) showLoading.end();
if (newComp.length === 0) await showLoading.end();
},
);
async function loadComp(): Promise<void> {
showLoading.start("正在加载首页...");
const temp: Array<SFComp> = [];
for (const item of showItems.value) {
switch (item) {
@@ -103,7 +101,7 @@ async function loadComp(): Promise<void> {
break;
}
}
showLoading.update("正在加载首页...", `正在加载:${showItems.value.join("、")}`);
await showLoading.start(`正在加载:${showItems.value.join("、")}`);
components.value = temp;
await TGLogger.Info(`[Home][loadComp] 打开首页,当前显示:${showItems.value.join("、")}`);
}
@@ -136,10 +134,10 @@ async function loadEnd(item: SFComp): Promise<void> {
const compName = getName(item.__name ?? "");
if (!compName) return;
await TGLogger.Info(`[Home][loadEnd] ${compName} 加载完成`);
showLoading.update("正在加载首页...", `${compName} 加载完成`);
await showLoading.update(`${compName} 加载完成`);
if (!loadItems.value.includes(compName)) loadItems.value.push(compName);
else showSnackbar.warn(`${compName} 已加载`);
if (loadItems.value.length === components.value.length) showLoading.end();
if (loadItems.value.length === components.value.length) await showLoading.end();
}
</script>
<style lang="css" scoped>

View File

@@ -156,13 +156,13 @@ function sortPost(value: boolean): void {
}
async function load(): Promise<void> {
showLoading.start("正在加载收藏帖子...", "获取收藏合集");
await showLoading.start("正在加载收藏帖子", "获取收藏合集");
collections.value = await TSUserCollection.getCollectList();
showLoading.update("正在加载收藏帖子...", "获取未分类帖子");
await showLoading.update("获取未分类帖子");
const postUnCollect = await TSUserCollection.getUnCollectPostList();
if (curSelect.value === "未分类" || collections.value.length === 0) {
if (curSelect.value === "未分类" || collections.value.length === 0)
selected.value = postUnCollect;
} else if (collections.value.find((c) => c.title === curSelect.value)) {
else if (collections.value.find((c) => c.title === curSelect.value)) {
selected.value = await TSUserCollection.getCollectPostList(curSelect.value);
} else {
selected.value = postUnCollect;
@@ -172,7 +172,7 @@ async function load(): Promise<void> {
selectedMode.value = false;
selectedPost.value = [];
if (page.value > length.value) page.value = 1;
showLoading.end();
await showLoading.end();
}
function toSelect(): void {
@@ -239,9 +239,9 @@ async function toEdit(): Promise<void> {
showSnackbar.cancel("取消修改分类信息");
return;
}
showLoading.start("正在修改分类信息...");
await showLoading.start("正在修改分类信息");
const check = await TSUserCollection.updateCollect(collect.title, cTc, cTd);
showLoading.end();
await showLoading.end();
if (!check) {
showSnackbar.warn("修改分类信息失败");
return;
@@ -266,18 +266,19 @@ async function deletePost(force: boolean = false): Promise<void> {
showSnackbar.cancel("取消操作");
return;
}
showLoading.start(`正在${title}...`);
await showLoading.start(`正在${title}`);
let success = 0;
for (const post of selectedPost.value) {
await showLoading.update(`正在处理帖子: ${post}`);
const check = await TSUserCollection.deletePostCollect(post, force);
if (check) {
success++;
continue;
}
showSnackbar.warn(`帖子 ${post} 操作失败`);
await new Promise((resolve) => setTimeout(resolve, 1500));
await new Promise<void>((resolve) => setTimeout(resolve, 1500));
}
showLoading.end();
await showLoading.end();
showSnackbar.success(`成功${title} ${success}`);
await load();
}
@@ -316,13 +317,13 @@ async function freshPost(select: string | null): Promise<void> {
curSelect.value = "未分类";
return;
}
showLoading.start("正在获取合集帖子...", `获取合集 ${select}`);
await showLoading.start("正在获取合集帖子", `获取合集 ${select}`);
if (select === "未分类") {
curSelect.value = "未分类";
selected.value = await TSUserCollection.getUnCollectPostList();
} else selected.value = await TSUserCollection.getCollectPostList(select);
page.value = 1;
showLoading.end();
await showLoading.end();
showSnackbar.success(`切换合集 ${select},共 ${selected.value.length} 条帖子`);
}
@@ -350,24 +351,24 @@ async function freshUser(uid?: string): Promise<void> {
return;
}
const uidReal = uid || briefInfo.value.uid;
showLoading.start("获取用户收藏...", `UID: ${uidReal}`);
await showLoading.start(`[${uidReal}]获取用户收藏`);
let res = await BBSApi.lovePost(cookie.value, uidReal);
while (true) {
if ("retcode" in res) {
showLoading.end();
await showLoading.end();
if (res.retcode === 1001) showSnackbar.warn("用户收藏已设为私密,无法获取");
else showSnackbar.error(`[${res.retcode}] ${res.message}`);
break;
}
let posts = res.list;
showLoading.update("获取用户收藏...", `合并收藏帖子 [offset]${res.next_offset}...`);
await mergePosts(posts, uid || briefInfo.value.uid);
if (res.is_last) break;
showLoading.update("获取用户收藏...", `[offset]${res.next_offset} [is_last]${res.is_last}`);
await showLoading.update(`[offset]${res.next_offset} [is_last]${res.is_last}`);
res = await BBSApi.lovePost(cookie.value, uid || briefInfo.value.uid, res.next_offset);
}
showLoading.end();
showSnackbar.success("获取用户收藏成功");
await showLoading.end();
showSnackbar.success("获取用户收藏成功,即将刷新页面");
await new Promise<void>((resolve) => setTimeout(resolve, 1500));
window.location.reload();
}
@@ -378,7 +379,7 @@ async function mergePosts(
): Promise<void> {
const title = `用户收藏-${collect}`;
for (const post of posts) {
showLoading.start("获取用户收藏...", `[POST]${post.post.subject} [collection]${title}`);
await showLoading.update(`[POST]${post.post.subject} [collection]${title}`);
const res = await TSUserCollection.addCollect(post.post.post_id, post, title, true);
if (!res) await TGLogger.Error(`[PostCollect] mergePosts [${post.post.post_id}]`);
}

View File

@@ -78,7 +78,6 @@ import { useRoute } from "vue-router";
import TGLogger from "@/utils/TGLogger.js";
import { createPost } from "@/utils/TGWindow.js";
import { getGameName } from "@/web/utils/tools.js";
type SortSelect = { text: string; value: number };
type SortSelectGame = { gid: number; forum: Array<SortSelect>; text: string };
@@ -158,11 +157,9 @@ const posts = shallowRef<Array<TGApp.Plugins.Mys.Post.FullData>>([]);
onMounted(async () => {
if (gid && typeof gid === "string") curGid.value = Number(gid);
if (forum && typeof forum === "string") curForum.value = Number(forum);
showLoading.start(`正在获取${getGameName(curGid.value)}帖子数据...`);
const gameLabel = getGameLabel(curGid.value);
const forumLabel = getForumLabel(curGid.value, curForum.value);
await TGLogger.Info(`[Posts][${gameLabel}][onMounted][${forumLabel}] 打开帖子列表`);
showLoading.update(`正在获取 ${gameLabel}-${forumLabel} 数据`);
await freshPostData();
curForumLabel.value = forumLabel;
firstLoad.value = true;
@@ -222,19 +219,20 @@ function getSortLabel(value: number): string {
}
async function freshPostData(): Promise<void> {
await showLoading.start(`正在刷新${getGameLabel(curGid.value)}帖子`);
const gameLabel = getGameLabel(curGid.value);
const forumLabel = getForumLabel(curGid.value, curForum.value);
const sortLabel = getSortLabel(curSortType.value);
await TGLogger.Info(
`[Posts][${gameLabel}][freshPostData][${forumLabel}][${sortLabel}] 刷新帖子列表`,
);
showLoading.update(`正在刷新 ${gameLabel}-${forumLabel}-${sortLabel} 数据`);
await showLoading.update(`版块:${forumLabel},排序:${sortLabel}`);
document.documentElement.scrollTo({ top: 0, behavior: "smooth" });
const postsGet = await Mys.Post.getForumPostList(curForum.value, curSortType.value);
posts.value = postsGet.list;
lastId.value = postsGet.last_id;
isLast.value = postsGet.is_last;
showLoading.end();
await showLoading.end();
}
async function loadMore(): Promise<void> {
@@ -242,13 +240,16 @@ async function loadMore(): Promise<void> {
showSnackbar.warn("没有更多帖子了");
return;
}
showLoading.start("正在加载更多帖子数据...");
await showLoading.start("正在加载更多帖子数据", `游戏:${getGameLabel(curGid.value)}`);
const postsGet = await Mys.Post.getForumPostList(curForum.value, curSortType.value, lastId.value);
await showLoading.update(
`版块:${curForumLabel.value},排序:${getSortLabel(curSortType.value)},数量:${postsGet.list.length}`,
);
posts.value = posts.value.concat(postsGet.list);
lastId.value = postsGet.last_id;
isLast.value = postsGet.is_last;
showSnackbar.success(`加载成功,共加载 ${postsGet.list.length} 条帖子`);
showLoading.end();
await showLoading.end();
}
function searchPost(): void {

View File

@@ -101,15 +101,16 @@ async function firstLoad(key: NewsType, refresh: boolean = false): Promise<void>
postData.value[key] = [];
rawData.value[key].lastId = 0;
}
showLoading.start(`正在获取${gameName}${rawData.value[key].name}数据...`);
await showLoading.start(`正在获取${gameName}${rawData.value[key].name}数据`);
document.documentElement.scrollTo({ top: 0, behavior: "smooth" });
const getData = await Mys.Painter.getNewsList(gid, NewsTypeEnum[key]);
await showLoading.update(`数量:${getData.list.length},是否最后一页:${getData.is_last}`);
rawData.value[key].isLast = getData.is_last;
rawData.value[key].lastId = getData.list.length;
postData.value[key] = getData.list;
triggerRef(postData);
triggerRef(rawData);
showLoading.end();
await showLoading.end();
await TGLogger.Info(`[News][${gid}][firstLoad] 获取${rawData.value[key].name}数据成功`);
}
@@ -126,25 +127,26 @@ async function loadMore(key: NewsType): Promise<void> {
loading.value = false;
return;
}
showLoading.start(`正在获取${gameName}${rawData.value[key].name}数据...`);
await showLoading.start(`正在获取${gameName}${rawData.value[key].name}数据`);
const getData = await Mys.Painter.getNewsList(
gid,
NewsTypeEnum[key],
20,
rawData.value[key].lastId,
);
await showLoading.update(`数量:${getData.list.length},是否最后一页:${getData.is_last}`);
rawData.value[key].lastId = rawData.value[key].lastId + getData.list.length;
rawData.value[key].isLast = getData.is_last;
postData.value[key] = postData.value[key].concat(getData.list);
triggerRef(postData);
triggerRef(rawData);
if (rawData.value[key].isLast) {
showLoading.end();
await showLoading.end();
showSnackbar.warn("已经是最后一页了");
loading.value = false;
return;
}
showLoading.end();
await showLoading.end();
loading.value = false;
}

View File

@@ -97,10 +97,10 @@ const sortList = computed<Array<SortSelect>>(() => {
});
onMounted(async () => {
showLoading.start(`正在加载话题${topic}信息`);
await showLoading.start(`正在加载话题${topic}信息`);
const info = await Mys.Post.getTopicFullInfo(gid, topic);
if ("retcode" in info) {
showLoading.end();
await showLoading.end();
showSnackbar.error(`[${info.retcode}] ${info.message}`);
return;
}
@@ -125,18 +125,19 @@ watch(
);
async function firstLoad(): Promise<void> {
if (curGame.value) showLoading.update(`正在加载${curGame.value.name}帖子列表`);
await showLoading.start(`正在加载话题${topicInfo.value?.topic.name}信息`);
document.documentElement.scrollTo({ top: 0, behavior: "smooth" });
const postList = await Mys.Post.getTopicPostList(curGid.value, topic, curSortType.value);
if ("retcode" in postList) {
showLoading.end();
await showLoading.end();
showSnackbar.error(`[${postList.retcode}] ${postList.message}`);
return;
}
await showLoading.update(`数量:${postList.posts.length},是否最后一页:${postList.is_last}`);
isLastPage.value = postList.is_last;
lastPostId.value = postList.last_id;
posts.value = postList.posts;
showLoading.end();
await showLoading.end();
showSnackbar.success(`加载了 ${postList.posts.length} 条帖子`);
}
@@ -145,7 +146,7 @@ async function freshPostData(): Promise<void> {
showSnackbar.warn("已经到底了");
return;
}
showLoading.start("正在加载帖子列表");
await showLoading.start(`正在刷新${topicInfo.value?.topic.name}帖子列表`);
const postList = await Mys.Post.getTopicPostList(
curGid.value,
topic,
@@ -153,14 +154,15 @@ async function freshPostData(): Promise<void> {
lastPostId.value,
);
if ("retcode" in postList) {
showLoading.end();
await showLoading.end();
showSnackbar.error(`[${postList.retcode}] ${postList.message}`);
return;
}
await showLoading.update(`数量:${postList.posts.length},是否最后一页:${postList.is_last}`);
isLastPage.value = postList.is_last;
lastPostId.value = postList.last_id;
posts.value = posts.value.concat(postList.posts);
showLoading.end();
await showLoading.end();
showSnackbar.success(`加载了 ${postList.posts.length} 条帖子`);
}