Compare commits
9 Commits
5.0.2
...
c60ea798fd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c60ea798fd | ||
|
|
f2389e73aa | ||
|
|
fe7613c6df | ||
|
|
7d62377380 | ||
|
|
93da905e1d | ||
|
|
1361bf34f8 | ||
|
|
a34ed84a29 | ||
|
|
a263e8a7e0 | ||
|
|
bb819d07a1 |
@@ -26,7 +26,7 @@ export function getParticipantList(data) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* pk 投票
|
* pk 投票
|
||||||
* @param { pkId: string, itemId: string, userId: string } data
|
* @param { pkId: string, itemId: string, userId?: string, count?: number } data
|
||||||
*/
|
*/
|
||||||
export function vote(data) {
|
export function vote(data) {
|
||||||
return request({
|
return request({
|
||||||
@@ -97,3 +97,18 @@ export function toggleEnable(data) {
|
|||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改评论状态
|
||||||
|
* @param {*} { id, enable: boolean }
|
||||||
|
* @param { enable: boolean } data 是否启用
|
||||||
|
* @param { id: string } data 评论id
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function commentStatus(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/pk/comment/toggle',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -66,3 +66,17 @@ export function toggleEnable(id, isEnabled) {
|
|||||||
data: { isEnabled },
|
data: { isEnabled },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 置顶话题置顶状态
|
||||||
|
* @param {id: string} id 话题 id
|
||||||
|
* @param {isPinned: boolean} 是否置顶话题
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function pinnedTopic(id, isPinned) {
|
||||||
|
return request({
|
||||||
|
url: `/management/api/rating/topic/pinned/${id}`,
|
||||||
|
method: 'patch',
|
||||||
|
data: { isPinned },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -58,3 +58,16 @@ export function getPendingList(data) {
|
|||||||
params: data,
|
params: data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给某个分数段投票
|
||||||
|
* @param {topicId: string, itemId: string, score: number, count: number} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function ItemScorevote(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topicItem/vote/robot',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export function scoreRecordList(data) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 评论记录
|
* 评论记录
|
||||||
* @param {*} { pageNo, pageSize, userId?, topicId?, itemId?, trueUser? }
|
* @param {*} { pageNo, pageSize, userId?, topicId?, itemId?, trueUser?, rootCommentId? }
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function userCommentList(data) {
|
export function userCommentList(data) {
|
||||||
@@ -42,7 +42,9 @@ export function userCommentList(data) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 评论
|
* 评论
|
||||||
* @param {*} { topicId, itemId, comment, userId }
|
* @param {*} { topicId, itemId, comment, userId,parentCommentId, replyToCommentId, }
|
||||||
|
* @param { parentCommentId: string } data 评论回复必传
|
||||||
|
* @param { replyToCommentId: string } data 回复必传
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function comment(data) {
|
export function comment(data) {
|
||||||
@@ -53,6 +55,21 @@ export function comment(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改评论状态
|
||||||
|
* @param {*} { id, enable: boolean }
|
||||||
|
* @param { enable: boolean } data 是否启用
|
||||||
|
* @param { id: string } data 评论id
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function commentStatus(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topicItemOperate/comment/toggle',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 评论点赞
|
* 评论点赞
|
||||||
* @param {*} { commentId, userId }
|
* @param {*} { commentId, userId }
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export function getList(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取机器人列表(基础信息) {appId, pageNo, pageSize, topicId, itemId, commentId?}
|
* 获取机器人列表(基础信息) {appId, pageNo, pageSize, topicId, itemId, commentId?, pkId?}
|
||||||
* @param {*} data
|
* @param {*} data
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
@@ -21,10 +21,10 @@ export function getListBase(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generate(appId) {
|
export function generate(appId, count) {
|
||||||
return request({
|
return request({
|
||||||
url: 'management/api/system/robot',
|
url: 'management/api/system/robot',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: { appId },
|
data: { appId, count },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
108
src/components/UserInfo/index.vue
Normal file
108
src/components/UserInfo/index.vue
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<template>
|
||||||
|
<div class="user-info-component">
|
||||||
|
<div v-if="user" class="user-info-cell" :class="{ 'is-clickable': !user.isRobot }" @click="handleUserClick">
|
||||||
|
<el-image v-if="user.avatar" class="user-avatar" :preview-src-list="[user.avatar]" :src="getThumbUrl(user.avatar)" @click.stop />
|
||||||
|
<div v-else class="user-avatar-placeholder"><i class="el-icon-user" /></div>
|
||||||
|
<div class="user-details">
|
||||||
|
<div class="user-nickname" :class="{ 'hover-link': !user.isRobot }">
|
||||||
|
{{ user.nickname || '未知用户' }}
|
||||||
|
<el-tag v-if="user.isRobot" size="mini" style="margin-left: 4px" type="info">机器人</el-tag>
|
||||||
|
<el-tag v-else size="mini" style="margin-left: 4px" type="success">真人</el-tag>
|
||||||
|
</div>
|
||||||
|
<div class="user-id">{{ user.id }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else class="user-details">
|
||||||
|
<div class="user-id">{{ userId }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'UserInfo',
|
||||||
|
props: {
|
||||||
|
user: {
|
||||||
|
type: Object,
|
||||||
|
default: () => null,
|
||||||
|
},
|
||||||
|
userId: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getThumbUrl,
|
||||||
|
handleUserClick() {
|
||||||
|
if (this.user && !this.user.isRobot) {
|
||||||
|
// 跳转到用户页面
|
||||||
|
this.$router.push({
|
||||||
|
path: '/spring/user/user',
|
||||||
|
query: { userId: this.user.id },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.user-info-component {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-info-cell {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-clickable:hover .hover-link {
|
||||||
|
color: #409eff;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-avatar,
|
||||||
|
.user-avatar-placeholder {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 12px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-avatar-placeholder {
|
||||||
|
background-color: #f0f2f5;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #909399;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-details {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-nickname {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
transition: color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-id {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -27,31 +27,13 @@
|
|||||||
|
|
||||||
<el-table-column align="left" label="用户信息" min-width="180">
|
<el-table-column align="left" label="用户信息" min-width="180">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div v-if="row.user" class="user-info-cell">
|
<user-info :user="row.user" :user-id="row.userId" />
|
||||||
<el-image
|
|
||||||
v-if="row.user.avatar"
|
|
||||||
class="user-avatar"
|
|
||||||
:preview-src-list="[row.user.avatar]"
|
|
||||||
:src="getThumbUrl(row.user.avatar)"
|
|
||||||
/>
|
|
||||||
<div v-else class="user-avatar-placeholder"><i class="el-icon-user" /></div>
|
|
||||||
<div class="user-details">
|
|
||||||
<div class="user-nickname">
|
|
||||||
{{ row.user.nickname || '未知用户' }}
|
|
||||||
<el-tag v-if="row.user.isRobot" size="mini" style="margin-left: 4px" type="info">机器人</el-tag>
|
|
||||||
<el-tag v-else size="mini" style="margin-left: 4px" type="success">真人</el-tag>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else class="user-details">
|
|
||||||
<div class="user-id">{{ row.userId }}</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="center" label="状态切换" width="80">
|
<el-table-column align="center" label="状态切换" width="80">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-switch v-model="row.enable" :active-value="true" :inactive-value="false" @change="handleToggleStatus(row)" />
|
<el-switch v-model="row.status" :active-value="2" :inactive-value="4" @change="handleToggleStatus(row)" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
@@ -75,12 +57,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getCommentList, toggleEnable } from '@/api/rating/pk'
|
import { getCommentList, commentStatus } from '@/api/rating/pk'
|
||||||
import { formatTime } from '@/utils'
|
import { formatTime } from '@/utils'
|
||||||
import { getThumbUrl } from '@/utils/blessing'
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
import UserInfo from '@/components/UserInfo'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CommentReplyList',
|
name: 'CommentReplyList',
|
||||||
|
components: { UserInfo },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
title: '回复列表',
|
title: '回复列表',
|
||||||
@@ -142,11 +126,12 @@
|
|||||||
},
|
},
|
||||||
async handleToggleStatus(row) {
|
async handleToggleStatus(row) {
|
||||||
try {
|
try {
|
||||||
const { msg } = await toggleEnable({ id: row.id, enable: row.enable })
|
const enable = row.status === 2
|
||||||
|
const { msg } = await commentStatus({ id: row.id, enable })
|
||||||
this.$baseMessage(msg || '状态切换成功', 'success')
|
this.$baseMessage(msg || '状态切换成功', 'success')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
row.enable = !row.enable
|
row.status = row.status === 2 ? 4 : 2
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -188,46 +173,4 @@
|
|||||||
.meta-item i {
|
.meta-item i {
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-info-cell {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-avatar,
|
|
||||||
.user-avatar-placeholder {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 8px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-avatar-placeholder {
|
|
||||||
background-color: #f0f2f5;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: #909399;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-details {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-nickname {
|
|
||||||
font-weight: bold;
|
|
||||||
color: #303133;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-id {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #909399;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -95,9 +95,9 @@
|
|||||||
getThumbUrl,
|
getThumbUrl,
|
||||||
getPkLabel(item) {
|
getPkLabel(item) {
|
||||||
if (!item) return ''
|
if (!item) return ''
|
||||||
const left = item.leftItem ? item.leftItem.name : '未知'
|
const left = item.leftItemName ? item.leftItemName : '未知'
|
||||||
const right = item.rightItem ? item.rightItem.name : '未知'
|
const right = item.rightItemName ? item.rightItemName : '未知'
|
||||||
return `[${item.topic ? item.topic.title : '未知主题'}] ${left} vs ${right}`
|
return `[${item.topicTitle ? item.topicTitle : '未知主题'}] ${left} vs ${right}`
|
||||||
},
|
},
|
||||||
showEdit(replyToRow = null, parentCommentId = null) {
|
showEdit(replyToRow = null, parentCommentId = null) {
|
||||||
this.dialogFormVisible = true
|
this.dialogFormVisible = true
|
||||||
|
|||||||
@@ -65,12 +65,12 @@
|
|||||||
|
|
||||||
<el-table-column align="left" label="PK赛目标" min-width="250">
|
<el-table-column align="left" label="PK赛目标" min-width="250">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div v-if="row.pk" class="target-info-cell">
|
<div v-if="row.leftItemName && row.rightItemName" class="target-info-cell">
|
||||||
<div class="topic-title">[{{ row.pk.topic ? row.pk.topic.title : '未知主题' }}]</div>
|
<div class="topic-title">[{{ row.topicTitle ? row.topicTitle : '未知主题' }}]</div>
|
||||||
<div class="item-info">
|
<div class="item-info">
|
||||||
<span>{{ row.pk.leftItem ? row.pk.leftItem.name : '未知' }}</span>
|
<span>{{ row.leftItemName ? row.leftItemName : '未知123' }}</span>
|
||||||
<span style="margin: 0 8px; color: #f56c6c; font-weight: bold">VS</span>
|
<span style="margin: 0 8px; color: #f56c6c; font-weight: bold">VS</span>
|
||||||
<span>{{ row.pk.rightItem ? row.pk.rightItem.name : '未知' }}</span>
|
<span>{{ row.rightItemName ? row.rightItemName : '未知123' }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>{{ row.pkId }}</div>
|
<div v-else>{{ row.pkId }}</div>
|
||||||
@@ -79,32 +79,13 @@
|
|||||||
|
|
||||||
<el-table-column align="left" label="用户信息" min-width="200">
|
<el-table-column align="left" label="用户信息" min-width="200">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div v-if="row.user" class="user-info-cell">
|
<user-info :user="row.user" :user-id="row.userId" />
|
||||||
<el-image
|
|
||||||
v-if="row.user.avatar"
|
|
||||||
class="user-avatar"
|
|
||||||
:preview-src-list="[row.user.avatar]"
|
|
||||||
:src="getThumbUrl(row.user.avatar)"
|
|
||||||
/>
|
|
||||||
<div v-else class="user-avatar-placeholder"><i class="el-icon-user" /></div>
|
|
||||||
<div class="user-details">
|
|
||||||
<div class="user-nickname">
|
|
||||||
{{ row.user.nickname || '未知用户' }}
|
|
||||||
<el-tag v-if="row.user.isRobot" size="mini" style="margin-left: 4px" type="info">机器人</el-tag>
|
|
||||||
<el-tag v-else size="mini" style="margin-left: 4px" type="success">真人</el-tag>
|
|
||||||
</div>
|
|
||||||
<div class="user-id">{{ row.user.id }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else class="user-details">
|
|
||||||
<div class="user-id">{{ row.userId }}</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="center" label="状态切换" width="100">
|
<el-table-column align="center" label="状态切换" width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-switch v-model="row.enable" :active-value="true" :inactive-value="false" @change="handleToggleStatus(row)" />
|
<el-switch v-model="row.status" :active-value="2" :inactive-value="4" @change="handleToggleStatus(row)" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
@@ -132,16 +113,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getCommentList, toggleEnable, getList as getPkList } from '@/api/rating/pk'
|
import { getCommentList, commentStatus, getList as getPkList } from '@/api/rating/pk'
|
||||||
import { formatTime } from '@/utils'
|
import { formatTime } from '@/utils'
|
||||||
import { getThumbUrl } from '@/utils/blessing'
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
import UserInfo from '@/components/UserInfo'
|
||||||
import PkCommentEdit from './components/PkCommentEdit'
|
import PkCommentEdit from './components/PkCommentEdit'
|
||||||
import PkCommentLikeEdit from './components/PkCommentLikeEdit'
|
import PkCommentLikeEdit from './components/PkCommentLikeEdit'
|
||||||
import CommentReplyList from './components/CommentReplyList'
|
import CommentReplyList from './components/CommentReplyList'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PkComment',
|
name: 'PkComment',
|
||||||
components: { PkCommentEdit, PkCommentLikeEdit, CommentReplyList },
|
components: { PkCommentEdit, PkCommentLikeEdit, CommentReplyList, UserInfo },
|
||||||
directives: {
|
directives: {
|
||||||
loadmore: {
|
loadmore: {
|
||||||
bind(el, binding) {
|
bind(el, binding) {
|
||||||
@@ -189,9 +171,9 @@
|
|||||||
getThumbUrl,
|
getThumbUrl,
|
||||||
getPkLabel(item) {
|
getPkLabel(item) {
|
||||||
if (!item) return ''
|
if (!item) return ''
|
||||||
const left = item.leftItem ? item.leftItem.name : '未知'
|
const left = item.leftItemName ? item.leftItemName : '未知'
|
||||||
const right = item.rightItem ? item.rightItem.name : '未知'
|
const right = item.rightItemName ? item.rightItemName : '未知'
|
||||||
return `[${item.topic ? item.topic.title : '未知主题'}] ${left} vs ${right}`
|
return `[${item.topicTitle ? item.topicTitle : '未知主题'}] ${left} vs ${right}`
|
||||||
},
|
},
|
||||||
|
|
||||||
// -- PK 列表加载 --
|
// -- PK 列表加载 --
|
||||||
@@ -260,11 +242,13 @@
|
|||||||
},
|
},
|
||||||
async handleToggleStatus(row) {
|
async handleToggleStatus(row) {
|
||||||
try {
|
try {
|
||||||
const { msg } = await toggleEnable({ id: row.id, enable: row.enable })
|
// status: 2为启用,4为禁用
|
||||||
|
const enable = row.status === 2
|
||||||
|
const { msg } = await commentStatus({ id: row.id, enable })
|
||||||
this.$baseMessage(msg || '状态切换成功', 'success')
|
this.$baseMessage(msg || '状态切换成功', 'success')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
row.enable = !row.enable
|
row.status = row.status === 2 ? 4 : 2
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -330,47 +314,4 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #303133;
|
color: #303133;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-info-cell {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-avatar,
|
|
||||||
.user-avatar-placeholder {
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 12px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-avatar-placeholder {
|
|
||||||
background-color: #f0f2f5;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: #909399;
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-details {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-nickname {
|
|
||||||
font-weight: bold;
|
|
||||||
color: #303133;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-id {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #909399;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -3,14 +3,7 @@
|
|||||||
<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="150">
|
<el-table-column align="left" label="投票用户" min-width="150">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="user-info-cell">
|
<user-info :user="row" :user-id="row.id" />
|
||||||
<el-image v-if="row.avatar" class="user-avatar" :preview-src-list="[row.avatar]" :src="getThumbUrl(row.avatar)" />
|
|
||||||
<div v-else class="user-avatar-placeholder"><i class="el-icon-user" /></div>
|
|
||||||
<div class="user-details">
|
|
||||||
<div class="user-nickname">{{ row.nickname || '未知用户' }}</div>
|
|
||||||
<div class="user-id">{{ row.id }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -30,9 +23,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getParticipantList } from '@/api/rating/pk'
|
import { getParticipantList } from '@/api/rating/pk'
|
||||||
import { getThumbUrl } from '@/utils/blessing'
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
import UserInfo from '@/components/UserInfo'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PkParticipantList',
|
name: 'PkParticipantList',
|
||||||
|
components: { UserInfo },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
title: '投票用户列表',
|
title: '投票用户列表',
|
||||||
@@ -87,47 +82,3 @@
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.user-info-cell {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-avatar,
|
|
||||||
.user-avatar-placeholder {
|
|
||||||
width: 36px;
|
|
||||||
height: 36px;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 10px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-avatar-placeholder {
|
|
||||||
background-color: #f0f2f5;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: #909399;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-details {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-nickname {
|
|
||||||
font-weight: bold;
|
|
||||||
color: #303133;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-id {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #909399;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -4,7 +4,14 @@
|
|||||||
<el-form-item label="支持项">
|
<el-form-item label="支持项">
|
||||||
<span style="font-weight: bold; color: #409eff">{{ targetName }}</span>
|
<span style="font-weight: bold; color: #409eff">{{ targetName }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="投票用户" prop="userId">
|
<el-form-item label="支持方式" prop="voteMode">
|
||||||
|
<el-radio-group v-model="form.voteMode">
|
||||||
|
<el-radio label="user">投票用户</el-radio>
|
||||||
|
<el-radio label="count">支持个数</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item v-if="form.voteMode === 'user'" label="投票用户" prop="userId">
|
||||||
<el-select v-model="form.userId" v-loadmore="loadMoreRobots" filterable placeholder="请选择投票的机器人" style="width: 100%">
|
<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">
|
<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">
|
<div style="display: flex; align-items: center">
|
||||||
@@ -18,6 +25,10 @@
|
|||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item v-if="form.voteMode === 'count'" label="支持个数" prop="count">
|
||||||
|
<el-input-number v-model="form.count" controls-position="right" :max="100000" :min="1" :step="1" style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
@@ -60,10 +71,12 @@
|
|||||||
form: {
|
form: {
|
||||||
pkId: '',
|
pkId: '',
|
||||||
itemId: '',
|
itemId: '',
|
||||||
|
voteMode: 'user',
|
||||||
userId: '',
|
userId: '',
|
||||||
|
count: 1,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
userId: [{ required: true, trigger: 'change', message: '请选择投票的机器人' }],
|
voteMode: [{ required: true, trigger: 'change', message: '请选择支持方式' }],
|
||||||
},
|
},
|
||||||
|
|
||||||
// 机器人下拉列表状态
|
// 机器人下拉列表状态
|
||||||
@@ -117,9 +130,26 @@
|
|||||||
save() {
|
save() {
|
||||||
this.$refs['form'].validate(async (valid) => {
|
this.$refs['form'].validate(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
if (this.form.voteMode === 'user' && !this.form.userId) {
|
||||||
|
this.$baseMessage('请选择投票的机器人', 'error')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (this.form.voteMode === 'count' && (!this.form.count || this.form.count < 1)) {
|
||||||
|
this.$baseMessage('请输入正确的支持个数', 'error')
|
||||||
|
return false
|
||||||
|
}
|
||||||
this.saving = true
|
this.saving = true
|
||||||
try {
|
try {
|
||||||
const { msg } = await vote(this.form)
|
const params = {
|
||||||
|
pkId: this.form.pkId,
|
||||||
|
itemId: this.form.itemId,
|
||||||
|
}
|
||||||
|
if (this.form.voteMode === 'user') {
|
||||||
|
params.userId = this.form.userId
|
||||||
|
} else {
|
||||||
|
params.count = this.form.count
|
||||||
|
}
|
||||||
|
const { msg } = await vote(params)
|
||||||
this.$baseMessage(msg || '投票成功', 'success')
|
this.$baseMessage(msg || '投票成功', 'success')
|
||||||
this.close()
|
this.close()
|
||||||
this.$emit('fetch-data')
|
this.$emit('fetch-data')
|
||||||
|
|||||||
@@ -94,6 +94,12 @@
|
|||||||
{{ formatTime(row.createdAt) }}
|
{{ formatTime(row.createdAt) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" fixed="right" label="操作" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="text" @click="handleComment(row)">评论</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<el-pagination
|
<el-pagination
|
||||||
@@ -109,13 +115,48 @@
|
|||||||
<pk-generate ref="generate" @fetch-data="fetchData" />
|
<pk-generate ref="generate" @fetch-data="fetchData" />
|
||||||
<pk-participant-list ref="participantList" />
|
<pk-participant-list ref="participantList" />
|
||||||
<pk-vote-edit ref="voteEdit" @fetch-data="fetchData" />
|
<pk-vote-edit ref="voteEdit" @fetch-data="fetchData" />
|
||||||
|
|
||||||
|
<el-dialog title="立即评论" :visible.sync="commentDialogVisible" width="600px" @close="closeCommentDialog">
|
||||||
|
<el-form ref="commentForm" label-width="100px" :model="commentForm" :rules="commentRules">
|
||||||
|
<el-form-item label="参与机器人" prop="userId">
|
||||||
|
<el-select
|
||||||
|
v-model="commentForm.userId"
|
||||||
|
v-loadmore="loadMoreCommentUsers"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择参与评论的机器人"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in commentUserList" :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-item label="评论内容" prop="content">
|
||||||
|
<el-input v-model="commentForm.content" maxlength="500" placeholder="请输入评论内容" :rows="4" show-word-limit type="textarea" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<div slot="footer">
|
||||||
|
<el-button @click="closeCommentDialog">取消</el-button>
|
||||||
|
<el-button :loading="commentSaving" type="primary" @click="submitComment">确定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getList } from '@/api/rating/pk'
|
import { comment, getList } from '@/api/rating/pk'
|
||||||
import { getList as getTopicList } from '@/api/rating/topic'
|
import { getList as getTopicList } from '@/api/rating/topic'
|
||||||
import { getList as getItemList } from '@/api/rating/topicItem'
|
import { getList as getItemList } from '@/api/rating/topicItem'
|
||||||
|
import { getListBase as getRobotListBase } from '@/api/system/robot'
|
||||||
import { formatTime } from '@/utils'
|
import { formatTime } from '@/utils'
|
||||||
import { getThumbUrl } from '@/utils/blessing'
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
import PkGenerate from './components/PkGenerate'
|
import PkGenerate from './components/PkGenerate'
|
||||||
@@ -172,6 +213,26 @@
|
|||||||
},
|
},
|
||||||
itemTotal: 0,
|
itemTotal: 0,
|
||||||
fetchingItems: false,
|
fetchingItems: false,
|
||||||
|
commentDialogVisible: false,
|
||||||
|
commentSaving: false,
|
||||||
|
commentForm: {
|
||||||
|
pkId: '',
|
||||||
|
userId: '',
|
||||||
|
content: '',
|
||||||
|
},
|
||||||
|
commentRules: {
|
||||||
|
userId: [{ required: true, trigger: 'change', message: '请选择参与评论的机器人' }],
|
||||||
|
content: [{ required: true, trigger: 'blur', message: '请输入评论内容' }],
|
||||||
|
},
|
||||||
|
commentUserList: [],
|
||||||
|
commentUserQuery: {
|
||||||
|
appId: '6a0d7dbe4c5de50f2ba66475',
|
||||||
|
pkId: '',
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
},
|
||||||
|
commentUserTotal: 0,
|
||||||
|
fetchingCommentUsers: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -281,6 +342,58 @@
|
|||||||
handleVote(pkId, itemId, itemName) {
|
handleVote(pkId, itemId, itemName) {
|
||||||
this.$refs['voteEdit'].showEdit(pkId, itemId, itemName)
|
this.$refs['voteEdit'].showEdit(pkId, itemId, itemName)
|
||||||
},
|
},
|
||||||
|
handleComment(row) {
|
||||||
|
this.commentDialogVisible = true
|
||||||
|
this.commentForm = {
|
||||||
|
pkId: row.id,
|
||||||
|
userId: '',
|
||||||
|
content: '',
|
||||||
|
}
|
||||||
|
this.commentUserList = []
|
||||||
|
this.commentUserTotal = 0
|
||||||
|
this.commentUserQuery.pageNo = 1
|
||||||
|
this.commentUserQuery.pkId = row.id
|
||||||
|
this.fetchCommentUsers()
|
||||||
|
},
|
||||||
|
closeCommentDialog() {
|
||||||
|
if (this.$refs['commentForm']) {
|
||||||
|
this.$refs['commentForm'].resetFields()
|
||||||
|
}
|
||||||
|
this.commentDialogVisible = false
|
||||||
|
},
|
||||||
|
async fetchCommentUsers() {
|
||||||
|
if (this.fetchingCommentUsers || !this.commentUserQuery.pkId) return
|
||||||
|
this.fetchingCommentUsers = true
|
||||||
|
try {
|
||||||
|
const { data } = await getRobotListBase(this.commentUserQuery)
|
||||||
|
this.commentUserList = this.commentUserList.concat(data.list || [])
|
||||||
|
this.commentUserTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingCommentUsers = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreCommentUsers() {
|
||||||
|
if (this.commentUserList.length >= this.commentUserTotal || this.fetchingCommentUsers) return
|
||||||
|
this.commentUserQuery.pageNo += 1
|
||||||
|
this.fetchCommentUsers()
|
||||||
|
},
|
||||||
|
submitComment() {
|
||||||
|
this.$refs['commentForm'].validate(async (valid) => {
|
||||||
|
if (!valid) return false
|
||||||
|
this.commentSaving = true
|
||||||
|
try {
|
||||||
|
const { msg } = await comment(this.commentForm)
|
||||||
|
this.$baseMessage(msg || '评论成功', 'success')
|
||||||
|
this.closeCommentDialog()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.commentSaving = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,11 +1,33 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="rating-topic-container">
|
<div class="rating-topic-container">
|
||||||
|
<el-alert
|
||||||
|
v-if="!queryForm.categoryId"
|
||||||
|
:closable="false"
|
||||||
|
show-icon
|
||||||
|
style="margin-bottom: 20px"
|
||||||
|
title="选择类别后可以置顶话题"
|
||||||
|
type="info"
|
||||||
|
/>
|
||||||
|
|
||||||
<vab-query-form>
|
<vab-query-form>
|
||||||
<vab-query-form-left-panel :span="12">
|
<vab-query-form-left-panel>
|
||||||
<el-button icon="el-icon-plus" type="primary" @click="handleAdd">创建话题</el-button>
|
<el-button icon="el-icon-plus" type="primary" @click="handleAdd">创建话题</el-button>
|
||||||
</vab-query-form-left-panel>
|
</vab-query-form-left-panel>
|
||||||
<vab-query-form-right-panel :span="12">
|
<vab-query-form-left-panel>
|
||||||
<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.categoryId"
|
||||||
|
v-loadmore="loadMoreCategories"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
placeholder="请选择分类"
|
||||||
|
style="width: 200px"
|
||||||
|
@change="queryData"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in categoryList" :key="item.id" :label="item.title" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-select v-model="queryForm.status" clearable placeholder="请选择状态" @change="queryData">
|
<el-select v-model="queryForm.status" clearable placeholder="请选择状态" @change="queryData">
|
||||||
<el-option label="审核中" :value="1" />
|
<el-option label="审核中" :value="1" />
|
||||||
@@ -21,7 +43,7 @@
|
|||||||
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
|
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</vab-query-form-right-panel>
|
</vab-query-form-left-panel>
|
||||||
</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">
|
||||||
@@ -46,10 +68,10 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="center" label="允许评论" width="100">
|
<el-table-column align="left" label="用户信息" min-width="200" width="300">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag v-if="row.allowComment === 1 || row.allowComment === true" type="success">是</el-tag>
|
<user-info v-if="row.user" :user="row.user" :user-id="row.userId" />
|
||||||
<el-tag v-else type="danger">否</el-tag>
|
<span v-else>系统创建</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
@@ -96,9 +118,15 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="center" label="操作" width="150">
|
<el-table-column align="center" label="操作" width="200">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button type="text" @click="handleViewItems(row)">查看评分项</el-button>
|
<el-button type="text" @click="handleViewItems(row)">查看评分项</el-button>
|
||||||
|
|
||||||
|
<template v-if="queryForm.categoryId">
|
||||||
|
<el-button v-if="!row.isPinned" style="color: #e6a23c" type="text" @click="handleTogglePin(row, true)">置顶</el-button>
|
||||||
|
<el-button v-else style="color: #909399" type="text" @click="handleTogglePin(row, false)">取消置顶</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
<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: #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>
|
<el-button v-if="row.status === 4" style="color: #67c23a" type="text" @click="handleEnable(row)">启用</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -120,15 +148,34 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getList } from '@/api/rating/topic'
|
import { getList, pinnedTopic } from '@/api/rating/topic'
|
||||||
|
import { getList as getCategoryList } from '@/api/rating/topicCategory'
|
||||||
import { reviewTopic } from '@/api/rating/topicOperate'
|
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'
|
import TopicEdit from './components/TopicEdit'
|
||||||
|
import UserInfo from '@/components/UserInfo'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RatingTopicIndex',
|
name: 'RatingTopicIndex',
|
||||||
components: { TopicEdit },
|
components: { TopicEdit, UserInfo },
|
||||||
|
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() {
|
data() {
|
||||||
return {
|
return {
|
||||||
list: [],
|
list: [],
|
||||||
@@ -141,15 +188,42 @@
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
keyword: '',
|
keyword: '',
|
||||||
status: '',
|
status: '',
|
||||||
|
categoryId: '',
|
||||||
},
|
},
|
||||||
|
categoryList: [],
|
||||||
|
categoryQuery: { pageNo: 1, pageSize: 20 },
|
||||||
|
categoryTotal: 0,
|
||||||
|
fetchingCategories: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
if (this.$route.query.topicId) {
|
||||||
|
this.queryForm.keyword = this.$route.query.topicId
|
||||||
|
}
|
||||||
|
this.fetchCategoryList()
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatTime,
|
formatTime,
|
||||||
getThumbUrl,
|
getThumbUrl,
|
||||||
|
async fetchCategoryList() {
|
||||||
|
if (this.fetchingCategories) return
|
||||||
|
this.fetchingCategories = true
|
||||||
|
try {
|
||||||
|
const { data } = await getCategoryList(this.categoryQuery)
|
||||||
|
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()
|
||||||
|
},
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.$refs['edit'].showEdit()
|
this.$refs['edit'].showEdit()
|
||||||
},
|
},
|
||||||
@@ -168,7 +242,9 @@
|
|||||||
async fetchData() {
|
async fetchData() {
|
||||||
this.listLoading = true
|
this.listLoading = true
|
||||||
try {
|
try {
|
||||||
const { data } = await getList(this.queryForm)
|
const params = { ...this.queryForm }
|
||||||
|
if (!params.categoryId) delete params.categoryId
|
||||||
|
const { data } = await getList(params)
|
||||||
this.list = data.list
|
this.list = data.list
|
||||||
this.total = data.totalCount
|
this.total = data.totalCount
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -183,6 +259,15 @@
|
|||||||
query: { topicId: row.id },
|
query: { topicId: row.id },
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
async handleTogglePin(row, isPinned) {
|
||||||
|
try {
|
||||||
|
const { msg } = await pinnedTopic(row.id, isPinned)
|
||||||
|
this.$baseMessage(msg || (isPinned ? '置顶成功' : '已取消置顶'), 'success')
|
||||||
|
this.fetchData()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
handleDisable(row) {
|
handleDisable(row) {
|
||||||
this.$confirm('确定要禁用该话题吗?', '提示', {
|
this.$confirm('确定要禁用该话题吗?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="评价主题" prop="topicId">
|
<el-form-item v-if="!isReply" label="评价主题" prop="topicId">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.topicId"
|
v-model="form.topicId"
|
||||||
v-loadmore="loadMoreTopics"
|
v-loadmore="loadMoreTopics"
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="评价项" prop="itemId">
|
<el-form-item v-if="!isReply" label="评价项" prop="itemId">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.itemId"
|
v-model="form.itemId"
|
||||||
v-loadmore="loadMoreItems"
|
v-loadmore="loadMoreItems"
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="评论内容" prop="content">
|
<el-form-item label="评论内容" prop="content">
|
||||||
<el-input v-model="form.content" maxlength="500" placeholder="请输入您的评论文字" :rows="4" show-word-limit type="textarea" />
|
<el-input v-model="form.content" maxlength="500" :placeholder="contentPlaceholder" :rows="4" show-word-limit type="textarea" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@@ -96,11 +96,15 @@
|
|||||||
title: '立即评论',
|
title: '立即评论',
|
||||||
dialogFormVisible: false,
|
dialogFormVisible: false,
|
||||||
saving: false,
|
saving: false,
|
||||||
|
isReply: false,
|
||||||
|
contentPlaceholder: '请输入您的评论文字',
|
||||||
form: {
|
form: {
|
||||||
userId: '',
|
userId: '',
|
||||||
topicId: '',
|
topicId: '',
|
||||||
itemId: '',
|
itemId: '',
|
||||||
content: '',
|
content: '',
|
||||||
|
parentCommentId: '',
|
||||||
|
replyToCommentId: '',
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
userId: [{ required: true, trigger: 'change', message: '请选择用户' }],
|
userId: [{ required: true, trigger: 'change', message: '请选择用户' }],
|
||||||
@@ -130,11 +134,31 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getThumbUrl,
|
getThumbUrl,
|
||||||
showEdit() {
|
showEdit(row = null, parentCommentId = null) {
|
||||||
this.title = '立即评论'
|
|
||||||
this.dialogFormVisible = true
|
this.dialogFormVisible = true
|
||||||
this.form = this.$options.data().form
|
this.form = this.$options.data().form
|
||||||
|
|
||||||
|
if (row) {
|
||||||
|
this.isReply = true
|
||||||
|
this.title = '回复评论'
|
||||||
|
this.contentPlaceholder = `回复 @${row.user ? row.user.nickname : '未知用户'}:`
|
||||||
|
|
||||||
|
this.form.parentCommentId = parentCommentId || row.id
|
||||||
|
this.form.replyToCommentId = row.id
|
||||||
|
|
||||||
|
if (row.rating) {
|
||||||
|
this.form.topicId = row.rating.topicId || row.rating.topic?.id || row.topicId
|
||||||
|
this.form.itemId = row.rating.itemId || row.rating.item?.id || row.itemId
|
||||||
|
} else {
|
||||||
|
this.form.topicId = row.topicId
|
||||||
|
this.form.itemId = row.itemId
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.isReply = false
|
||||||
|
this.title = '立即评论'
|
||||||
|
this.contentPlaceholder = '请输入您的评论文字'
|
||||||
|
}
|
||||||
|
|
||||||
// 重置列表数据
|
// 重置列表数据
|
||||||
this.userList = []
|
this.userList = []
|
||||||
this.userQuery.pageNo = 1
|
this.userQuery.pageNo = 1
|
||||||
@@ -151,7 +175,9 @@
|
|||||||
|
|
||||||
// 初始化加载第一页数据
|
// 初始化加载第一页数据
|
||||||
this.fetchUserList()
|
this.fetchUserList()
|
||||||
|
if (!this.isReply) {
|
||||||
this.fetchTopicList()
|
this.fetchTopicList()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
this.$refs['form'].resetFields()
|
this.$refs['form'].resetFields()
|
||||||
|
|||||||
@@ -0,0 +1,176 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogVisible" width="900px" @close="close">
|
||||||
|
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||||
|
<el-table-column align="center" fixed="left" label="操作" width="120">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="text" @click="handleLike(row)">点赞</el-button>
|
||||||
|
<el-button type="text" @click="handleReply(row)">回复</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="left" label="回复内容" min-width="250">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="comment-content-cell">
|
||||||
|
<div v-if="row.replyToUser" class="reply-target">回复 @{{ row.replyToUser.nickname || '未知用户' }}:</div>
|
||||||
|
<div class="content-text">{{ row.content }}</div>
|
||||||
|
<div class="comment-meta">
|
||||||
|
<span class="meta-item">
|
||||||
|
<i class="el-icon-thumb" />
|
||||||
|
{{ row.likeCount || 0 }}
|
||||||
|
</span>
|
||||||
|
<el-tag v-if="row.status === 2" size="mini" style="margin-left: 8px" type="success">已展示</el-tag>
|
||||||
|
<el-tag v-else size="mini" style="margin-left: 8px" type="info">隐藏/待审</el-tag>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="left" label="用户信息" min-width="180">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<user-info :user="row.user" :user-id="row.userId" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="状态切换" width="80">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-switch v-model="row.status" :active-value="2" :inactive-value="4" @change="handleToggleStatus(row)" />
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<el-pagination
|
||||||
|
background
|
||||||
|
:current-page="queryForm.pageNo"
|
||||||
|
:layout="layout"
|
||||||
|
:page-size="queryForm.pageSize"
|
||||||
|
:total="total"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
/>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { userCommentList, commentStatus } from '@/api/rating/topicOperate'
|
||||||
|
import { formatTime } from '@/utils'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
import UserInfo from '@/components/UserInfo'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RecordCommentReplyList',
|
||||||
|
components: { UserInfo },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '回复列表',
|
||||||
|
dialogVisible: false,
|
||||||
|
list: [],
|
||||||
|
listLoading: false,
|
||||||
|
layout: 'total, prev, pager, next',
|
||||||
|
total: 0,
|
||||||
|
elementLoadingText: '正在加载...',
|
||||||
|
queryForm: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
rootCommentId: '',
|
||||||
|
},
|
||||||
|
parentRow: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime,
|
||||||
|
getThumbUrl,
|
||||||
|
show(row) {
|
||||||
|
this.parentRow = row
|
||||||
|
this.title = `回复列表`
|
||||||
|
this.dialogVisible = true
|
||||||
|
this.queryForm.rootCommentId = row.id
|
||||||
|
this.queryForm.pageNo = 1
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.list = []
|
||||||
|
},
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.queryForm.pageSize = val
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.queryForm.pageNo = val
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
async fetchData() {
|
||||||
|
this.listLoading = true
|
||||||
|
try {
|
||||||
|
const { data } = await userCommentList(this.queryForm)
|
||||||
|
this.list = data.list || []
|
||||||
|
this.total = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.listLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleLike(row) {
|
||||||
|
this.$emit('like', row)
|
||||||
|
},
|
||||||
|
handleReply(row) {
|
||||||
|
// 传递当前行作为被回复对象,同时传递根评论ID
|
||||||
|
this.$emit('reply', row, this.queryForm.rootCommentId)
|
||||||
|
},
|
||||||
|
async handleToggleStatus(row) {
|
||||||
|
try {
|
||||||
|
const enable = row.status === 2
|
||||||
|
const { msg } = await commentStatus({ id: row.id, enable })
|
||||||
|
this.$baseMessage(msg || '状态切换成功', 'success')
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
row.status = row.status === 2 ? 4 : 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.comment-content-cell {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reply-target {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #409eff;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-text {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-meta {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-item i {
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -83,9 +83,11 @@
|
|||||||
</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">
|
<el-table-column align="center" fixed="left" label="操作" width="160">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button type="text" @click="handleLike(row)">点赞</el-button>
|
<el-button type="text" @click="handleLike(row)">点赞</el-button>
|
||||||
|
<el-button type="text" @click="handleReply(row)">回复</el-button>
|
||||||
|
<el-button v-if="row.replyCount > 0" type="text" @click="handleViewReplies(row)">查看回复</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
@@ -130,26 +132,13 @@
|
|||||||
|
|
||||||
<el-table-column align="left" label="用户信息" min-width="200">
|
<el-table-column align="left" label="用户信息" min-width="200">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div v-if="row.user" class="user-info-cell">
|
<user-info :user="row.user" :user-id="row.userId" />
|
||||||
<el-image
|
</template>
|
||||||
v-if="row.user.avatar"
|
</el-table-column>
|
||||||
class="user-avatar"
|
|
||||||
:preview-src-list="[row.user.avatar]"
|
<el-table-column align="center" label="状态切换" width="100">
|
||||||
:src="getThumbUrl(row.user.avatar)"
|
<template #default="{ row }">
|
||||||
/>
|
<el-switch v-model="row.status" :active-value="2" :inactive-value="4" @change="handleToggleStatus(row)" />
|
||||||
<div v-else class="user-avatar-placeholder"><i class="el-icon-user" /></div>
|
|
||||||
<div class="user-details">
|
|
||||||
<div class="user-nickname">
|
|
||||||
{{ row.user.nickname || '未知用户' }}
|
|
||||||
<el-tag v-if="row.user.isRobot" size="mini" style="margin-left: 4px" type="info">机器人</el-tag>
|
|
||||||
<el-tag v-else size="mini" style="margin-left: 4px" type="success">真人</el-tag>
|
|
||||||
</div>
|
|
||||||
<div class="user-id">{{ row.user.id }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else class="user-details">
|
|
||||||
<div class="user-id">{{ row.userId }}</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
@@ -172,22 +161,25 @@
|
|||||||
|
|
||||||
<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" />
|
<record-comment-like-edit ref="likeEdit" @fetch-data="fetchData" />
|
||||||
|
<record-comment-reply-list ref="replyList" @like="handleLikeFromList" @reply="handleReplyFromList" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { userCommentList } from '@/api/rating/topicOperate'
|
import { userCommentList, commentStatus } from '@/api/rating/topicOperate'
|
||||||
import { getList as getUserList } from '@/api/system/user'
|
import { getList as getUserList } from '@/api/system/user'
|
||||||
import { getList as getTopicList } from '@/api/rating/topic'
|
import { getList as getTopicList } from '@/api/rating/topic'
|
||||||
import { getList as getItemList } from '@/api/rating/topicItem'
|
import { getList as getItemList } from '@/api/rating/topicItem'
|
||||||
import { formatTime } from '@/utils'
|
import { formatTime } from '@/utils'
|
||||||
import { getThumbUrl } from '@/utils/blessing'
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
import UserInfo from '@/components/UserInfo'
|
||||||
import RecordCommentEdit from './components/RecordCommentEdit'
|
import RecordCommentEdit from './components/RecordCommentEdit'
|
||||||
import RecordCommentLikeEdit from './components/RecordCommentLikeEdit'
|
import RecordCommentLikeEdit from './components/RecordCommentLikeEdit'
|
||||||
|
import RecordCommentReplyList from './components/RecordCommentReplyList'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RatingTopicCommentIndex',
|
name: 'RatingTopicCommentIndex',
|
||||||
components: { RecordCommentEdit, RecordCommentLikeEdit },
|
components: { RecordCommentEdit, RecordCommentLikeEdit, RecordCommentReplyList, UserInfo },
|
||||||
directives: {
|
directives: {
|
||||||
loadmore: {
|
loadmore: {
|
||||||
bind(el, binding) {
|
bind(el, binding) {
|
||||||
@@ -351,9 +343,32 @@
|
|||||||
handleLike(row) {
|
handleLike(row) {
|
||||||
this.$refs['likeEdit'].showEdit(row)
|
this.$refs['likeEdit'].showEdit(row)
|
||||||
},
|
},
|
||||||
|
handleReply(row) {
|
||||||
|
this.$refs['commentEdit'].showEdit(row)
|
||||||
|
},
|
||||||
|
handleViewReplies(row) {
|
||||||
|
this.$refs['replyList'].show(row)
|
||||||
|
},
|
||||||
handleCommentNow() {
|
handleCommentNow() {
|
||||||
this.$refs['commentEdit'].showEdit()
|
this.$refs['commentEdit'].showEdit()
|
||||||
},
|
},
|
||||||
|
async handleToggleStatus(row) {
|
||||||
|
try {
|
||||||
|
const enable = row.status === 2
|
||||||
|
const { msg } = await commentStatus({ id: row.id, enable })
|
||||||
|
this.$baseMessage(msg || '状态切换成功', 'success')
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
row.status = row.status === 2 ? 4 : 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 子组件触发的方法
|
||||||
|
handleReplyFromList(row, parentCommentId) {
|
||||||
|
this.$refs['commentEdit'].showEdit(row, parentCommentId)
|
||||||
|
},
|
||||||
|
handleLikeFromList(row) {
|
||||||
|
this.$refs['likeEdit'].showEdit(row)
|
||||||
|
},
|
||||||
handleSizeChange(val) {
|
handleSizeChange(val) {
|
||||||
this.queryForm.pageSize = val
|
this.queryForm.pageSize = val
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
@@ -420,45 +435,6 @@
|
|||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 用户信息列样式 */
|
|
||||||
.user-info-cell {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.user-avatar,
|
|
||||||
.user-avatar-placeholder {
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 12px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
.user-avatar-placeholder {
|
|
||||||
background-color: #f0f2f5;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: #909399;
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
.user-details {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.user-nickname {
|
|
||||||
font-weight: bold;
|
|
||||||
color: #303133;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
.user-id {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #909399;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 评价目标列样式 */
|
/* 评价目标列样式 */
|
||||||
.target-info-cell {
|
.target-info-cell {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -31,10 +31,11 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<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="120">
|
<el-table-column align="center" fixed="left" label="操作" width="180">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button type="text" @click="handleRating(row)">评价</el-button>
|
<el-button type="text" @click="handleRating(row)">评价</el-button>
|
||||||
<el-button type="text" @click="handleComment(row)">评论</el-button>
|
<el-button type="text" @click="handleComment(row)">评论</el-button>
|
||||||
|
<el-button type="text" @click="handleScoreVote(row)">补评分</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
@@ -61,6 +62,13 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="left" label="用户信息" min-width="200" width="300">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<user-info v-if="row.user" :user="row.user" :user-id="row.userId" />
|
||||||
|
<span v-else>系统创建</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="left" label="分数统计">
|
<el-table-column align="left" label="分数统计">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="stat-cell">
|
<div class="stat-cell">
|
||||||
@@ -84,6 +92,17 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="left" label="分段票数" min-width="260">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="score-segment-list">
|
||||||
|
<div v-for="score in scoreOptions" :key="score" class="score-segment-item">
|
||||||
|
<span class="score-segment-label">{{ score }}分</span>
|
||||||
|
<span class="score-segment-value">{{ getScoreCount(row.scores, score) }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="left" label="互动数据" min-width="150">
|
<el-table-column align="left" label="互动数据" min-width="150">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="stat-cell">
|
<div class="stat-cell">
|
||||||
@@ -140,20 +159,41 @@
|
|||||||
|
|
||||||
<topic-item-rating-edit ref="ratingEdit" @fetch-data="fetchData" />
|
<topic-item-rating-edit ref="ratingEdit" @fetch-data="fetchData" />
|
||||||
<topic-item-comment-edit ref="commentEdit" @fetch-data="fetchData" />
|
<topic-item-comment-edit ref="commentEdit" @fetch-data="fetchData" />
|
||||||
|
|
||||||
|
<el-dialog title="补充分段评分" :visible.sync="scoreVoteVisible" width="480px" @close="closeScoreVoteDialog">
|
||||||
|
<el-form ref="scoreVoteForm" label-width="100px" :model="scoreVoteForm" :rules="scoreVoteRules">
|
||||||
|
<el-form-item label="评价项">
|
||||||
|
<span>{{ scoreVoteForm.itemName || '-' }}</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="分数段" prop="score">
|
||||||
|
<el-select v-model="scoreVoteForm.score" placeholder="请选择分数段" style="width: 100%">
|
||||||
|
<el-option v-for="score in scoreOptions" :key="score" :label="`${score}分`" :value="score" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="补充数量" prop="count">
|
||||||
|
<el-input-number v-model="scoreVoteForm.count" controls-position="right" :max="100000" :min="1" :step="1" style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer">
|
||||||
|
<el-button @click="closeScoreVoteDialog">取 消</el-button>
|
||||||
|
<el-button :loading="scoreVoteSubmitting" type="primary" @click="submitScoreVote">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getList } from '@/api/rating/topicItem'
|
import { getList, ItemScorevote } from '@/api/rating/topicItem'
|
||||||
import { getList as getTopicList } from '@/api/rating/topic'
|
import { getList as getTopicList } from '@/api/rating/topic'
|
||||||
import { formatTime } from '@/utils'
|
import { formatTime } from '@/utils'
|
||||||
import { getThumbUrl } from '@/utils/blessing'
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
import TopicItemRatingEdit from './components/TopicItemRatingEdit'
|
import TopicItemRatingEdit from './components/TopicItemRatingEdit'
|
||||||
import TopicItemCommentEdit from './components/TopicItemCommentEdit'
|
import TopicItemCommentEdit from './components/TopicItemCommentEdit'
|
||||||
|
import UserInfo from '@/components/UserInfo'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RatingTopicItemIndex',
|
name: 'RatingTopicItemIndex',
|
||||||
components: { TopicItemRatingEdit, TopicItemCommentEdit },
|
components: { TopicItemRatingEdit, TopicItemCommentEdit, UserInfo },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
list: [],
|
list: [],
|
||||||
@@ -168,6 +208,20 @@
|
|||||||
keyword: '',
|
keyword: '',
|
||||||
topicId: '',
|
topicId: '',
|
||||||
},
|
},
|
||||||
|
scoreOptions: [2, 4, 6, 8, 10],
|
||||||
|
scoreVoteVisible: false,
|
||||||
|
scoreVoteSubmitting: false,
|
||||||
|
scoreVoteForm: {
|
||||||
|
topicId: '',
|
||||||
|
itemId: '',
|
||||||
|
itemName: '',
|
||||||
|
score: 2,
|
||||||
|
count: 1,
|
||||||
|
},
|
||||||
|
scoreVoteRules: {
|
||||||
|
score: [{ required: true, trigger: 'change', message: '请选择分数段' }],
|
||||||
|
count: [{ required: true, trigger: 'change', message: '请输入补充数量' }],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -235,6 +289,48 @@
|
|||||||
handleComment(row) {
|
handleComment(row) {
|
||||||
this.$refs['commentEdit'].showEdit(row, this.queryForm.topicId)
|
this.$refs['commentEdit'].showEdit(row, this.queryForm.topicId)
|
||||||
},
|
},
|
||||||
|
getScoreCount(scores, score) {
|
||||||
|
if (!scores) return 0
|
||||||
|
return scores[score] || scores[String(score)] || 0
|
||||||
|
},
|
||||||
|
handleScoreVote(row) {
|
||||||
|
this.scoreVoteForm = {
|
||||||
|
topicId: this.queryForm.topicId,
|
||||||
|
itemId: row.id,
|
||||||
|
itemName: row.name,
|
||||||
|
score: 2,
|
||||||
|
count: 1,
|
||||||
|
}
|
||||||
|
this.scoreVoteVisible = true
|
||||||
|
},
|
||||||
|
closeScoreVoteDialog() {
|
||||||
|
this.scoreVoteVisible = false
|
||||||
|
if (this.$refs['scoreVoteForm']) {
|
||||||
|
this.$refs['scoreVoteForm'].resetFields()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submitScoreVote() {
|
||||||
|
this.$refs['scoreVoteForm'].validate(async (valid) => {
|
||||||
|
if (!valid) return false
|
||||||
|
this.scoreVoteSubmitting = true
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
topicId: this.scoreVoteForm.topicId,
|
||||||
|
itemId: this.scoreVoteForm.itemId,
|
||||||
|
score: this.scoreVoteForm.score,
|
||||||
|
count: this.scoreVoteForm.count,
|
||||||
|
}
|
||||||
|
const { msg } = await ItemScorevote(params)
|
||||||
|
this.$baseMessage(msg || '补充评分成功', 'success')
|
||||||
|
this.closeScoreVoteDialog()
|
||||||
|
this.fetchData()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.scoreVoteSubmitting = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -315,4 +411,29 @@
|
|||||||
color: #409eff;
|
color: #409eff;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.score-segment-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.score-segment-item {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 4px 10px;
|
||||||
|
background: #f5f7fa;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.score-segment-label {
|
||||||
|
color: #606266;
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.score-segment-value {
|
||||||
|
color: #409eff;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<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="220" width="220">
|
<el-table-column align="left" label="推荐话题" min-width="220" width="220">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="topic-cell">
|
<div class="topic-cell" @click="handleClick(row.topic)">
|
||||||
<div class="topic-title">{{ row.topic ? row.topic.title : '-' }}</div>
|
<div class="topic-title">{{ row.topic ? row.topic.title : '-' }}</div>
|
||||||
<div class="topic-meta">
|
<div class="topic-meta">
|
||||||
<span class="meta-label">Topic ID:</span>
|
<span class="meta-label">Topic ID:</span>
|
||||||
@@ -91,6 +91,14 @@
|
|||||||
this.queryForm.pageNo = val
|
this.queryForm.pageNo = val
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
|
handleClick(topic) {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/rating/topic',
|
||||||
|
query: {
|
||||||
|
topicId: topic.id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
async fetchData() {
|
async fetchData() {
|
||||||
this.listLoading = true
|
this.listLoading = true
|
||||||
try {
|
try {
|
||||||
@@ -142,6 +150,7 @@
|
|||||||
.topic-cell {
|
.topic-cell {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topic-title {
|
.topic-title {
|
||||||
|
|||||||
@@ -108,26 +108,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="left" label="用户信息" min-width="200">
|
<el-table-column align="left" label="用户信息" min-width="200">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div v-if="row.user" class="user-info-cell">
|
<user-info :user="row.user" :user-id="row.userId" />
|
||||||
<el-image
|
|
||||||
v-if="row.user.avatar"
|
|
||||||
class="user-avatar"
|
|
||||||
:preview-src-list="[row.user.avatar]"
|
|
||||||
:src="getThumbUrl(row.user.avatar)"
|
|
||||||
/>
|
|
||||||
<div v-else class="user-avatar-placeholder"><i class="el-icon-user" /></div>
|
|
||||||
<div class="user-details">
|
|
||||||
<div class="user-nickname">
|
|
||||||
{{ row.user.nickname || '未知用户' }}
|
|
||||||
<el-tag v-if="row.user.isRobot" size="mini" style="margin-left: 4px" type="info">机器人</el-tag>
|
|
||||||
<el-tag v-else size="mini" style="margin-left: 4px" type="success">真人</el-tag>
|
|
||||||
</div>
|
|
||||||
<div class="user-id">{{ row.user.id }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else class="user-details">
|
|
||||||
<div class="user-id">{{ row.userId }}</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
@@ -161,11 +142,12 @@
|
|||||||
import { getList as getItemList } from '@/api/rating/topicItem'
|
import { getList as getItemList } from '@/api/rating/topicItem'
|
||||||
import { formatTime } from '@/utils'
|
import { formatTime } from '@/utils'
|
||||||
import { getThumbUrl } from '@/utils/blessing'
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
import UserInfo from '@/components/UserInfo'
|
||||||
import RecordRatingEdit from './components/RecordRatingEdit'
|
import RecordRatingEdit from './components/RecordRatingEdit'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RatingTopicRecordIndex',
|
name: 'RatingTopicRecordIndex',
|
||||||
components: { RecordRatingEdit },
|
components: { RecordRatingEdit, UserInfo },
|
||||||
directives: {
|
directives: {
|
||||||
loadmore: {
|
loadmore: {
|
||||||
bind(el, binding) {
|
bind(el, binding) {
|
||||||
@@ -392,45 +374,6 @@
|
|||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 用户信息列样式 */
|
|
||||||
.user-info-cell {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.user-avatar,
|
|
||||||
.user-avatar-placeholder {
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 12px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
.user-avatar-placeholder {
|
|
||||||
background-color: #f0f2f5;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: #909399;
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
.user-details {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.user-nickname {
|
|
||||||
font-weight: bold;
|
|
||||||
color: #303133;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
.user-id {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #909399;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 评价目标列样式 */
|
/* 评价目标列样式 */
|
||||||
.target-info-cell {
|
.target-info-cell {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -92,6 +92,18 @@
|
|||||||
<robot-rating-edit ref="ratingEdit" @fetch-data="fetchData" />
|
<robot-rating-edit ref="ratingEdit" @fetch-data="fetchData" />
|
||||||
<robot-comment-edit ref="commentEdit" @fetch-data="fetchData" />
|
<robot-comment-edit ref="commentEdit" @fetch-data="fetchData" />
|
||||||
<robot-comment-view ref="commentView" />
|
<robot-comment-view ref="commentView" />
|
||||||
|
|
||||||
|
<el-dialog title="生成机器人" :visible.sync="generateDialogVisible" width="420px" @close="closeGenerateDialog">
|
||||||
|
<el-form ref="generateForm" label-width="100px" :model="generateForm" :rules="generateRules">
|
||||||
|
<el-form-item label="生成个数" prop="count">
|
||||||
|
<el-input-number v-model="generateForm.count" controls-position="right" :max="1000" :min="1" :step="1" style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer">
|
||||||
|
<el-button @click="closeGenerateDialog">取消</el-button>
|
||||||
|
<el-button :loading="generateSubmitting" type="primary" @click="submitGenerate">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -121,6 +133,14 @@
|
|||||||
keyword: '',
|
keyword: '',
|
||||||
},
|
},
|
||||||
applicationList: [],
|
applicationList: [],
|
||||||
|
generateDialogVisible: false,
|
||||||
|
generateSubmitting: false,
|
||||||
|
generateForm: {
|
||||||
|
count: 1,
|
||||||
|
},
|
||||||
|
generateRules: {
|
||||||
|
count: [{ required: true, trigger: 'change', message: '请输入生成个数' }],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -150,13 +170,30 @@
|
|||||||
this.$baseMessage('请先选择应用', 'error')
|
this.$baseMessage('请先选择应用', 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.generateDialogVisible = true
|
||||||
|
},
|
||||||
|
closeGenerateDialog() {
|
||||||
|
this.generateDialogVisible = false
|
||||||
|
if (this.$refs['generateForm']) {
|
||||||
|
this.$refs['generateForm'].resetFields()
|
||||||
|
}
|
||||||
|
this.generateForm.count = 1
|
||||||
|
},
|
||||||
|
submitGenerate() {
|
||||||
|
this.$refs['generateForm'].validate(async (valid) => {
|
||||||
|
if (!valid) return false
|
||||||
|
this.generateSubmitting = true
|
||||||
try {
|
try {
|
||||||
const { msg } = await generate(this.queryForm.appId)
|
const { msg } = await generate(this.queryForm.appId, this.generateForm.count)
|
||||||
this.$baseMessage(msg || '生成成功', 'success')
|
this.$baseMessage(msg || '生成成功', 'success')
|
||||||
|
this.closeGenerateDialog()
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.generateSubmitting = false
|
||||||
}
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
handleSizeChange(val) {
|
handleSizeChange(val) {
|
||||||
this.queryForm.pageSize = val
|
this.queryForm.pageSize = val
|
||||||
|
|||||||
Reference in New Issue
Block a user