mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🎨 调整帖子数量
This commit is contained in:
@@ -141,41 +141,13 @@ const forumDbyList: SortSelect[] = [
|
|||||||
{ text: "公告", value: 36 },
|
{ text: "公告", value: 36 },
|
||||||
];
|
];
|
||||||
const sortGameList: SortSelectGame[] = [
|
const sortGameList: SortSelectGame[] = [
|
||||||
{
|
{ gid: 2, forum: forumYsList, text: "原神" },
|
||||||
gid: 2,
|
{ gid: 6, forum: forumSrList, text: "崩坏:星穹铁道" },
|
||||||
forum: forumYsList,
|
{ gid: 8, forum: forumZzzList, text: "绝区零" },
|
||||||
text: "原神",
|
{ gid: 1, forum: forumBh3List, text: "崩坏3" },
|
||||||
},
|
{ gid: 3, forum: forumBh2List, text: "崩坏2" },
|
||||||
{
|
{ gid: 4, forum: forumWdList, text: "未定事件簿" },
|
||||||
gid: 6,
|
{ gid: 5, forum: forumDbyList, text: "大别野" },
|
||||||
forum: forumSrList,
|
|
||||||
text: "崩坏:星穹铁道",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
gid: 8,
|
|
||||||
forum: forumZzzList,
|
|
||||||
text: "绝区零",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
gid: 1,
|
|
||||||
forum: forumBh3List,
|
|
||||||
text: "崩坏3",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
gid: 3,
|
|
||||||
forum: forumBh2List,
|
|
||||||
text: "崩坏2",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
gid: 4,
|
|
||||||
forum: forumWdList,
|
|
||||||
text: "未定事件簿",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
gid: 5,
|
|
||||||
forum: forumDbyList,
|
|
||||||
text: "大别野",
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// 路由
|
// 路由
|
||||||
@@ -184,17 +156,13 @@ const forum = useRoute().params.forum;
|
|||||||
|
|
||||||
function getGameForums(gid: number): SortSelect[] {
|
function getGameForums(gid: number): SortSelect[] {
|
||||||
const game = sortGameList.find((item) => item.gid === gid);
|
const game = sortGameList.find((item) => item.gid === gid);
|
||||||
if (game) {
|
if (game) return game.forum;
|
||||||
return game.forum;
|
|
||||||
}
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGameLabel(gid: number): string {
|
function getGameLabel(gid: number): string {
|
||||||
const game = sortGameList.find((item) => item.gid === gid);
|
const game = sortGameList.find((item) => item.gid === gid);
|
||||||
if (game) {
|
if (game) return game.text;
|
||||||
return game.text;
|
|
||||||
}
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,16 +208,10 @@ watch(
|
|||||||
async (newVal: number) => {
|
async (newVal: number) => {
|
||||||
const forums = getGameForums(newVal);
|
const forums = getGameForums(newVal);
|
||||||
const forumFind = forums.find((item) => item.text === curForumLabel.value);
|
const forumFind = forums.find((item) => item.text === curForumLabel.value);
|
||||||
if (forumFind) {
|
if (forumFind) curForum.value = forumFind.value;
|
||||||
curForum.value = forumFind.value;
|
else curForum.value = forums[0].value;
|
||||||
} else {
|
|
||||||
curForum.value = forums[0].value;
|
|
||||||
}
|
|
||||||
await nextTick();
|
await nextTick();
|
||||||
showSnackbar({
|
showSnackbar({ text: `已将分区切换到 ${getGameLabel(newVal)}`, color: "success" });
|
||||||
text: `已将分区切换到 ${getGameLabel(newVal)}`,
|
|
||||||
color: "success",
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
watch(
|
watch(
|
||||||
@@ -268,13 +230,10 @@ watch(
|
|||||||
);
|
);
|
||||||
watch(
|
watch(
|
||||||
() => curSortType.value,
|
() => curSortType.value,
|
||||||
async (newVal) => {
|
async () => {
|
||||||
await freshPostData();
|
await freshPostData();
|
||||||
const sortLabel = getSortLabel(newVal);
|
const sortLabel = getSortLabel(curSortType.value);
|
||||||
showSnackbar({
|
showSnackbar({ text: `已将排序切换到 ${sortLabel}`, color: "success" });
|
||||||
text: `已将排序切换到 ${sortLabel}`,
|
|
||||||
color: "success",
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -287,7 +246,7 @@ async function freshPostData(): Promise<void> {
|
|||||||
);
|
);
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
loadingTitle.value = `正在加载 ${gameLabel}-${forumLabel}-${sortLabel} 数据`;
|
loadingTitle.value = `正在加载 ${gameLabel}-${forumLabel}-${sortLabel} 数据`;
|
||||||
const postsGet = await Mys.Post.getForumPostList(curForum.value, curSortType.value, 12);
|
const postsGet = await Mys.Post.getForumPostList(curForum.value, curSortType.value);
|
||||||
posts.value = postsGet.list;
|
posts.value = postsGet.list;
|
||||||
await nextTick();
|
await nextTick();
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
@@ -296,18 +255,12 @@ async function freshPostData(): Promise<void> {
|
|||||||
// 查询帖子
|
// 查询帖子
|
||||||
function searchPost(): void {
|
function searchPost(): void {
|
||||||
if (search.value === "") {
|
if (search.value === "") {
|
||||||
showSnackbar({
|
showSnackbar({ text: "请输入搜索内容", color: "error" });
|
||||||
text: "请输入搜索内容",
|
|
||||||
color: "error",
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const numCheck = Number(search.value);
|
const numCheck = Number(search.value);
|
||||||
if (isNaN(numCheck)) {
|
if (isNaN(numCheck)) showSearch.value = true;
|
||||||
showSearch.value = true;
|
else createPost(search.value);
|
||||||
} else {
|
|
||||||
createPost(search.value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="css" scoped>
|
<style lang="css" scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user