diff --git a/api/pk.js b/api/pk.js index 2fc0ffe..259b061 100644 --- a/api/pk.js +++ b/api/pk.js @@ -71,5 +71,17 @@ export const likeComment = async (data) => { }); }; +/** + * 获取用户 pk 列表 + * @param { page: number } + */ +export const fetchUserPkList = async (data) => { + return request({ + url: "/api/rating/personal/pk/list", + method: "GET", + data, + }); +}; + diff --git a/components/CommentSection/CommentSection.vue b/components/CommentSection/CommentSection.vue index 43a7e4d..1da0843 100644 --- a/components/CommentSection/CommentSection.vue +++ b/components/CommentSection/CommentSection.vue @@ -148,11 +148,6 @@ import { onUnmounted } from "vue"; import CommentItem from "@/components/CommentItem/CommentItem.vue"; import { useUserStore } from "@/stores/user"; -const defaultTabs = [ - { label: "最热", value: "hot" }, - { label: "最新", value: "new" }, -]; - const props = defineProps({ requestKey: { type: String, @@ -176,7 +171,10 @@ const props = defineProps({ }, tabs: { type: Array, - default: () => defaultTabs, + default: () => [ + { label: "最热", value: "hot" }, + { label: "最新", value: "new" }, + ], }, allowCompose: { type: Boolean, @@ -320,7 +318,7 @@ const emit = defineEmits(["need-login", "published"]); const userStore = useUserStore(); const comments = ref([]); -const currentTab = ref(defaultTabs[0].value); +const currentTab = ref("hot"); const currentPage = ref(1); const hasMore = ref(true); const loading = ref(false); diff --git a/pages.json b/pages.json index 2b97e0d..ac969f7 100644 --- a/pages.json +++ b/pages.json @@ -112,6 +112,15 @@ "enablePullDownRefresh": true, "onReachBottomDistance": 50 } + }, + { + "path": "pages/mine/pk", + "style": { + "navigationBarTitleText": "我参与的PK", + "navigationStyle": "custom", + "enablePullDownRefresh": true, + "onReachBottomDistance": 50 + } } ], "globalStyle": { diff --git a/pages/mine/mine.vue b/pages/mine/mine.vue index e2dd0f5..4efcdbd 100644 --- a/pages/mine/mine.vue +++ b/pages/mine/mine.vue @@ -65,7 +65,12 @@ - 我的参与 + 我参与的话题 + {{ userStats.participant }} + + + + 我参与的PK {{ userStats.participant }} @@ -226,6 +231,11 @@ const navTo = (page) => { return; } + if (page === "/pages/mine/pk") { + uni.navigateTo({ url: page }); + return; + } + uni.showToast({ title: "功能开发中", icon: "none" }); }; diff --git a/pages/mine/pk.vue b/pages/mine/pk.vue new file mode 100644 index 0000000..8ca7798 --- /dev/null +++ b/pages/mine/pk.vue @@ -0,0 +1,786 @@ + + + + +