mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
🐛 修复分类更新无效
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
<v-select
|
<v-select
|
||||||
v-model="curSortType"
|
v-model="curSortType"
|
||||||
class="post-switch-item"
|
class="post-switch-item"
|
||||||
:items="sortOrderList"
|
:items="sortList"
|
||||||
item-title="text"
|
item-title="text"
|
||||||
item-value="value"
|
item-value="value"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
@click:append="searchPost"
|
@click:append="searchPost"
|
||||||
@keyup.enter="searchPost"
|
@keyup.enter="searchPost"
|
||||||
/>
|
/>
|
||||||
<v-btn :rounded="true" class="post-fresh-btn" @click="freshPostData()">
|
<v-btn :rounded="true" class="post-fresh-btn" @click="firstLoad()">
|
||||||
<v-icon>mdi-refresh</v-icon>
|
<v-icon>mdi-refresh</v-icon>
|
||||||
<span>刷新</span>
|
<span>刷新</span>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
<ToPostSearch :gid="curGid.toString()" v-model="showSearch" :keyword="search" />
|
<ToPostSearch :gid="curGid.toString()" v-model="showSearch" :keyword="search" />
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, ref, toRaw, watch } from "vue";
|
import { computed, onMounted, ref, toRaw, watch } from "vue";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
|
|
||||||
import showSnackbar from "../../components/func/snackbar.js";
|
import showSnackbar from "../../components/func/snackbar.js";
|
||||||
@@ -90,12 +90,20 @@ const isLastPage = ref<boolean>(false);
|
|||||||
const curGame = ref<TGApp.Plugins.Mys.Topic.GameInfo>();
|
const curGame = ref<TGApp.Plugins.Mys.Topic.GameInfo>();
|
||||||
|
|
||||||
type SortSelect = { text: string; value: number };
|
type SortSelect = { text: string; value: number };
|
||||||
// todo 根据实际情况修改
|
const sortList = computed<SortSelect[]>(() => {
|
||||||
const sortOrderList: SortSelect[] = [
|
if (!topicInfo.value) return [];
|
||||||
{ text: "默认排序", value: 0 },
|
if (!topicInfo.value.good_post_exist) {
|
||||||
{ text: "按时间排序", value: 1 },
|
return [
|
||||||
{ text: "按热度排序", value: 2 },
|
{ text: "最新", value: 0 },
|
||||||
];
|
{ text: "热门", value: 2 },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
{ text: "最新", value: 0 },
|
||||||
|
{ text: "热门", value: 2 },
|
||||||
|
{ text: "精华", value: 1 },
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
onMounted(async () => await firstLoad());
|
onMounted(async () => await firstLoad());
|
||||||
watch(
|
watch(
|
||||||
@@ -122,7 +130,7 @@ async function firstLoad(): Promise<void> {
|
|||||||
}
|
}
|
||||||
if (curGame.value === undefined) curGame.value = info.game_info_list[0];
|
if (curGame.value === undefined) curGame.value = info.game_info_list[0];
|
||||||
loadingTitle.value = `正在加载${curGame.value.name}帖子列表`;
|
loadingTitle.value = `正在加载${curGame.value.name}帖子列表`;
|
||||||
const postList = await Mys.Post.getTopicPostList(gid, topic);
|
const postList = await Mys.Post.getTopicPostList(gid, topic, curSortType.value);
|
||||||
if ("retcode" in postList) {
|
if ("retcode" in postList) {
|
||||||
showSnackbar.error(`[${postList.retcode}] ${postList.message}`);
|
showSnackbar.error(`[${postList.retcode}] ${postList.message}`);
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
|||||||
35
src/plugins/Mys/types/Post.d.ts
vendored
35
src/plugins/Mys/types/Post.d.ts
vendored
@@ -1,15 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* @file plugins/Mys/types/post.d.ts
|
* @file plugins/Mys/types/post.d.ts
|
||||||
* @description Mys 插件帖子类型定义文件
|
* @description Mys 插件帖子类型定义文件
|
||||||
* @since Beta v0.5.5
|
* @since Beta v0.6.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Mys 插件帖子类型
|
|
||||||
* @since Beta v0.5.5
|
|
||||||
* @namespace TGApp.Plugins.Mys.Post
|
|
||||||
* @memberof TGApp.Plugins.Mys
|
|
||||||
*/
|
|
||||||
declare namespace TGApp.Plugins.Mys.Post {
|
declare namespace TGApp.Plugins.Mys.Post {
|
||||||
/**
|
/**
|
||||||
* @description 帖子返回数据
|
* @description 帖子返回数据
|
||||||
@@ -55,7 +49,7 @@ declare namespace TGApp.Plugins.Mys.Post {
|
|||||||
interface FullData {
|
interface FullData {
|
||||||
post: Post;
|
post: Post;
|
||||||
forum: Forum | null;
|
forum: Forum | null;
|
||||||
topics: Topic[];
|
topics: TGApp.Plugins.Mys.Topic.Info[];
|
||||||
user: TGApp.Plugins.Mys.User.Post | null;
|
user: TGApp.Plugins.Mys.User.Post | null;
|
||||||
self_operation: TGApp.Plugins.Mys.User.SelfOperation;
|
self_operation: TGApp.Plugins.Mys.User.SelfOperation;
|
||||||
stat: Stat | null;
|
stat: Stat | null;
|
||||||
@@ -195,31 +189,6 @@ declare namespace TGApp.Plugins.Mys.Post {
|
|||||||
forum_cate: unknown | null;
|
forum_cate: unknown | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 话题信息
|
|
||||||
* @since Alpha v0.2.1
|
|
||||||
* @interface Topic
|
|
||||||
* @property {number} id 话题 ID
|
|
||||||
* @property {string} name 话题名称
|
|
||||||
* @property {string} cover 话题封面图 URL
|
|
||||||
* @property {boolean} is_top 是否置顶
|
|
||||||
* @property {boolean} is_good 是否加精
|
|
||||||
* @property {boolean} is_interactive 是否互动
|
|
||||||
* @property {number} game_id 游戏 ID
|
|
||||||
* @property {number} content_type 内容类型
|
|
||||||
* @return Topic
|
|
||||||
*/
|
|
||||||
interface Topic {
|
|
||||||
id: number;
|
|
||||||
name: string;
|
|
||||||
cover: string;
|
|
||||||
is_top: boolean;
|
|
||||||
is_good: boolean;
|
|
||||||
is_interactive: boolean;
|
|
||||||
game_id: number;
|
|
||||||
content_type: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 帖子状态
|
* @description 帖子状态
|
||||||
* @since Beta v0.3.7
|
* @since Beta v0.3.7
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ watch(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
async function toTopic(topic: TGApp.Plugins.Mys.Post.Topic): Promise<void> {
|
async function toTopic(topic: TGApp.Plugins.Mys.Topic.Info): Promise<void> {
|
||||||
const gid = postData.value?.post.game_id ?? topic.game_id;
|
const gid = postData.value?.post.game_id ?? topic.game_id;
|
||||||
await emit("active_deep_link", `router?path=/posts/${gid}/${topic.id}`);
|
await emit("active_deep_link", `router?path=/posts/${gid}/${topic.id}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user