diff --git a/src/api/ranking/types/ranking.ts b/src/api/ranking/types/ranking.ts
index 790cf619..ac895814 100644
--- a/src/api/ranking/types/ranking.ts
+++ b/src/api/ranking/types/ranking.ts
@@ -2,7 +2,7 @@ export interface RankingGetTopicsRequestData {
page: number
limit: number
sortField: string
- sortOrder: string
+ sortOrder: 'asc' | 'desc'
}
export interface RankingTopics {
diff --git a/src/views/Home/content/article/components/header/navSortItem.ts b/src/views/Home/content/article/components/header/navSortItem.ts
index a5ea1cd7..26842862 100644
--- a/src/views/Home/content/article/components/header/navSortItem.ts
+++ b/src/views/Home/content/article/components/header/navSortItem.ts
@@ -34,13 +34,13 @@ export const navSortItem: Sort[] = [
index: 5,
icon: 'line-md:thumbs-up-twotone',
name: 'likes',
- sortField: 'likes',
+ sortField: 'likes_count',
},
{
index: 6,
icon: 'ri:reply-line',
name: 'replies',
- sortField: 'replies',
+ sortField: 'replies_count',
},
{
index: 7,
diff --git a/src/views/ranking/components/KUNGalgamerForm.vue b/src/views/ranking/components/KUNGalgamerForm.vue
index 2bfed3e2..77a11457 100644
--- a/src/views/ranking/components/KUNGalgamerForm.vue
+++ b/src/views/ranking/components/KUNGalgamerForm.vue
@@ -6,7 +6,7 @@ import KUNgalgamer from './KUNGalgamer.vue'
-
最萌的萝莉
+
用户
diff --git a/src/views/ranking/components/Topic.vue b/src/views/ranking/components/Topic.vue
index 100c8f89..c655efc3 100644
--- a/src/views/ranking/components/Topic.vue
+++ b/src/views/ranking/components/Topic.vue
@@ -10,7 +10,7 @@ const props = defineProps<{
const topics = computed(() => props.topics)
-const icons: Record
= {
+const iconMap: Record = {
popularity: 'bi:fire',
upvotes_count: 'bi:rocket',
views: 'ic:outline-remove-red-eye',
@@ -26,33 +26,50 @@ const parseTopicNumber = (field: string | string[]) => {
-
-
-
-
- {{ topic.title }}
+
+
+
+
+
+
+ {{ topic.title }}
+
+
+
+
+
+
+ {{ parseTopicNumber(topic.field) }}
+
+
-
-
-
-
-
- {{ parseTopicNumber(topic.field) }}
-
-
-
+
diff --git a/src/views/ranking/components/TopicForm.vue b/src/views/ranking/components/TopicForm.vue
index 83fb9bf3..735fcbab 100644
--- a/src/views/ranking/components/TopicForm.vue
+++ b/src/views/ranking/components/TopicForm.vue
@@ -9,8 +9,10 @@ import { storeToRefs } from 'pinia'
import type { RankingTopics } from '@/api'
import { topicNavSortItem } from './navSortItem'
-const { topic, user } = storeToRefs(useKUNGalgameRankingStore())
+const { topic } = storeToRefs(useKUNGalgameRankingStore())
const topics = ref
([])
+// 升序降序
+const isAscending = ref(false)
// 获取话题
const getTopics = async () => {
@@ -18,6 +20,15 @@ const getTopics = async () => {
return responseData.data
}
+const iconMap: Record = {
+ popularity: 'bi:fire',
+ upvotes_count: 'bi:rocket',
+ views: 'ic:outline-remove-red-eye',
+ likes_count: 'line-md:thumbs-up-twotone',
+ replies_count: 'ri:reply-line',
+ comments: 'fa-regular:comment-dots',
+}
+
// 监听话题数据获取新话题
watch(
() => topic,
@@ -31,29 +42,53 @@ watch(
onMounted(async () => {
topics.value = await getTopics()
})
+
+// 切换排序方式
+const handleClickSortOrder = () => {
+ isAscending.value = !isAscending.value
+ if (isAscending.value) {
+ topic.value.sortOrder = 'asc'
+ } else {
+ topic.value.sortOrder = 'desc'
+ }
+}
-
最萌的话题
+
话题
-
排序
+
+
+
+ 升序
+
+
+
+ 降序
+
+
+
+
-
+
+
+
+ 筛选
-
@@ -69,6 +104,7 @@ onMounted(async () => {
/* 话题排行 */
.topic {
width: 50%;
+ height: calc(100% - 50px - 20px - 40px);
}
/* 话题排行标题 */
.title {
@@ -82,8 +118,75 @@ onMounted(async () => {
}
/* 话题排行的交互 */
.nav {
+ height: 40px;
display: flex;
+ justify-content: space-around;
+ align-items: center;
margin-left: 10px;
+ border: 1px solid var(--kungalgame-blue-4);
+ border-radius: 5px;
+}
+
+.order {
+ width: 100%;
+ height: 100%;
+ cursor: pointer;
+ transition: all 0.2s;
+ display: flex;
+ align-items: center;
+
+ .icon {
+ font-size: 22px;
+ }
+
+ & > div {
+ width: 100%;
+ display: flex;
+ justify-content: space-around;
+ align-items: center;
+ }
+}
+
+.sort {
+ position: relative;
+ width: 100%;
+ height: 100%;
+ display: flex;
+ justify-content: space-around;
+ align-items: center;
+ cursor: pointer;
+ border-left: 1px solid var(--kungalgame-blue-4);
+}
+
+.sort:hover .submenu {
+ display: flex;
+}
+
+.icon {
+ color: var(--kungalgame-blue-4);
+}
+
+.submenu {
+ top: 40px;
+ position: absolute;
+ width: 100%;
+ display: none;
+ flex-direction: column;
+ border-radius: 5px;
+ border: 1px solid var(--kungalgame-blue-1);
+ box-shadow: var(--shadow);
+ background-color: var(--kungalgame-trans-white-5);
+ backdrop-filter: blur(5px);
+ .item {
+ transition: all 0.2s;
+ height: 40px;
+ display: flex;
+ justify-content: space-around;
+ align-items: center;
+ &:hover {
+ background-color: var(--kungalgame-trans-blue-1);
+ }
+ }
}
/* 单个话题的容器 */
@@ -108,4 +211,19 @@ onMounted(async () => {
scrollbar-width: thin;
scrollbar-color: var(--kungalgame-blue-4) var(--kungalgame-blue-1);
}
+
+.order-enter-active,
+.order-leave-active {
+ transition: all 0.25s ease-out;
+}
+
+.order-enter-from {
+ opacity: 0;
+ transform: translateY(-30px);
+}
+
+.order-leave-to {
+ opacity: 0;
+ transform: translateY(30px);
+}