Compare commits
6 Commits
6f99958275
...
790a2658d5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
790a2658d5 | ||
|
|
993b5f8eef | ||
|
|
acef084df7 | ||
|
|
b5a246f11b | ||
|
|
ffbd355393 | ||
|
|
0dc2c2f0c3 |
@@ -8,6 +8,19 @@ export function getList(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取待审核话题列表
|
||||||
|
* @param {pageNo: number, pageSize: number} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getPendingList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topic/pending/list',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function getAllList(data) {
|
export function getAllList(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'management/api/rating/topic/list/all',
|
url: 'management/api/rating/topic/list/all',
|
||||||
@@ -16,6 +29,12 @@ export function getAllList(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加话题
|
||||||
|
* @param {title: string, categoryId: string, participants: object[]} data
|
||||||
|
* @param {name: string, avatar: string} data.participants 话题 items
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
export function doAdd(data) {
|
export function doAdd(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'management/api/rating/topic',
|
url: 'management/api/rating/topic',
|
||||||
|
|||||||
54
src/api/rating/topicCategory.js
Normal file
54
src/api/rating/topicCategory.js
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取话题分类列表
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topic_category/list',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切换话题分类状态
|
||||||
|
* @param {*} id
|
||||||
|
* @param {*} enable
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function toggleEnable(id, enable) {
|
||||||
|
return request({
|
||||||
|
url: `/management/api/rating/topic_category/toggle/${id}`,
|
||||||
|
method: 'patch',
|
||||||
|
data: { enable },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移动话题分类
|
||||||
|
* @param {*} id
|
||||||
|
* @param {*} to
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function moveTo(id, to) {
|
||||||
|
return request({
|
||||||
|
url: `/management/api/rating/topic_category/move_to/${id}`,
|
||||||
|
method: 'patch',
|
||||||
|
data: { to },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑话题分类
|
||||||
|
* @param {*} id
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function doEdit(id, data) {
|
||||||
|
return request({
|
||||||
|
url: `/management/api/rating/topic_category/${id}`,
|
||||||
|
method: 'put',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -52,3 +52,33 @@ export function comment(data) {
|
|||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评论点赞
|
||||||
|
* @param {*} { commentId, userId }
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function commentLike(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topicItemOperate/comment/like',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核话题
|
||||||
|
* @param { topicId, itemmId, userId, status, type, rejectReason?, auditRemark? }
|
||||||
|
* @param {*} status 2: 通过, 3: 拒绝 4: 禁用
|
||||||
|
* @param {*} type topic topicItem
|
||||||
|
* @param {*} rejectReason 拒绝原因
|
||||||
|
* @param {*} auditRemark 审核备注
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function reviewTopic(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topicItemOperate/audit',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export function getList(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取机器人列表(基础信息) {appId, pageNo, pageSize, topicId, itemId}
|
* 获取机器人列表(基础信息) {appId, pageNo, pageSize, topicId, itemId, commentId?}
|
||||||
* @param {*} data
|
* @param {*} data
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -79,6 +79,18 @@ export const asyncRoutes = [
|
|||||||
component: () => import('@/views/rating/topicCommentRecord/index'),
|
component: () => import('@/views/rating/topicCommentRecord/index'),
|
||||||
meta: { title: '用户评论记录' },
|
meta: { title: '用户评论记录' },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'topic-category',
|
||||||
|
name: 'RatingTopicCategoryIndex',
|
||||||
|
component: () => import('@/views/rating/topicCategory/index'),
|
||||||
|
meta: { title: '评分话题分类' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'topic-review',
|
||||||
|
name: 'RatingTopicReviewIndex',
|
||||||
|
component: () => import('@/views/rating/topicReview/index'),
|
||||||
|
meta: { title: '话题审核' },
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export const eventTypeMap = {
|
|||||||
|
|
||||||
export const appMap = {
|
export const appMap = {
|
||||||
'69665538a49b8ae3be50fe5d': '新春祝福',
|
'69665538a49b8ae3be50fe5d': '新春祝福',
|
||||||
|
'6a0d7dbe4c5de50f2ba66475': '夯拉评',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const userMap = {
|
export const userMap = {
|
||||||
|
|||||||
234
src/views/rating/topic/components/TopicEdit.vue
Normal file
234
src/views/rating/topic/components/TopicEdit.vue
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="700px" @close="close">
|
||||||
|
<el-form ref="form" label-width="100px" :model="form" :rules="rules">
|
||||||
|
<el-form-item label="话题标题" prop="title">
|
||||||
|
<el-input v-model="form.title" placeholder="请输入话题标题" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="话题分类" prop="categoryId">
|
||||||
|
<el-select
|
||||||
|
v-model="form.categoryId"
|
||||||
|
v-loadmore="loadMoreCategories"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择话题分类"
|
||||||
|
:popper-append-to-body="false"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in categoryList" :key="item.id" :label="item.title" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="评价项" required>
|
||||||
|
<div class="participants-container">
|
||||||
|
<div v-for="(item, index) in form.participants" :key="index" class="participant-item">
|
||||||
|
<div class="participant-avatar">
|
||||||
|
<single-upload v-model="item.avatar" style="width: 60px; height: 60px" :upload-url="uploadUrl" />
|
||||||
|
</div>
|
||||||
|
<div class="participant-name">
|
||||||
|
<el-input v-model="item.name" placeholder="请输入评价项名称" />
|
||||||
|
</div>
|
||||||
|
<div class="participant-action">
|
||||||
|
<el-button circle icon="el-icon-delete" type="danger" @click="removeParticipant(index)" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-button icon="el-icon-plus" plain style="width: 100%; margin-top: 10px" @click="addParticipant">添加评价项</el-button>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="close">取 消</el-button>
|
||||||
|
<el-button :loading="saving" type="primary" @click="save">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { doAdd } from '@/api/rating/topic'
|
||||||
|
import { getList as getCategoryList } from '@/api/rating/topicCategory'
|
||||||
|
import SingleUpload from '@/components/SingleUpload'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'TopicEdit',
|
||||||
|
components: { SingleUpload },
|
||||||
|
directives: {
|
||||||
|
loadmore: {
|
||||||
|
bind(el, binding) {
|
||||||
|
setTimeout(() => {
|
||||||
|
const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap')
|
||||||
|
if (SELECTWRAP_DOM) {
|
||||||
|
SELECTWRAP_DOM.addEventListener('scroll', function () {
|
||||||
|
const condition = this.scrollHeight - this.scrollTop <= this.clientHeight + 2
|
||||||
|
if (condition) {
|
||||||
|
binding.value()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, 0)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '创建话题',
|
||||||
|
dialogFormVisible: false,
|
||||||
|
saving: false,
|
||||||
|
form: {
|
||||||
|
title: '',
|
||||||
|
categoryId: '',
|
||||||
|
participants: [{ name: '', avatar: '' }],
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
title: [{ required: true, trigger: 'blur', message: '请输入话题标题' }],
|
||||||
|
categoryId: [{ required: true, trigger: 'change', message: '请选择话题分类' }],
|
||||||
|
},
|
||||||
|
categoryList: [],
|
||||||
|
categoryTotal: 0,
|
||||||
|
categoryQuery: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
},
|
||||||
|
fetchingCategories: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
uploadUrl() {
|
||||||
|
return `${process.env.VUE_APP_API_BASE_URL}/management/api/common/upload`
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showEdit() {
|
||||||
|
this.title = '创建话题'
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.dialogFormVisible = true
|
||||||
|
this.fetchCategoryList(true)
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$refs['form'].resetFields()
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
this.saving = false
|
||||||
|
},
|
||||||
|
async fetchCategoryList(refresh = false) {
|
||||||
|
if (refresh) {
|
||||||
|
this.categoryQuery.pageNo = 1
|
||||||
|
this.categoryList = []
|
||||||
|
}
|
||||||
|
this.fetchingCategories = true
|
||||||
|
try {
|
||||||
|
const { data } = await getCategoryList(this.categoryQuery)
|
||||||
|
if (refresh) {
|
||||||
|
this.categoryList = data.list || []
|
||||||
|
} else {
|
||||||
|
this.categoryList = this.categoryList.concat(data.list || [])
|
||||||
|
}
|
||||||
|
this.categoryTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingCategories = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreCategories() {
|
||||||
|
if (this.categoryList.length >= this.categoryTotal || this.fetchingCategories) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.categoryQuery.pageNo += 1
|
||||||
|
this.fetchCategoryList()
|
||||||
|
},
|
||||||
|
addParticipant() {
|
||||||
|
this.form.participants.push({ name: '', avatar: '' })
|
||||||
|
},
|
||||||
|
removeParticipant(index) {
|
||||||
|
this.form.participants.splice(index, 1)
|
||||||
|
},
|
||||||
|
save() {
|
||||||
|
this.$refs['form'].validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
// 验证 participants
|
||||||
|
if (this.form.participants.length === 0) {
|
||||||
|
this.$message.error('请至少添加一个评价项')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for (let i = 0; i < this.form.participants.length; i++) {
|
||||||
|
const p = this.form.participants[i]
|
||||||
|
if (!p.name) {
|
||||||
|
this.$message.error(`第 ${i + 1} 个评价项名称不能为空`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理提交数据:去掉 avatar 的域名前缀
|
||||||
|
const submitData = {
|
||||||
|
...this.form,
|
||||||
|
participants: this.form.participants.map((p) => {
|
||||||
|
let avatar = p.avatar || ''
|
||||||
|
if (avatar.startsWith('https://file.lihailezzc.com/')) {
|
||||||
|
avatar = avatar.replace('https://file.lihailezzc.com/', '')
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
...p,
|
||||||
|
avatar,
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
||||||
|
this.saving = true
|
||||||
|
try {
|
||||||
|
const { msg } = await doAdd(submitData)
|
||||||
|
this.$baseMessage(msg || '创建成功', 'success')
|
||||||
|
this.$emit('fetch-data')
|
||||||
|
this.close()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.saving = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.participants-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
.participant-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
gap: 15px;
|
||||||
|
height: 80px; /* 固定高度确保内容居中对齐 */
|
||||||
|
}
|
||||||
|
.participant-avatar {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
/* 深度覆盖 SingleUpload 的默认宽高 */
|
||||||
|
::v-deep .participant-avatar .single-upload .uploader-icon,
|
||||||
|
::v-deep .participant-avatar .single-upload .avatar {
|
||||||
|
width: 60px !important;
|
||||||
|
height: 60px !important;
|
||||||
|
line-height: 60px !important;
|
||||||
|
}
|
||||||
|
.participant-name {
|
||||||
|
flex-grow: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.participant-action {
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,8 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="rating-topic-container">
|
<div class="rating-topic-container">
|
||||||
<vab-query-form>
|
<vab-query-form>
|
||||||
<vab-query-form-right-panel :span="24">
|
<vab-query-form-left-panel :span="12">
|
||||||
|
<el-button icon="el-icon-plus" type="primary" @click="handleAdd">创建话题</el-button>
|
||||||
|
</vab-query-form-left-panel>
|
||||||
|
<vab-query-form-right-panel :span="12">
|
||||||
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
||||||
|
<el-form-item>
|
||||||
|
<el-select v-model="queryForm.status" clearable placeholder="请选择状态" @change="queryData">
|
||||||
|
<el-option label="审核中" :value="1" />
|
||||||
|
<el-option label="已通过" :value="2" />
|
||||||
|
<el-option label="已拒绝" :value="3" />
|
||||||
|
<el-option label="禁用" :value="4" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-input v-model.trim="queryForm.keyword" clearable placeholder="请输入评价主题" />
|
<el-input v-model.trim="queryForm.keyword" clearable placeholder="请输入评价主题" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -14,11 +25,9 @@
|
|||||||
</vab-query-form>
|
</vab-query-form>
|
||||||
|
|
||||||
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||||
<el-table-column align="left" label="评价主题" min-width="250">
|
<el-table-column align="left" label="评价主题" min-width="200" width="200">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="topic-info-cell">
|
<div class="topic-info-cell" style="cursor: pointer" @click="handleViewItems(row)">
|
||||||
<el-image v-if="row.coverUrl" class="topic-cover" :preview-src-list="[row.coverUrl]" :src="getThumbUrl(row.coverUrl)" />
|
|
||||||
<div v-else class="topic-cover-placeholder"><i class="el-icon-picture-outline" /></div>
|
|
||||||
<div class="topic-details">
|
<div class="topic-details">
|
||||||
<div class="topic-title">{{ row.title }}</div>
|
<div class="topic-title">{{ row.title }}</div>
|
||||||
<div v-if="row.description" class="topic-desc" :title="row.description">{{ row.description }}</div>
|
<div v-if="row.description" class="topic-desc" :title="row.description">{{ row.description }}</div>
|
||||||
@@ -44,7 +53,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="left" label="互动统计" min-width="180">
|
<el-table-column align="left" label="互动统计" width="180">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="stat-cell">
|
<div class="stat-cell">
|
||||||
<div class="stat-row">
|
<div class="stat-row">
|
||||||
@@ -79,17 +88,19 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="center" label="热门分数" prop="hotScore" width="100" />
|
<el-table-column align="left" label="热门分数" prop="hotScore" width="100" />
|
||||||
|
|
||||||
<el-table-column align="center" label="创建时间" prop="createdAt" width="160">
|
<el-table-column align="left" label="创建时间" prop="createdAt" width="160">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ formatTime(row.createdAt) }}
|
{{ formatTime(row.createdAt) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="center" fixed="right" label="操作" width="120">
|
<el-table-column align="center" label="操作" width="150">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button type="text" @click="handleViewItems(row)">查看评分项</el-button>
|
<el-button type="text" @click="handleViewItems(row)">查看评分项</el-button>
|
||||||
|
<el-button v-if="row.status !== 4" style="color: #f56c6c" type="text" @click="handleDisable(row)">禁用</el-button>
|
||||||
|
<el-button v-if="row.status === 4" style="color: #67c23a" type="text" @click="handleEnable(row)">启用</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -103,16 +114,21 @@
|
|||||||
@current-change="handleCurrentChange"
|
@current-change="handleCurrentChange"
|
||||||
@size-change="handleSizeChange"
|
@size-change="handleSizeChange"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<topic-edit ref="edit" @fetch-data="fetchData" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getList } from '@/api/rating/topic'
|
import { getList } from '@/api/rating/topic'
|
||||||
|
import { reviewTopic } from '@/api/rating/topicOperate'
|
||||||
import { formatTime } from '@/utils'
|
import { formatTime } from '@/utils'
|
||||||
import { getThumbUrl } from '@/utils/blessing'
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
import TopicEdit from './components/TopicEdit'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RatingTopicIndex',
|
name: 'RatingTopicIndex',
|
||||||
|
components: { TopicEdit },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
list: [],
|
list: [],
|
||||||
@@ -124,6 +140,7 @@
|
|||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
keyword: '',
|
keyword: '',
|
||||||
|
status: '',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -133,6 +150,9 @@
|
|||||||
methods: {
|
methods: {
|
||||||
formatTime,
|
formatTime,
|
||||||
getThumbUrl,
|
getThumbUrl,
|
||||||
|
handleAdd() {
|
||||||
|
this.$refs['edit'].showEdit()
|
||||||
|
},
|
||||||
handleSizeChange(val) {
|
handleSizeChange(val) {
|
||||||
this.queryForm.pageSize = val
|
this.queryForm.pageSize = val
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
@@ -163,6 +183,50 @@
|
|||||||
query: { topicId: row.id },
|
query: { topicId: row.id },
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
handleDisable(row) {
|
||||||
|
this.$confirm('确定要禁用该话题吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
try {
|
||||||
|
const { msg } = await reviewTopic({
|
||||||
|
topicId: row.id,
|
||||||
|
userId: this.$store.state.user.userId || '',
|
||||||
|
status: 4,
|
||||||
|
type: 'topic',
|
||||||
|
})
|
||||||
|
this.$baseMessage(msg || '已禁用', 'success')
|
||||||
|
this.fetchData()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
},
|
||||||
|
handleEnable(row) {
|
||||||
|
this.$confirm('确定要启用该话题吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
try {
|
||||||
|
const { msg } = await reviewTopic({
|
||||||
|
topicId: row.id,
|
||||||
|
userId: this.$store.state.user.userId || '',
|
||||||
|
status: 2,
|
||||||
|
type: 'topic',
|
||||||
|
})
|
||||||
|
this.$baseMessage(msg || '已启用', 'success')
|
||||||
|
this.fetchData()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
|
||||||
|
<el-form ref="form" label-width="80px" :model="form" :rules="rules">
|
||||||
|
<el-form-item label="分类名称" prop="title">
|
||||||
|
<el-input v-model.trim="form.title" placeholder="请输入分类名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="排序" prop="sort">
|
||||||
|
<el-input-number v-model="form.sort" :min="0" placeholder="数字越大越靠前" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="close">取 消</el-button>
|
||||||
|
<el-button :loading="saving" type="primary" @click="save">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { doEdit } from '@/api/rating/topicCategory'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'TopicCategoryEdit',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '编辑话题分类',
|
||||||
|
dialogFormVisible: false,
|
||||||
|
saving: false,
|
||||||
|
form: {
|
||||||
|
title: '',
|
||||||
|
sort: 0,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
title: [{ required: true, trigger: 'blur', message: '请输入分类名称' }],
|
||||||
|
},
|
||||||
|
id: '',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showEdit(row) {
|
||||||
|
if (!row) {
|
||||||
|
// 当前接口似乎只提供了编辑,如果需要新增可在此扩展
|
||||||
|
this.title = '添加话题分类'
|
||||||
|
this.id = ''
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
} else {
|
||||||
|
this.title = '编辑话题分类'
|
||||||
|
this.id = row.id
|
||||||
|
this.form = {
|
||||||
|
title: row.title || '',
|
||||||
|
sort: row.sort || 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.dialogFormVisible = true
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$refs['form'].resetFields()
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.id = ''
|
||||||
|
this.saving = false
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
},
|
||||||
|
save() {
|
||||||
|
this.$refs['form'].validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.saving = true
|
||||||
|
try {
|
||||||
|
if (this.id) {
|
||||||
|
const { msg } = await doEdit(this.id, this.form)
|
||||||
|
this.$baseMessage(msg || '编辑成功', 'success')
|
||||||
|
}
|
||||||
|
this.$emit('fetch-data')
|
||||||
|
this.close()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.saving = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
141
src/views/rating/topicCategory/index.vue
Normal file
141
src/views/rating/topicCategory/index.vue
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
<template>
|
||||||
|
<div class="topic-category-container">
|
||||||
|
<vab-query-form>
|
||||||
|
<vab-query-form-right-panel :span="24">
|
||||||
|
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
||||||
|
<el-form-item>
|
||||||
|
<el-input v-model.trim="queryForm.keyword" clearable placeholder="请输入分类名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</vab-query-form-right-panel>
|
||||||
|
</vab-query-form>
|
||||||
|
|
||||||
|
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||||
|
<el-table-column align="center" label="分类名称" min-width="150" prop="title" width="100" />
|
||||||
|
<el-table-column align="center" label="排序" prop="sort" width="120">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-input v-model="row.sort" placeholder="排序" size="mini" @blur="handleMove(row)" @keyup.enter.native="handleMove(row)" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="状态" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-switch v-model="row.enable" :active-value="true" :inactive-value="false" @change="handleToggleStatus(row)" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="操作" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="text" @click="handleEdit(row)">编辑</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<el-pagination
|
||||||
|
background
|
||||||
|
:current-page="queryForm.pageNo"
|
||||||
|
:layout="layout"
|
||||||
|
:page-size="queryForm.pageSize"
|
||||||
|
:total="total"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<topic-category-edit ref="edit" @fetch-data="fetchData" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getList, toggleEnable, moveTo } from '@/api/rating/topicCategory'
|
||||||
|
import { formatTime } from '@/utils'
|
||||||
|
import TopicCategoryEdit from './components/TopicCategoryEdit'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RatingTopicCategoryIndex',
|
||||||
|
components: { TopicCategoryEdit },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: [],
|
||||||
|
listLoading: true,
|
||||||
|
layout: 'total, sizes, prev, pager, next, jumper',
|
||||||
|
total: 0,
|
||||||
|
elementLoadingText: '正在加载...',
|
||||||
|
queryForm: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
keyword: '',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime,
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.queryForm.pageSize = val
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.queryForm.pageNo = val
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
queryData() {
|
||||||
|
this.queryForm.pageNo = 1
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
async fetchData() {
|
||||||
|
this.listLoading = true
|
||||||
|
try {
|
||||||
|
const { data } = await getList(this.queryForm)
|
||||||
|
this.list = data.list
|
||||||
|
this.total = data.totalCount
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.listLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleEdit(row) {
|
||||||
|
this.$refs['edit'].showEdit(row)
|
||||||
|
},
|
||||||
|
async handleToggleStatus(row) {
|
||||||
|
try {
|
||||||
|
const { msg } = await toggleEnable(row.id, row.enable)
|
||||||
|
this.$baseMessage(msg || '状态切换成功', 'success')
|
||||||
|
this.fetchData()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
row.enable = !row.enable
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async handleMove(row) {
|
||||||
|
// 如果输入为空或不是数字,给出提示并重新获取列表恢复原值
|
||||||
|
const sortVal = Number(row.sort)
|
||||||
|
if (isNaN(sortVal)) {
|
||||||
|
this.$message.error('排序必须是数字')
|
||||||
|
this.fetchData()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { msg } = await moveTo(row.id, sortVal)
|
||||||
|
this.$baseMessage(msg || '移动成功', 'success')
|
||||||
|
this.fetchData()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
this.fetchData()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.topic-category-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
|
||||||
|
<el-form ref="form" label-width="80px" :model="form" :rules="rules">
|
||||||
|
<el-form-item label="点赞用户" prop="userId">
|
||||||
|
<el-select v-model="form.userId" v-loadmore="loadMoreRobots" filterable placeholder="请选择执行点赞的机器人" style="width: 100%">
|
||||||
|
<el-option v-for="item in robotList" :key="item.id" :label="item.nickname || item.id" :value="item.id">
|
||||||
|
<div style="display: flex; align-items: center">
|
||||||
|
<el-image
|
||||||
|
v-if="item.avatar"
|
||||||
|
:src="getThumbUrl(item.avatar)"
|
||||||
|
style="width: 24px; height: 24px; border-radius: 50%; margin-right: 10px"
|
||||||
|
/>
|
||||||
|
<span>{{ item.nickname || '未知用户' }}</span>
|
||||||
|
</div>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="close">取 消</el-button>
|
||||||
|
<el-button :loading="saving" type="primary" @click="save">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getListBase as getRobotList } from '@/api/system/robot'
|
||||||
|
import { commentLike } from '@/api/rating/topicOperate'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RecordCommentLikeEdit',
|
||||||
|
directives: {
|
||||||
|
loadmore: {
|
||||||
|
bind(el, binding) {
|
||||||
|
setTimeout(() => {
|
||||||
|
const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap')
|
||||||
|
if (SELECTWRAP_DOM) {
|
||||||
|
SELECTWRAP_DOM.addEventListener('scroll', function () {
|
||||||
|
const condition = this.scrollHeight - this.scrollTop <= this.clientHeight + 2
|
||||||
|
if (condition) {
|
||||||
|
binding.value()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, 0)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '选择机器人点赞',
|
||||||
|
dialogFormVisible: false,
|
||||||
|
saving: false,
|
||||||
|
form: {
|
||||||
|
commentId: '',
|
||||||
|
userId: '',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
userId: [{ required: true, trigger: 'change', message: '请选择执行点赞的机器人' }],
|
||||||
|
},
|
||||||
|
|
||||||
|
// 机器人下拉列表状态
|
||||||
|
robotList: [],
|
||||||
|
robotQuery: {
|
||||||
|
appId: '6a0d7dbe4c5de50f2ba66475',
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
commentId: '',
|
||||||
|
},
|
||||||
|
robotTotal: 0,
|
||||||
|
fetchingRobots: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getThumbUrl,
|
||||||
|
showEdit(row) {
|
||||||
|
this.title = '选择机器人点赞'
|
||||||
|
this.dialogFormVisible = true
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.form.commentId = row.id
|
||||||
|
|
||||||
|
// 重置列表并加载第一页
|
||||||
|
this.robotList = []
|
||||||
|
this.robotQuery.pageNo = 1
|
||||||
|
this.robotQuery.commentId = row.id
|
||||||
|
this.robotTotal = 0
|
||||||
|
this.fetchRobotList()
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$refs['form'].resetFields()
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
},
|
||||||
|
async fetchRobotList() {
|
||||||
|
if (this.fetchingRobots) return
|
||||||
|
this.fetchingRobots = true
|
||||||
|
try {
|
||||||
|
const { data } = await getRobotList(this.robotQuery)
|
||||||
|
this.robotList = this.robotList.concat(data.list || [])
|
||||||
|
this.robotTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingRobots = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreRobots() {
|
||||||
|
if (this.robotList.length >= this.robotTotal || this.fetchingRobots) return
|
||||||
|
this.robotQuery.pageNo += 1
|
||||||
|
this.fetchRobotList()
|
||||||
|
},
|
||||||
|
save() {
|
||||||
|
this.$refs['form'].validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.saving = true
|
||||||
|
try {
|
||||||
|
const { msg } = await commentLike(this.form)
|
||||||
|
this.$baseMessage(msg || '点赞成功', 'success')
|
||||||
|
this.close()
|
||||||
|
this.$emit('fetch-data')
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.saving = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -83,6 +83,12 @@
|
|||||||
</vab-query-form>
|
</vab-query-form>
|
||||||
|
|
||||||
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||||
|
<el-table-column align="center" fixed="left" label="操作" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="text" @click="handleLike(row)">点赞</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="left" label="评论内容" min-width="250">
|
<el-table-column align="left" label="评论内容" min-width="250">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="comment-content-cell">
|
<div class="comment-content-cell">
|
||||||
@@ -165,6 +171,7 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<record-comment-edit ref="commentEdit" @fetch-data="fetchData" />
|
<record-comment-edit ref="commentEdit" @fetch-data="fetchData" />
|
||||||
|
<record-comment-like-edit ref="likeEdit" @fetch-data="fetchData" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -176,10 +183,11 @@
|
|||||||
import { formatTime } from '@/utils'
|
import { formatTime } from '@/utils'
|
||||||
import { getThumbUrl } from '@/utils/blessing'
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
import RecordCommentEdit from './components/RecordCommentEdit'
|
import RecordCommentEdit from './components/RecordCommentEdit'
|
||||||
|
import RecordCommentLikeEdit from './components/RecordCommentLikeEdit'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RatingTopicCommentIndex',
|
name: 'RatingTopicCommentIndex',
|
||||||
components: { RecordCommentEdit },
|
components: { RecordCommentEdit, RecordCommentLikeEdit },
|
||||||
directives: {
|
directives: {
|
||||||
loadmore: {
|
loadmore: {
|
||||||
bind(el, binding) {
|
bind(el, binding) {
|
||||||
@@ -340,6 +348,9 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// -- 列表数据加载 --
|
// -- 列表数据加载 --
|
||||||
|
handleLike(row) {
|
||||||
|
this.$refs['likeEdit'].showEdit(row)
|
||||||
|
},
|
||||||
handleCommentNow() {
|
handleCommentNow() {
|
||||||
this.$refs['commentEdit'].showEdit()
|
this.$refs['commentEdit'].showEdit()
|
||||||
},
|
},
|
||||||
|
|||||||
77
src/views/rating/topicReview/components/ReviewEdit.vue
Normal file
77
src/views/rating/topicReview/components/ReviewEdit.vue
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
|
||||||
|
<el-form ref="form" label-width="100px" :model="form">
|
||||||
|
<el-form-item label="审核结果">
|
||||||
|
<el-tag :type="form.status === 2 ? 'success' : 'danger'">
|
||||||
|
{{ form.status === 2 ? '通过' : '拒绝' }}
|
||||||
|
</el-tag>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="form.status === 3" label="拒绝原因">
|
||||||
|
<el-input v-model="form.rejectReason" placeholder="选填,请输入拒绝原因" :rows="3" type="textarea" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="审核备注">
|
||||||
|
<el-input v-model="form.auditRemark" placeholder="选填,请输入内部审核备注" :rows="3" type="textarea" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="close">取 消</el-button>
|
||||||
|
<el-button :loading="saving" type="primary" @click="save">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { reviewTopic } from '@/api/rating/topicOperate'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ReviewEdit',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '审核确认',
|
||||||
|
dialogFormVisible: false,
|
||||||
|
saving: false,
|
||||||
|
form: {
|
||||||
|
topicId: '',
|
||||||
|
itemId: '',
|
||||||
|
userId: '',
|
||||||
|
status: '',
|
||||||
|
type: '', // topic 或 topicItem
|
||||||
|
rejectReason: '',
|
||||||
|
auditRemark: '',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showEdit(row, status, type) {
|
||||||
|
this.title = `审核确认 (${type === 'topic' ? '话题' : '评价项'})`
|
||||||
|
this.form = {
|
||||||
|
topicId: type === 'topic' ? row.id : row.topicId || '',
|
||||||
|
itemId: type === 'topicItem' ? row.id : '',
|
||||||
|
userId: this.$store.state.user.userId || '',
|
||||||
|
status,
|
||||||
|
type,
|
||||||
|
rejectReason: '',
|
||||||
|
auditRemark: '',
|
||||||
|
}
|
||||||
|
this.dialogFormVisible = true
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
this.saving = false
|
||||||
|
},
|
||||||
|
async save() {
|
||||||
|
this.saving = true
|
||||||
|
try {
|
||||||
|
const { msg } = await reviewTopic(this.form)
|
||||||
|
this.$baseMessage(msg || '操作成功', 'success')
|
||||||
|
this.$emit('fetch-data')
|
||||||
|
this.close()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.saving = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
275
src/views/rating/topicReview/index.vue
Normal file
275
src/views/rating/topicReview/index.vue
Normal file
@@ -0,0 +1,275 @@
|
|||||||
|
<template>
|
||||||
|
<div class="rating-topic-review-container">
|
||||||
|
<vab-query-form>
|
||||||
|
<vab-query-form-right-panel :span="24">
|
||||||
|
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
||||||
|
<el-form-item>
|
||||||
|
<el-input v-model.trim="queryForm.keyword" clearable placeholder="请输入评价主题" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</vab-query-form-right-panel>
|
||||||
|
</vab-query-form>
|
||||||
|
|
||||||
|
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||||
|
<!-- 展开行,展示评价项(topicItems) -->
|
||||||
|
<el-table-column type="expand">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div v-if="row.topicItems && row.topicItems.length > 0" class="expand-content">
|
||||||
|
<h4>包含的评价项列表</h4>
|
||||||
|
<el-table border :data="row.topicItems" size="mini" style="width: 100%">
|
||||||
|
<el-table-column align="center" label="评价项" min-width="150">
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="item-info">
|
||||||
|
<el-image v-if="scope.row.avatarUrl" class="item-avatar" :src="getThumbUrl(scope.row.avatarUrl)" />
|
||||||
|
<span>{{ scope.row.name }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="状态" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag v-if="scope.row.status === 1" size="mini" type="warning">审核中</el-tag>
|
||||||
|
<el-tag v-else-if="scope.row.status === 2" size="mini" type="success">已审通过</el-tag>
|
||||||
|
<el-tag v-else-if="scope.row.status === 3" size="mini" type="danger">已拒绝</el-tag>
|
||||||
|
<el-tag v-else-if="scope.row.status === 4" size="mini" type="info">禁用</el-tag>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="创建时间" prop="createdAt" width="160">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ formatTime(scope.row.createdAt) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="操作" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button size="mini" type="success" @click="handleReview(scope.row, 2, 'topicItem')">通过</el-button>
|
||||||
|
<el-button size="mini" type="danger" @click="handleReview(scope.row, 3, 'topicItem')">拒绝</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<div v-else class="expand-empty">该话题下暂无评价项</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="left" label="评价主题" width="250">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="topic-info-cell">
|
||||||
|
<div class="topic-details">
|
||||||
|
<div class="topic-title">{{ row.title }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="left" label="类型" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="topic-info-cell">
|
||||||
|
<div class="topic-details">
|
||||||
|
<div class="topic-title">{{ row.category }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="状态" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag v-if="row.status === 1" type="warning">审核中</el-tag>
|
||||||
|
<el-tag v-else-if="row.status === 2" type="success">已审通过</el-tag>
|
||||||
|
<el-tag v-else-if="row.status === 3" type="danger">已拒绝</el-tag>
|
||||||
|
<el-tag v-else-if="row.status === 4" type="info">禁用</el-tag>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="创建时间" prop="createdAt" width="160">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ formatTime(row.createdAt) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="操作" width="180">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button size="mini" type="success" @click="handleReview(row, 2, 'topic')">通过</el-button>
|
||||||
|
<el-button size="mini" type="danger" @click="handleReview(row, 3, 'topic')">拒绝</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<el-pagination
|
||||||
|
background
|
||||||
|
:current-page="queryForm.pageNo"
|
||||||
|
:layout="layout"
|
||||||
|
:page-size="queryForm.pageSize"
|
||||||
|
:total="total"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<review-edit ref="edit" @fetch-data="fetchData" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getPendingList } from '@/api/rating/topic'
|
||||||
|
import { formatTime } from '@/utils'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
import ReviewEdit from './components/ReviewEdit'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RatingTopicReviewIndex',
|
||||||
|
components: { ReviewEdit },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: [],
|
||||||
|
listLoading: true,
|
||||||
|
layout: 'total, sizes, prev, pager, next, jumper',
|
||||||
|
total: 0,
|
||||||
|
elementLoadingText: '正在加载...',
|
||||||
|
queryForm: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
keyword: '',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime,
|
||||||
|
getThumbUrl,
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.queryForm.pageSize = val
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.queryForm.pageNo = val
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
queryData() {
|
||||||
|
this.queryForm.pageNo = 1
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
async fetchData() {
|
||||||
|
this.listLoading = true
|
||||||
|
try {
|
||||||
|
const { data } = await getPendingList(this.queryForm)
|
||||||
|
this.list = data.list
|
||||||
|
this.total = data.totalCount
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.listLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleReview(row, status, type) {
|
||||||
|
this.$refs['edit'].showEdit(row, status, type)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.rating-topic-review-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.expand-content {
|
||||||
|
padding: 15px 40px;
|
||||||
|
background-color: #fafafa;
|
||||||
|
border-radius: 4px;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.expand-content h4 {
|
||||||
|
margin: 0 0 15px 0;
|
||||||
|
color: #606266;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.expand-empty {
|
||||||
|
padding: 20px;
|
||||||
|
text-align: center;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
.item-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.item-avatar {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topic-info-cell {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topic-cover,
|
||||||
|
.topic-cover-placeholder {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-right: 12px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topic-cover-placeholder {
|
||||||
|
background-color: #f0f2f5;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #909399;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topic-details {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topic-title {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topic-desc {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-cell {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-label {
|
||||||
|
color: #909399;
|
||||||
|
width: 90px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-value {
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user