feat: rank community recommendation feed

This commit is contained in:
hajimi
2026-08-02 18:39:36 +08:00
parent 3fc4703986
commit 51cd9898a7
9 changed files with 122 additions and 3 deletions
+17
View File
@@ -103,6 +103,12 @@
:active-value="1" :inactive-value="0" @change="handleSetRecommend($event, row.id)" />
</template>
</el-table-column>
<el-table-column label="排序" min-width="130">
<template #default="{ row }">
<el-input-number v-perms="['community.communityPost/setSort']" v-model="row.sort" :min="0"
:max="999999" :controls="false" class="!w-[100px]" @change="handleSetSort($event, row.id)" />
</template>
</el-table-column>
<el-table-column label="热门" min-width="70">
<template #default="{ row }">
<el-switch v-perms="['community.communityPost/setHot']" v-model="row.is_hot" :active-value="1"
@@ -183,6 +189,7 @@
<el-descriptions-item label="置顶">{{ detailData.is_top ? '是' : '否' }}</el-descriptions-item>
<el-descriptions-item label="分类">{{ detailData.category_name || '未分类' }}</el-descriptions-item>
<el-descriptions-item label="推荐">{{ detailData.is_recommend ? '是' : '否' }}</el-descriptions-item>
<el-descriptions-item label="排序">{{ detailData.sort || 0 }}</el-descriptions-item>
<el-descriptions-item label="热门">{{ detailData.is_hot ? '是' : '否' }}</el-descriptions-item>
<el-descriptions-item label="话题">{{ detailData.is_topic ? '是' : '否' }}</el-descriptions-item>
<el-descriptions-item label="更新时间">{{ detailData.update_time || '-' }}</el-descriptions-item>
@@ -202,6 +209,7 @@ import {
communityPostSetTop,
communityPostSetHot,
communityPostSetRecommend,
communityPostSetSort,
communityPostSetTopic,
communityPostSetCategory,
communityCategoryAll,
@@ -259,6 +267,15 @@ const handleSetRecommend = async (is_recommend: any, id: number) => {
}
}
const handleSetSort = async (sort: any, id: number) => {
try {
await communityPostSetSort({ id, sort: Number(sort) || 0 })
getLists()
} catch (error) {
getLists()
}
}
const handleSetTopic = async (is_topic: any, id: number) => {
try {
await communityPostSetTopic({ id, is_topic })