Compare commits
16 Commits
4.0.1
...
6f99958275
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f99958275 | ||
|
|
6b3dbec68e | ||
|
|
908f3ad1b1 | ||
|
|
4789ac6ca0 | ||
|
|
af23adfd2b | ||
|
|
ca1585962b | ||
|
|
99bc334d0b | ||
|
|
f3c42fb83c | ||
|
|
77ca847b38 | ||
|
|
4f81850583 | ||
|
|
6cb7be6658 | ||
|
|
69fa3f4a43 | ||
|
|
d26db99e54 | ||
|
|
5df4664b16 | ||
|
|
9928bc3329 | ||
|
|
6322b0962b |
49
src/api/rating/topic.js
Normal file
49
src/api/rating/topic.js
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topic/list',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAllList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topic/list/all',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function doAdd(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topic',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function doEdit(id, data) {
|
||||||
|
return request({
|
||||||
|
url: `/management/api/rating/topic/${id}`,
|
||||||
|
method: 'put',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function doDelete(data) {
|
||||||
|
return request({
|
||||||
|
url: `/management/api/rating/topic`,
|
||||||
|
method: 'delete',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function toggleEnable(id, isEnabled) {
|
||||||
|
return request({
|
||||||
|
url: `/management/api/rating/topic/enable/${id}`,
|
||||||
|
method: 'patch',
|
||||||
|
data: { isEnabled },
|
||||||
|
})
|
||||||
|
}
|
||||||
49
src/api/rating/topicItem.js
Normal file
49
src/api/rating/topicItem.js
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topicItem/list',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAllList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topicItem/list/all',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function doAdd(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topicItem',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function doEdit(id, data) {
|
||||||
|
return request({
|
||||||
|
url: `/management/api/rating/topicItem/${id}`,
|
||||||
|
method: 'put',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function doDelete(data) {
|
||||||
|
return request({
|
||||||
|
url: `/management/api/rating/topicItem`,
|
||||||
|
method: 'delete',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function toggleEnable(id, isEnabled) {
|
||||||
|
return request({
|
||||||
|
url: `/management/api/rating/topicItem/enable/${id}`,
|
||||||
|
method: 'patch',
|
||||||
|
data: { isEnabled },
|
||||||
|
})
|
||||||
|
}
|
||||||
54
src/api/rating/topicOperate.js
Normal file
54
src/api/rating/topicOperate.js
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 评分
|
||||||
|
/**
|
||||||
|
* 评分
|
||||||
|
* @param {*} { topicId, itemId, scoreType, userId }
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function score(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topicItemOperate/score',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评分记录
|
||||||
|
* @param {*} { pageNo, pageSize, userId?, topicId?, itemId?, trueUser? }
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function scoreRecordList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topicItemOperate/score/list',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评论记录
|
||||||
|
* @param {*} { pageNo, pageSize, userId?, topicId?, itemId?, trueUser? }
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function userCommentList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topicItemOperate/comment/list',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评论
|
||||||
|
* @param {*} { topicId, itemId, comment, userId }
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function comment(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/rating/topicItemOperate/comment',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -31,6 +31,7 @@ export function doDelete(data) {
|
|||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toggleEnable(id, isEnabled) {
|
export function toggleEnable(id, isEnabled) {
|
||||||
return request({
|
return request({
|
||||||
url: `/management/api/ability/rule/enable/${id}`,
|
url: `/management/api/ability/rule/enable/${id}`,
|
||||||
|
|||||||
30
src/api/system/robot.js
Normal file
30
src/api/system/robot.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/system/robot/list',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取机器人列表(基础信息) {appId, pageNo, pageSize, topicId, itemId}
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getListBase(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/system/robot/list/base',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function generate(appId) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/system/robot',
|
||||||
|
method: 'post',
|
||||||
|
data: { appId },
|
||||||
|
})
|
||||||
|
}
|
||||||
9
src/api/system/system.js
Normal file
9
src/api/system/system.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getUserSignStatList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/system/user-sign-stat/list',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
14
src/api/system/user.js
Normal file
14
src/api/system/user.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户列表
|
||||||
|
* @param {*} { pageNo, pageSize, appId?, trueUser? }
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/system/user/list',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -48,6 +48,39 @@ export const asyncRoutes = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/rating',
|
||||||
|
component: Layout,
|
||||||
|
redirect: 'noRedirect',
|
||||||
|
name: 'RatingMini',
|
||||||
|
meta: { title: '夯拉评分', icon: 'gift', permissions: ['admin'] },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'topic',
|
||||||
|
name: 'RatingTopicIndex',
|
||||||
|
component: () => import('@/views/rating/topic/index'),
|
||||||
|
meta: { title: '评分话题' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'topic-item',
|
||||||
|
name: 'RatingTopicItemIndex',
|
||||||
|
component: () => import('@/views/rating/topicItem/index'),
|
||||||
|
meta: { title: '评分项' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'topic-record',
|
||||||
|
name: 'RatingTopicRecordIndex',
|
||||||
|
component: () => import('@/views/rating/topicScoreRecord/index'),
|
||||||
|
meta: { title: '用户评分记录' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'topic-comment',
|
||||||
|
name: 'RatingTopicCommentIndex',
|
||||||
|
component: () => import('@/views/rating/topicCommentRecord/index'),
|
||||||
|
meta: { title: '用户评论记录' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/spring',
|
path: '/spring',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
@@ -360,12 +393,24 @@ export const asyncRoutes = [
|
|||||||
component: () => import('@/views/systemManagement/reward/index'),
|
component: () => import('@/views/systemManagement/reward/index'),
|
||||||
meta: { title: '奖励管理' },
|
meta: { title: '奖励管理' },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'robotManagement',
|
||||||
|
name: 'RobotManagement',
|
||||||
|
component: () => import('@/views/systemManagement/robot/index'),
|
||||||
|
meta: { title: '机器人' },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'abilityManagement',
|
path: 'abilityManagement',
|
||||||
name: 'AbilityManagement',
|
name: 'AbilityManagement',
|
||||||
component: () => import('@/views/systemManagement/ability/index'),
|
component: () => import('@/views/systemManagement/ability/index'),
|
||||||
meta: { title: '用户能力管理' },
|
meta: { title: '用户能力管理' },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'userSignStat',
|
||||||
|
name: 'UserSignStat',
|
||||||
|
component: () => import('@/views/systemManagement/userSignStat/index'),
|
||||||
|
meta: { title: '用户签到信息' },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'accessLogManagement',
|
path: 'accessLogManagement',
|
||||||
name: 'AccessLogManagement',
|
name: 'AccessLogManagement',
|
||||||
|
|||||||
@@ -22,5 +22,9 @@ export function getSceneName(scene) {
|
|||||||
|
|
||||||
export const getThumbUrl = (url, w = 200, h = 200) => {
|
export const getThumbUrl = (url, w = 200, h = 200) => {
|
||||||
if (!url) return ''
|
if (!url) return ''
|
||||||
return `${url}?imageView2/1/w/${w}/h/${h}/q/80`
|
if (url.startsWith('http')) {
|
||||||
|
return `${url}?imageView2/1/w/${w}/h/${h}/q/80`
|
||||||
|
} else {
|
||||||
|
return `https://file.lihailezzc.com/${url}?imageView2/1/w/${w}/h/${h}/q/80`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
241
src/views/rating/topic/index.vue
Normal file
241
src/views/rating/topic/index.vue
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
<template>
|
||||||
|
<div class="rating-topic-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="left" label="评价主题" min-width="250">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="topic-info-cell">
|
||||||
|
<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-title">{{ row.title }}</div>
|
||||||
|
<div v-if="row.description" class="topic-desc" :title="row.description">{{ row.description }}</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="允许评论" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag v-if="row.allowComment === 1 || row.allowComment === true" type="success">是</el-tag>
|
||||||
|
<el-tag v-else type="danger">否</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="left" label="互动统计" min-width="180">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="stat-cell">
|
||||||
|
<div class="stat-row">
|
||||||
|
<span class="stat-label">
|
||||||
|
<i class="el-icon-view" />
|
||||||
|
浏览数:
|
||||||
|
</span>
|
||||||
|
<span class="stat-value">{{ row.viewCount }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="stat-row">
|
||||||
|
<span class="stat-label">
|
||||||
|
<i class="el-icon-user" />
|
||||||
|
参与人数:
|
||||||
|
</span>
|
||||||
|
<span class="stat-value">{{ row.participantCount }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="stat-row">
|
||||||
|
<span class="stat-label">
|
||||||
|
<i class="el-icon-star-on" />
|
||||||
|
评价人数:
|
||||||
|
</span>
|
||||||
|
<span class="stat-value">{{ row.scoreCount }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="stat-row">
|
||||||
|
<span class="stat-label">
|
||||||
|
<i class="el-icon-chat-dot-round" />
|
||||||
|
评论人数:
|
||||||
|
</span>
|
||||||
|
<span class="stat-value">{{ row.commentCount }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="热门分数" prop="hotScore" width="100" />
|
||||||
|
|
||||||
|
<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" fixed="right" label="操作" width="120">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="text" @click="handleViewItems(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"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getList } from '@/api/rating/topic'
|
||||||
|
import { formatTime } from '@/utils'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RatingTopicIndex',
|
||||||
|
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 getList(this.queryForm)
|
||||||
|
this.list = data.list
|
||||||
|
this.total = data.totalCount
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.listLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleViewItems(row) {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/rating/topic-item',
|
||||||
|
query: { topicId: row.id },
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.rating-topic-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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>
|
||||||
@@ -0,0 +1,257 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="600px" @close="close">
|
||||||
|
<el-form ref="form" label-width="100px" :model="form" :rules="rules">
|
||||||
|
<el-form-item label="参与用户" prop="userId">
|
||||||
|
<el-select v-model="form.userId" v-loadmore="loadMoreUsers" filterable placeholder="请选择参与评论的用户" style="width: 100%">
|
||||||
|
<el-option v-for="item in userList" :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>
|
||||||
|
<el-tag v-if="item.isRobot" size="mini" style="margin-left: 8px" type="info">机器人</el-tag>
|
||||||
|
<el-tag v-else size="mini" style="margin-left: 8px" type="success">真人</el-tag>
|
||||||
|
</div>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="评价主题" prop="topicId">
|
||||||
|
<el-select
|
||||||
|
v-model="form.topicId"
|
||||||
|
v-loadmore="loadMoreTopics"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择评价主题"
|
||||||
|
style="width: 100%"
|
||||||
|
@change="handleTopicChange"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in topicList" :key="item.id" :label="item.title" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="评价项" prop="itemId">
|
||||||
|
<el-select
|
||||||
|
v-model="form.itemId"
|
||||||
|
v-loadmore="loadMoreItems"
|
||||||
|
:disabled="!form.topicId"
|
||||||
|
filterable
|
||||||
|
placeholder="请先选择主题,再选择评价项"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in itemList" :key="item.id" :label="item.name" :value="item.id">
|
||||||
|
<div style="display: flex; align-items: center">
|
||||||
|
<el-image
|
||||||
|
v-if="item.avatarUrl"
|
||||||
|
:src="getThumbUrl(item.avatarUrl)"
|
||||||
|
style="width: 24px; height: 24px; border-radius: 50%; margin-right: 10px"
|
||||||
|
/>
|
||||||
|
<span>{{ item.name }}</span>
|
||||||
|
</div>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="评论内容" prop="content">
|
||||||
|
<el-input v-model="form.content" maxlength="500" placeholder="请输入您的评论文字" :rows="4" show-word-limit 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 { getList as getUserList } from '@/api/system/user'
|
||||||
|
import { getList as getTopicList } from '@/api/rating/topic'
|
||||||
|
import { getList as getItemList } from '@/api/rating/topicItem'
|
||||||
|
import { comment } from '@/api/rating/topicOperate'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RecordCommentEdit',
|
||||||
|
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: {
|
||||||
|
userId: '',
|
||||||
|
topicId: '',
|
||||||
|
itemId: '',
|
||||||
|
content: '',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
userId: [{ required: true, trigger: 'change', message: '请选择用户' }],
|
||||||
|
topicId: [{ required: true, trigger: 'change', message: '请选择评价主题' }],
|
||||||
|
itemId: [{ required: true, trigger: 'change', message: '请选择评价项' }],
|
||||||
|
content: [{ required: true, trigger: 'blur', message: '请输入评论内容' }],
|
||||||
|
},
|
||||||
|
|
||||||
|
// 用户列表
|
||||||
|
userList: [],
|
||||||
|
userQuery: { pageNo: 1, pageSize: 20 },
|
||||||
|
userTotal: 0,
|
||||||
|
fetchingUsers: false,
|
||||||
|
|
||||||
|
// 主题列表
|
||||||
|
topicList: [],
|
||||||
|
topicQuery: { pageNo: 1, pageSize: 20 },
|
||||||
|
topicTotal: 0,
|
||||||
|
fetchingTopics: false,
|
||||||
|
|
||||||
|
// 评价项列表
|
||||||
|
itemList: [],
|
||||||
|
itemQuery: { pageNo: 1, pageSize: 20, topicId: '' },
|
||||||
|
itemTotal: 0,
|
||||||
|
fetchingItems: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getThumbUrl,
|
||||||
|
showEdit() {
|
||||||
|
this.title = '立即评论'
|
||||||
|
this.dialogFormVisible = true
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
|
||||||
|
// 重置列表数据
|
||||||
|
this.userList = []
|
||||||
|
this.userQuery.pageNo = 1
|
||||||
|
this.userTotal = 0
|
||||||
|
|
||||||
|
this.topicList = []
|
||||||
|
this.topicQuery.pageNo = 1
|
||||||
|
this.topicTotal = 0
|
||||||
|
|
||||||
|
this.itemList = []
|
||||||
|
this.itemQuery.pageNo = 1
|
||||||
|
this.itemQuery.topicId = ''
|
||||||
|
this.itemTotal = 0
|
||||||
|
|
||||||
|
// 初始化加载第一页数据
|
||||||
|
this.fetchUserList()
|
||||||
|
this.fetchTopicList()
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$refs['form'].resetFields()
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- 用户列表加载 --
|
||||||
|
async fetchUserList() {
|
||||||
|
if (this.fetchingUsers) return
|
||||||
|
this.fetchingUsers = true
|
||||||
|
try {
|
||||||
|
const params = { pageNo: this.userQuery.pageNo, pageSize: this.userQuery.pageSize }
|
||||||
|
const { data } = await getUserList(params)
|
||||||
|
this.userList = this.userList.concat(data.list || [])
|
||||||
|
this.userTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingUsers = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreUsers() {
|
||||||
|
if (this.userList.length >= this.userTotal || this.fetchingUsers) return
|
||||||
|
this.userQuery.pageNo += 1
|
||||||
|
this.fetchUserList()
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- Topic 列表加载 --
|
||||||
|
async fetchTopicList() {
|
||||||
|
if (this.fetchingTopics) return
|
||||||
|
this.fetchingTopics = true
|
||||||
|
try {
|
||||||
|
const { data } = await getTopicList(this.topicQuery)
|
||||||
|
this.topicList = this.topicList.concat(data.list || [])
|
||||||
|
this.topicTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingTopics = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreTopics() {
|
||||||
|
if (this.topicList.length >= this.topicTotal || this.fetchingTopics) return
|
||||||
|
this.topicQuery.pageNo += 1
|
||||||
|
this.fetchTopicList()
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- Item 列表加载 --
|
||||||
|
async fetchItemList() {
|
||||||
|
if (this.fetchingItems || !this.itemQuery.topicId) return
|
||||||
|
this.fetchingItems = true
|
||||||
|
try {
|
||||||
|
const { data } = await getItemList(this.itemQuery)
|
||||||
|
this.itemList = this.itemList.concat(data.list || [])
|
||||||
|
this.itemTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingItems = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreItems() {
|
||||||
|
if (this.itemList.length >= this.itemTotal || this.fetchingItems) return
|
||||||
|
this.itemQuery.pageNo += 1
|
||||||
|
this.fetchItemList()
|
||||||
|
},
|
||||||
|
|
||||||
|
handleTopicChange(val) {
|
||||||
|
this.form.itemId = ''
|
||||||
|
this.itemList = []
|
||||||
|
this.itemQuery.pageNo = 1
|
||||||
|
this.itemTotal = 0
|
||||||
|
|
||||||
|
if (val) {
|
||||||
|
this.itemQuery.topicId = val
|
||||||
|
this.fetchItemList()
|
||||||
|
} else {
|
||||||
|
this.itemQuery.topicId = ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
save() {
|
||||||
|
this.$refs['form'].validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.saving = true
|
||||||
|
try {
|
||||||
|
const { msg } = await comment(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>
|
||||||
482
src/views/rating/topicCommentRecord/index.vue
Normal file
482
src/views/rating/topicCommentRecord/index.vue
Normal file
@@ -0,0 +1,482 @@
|
|||||||
|
<template>
|
||||||
|
<div class="rating-topic-comment-record-container">
|
||||||
|
<vab-query-form>
|
||||||
|
<vab-query-form-left-panel :span="24">
|
||||||
|
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
||||||
|
<el-form-item>
|
||||||
|
<el-select
|
||||||
|
v-model="queryForm.userId"
|
||||||
|
v-loadmore="loadMoreUsers"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
placeholder="请选择用户"
|
||||||
|
style="width: 200px"
|
||||||
|
@change="handleFilterChange"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in userList" :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>
|
||||||
|
<el-tag v-if="item.isRobot" size="mini" style="margin-left: 8px" type="info">机器人</el-tag>
|
||||||
|
<el-tag v-else size="mini" style="margin-left: 8px" type="success">真人</el-tag>
|
||||||
|
</div>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-select
|
||||||
|
v-model="queryForm.topicId"
|
||||||
|
v-loadmore="loadMoreTopics"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
placeholder="请选择评价主题"
|
||||||
|
style="width: 200px"
|
||||||
|
@change="handleTopicChange"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in topicList" :key="item.id" :label="item.title" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-select
|
||||||
|
v-model="queryForm.itemId"
|
||||||
|
v-loadmore="loadMoreItems"
|
||||||
|
clearable
|
||||||
|
:disabled="!queryForm.topicId"
|
||||||
|
filterable
|
||||||
|
placeholder="请先选择主题,再选择评价项"
|
||||||
|
style="width: 220px"
|
||||||
|
@change="handleFilterChange"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in itemList" :key="item.id" :label="item.name" :value="item.id">
|
||||||
|
<div style="display: flex; align-items: center">
|
||||||
|
<el-image
|
||||||
|
v-if="item.avatarUrl"
|
||||||
|
:src="getThumbUrl(item.avatarUrl)"
|
||||||
|
style="width: 24px; height: 24px; border-radius: 50%; margin-right: 10px"
|
||||||
|
/>
|
||||||
|
<span>{{ item.name }}</span>
|
||||||
|
</div>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button :type="queryForm.trueUser ? 'warning' : 'default'" @click="toggleTrueUser">
|
||||||
|
{{ queryForm.trueUser ? '已去掉机器人' : '去掉机器人' }}
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button icon="el-icon-edit" type="success" @click="handleCommentNow">立即评论</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</vab-query-form-left-panel>
|
||||||
|
</vab-query-form>
|
||||||
|
|
||||||
|
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||||
|
<el-table-column align="left" label="评论内容" min-width="250">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="comment-content-cell">
|
||||||
|
<div class="content-text">{{ row.content }}</div>
|
||||||
|
<div class="comment-meta">
|
||||||
|
<span class="meta-item">
|
||||||
|
<i class="el-icon-thumb" />
|
||||||
|
{{ row.likeCount || 0 }}
|
||||||
|
</span>
|
||||||
|
<span class="meta-item">
|
||||||
|
<i class="el-icon-chat-dot-square" />
|
||||||
|
{{ row.replyCount || 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="200">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="target-info-cell">
|
||||||
|
<div class="topic-title">
|
||||||
|
[{{ row.rating ? (row.rating.topic ? row.rating.topic.title : '未知主题') : row.topicName || '未知主题' }}]
|
||||||
|
</div>
|
||||||
|
<div class="item-info">
|
||||||
|
<el-image
|
||||||
|
v-if="row.rating && row.rating.item && row.rating.item.avatarUrl"
|
||||||
|
class="item-avatar"
|
||||||
|
:src="getThumbUrl(row.rating.item.avatarUrl)"
|
||||||
|
/>
|
||||||
|
<el-image v-else-if="row.itemAvatarUrl" class="item-avatar" :src="getThumbUrl(row.itemAvatarUrl)" />
|
||||||
|
<span class="item-name">{{ row.rating && row.rating.item ? row.rating.item.name : row.itemName || '未知评价项' }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="left" label="用户信息" min-width="200">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div v-if="row.user" class="user-info-cell">
|
||||||
|
<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>
|
||||||
|
</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"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<record-comment-edit ref="commentEdit" @fetch-data="fetchData" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { userCommentList } from '@/api/rating/topicOperate'
|
||||||
|
import { getList as getUserList } from '@/api/system/user'
|
||||||
|
import { getList as getTopicList } from '@/api/rating/topic'
|
||||||
|
import { getList as getItemList } from '@/api/rating/topicItem'
|
||||||
|
import { formatTime } from '@/utils'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
import RecordCommentEdit from './components/RecordCommentEdit'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RatingTopicCommentIndex',
|
||||||
|
components: { RecordCommentEdit },
|
||||||
|
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 {
|
||||||
|
list: [],
|
||||||
|
listLoading: true,
|
||||||
|
layout: 'total, sizes, prev, pager, next, jumper',
|
||||||
|
total: 0,
|
||||||
|
elementLoadingText: '正在加载...',
|
||||||
|
queryForm: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
userId: '',
|
||||||
|
topicId: '',
|
||||||
|
itemId: '',
|
||||||
|
trueUser: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
// 用户下拉列表状态
|
||||||
|
userList: [],
|
||||||
|
userQuery: { pageNo: 1, pageSize: 20, trueUser: false },
|
||||||
|
userTotal: 0,
|
||||||
|
fetchingUsers: false,
|
||||||
|
|
||||||
|
// Topic 下拉列表状态
|
||||||
|
topicList: [],
|
||||||
|
topicQuery: { pageNo: 1, pageSize: 20 },
|
||||||
|
topicTotal: 0,
|
||||||
|
fetchingTopics: false,
|
||||||
|
|
||||||
|
// Item 下拉列表状态
|
||||||
|
itemList: [],
|
||||||
|
itemQuery: { pageNo: 1, pageSize: 20, topicId: '' },
|
||||||
|
itemTotal: 0,
|
||||||
|
fetchingItems: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetchUserList()
|
||||||
|
this.fetchTopicList()
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime,
|
||||||
|
getThumbUrl,
|
||||||
|
|
||||||
|
// -- 用户列表加载 --
|
||||||
|
async fetchUserList() {
|
||||||
|
if (this.fetchingUsers) return
|
||||||
|
this.fetchingUsers = true
|
||||||
|
try {
|
||||||
|
const params = { pageNo: this.userQuery.pageNo, pageSize: this.userQuery.pageSize, appId: '6a0d7dbe4c5de50f2ba66475' }
|
||||||
|
if (this.userQuery.trueUser) params.trueUser = true
|
||||||
|
|
||||||
|
const { data } = await getUserList(params)
|
||||||
|
this.userList = this.userList.concat(data.list || [])
|
||||||
|
this.userTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingUsers = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreUsers() {
|
||||||
|
if (this.userList.length >= this.userTotal || this.fetchingUsers) return
|
||||||
|
this.userQuery.pageNo += 1
|
||||||
|
this.fetchUserList()
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- Topic 列表加载 --
|
||||||
|
async fetchTopicList() {
|
||||||
|
if (this.fetchingTopics) return
|
||||||
|
this.fetchingTopics = true
|
||||||
|
try {
|
||||||
|
const { data } = await getTopicList(this.topicQuery)
|
||||||
|
this.topicList = this.topicList.concat(data.list || [])
|
||||||
|
this.topicTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingTopics = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreTopics() {
|
||||||
|
if (this.topicList.length >= this.topicTotal || this.fetchingTopics) return
|
||||||
|
this.topicQuery.pageNo += 1
|
||||||
|
this.fetchTopicList()
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- Item 列表加载 --
|
||||||
|
async fetchItemList() {
|
||||||
|
if (this.fetchingItems || !this.itemQuery.topicId) return
|
||||||
|
this.fetchingItems = true
|
||||||
|
try {
|
||||||
|
const { data } = await getItemList(this.itemQuery)
|
||||||
|
this.itemList = this.itemList.concat(data.list || [])
|
||||||
|
this.itemTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingItems = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreItems() {
|
||||||
|
if (this.itemList.length >= this.itemTotal || this.fetchingItems) return
|
||||||
|
this.itemQuery.pageNo += 1
|
||||||
|
this.fetchItemList()
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- 交互与筛选 --
|
||||||
|
toggleTrueUser() {
|
||||||
|
this.queryForm.trueUser = !this.queryForm.trueUser
|
||||||
|
|
||||||
|
// 同步更新 userQuery
|
||||||
|
this.userQuery.trueUser = this.queryForm.trueUser
|
||||||
|
// 重新拉取用户下拉列表
|
||||||
|
this.userQuery.pageNo = 1
|
||||||
|
this.userList = []
|
||||||
|
this.userTotal = 0
|
||||||
|
this.fetchUserList()
|
||||||
|
|
||||||
|
// 重新拉取表格数据
|
||||||
|
this.queryData()
|
||||||
|
},
|
||||||
|
handleTopicChange(val) {
|
||||||
|
// 重置 item 选择
|
||||||
|
this.queryForm.itemId = ''
|
||||||
|
this.itemList = []
|
||||||
|
this.itemQuery.pageNo = 1
|
||||||
|
this.itemTotal = 0
|
||||||
|
|
||||||
|
if (val) {
|
||||||
|
this.itemQuery.topicId = val
|
||||||
|
this.fetchItemList()
|
||||||
|
} else {
|
||||||
|
this.itemQuery.topicId = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
this.queryData()
|
||||||
|
},
|
||||||
|
handleFilterChange() {
|
||||||
|
this.queryData()
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- 列表数据加载 --
|
||||||
|
handleCommentNow() {
|
||||||
|
this.$refs['commentEdit'].showEdit()
|
||||||
|
},
|
||||||
|
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 params = { pageNo: this.queryForm.pageNo, pageSize: this.queryForm.pageSize }
|
||||||
|
if (this.queryForm.userId) params.userId = this.queryForm.userId
|
||||||
|
if (this.queryForm.topicId) params.topicId = this.queryForm.topicId
|
||||||
|
if (this.queryForm.itemId) params.itemId = this.queryForm.itemId
|
||||||
|
if (this.queryForm.trueUser) params.trueUser = true
|
||||||
|
|
||||||
|
const { data } = await userCommentList(params)
|
||||||
|
this.list = data.list || []
|
||||||
|
this.total = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.listLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.rating-topic-comment-record-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 评论内容列样式 */
|
||||||
|
.comment-content-cell {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
.content-text {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #303133;
|
||||||
|
line-height: 1.5;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 用户信息列样式 */
|
||||||
|
.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 {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.topic-title {
|
||||||
|
color: #409eff;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.item-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.item-avatar {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-right: 8px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.item-name {
|
||||||
|
color: #606266;
|
||||||
|
font-size: 14px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
146
src/views/rating/topicItem/components/TopicItemCommentEdit.vue
Normal file
146
src/views/rating/topicItem/components/TopicItemCommentEdit.vue
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="600px" @close="close">
|
||||||
|
<el-form ref="form" label-width="100px" :model="form" :rules="rules">
|
||||||
|
<el-form-item label="选择机器人" prop="userId">
|
||||||
|
<el-select
|
||||||
|
v-model="form.userId"
|
||||||
|
v-loadmore="loadMoreRobots"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择评价机器人"
|
||||||
|
:popper-append-to-body="false"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in robotList" :key="item.id" :label="item.nickname" :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="form.content" maxlength="500" placeholder="请输入评论内容" :rows="4" show-word-limit type="textarea" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="close">取 消</el-button>
|
||||||
|
<el-button :loading="loading" type="primary" @click="save">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getListBase as getRobotList } from '@/api/system/robot'
|
||||||
|
import { comment } from '@/api/rating/topicOperate'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'TopicItemCommentEdit',
|
||||||
|
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,
|
||||||
|
loading: false,
|
||||||
|
form: {
|
||||||
|
topicId: '',
|
||||||
|
itemId: '',
|
||||||
|
content: '',
|
||||||
|
userId: '',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
userId: [{ required: true, trigger: 'change', message: '请选择评价机器人' }],
|
||||||
|
content: [{ required: true, trigger: 'blur', message: '请输入评论内容' }],
|
||||||
|
},
|
||||||
|
robotList: [],
|
||||||
|
robotQuery: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
appId: '6a0d7dbe4c5de50f2ba66475',
|
||||||
|
},
|
||||||
|
robotTotal: 0,
|
||||||
|
fetchingRobots: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getThumbUrl,
|
||||||
|
async showEdit(row, topicId) {
|
||||||
|
this.title = `给 ${row.name} 写评论`
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.form.topicId = topicId
|
||||||
|
this.form.itemId = row.id
|
||||||
|
this.dialogFormVisible = true
|
||||||
|
|
||||||
|
this.robotQuery.pageNo = 1
|
||||||
|
this.robotList = []
|
||||||
|
this.robotTotal = 0
|
||||||
|
await this.fetchRobotList()
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$refs['form'].resetFields()
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.robotList = []
|
||||||
|
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.loading = true
|
||||||
|
try {
|
||||||
|
const { msg } = await comment(this.form)
|
||||||
|
this.$baseMessage(msg || '评论成功', 'success')
|
||||||
|
this.close()
|
||||||
|
this.$emit('fetch-data')
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
159
src/views/rating/topicItem/components/TopicItemRatingEdit.vue
Normal file
159
src/views/rating/topicItem/components/TopicItemRatingEdit.vue
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="600px" @close="close">
|
||||||
|
<el-form ref="form" label-width="100px" :model="form" :rules="rules">
|
||||||
|
<el-form-item label="选择机器人" prop="userId">
|
||||||
|
<el-select
|
||||||
|
v-model="form.userId"
|
||||||
|
v-loadmore="loadMoreRobots"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择评价机器人"
|
||||||
|
:popper-append-to-body="false"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in robotList" :key="item.id" :label="item.nickname" :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="scoreType">
|
||||||
|
<el-radio-group v-model="form.scoreType">
|
||||||
|
<el-radio :label="5">夯</el-radio>
|
||||||
|
<el-radio :label="4">顶级</el-radio>
|
||||||
|
<el-radio :label="3">人上人</el-radio>
|
||||||
|
<el-radio :label="2">NPC</el-radio>
|
||||||
|
<el-radio :label="1">拉</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="close">取 消</el-button>
|
||||||
|
<el-button :loading="loading" type="primary" @click="save">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getListBase as getRobotList } from '@/api/system/robot'
|
||||||
|
import { score } from '@/api/rating/topicOperate'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'TopicItemRatingEdit',
|
||||||
|
directives: {
|
||||||
|
loadmore: {
|
||||||
|
bind(el, binding) {
|
||||||
|
// 在 bind 阶段由于使用了 :popper-append-to-body="false" 可以确保 DOM 存在于 el 内部
|
||||||
|
// 但是下拉框容器渲染可能有延迟,我们可以通过 setTimeout 确保获取到 DOM
|
||||||
|
setTimeout(() => {
|
||||||
|
const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap')
|
||||||
|
if (SELECTWRAP_DOM) {
|
||||||
|
SELECTWRAP_DOM.addEventListener('scroll', function () {
|
||||||
|
// 判断滚动到底部的条件,加一个小容差 2px 防止不同浏览器下的精度问题
|
||||||
|
const condition = this.scrollHeight - this.scrollTop <= this.clientHeight + 2
|
||||||
|
if (condition) {
|
||||||
|
binding.value()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, 0)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '评价项打分',
|
||||||
|
dialogFormVisible: false,
|
||||||
|
loading: false,
|
||||||
|
form: {
|
||||||
|
topicId: '',
|
||||||
|
itemId: '',
|
||||||
|
scoreType: '',
|
||||||
|
userId: '',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
userId: [{ required: true, trigger: 'change', message: '请选择评价机器人' }],
|
||||||
|
scoreType: [{ required: true, trigger: 'change', message: '请选择评分' }],
|
||||||
|
},
|
||||||
|
robotList: [],
|
||||||
|
robotQuery: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
appId: '6a0d7dbe4c5de50f2ba66475',
|
||||||
|
topicId: '',
|
||||||
|
itemId: '',
|
||||||
|
},
|
||||||
|
robotTotal: 0,
|
||||||
|
fetchingRobots: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getThumbUrl,
|
||||||
|
async showEdit(row, topicId) {
|
||||||
|
this.title = `给 ${row.name} 打分`
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.form.topicId = topicId
|
||||||
|
this.form.itemId = row.id
|
||||||
|
this.dialogFormVisible = true
|
||||||
|
|
||||||
|
this.robotQuery.pageNo = 1
|
||||||
|
this.robotQuery.topicId = topicId
|
||||||
|
this.robotQuery.itemId = row.id
|
||||||
|
this.robotList = []
|
||||||
|
this.robotTotal = 0
|
||||||
|
await this.fetchRobotList()
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$refs['form'].resetFields()
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.robotList = []
|
||||||
|
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.loading = true
|
||||||
|
try {
|
||||||
|
const { msg } = await score(this.form)
|
||||||
|
this.$baseMessage(msg || '评分成功', 'success')
|
||||||
|
this.close()
|
||||||
|
this.$emit('fetch-data')
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
318
src/views/rating/topicItem/index.vue
Normal file
318
src/views/rating/topicItem/index.vue
Normal file
@@ -0,0 +1,318 @@
|
|||||||
|
<template>
|
||||||
|
<div class="rating-topic-item-container">
|
||||||
|
<vab-query-form>
|
||||||
|
<vab-query-form-left-panel :span="12">
|
||||||
|
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
||||||
|
<el-form-item>
|
||||||
|
<el-select v-model="queryForm.topicId" clearable filterable placeholder="请选择评价主题" @change="handleTopicChange">
|
||||||
|
<el-option v-for="item in topicList" :key="item.id" :label="item.title" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</vab-query-form-left-panel>
|
||||||
|
<vab-query-form-right-panel :span="12">
|
||||||
|
<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-alert
|
||||||
|
v-if="!queryForm.topicId"
|
||||||
|
show-icon
|
||||||
|
style="margin-bottom: 20px"
|
||||||
|
title="请先在左侧选择一个评价主题,或从主题列表点击跳转过来"
|
||||||
|
type="warning"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<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="handleRating(row)">评价</el-button>
|
||||||
|
<el-button type="text" @click="handleComment(row)">评论</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="left" label="评价项" min-width="200">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="item-info-cell">
|
||||||
|
<el-image v-if="row.avatarUrl" class="item-avatar" :preview-src-list="[row.avatarUrl]" :src="getThumbUrl(row.avatarUrl)" />
|
||||||
|
<div v-else class="item-avatar-placeholder"><i class="el-icon-picture-outline" /></div>
|
||||||
|
<div class="item-details">
|
||||||
|
<div class="item-name">{{ row.name }}</div>
|
||||||
|
<div v-if="row.description" class="item-desc" :title="row.description">{{ row.description }}</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="left" label="分数统计">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="stat-cell">
|
||||||
|
<div class="stat-row">
|
||||||
|
<span class="stat-label">排名分:</span>
|
||||||
|
<span class="stat-value highlight">{{ row.rankScore }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="stat-row">
|
||||||
|
<span class="stat-label">平均分数:</span>
|
||||||
|
<span class="stat-value highlight">{{ row.scoreAvg }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="stat-row">
|
||||||
|
<span class="stat-label">累计总分:</span>
|
||||||
|
<span class="stat-value">{{ row.scoreTotal }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="stat-row">
|
||||||
|
<span class="stat-label">热门分:</span>
|
||||||
|
<span class="stat-value">{{ row.hotScore }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="left" label="互动数据" min-width="150">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="stat-cell">
|
||||||
|
<div class="stat-row">
|
||||||
|
<span class="stat-label">
|
||||||
|
<i class="el-icon-view" />
|
||||||
|
浏览数:
|
||||||
|
</span>
|
||||||
|
<span class="stat-value">{{ row.viewCount }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="stat-row">
|
||||||
|
<span class="stat-label">
|
||||||
|
<i class="el-icon-chat-dot-round" />
|
||||||
|
评论数:
|
||||||
|
</span>
|
||||||
|
<span class="stat-value">{{ row.commentCount }}</span>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="stat-row">
|
||||||
|
<span class="stat-label">
|
||||||
|
<i class="el-icon-star-off" />
|
||||||
|
打分次数:
|
||||||
|
</span>
|
||||||
|
<span class="stat-value">{{ row.ratingCount }}</span>
|
||||||
|
</div> -->
|
||||||
|
<div class="stat-row">
|
||||||
|
<span class="stat-label">
|
||||||
|
<i class="el-icon-user" />
|
||||||
|
评价人数:
|
||||||
|
</span>
|
||||||
|
<span class="stat-value">{{ row.scoreCount }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="排序" prop="sortOrder" width="80" />
|
||||||
|
|
||||||
|
<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"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<topic-item-rating-edit ref="ratingEdit" @fetch-data="fetchData" />
|
||||||
|
<topic-item-comment-edit ref="commentEdit" @fetch-data="fetchData" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getList } from '@/api/rating/topicItem'
|
||||||
|
import { getList as getTopicList } from '@/api/rating/topic'
|
||||||
|
import { formatTime } from '@/utils'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
import TopicItemRatingEdit from './components/TopicItemRatingEdit'
|
||||||
|
import TopicItemCommentEdit from './components/TopicItemCommentEdit'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RatingTopicItemIndex',
|
||||||
|
components: { TopicItemRatingEdit, TopicItemCommentEdit },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: [],
|
||||||
|
topicList: [],
|
||||||
|
listLoading: false,
|
||||||
|
layout: 'total, sizes, prev, pager, next, jumper',
|
||||||
|
total: 0,
|
||||||
|
elementLoadingText: '正在加载...',
|
||||||
|
queryForm: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
keyword: '',
|
||||||
|
topicId: '',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'$route.query.topicId': {
|
||||||
|
handler(newVal) {
|
||||||
|
if (newVal && newVal !== this.queryForm.topicId) {
|
||||||
|
this.queryForm.topicId = newVal
|
||||||
|
this.fetchData()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
immediate: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime,
|
||||||
|
getThumbUrl,
|
||||||
|
async initData() {
|
||||||
|
// 先获取下拉列表的主题数据(暂时取100条)
|
||||||
|
try {
|
||||||
|
const { data } = await getTopicList({ pageNo: 1, pageSize: 100 })
|
||||||
|
this.topicList = data.list || []
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleTopicChange() {
|
||||||
|
this.queryForm.pageNo = 1
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
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() {
|
||||||
|
if (!this.queryForm.topicId) {
|
||||||
|
this.list = []
|
||||||
|
this.total = 0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
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
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleRating(row) {
|
||||||
|
this.$refs['ratingEdit'].showEdit(row, this.queryForm.topicId)
|
||||||
|
},
|
||||||
|
handleComment(row) {
|
||||||
|
this.$refs['commentEdit'].showEdit(row, this.queryForm.topicId)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.rating-topic-item-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-info-cell {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-avatar,
|
||||||
|
.item-avatar-placeholder {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 12px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-avatar-placeholder {
|
||||||
|
background-color: #f0f2f5;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #909399;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-details {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-name {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-value.highlight {
|
||||||
|
color: #409eff;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,263 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="600px" @close="close">
|
||||||
|
<el-form ref="form" label-width="100px" :model="form" :rules="rules">
|
||||||
|
<el-form-item label="参与用户" prop="userId">
|
||||||
|
<el-select v-model="form.userId" v-loadmore="loadMoreUsers" filterable placeholder="请选择参与评分的用户" style="width: 100%">
|
||||||
|
<el-option v-for="item in userList" :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>
|
||||||
|
<el-tag v-if="item.isRobot" size="mini" style="margin-left: 8px" type="info">机器人</el-tag>
|
||||||
|
<el-tag v-else size="mini" style="margin-left: 8px" type="success">真人</el-tag>
|
||||||
|
</div>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="评价主题" prop="topicId">
|
||||||
|
<el-select
|
||||||
|
v-model="form.topicId"
|
||||||
|
v-loadmore="loadMoreTopics"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择评价主题"
|
||||||
|
style="width: 100%"
|
||||||
|
@change="handleTopicChange"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in topicList" :key="item.id" :label="item.title" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="评价项" prop="itemId">
|
||||||
|
<el-select
|
||||||
|
v-model="form.itemId"
|
||||||
|
v-loadmore="loadMoreItems"
|
||||||
|
:disabled="!form.topicId"
|
||||||
|
filterable
|
||||||
|
placeholder="请先选择主题,再选择评价项"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in itemList" :key="item.id" :label="item.name" :value="item.id">
|
||||||
|
<div style="display: flex; align-items: center">
|
||||||
|
<el-image
|
||||||
|
v-if="item.avatarUrl"
|
||||||
|
:src="getThumbUrl(item.avatarUrl)"
|
||||||
|
style="width: 24px; height: 24px; border-radius: 50%; margin-right: 10px"
|
||||||
|
/>
|
||||||
|
<span>{{ item.name }}</span>
|
||||||
|
</div>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="评分" prop="scoreType">
|
||||||
|
<el-radio-group v-model="form.scoreType">
|
||||||
|
<el-radio :label="5">夯</el-radio>
|
||||||
|
<el-radio :label="4">顶级</el-radio>
|
||||||
|
<el-radio :label="3">人上人</el-radio>
|
||||||
|
<el-radio :label="2">NPC</el-radio>
|
||||||
|
<el-radio :label="1">拉</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</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 { getList as getUserList } from '@/api/system/user'
|
||||||
|
import { getList as getTopicList } from '@/api/rating/topic'
|
||||||
|
import { getList as getItemList } from '@/api/rating/topicItem'
|
||||||
|
import { score } from '@/api/rating/topicOperate'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RecordRatingEdit',
|
||||||
|
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: {
|
||||||
|
userId: '',
|
||||||
|
topicId: '',
|
||||||
|
itemId: '',
|
||||||
|
scoreType: '',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
userId: [{ required: true, trigger: 'change', message: '请选择用户' }],
|
||||||
|
topicId: [{ required: true, trigger: 'change', message: '请选择评价主题' }],
|
||||||
|
itemId: [{ required: true, trigger: 'change', message: '请选择评价项' }],
|
||||||
|
scoreType: [{ required: true, trigger: 'change', message: '请选择评分' }],
|
||||||
|
},
|
||||||
|
|
||||||
|
// 用户列表
|
||||||
|
userList: [],
|
||||||
|
userQuery: { pageNo: 1, pageSize: 20 },
|
||||||
|
userTotal: 0,
|
||||||
|
fetchingUsers: false,
|
||||||
|
|
||||||
|
// 主题列表
|
||||||
|
topicList: [],
|
||||||
|
topicQuery: { pageNo: 1, pageSize: 20 },
|
||||||
|
topicTotal: 0,
|
||||||
|
fetchingTopics: false,
|
||||||
|
|
||||||
|
// 评价项列表
|
||||||
|
itemList: [],
|
||||||
|
itemQuery: { pageNo: 1, pageSize: 20, topicId: '' },
|
||||||
|
itemTotal: 0,
|
||||||
|
fetchingItems: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getThumbUrl,
|
||||||
|
showEdit() {
|
||||||
|
this.title = '立即评分'
|
||||||
|
this.dialogFormVisible = true
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
|
||||||
|
// 重置列表数据
|
||||||
|
this.userList = []
|
||||||
|
this.userQuery.pageNo = 1
|
||||||
|
this.userTotal = 0
|
||||||
|
|
||||||
|
this.topicList = []
|
||||||
|
this.topicQuery.pageNo = 1
|
||||||
|
this.topicTotal = 0
|
||||||
|
|
||||||
|
this.itemList = []
|
||||||
|
this.itemQuery.pageNo = 1
|
||||||
|
this.itemQuery.topicId = ''
|
||||||
|
this.itemTotal = 0
|
||||||
|
|
||||||
|
// 初始化加载第一页数据
|
||||||
|
this.fetchUserList()
|
||||||
|
this.fetchTopicList()
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$refs['form'].resetFields()
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- 用户列表加载 --
|
||||||
|
async fetchUserList() {
|
||||||
|
if (this.fetchingUsers) return
|
||||||
|
this.fetchingUsers = true
|
||||||
|
try {
|
||||||
|
const params = { pageNo: this.userQuery.pageNo, pageSize: this.userQuery.pageSize }
|
||||||
|
const { data } = await getUserList(params)
|
||||||
|
this.userList = this.userList.concat(data.list || [])
|
||||||
|
this.userTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingUsers = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreUsers() {
|
||||||
|
if (this.userList.length >= this.userTotal || this.fetchingUsers) return
|
||||||
|
this.userQuery.pageNo += 1
|
||||||
|
this.fetchUserList()
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- Topic 列表加载 --
|
||||||
|
async fetchTopicList() {
|
||||||
|
if (this.fetchingTopics) return
|
||||||
|
this.fetchingTopics = true
|
||||||
|
try {
|
||||||
|
const { data } = await getTopicList(this.topicQuery)
|
||||||
|
this.topicList = this.topicList.concat(data.list || [])
|
||||||
|
this.topicTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingTopics = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreTopics() {
|
||||||
|
if (this.topicList.length >= this.topicTotal || this.fetchingTopics) return
|
||||||
|
this.topicQuery.pageNo += 1
|
||||||
|
this.fetchTopicList()
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- Item 列表加载 --
|
||||||
|
async fetchItemList() {
|
||||||
|
if (this.fetchingItems || !this.itemQuery.topicId) return
|
||||||
|
this.fetchingItems = true
|
||||||
|
try {
|
||||||
|
const { data } = await getItemList(this.itemQuery)
|
||||||
|
this.itemList = this.itemList.concat(data.list || [])
|
||||||
|
this.itemTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingItems = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreItems() {
|
||||||
|
if (this.itemList.length >= this.itemTotal || this.fetchingItems) return
|
||||||
|
this.itemQuery.pageNo += 1
|
||||||
|
this.fetchItemList()
|
||||||
|
},
|
||||||
|
|
||||||
|
handleTopicChange(val) {
|
||||||
|
this.form.itemId = ''
|
||||||
|
this.itemList = []
|
||||||
|
this.itemQuery.pageNo = 1
|
||||||
|
this.itemTotal = 0
|
||||||
|
|
||||||
|
if (val) {
|
||||||
|
this.itemQuery.topicId = val
|
||||||
|
this.fetchItemList()
|
||||||
|
} else {
|
||||||
|
this.itemQuery.topicId = ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
save() {
|
||||||
|
this.$refs['form'].validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.saving = true
|
||||||
|
try {
|
||||||
|
const { msg } = await score(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>
|
||||||
477
src/views/rating/topicScoreRecord/index.vue
Normal file
477
src/views/rating/topicScoreRecord/index.vue
Normal file
@@ -0,0 +1,477 @@
|
|||||||
|
<template>
|
||||||
|
<div class="rating-topic-score-record-container">
|
||||||
|
<vab-query-form>
|
||||||
|
<vab-query-form-left-panel :span="24">
|
||||||
|
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
||||||
|
<el-form-item>
|
||||||
|
<el-select
|
||||||
|
v-model="queryForm.userId"
|
||||||
|
v-loadmore="loadMoreUsers"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
placeholder="请选择用户"
|
||||||
|
style="width: 200px"
|
||||||
|
@change="handleFilterChange"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in userList" :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>
|
||||||
|
<el-tag v-if="item.isRobot" size="mini" style="margin-left: 8px" type="info">机器人</el-tag>
|
||||||
|
<el-tag v-else size="mini" style="margin-left: 8px" type="success">真人</el-tag>
|
||||||
|
</div>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-select
|
||||||
|
v-model="queryForm.topicId"
|
||||||
|
v-loadmore="loadMoreTopics"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
placeholder="请选择评价主题"
|
||||||
|
style="width: 200px"
|
||||||
|
@change="handleTopicChange"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in topicList" :key="item.id" :label="item.title" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-select
|
||||||
|
v-model="queryForm.itemId"
|
||||||
|
v-loadmore="loadMoreItems"
|
||||||
|
clearable
|
||||||
|
:disabled="!queryForm.topicId"
|
||||||
|
filterable
|
||||||
|
placeholder="请先选择主题,再选择评价项"
|
||||||
|
style="width: 220px"
|
||||||
|
@change="handleFilterChange"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in itemList" :key="item.id" :label="item.name" :value="item.id">
|
||||||
|
<div style="display: flex; align-items: center">
|
||||||
|
<el-image
|
||||||
|
v-if="item.avatarUrl"
|
||||||
|
:src="getThumbUrl(item.avatarUrl)"
|
||||||
|
style="width: 24px; height: 24px; border-radius: 50%; margin-right: 10px"
|
||||||
|
/>
|
||||||
|
<span>{{ item.name }}</span>
|
||||||
|
</div>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button :type="queryForm.trueUser ? 'warning' : 'default'" @click="toggleTrueUser">
|
||||||
|
{{ queryForm.trueUser ? '已去掉机器人' : '去掉机器人' }}
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button icon="el-icon-edit" type="success" @click="handleRateNow">立即评分</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</vab-query-form-left-panel>
|
||||||
|
</vab-query-form>
|
||||||
|
|
||||||
|
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||||
|
<el-table-column align="left" label="评分" min-width="120">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="score-cell">
|
||||||
|
<el-tag :type="getScoreTypeTag(row.scoreType)">{{ getScoreTypeText(row.scoreType) }}</el-tag>
|
||||||
|
<div class="score-value">分值: {{ row.score }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="left" label="评价目标" min-width="250">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div v-if="row.rating" class="target-info-cell">
|
||||||
|
<div class="topic-title">[{{ row.rating.topic ? row.rating.topic.title : '未知主题' }}]</div>
|
||||||
|
<div v-if="row.rating.item" class="item-info">
|
||||||
|
<el-image v-if="row.rating.item.avatarUrl" class="item-avatar" :src="getThumbUrl(row.rating.item.avatarUrl)" />
|
||||||
|
<span class="item-name">{{ row.rating.item.name }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else class="target-info-cell">
|
||||||
|
<div class="topic-title">[未知主题]</div>
|
||||||
|
<div class="item-info"><span class="item-name">未知评价项</span></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="left" label="用户信息" min-width="200">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div v-if="row.user" class="user-info-cell">
|
||||||
|
<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>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="记录日期" prop="day" width="120" />
|
||||||
|
|
||||||
|
<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"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<record-rating-edit ref="ratingEdit" @fetch-data="fetchData" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { scoreRecordList } from '@/api/rating/topicOperate'
|
||||||
|
import { getList as getUserList } from '@/api/system/user'
|
||||||
|
import { getList as getTopicList } from '@/api/rating/topic'
|
||||||
|
import { getList as getItemList } from '@/api/rating/topicItem'
|
||||||
|
import { formatTime } from '@/utils'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
import RecordRatingEdit from './components/RecordRatingEdit'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RatingTopicRecordIndex',
|
||||||
|
components: { RecordRatingEdit },
|
||||||
|
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 {
|
||||||
|
list: [],
|
||||||
|
listLoading: true,
|
||||||
|
layout: 'total, sizes, prev, pager, next, jumper',
|
||||||
|
total: 0,
|
||||||
|
elementLoadingText: '正在加载...',
|
||||||
|
queryForm: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
userId: '',
|
||||||
|
topicId: '',
|
||||||
|
itemId: '',
|
||||||
|
trueUser: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
// 用户下拉列表状态
|
||||||
|
userList: [],
|
||||||
|
userQuery: { pageNo: 1, pageSize: 20, trueUser: false },
|
||||||
|
userTotal: 0,
|
||||||
|
fetchingUsers: false,
|
||||||
|
|
||||||
|
// Topic 下拉列表状态
|
||||||
|
topicList: [],
|
||||||
|
topicQuery: { pageNo: 1, pageSize: 20 },
|
||||||
|
topicTotal: 0,
|
||||||
|
fetchingTopics: false,
|
||||||
|
|
||||||
|
// Item 下拉列表状态
|
||||||
|
itemList: [],
|
||||||
|
itemQuery: { pageNo: 1, pageSize: 20, topicId: '' },
|
||||||
|
itemTotal: 0,
|
||||||
|
fetchingItems: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetchUserList()
|
||||||
|
this.fetchTopicList()
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime,
|
||||||
|
getThumbUrl,
|
||||||
|
|
||||||
|
// -- 用户列表加载 --
|
||||||
|
async fetchUserList() {
|
||||||
|
if (this.fetchingUsers) return
|
||||||
|
this.fetchingUsers = true
|
||||||
|
try {
|
||||||
|
// 清理传参
|
||||||
|
const params = { pageNo: this.userQuery.pageNo, pageSize: this.userQuery.pageSize, appId: '6a0d7dbe4c5de50f2ba66475' }
|
||||||
|
if (this.userQuery.trueUser) params.trueUser = true
|
||||||
|
|
||||||
|
const { data } = await getUserList(params)
|
||||||
|
this.userList = this.userList.concat(data.list || [])
|
||||||
|
this.userTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingUsers = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreUsers() {
|
||||||
|
if (this.userList.length >= this.userTotal || this.fetchingUsers) return
|
||||||
|
this.userQuery.pageNo += 1
|
||||||
|
this.fetchUserList()
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- Topic 列表加载 --
|
||||||
|
async fetchTopicList() {
|
||||||
|
if (this.fetchingTopics) return
|
||||||
|
this.fetchingTopics = true
|
||||||
|
try {
|
||||||
|
const { data } = await getTopicList(this.topicQuery)
|
||||||
|
this.topicList = this.topicList.concat(data.list || [])
|
||||||
|
this.topicTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingTopics = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreTopics() {
|
||||||
|
if (this.topicList.length >= this.topicTotal || this.fetchingTopics) return
|
||||||
|
this.topicQuery.pageNo += 1
|
||||||
|
this.fetchTopicList()
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- Item 列表加载 --
|
||||||
|
async fetchItemList() {
|
||||||
|
if (this.fetchingItems || !this.itemQuery.topicId) return
|
||||||
|
this.fetchingItems = true
|
||||||
|
try {
|
||||||
|
const { data } = await getItemList(this.itemQuery)
|
||||||
|
this.itemList = this.itemList.concat(data.list || [])
|
||||||
|
this.itemTotal = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.fetchingItems = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadMoreItems() {
|
||||||
|
if (this.itemList.length >= this.itemTotal || this.fetchingItems) return
|
||||||
|
this.itemQuery.pageNo += 1
|
||||||
|
this.fetchItemList()
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- 交互与筛选 --
|
||||||
|
toggleTrueUser() {
|
||||||
|
this.queryForm.trueUser = !this.queryForm.trueUser
|
||||||
|
|
||||||
|
// 同步更新 userQuery
|
||||||
|
this.userQuery.trueUser = this.queryForm.trueUser
|
||||||
|
// 重新拉取用户下拉列表
|
||||||
|
this.userQuery.pageNo = 1
|
||||||
|
this.userList = []
|
||||||
|
this.userTotal = 0
|
||||||
|
this.fetchUserList()
|
||||||
|
|
||||||
|
// 重新拉取表格数据
|
||||||
|
this.queryData()
|
||||||
|
},
|
||||||
|
handleTopicChange(val) {
|
||||||
|
// 重置 item 选择
|
||||||
|
this.queryForm.itemId = ''
|
||||||
|
this.itemList = []
|
||||||
|
this.itemQuery.pageNo = 1
|
||||||
|
this.itemTotal = 0
|
||||||
|
|
||||||
|
if (val) {
|
||||||
|
this.itemQuery.topicId = val
|
||||||
|
this.fetchItemList()
|
||||||
|
} else {
|
||||||
|
this.itemQuery.topicId = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
this.queryData()
|
||||||
|
},
|
||||||
|
handleFilterChange() {
|
||||||
|
this.queryData()
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- 列表数据加载 --
|
||||||
|
handleRateNow() {
|
||||||
|
this.$refs['ratingEdit'].showEdit()
|
||||||
|
},
|
||||||
|
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 params = { pageNo: this.queryForm.pageNo, pageSize: this.queryForm.pageSize }
|
||||||
|
if (this.queryForm.userId) params.userId = this.queryForm.userId
|
||||||
|
if (this.queryForm.topicId) params.topicId = this.queryForm.topicId
|
||||||
|
if (this.queryForm.itemId) params.itemId = this.queryForm.itemId
|
||||||
|
if (this.queryForm.trueUser) params.trueUser = true
|
||||||
|
|
||||||
|
const { data } = await scoreRecordList(params)
|
||||||
|
this.list = data.list || []
|
||||||
|
this.total = data.totalCount || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.listLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// -- 辅助展示方法 --
|
||||||
|
getScoreTypeText(type) {
|
||||||
|
const map = {
|
||||||
|
5: '夯',
|
||||||
|
4: '顶级',
|
||||||
|
3: '人上人',
|
||||||
|
2: 'NPC',
|
||||||
|
1: '拉',
|
||||||
|
}
|
||||||
|
return map[type] || '未知'
|
||||||
|
},
|
||||||
|
getScoreTypeTag(type) {
|
||||||
|
const map = {
|
||||||
|
5: 'success', // 夯
|
||||||
|
4: 'primary', // 顶级
|
||||||
|
3: 'warning', // 人上人
|
||||||
|
2: 'info', // NPC
|
||||||
|
1: 'danger', // 拉
|
||||||
|
}
|
||||||
|
return map[type] || 'info'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.rating-topic-score-record-container {
|
||||||
|
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 {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.topic-title {
|
||||||
|
color: #409eff;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.item-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.item-avatar {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-right: 8px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.item-name {
|
||||||
|
color: #606266;
|
||||||
|
font-size: 14px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 评分列样式 */
|
||||||
|
.score-cell {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
.score-value {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
114
src/views/systemManagement/robot/components/RobotCommentEdit.vue
Normal file
114
src/views/systemManagement/robot/components/RobotCommentEdit.vue
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="600px" @close="close">
|
||||||
|
<el-form ref="form" label-width="100px" :model="form" :rules="rules">
|
||||||
|
<el-form-item label="评价主题" prop="topicId">
|
||||||
|
<el-select v-model="form.topicId" filterable placeholder="请选择评价主题" style="width: 100%" @change="handleTopicChange">
|
||||||
|
<el-option v-for="item in topicList" :key="item.id" :label="item.title" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="评价项" prop="itemId">
|
||||||
|
<el-select v-model="form.itemId" filterable placeholder="请选择评价项" style="width: 100%">
|
||||||
|
<el-option v-for="item in itemList" :key="item.id" :label="item.name" :value="item.id">
|
||||||
|
<div style="display: flex; align-items: center">
|
||||||
|
<el-image
|
||||||
|
v-if="item.avatarUrl"
|
||||||
|
:src="getThumbUrl(item.avatarUrl)"
|
||||||
|
style="width: 20px; height: 20px; border-radius: 50%; margin-right: 10px"
|
||||||
|
/>
|
||||||
|
<span>{{ item.name }}</span>
|
||||||
|
</div>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="评论内容" prop="content">
|
||||||
|
<el-input v-model="form.content" maxlength="500" placeholder="请输入您的评论文字" :rows="4" show-word-limit type="textarea" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="close">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="save">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getAllList as getTopicList } from '@/api/rating/topic'
|
||||||
|
import { getAllList as getTopicItemList } from '@/api/rating/topicItem'
|
||||||
|
import { comment } from '@/api/rating/topicOperate'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RobotCommentEdit',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '机器人评论',
|
||||||
|
dialogFormVisible: false,
|
||||||
|
form: {
|
||||||
|
topicId: '',
|
||||||
|
itemId: '',
|
||||||
|
content: '',
|
||||||
|
userId: '',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
topicId: [{ required: true, trigger: 'change', message: '请选择评价主题' }],
|
||||||
|
itemId: [{ required: true, trigger: 'change', message: '请选择评价项' }],
|
||||||
|
content: [{ required: true, trigger: 'blur', message: '请输入评论内容' }],
|
||||||
|
},
|
||||||
|
topicList: [],
|
||||||
|
itemList: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getThumbUrl,
|
||||||
|
async showEdit(row) {
|
||||||
|
this.title = '机器人评论'
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.form.userId = row.userId || row.id
|
||||||
|
this.dialogFormVisible = true
|
||||||
|
await this.fetchTopicList()
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$refs['form'].resetFields()
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.itemList = []
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
},
|
||||||
|
async fetchTopicList() {
|
||||||
|
try {
|
||||||
|
const { data } = await getTopicList()
|
||||||
|
this.topicList = data || []
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async handleTopicChange(val) {
|
||||||
|
this.form.itemId = ''
|
||||||
|
this.itemList = []
|
||||||
|
if (val) {
|
||||||
|
try {
|
||||||
|
const { data } = await getTopicItemList({ topicId: val })
|
||||||
|
this.itemList = data || []
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
save() {
|
||||||
|
this.$refs['form'].validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
try {
|
||||||
|
const { msg } = await comment(this.form)
|
||||||
|
this.$baseMessage(msg || '评论成功', 'success')
|
||||||
|
this.close()
|
||||||
|
this.$emit('fetch-data')
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
166
src/views/systemManagement/robot/components/RobotCommentView.vue
Normal file
166
src/views/systemManagement/robot/components/RobotCommentView.vue
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog title="用户评论" :visible.sync="dialogVisible" width="600px" @close="close">
|
||||||
|
<div v-if="commentList && commentList.length > 0" class="comment-list">
|
||||||
|
<div v-for="item in commentList" :key="item.id" class="comment-item">
|
||||||
|
<div class="comment-header">
|
||||||
|
<el-image
|
||||||
|
v-if="item.itemAvatarUrl"
|
||||||
|
class="comment-avatar"
|
||||||
|
:preview-src-list="[item.itemAvatarUrl]"
|
||||||
|
:src="getThumbUrl(item.itemAvatarUrl)"
|
||||||
|
/>
|
||||||
|
<div class="comment-meta">
|
||||||
|
<div class="comment-title">
|
||||||
|
<span class="topic-name">[{{ item.topicName }}]</span>
|
||||||
|
<span class="item-name">{{ item.itemName }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="comment-time">{{ formatTime(item.createdAt) }}</div>
|
||||||
|
</div>
|
||||||
|
<el-tag size="mini" :type="item.status === 2 ? 'success' : 'info'">
|
||||||
|
{{ item.status === 2 ? '已展示' : '隐藏/待审' }}
|
||||||
|
</el-tag>
|
||||||
|
</div>
|
||||||
|
<div class="comment-content">
|
||||||
|
{{ item.content }}
|
||||||
|
</div>
|
||||||
|
<div class="comment-footer">
|
||||||
|
<span>
|
||||||
|
<i class="el-icon-thumb" />
|
||||||
|
{{ item.likeCount || 0 }}
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
<i class="el-icon-chat-dot-round" />
|
||||||
|
{{ item.replyCount || 0 }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-empty v-else description="暂无评论数据" />
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="close">关 闭</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { formatTime } from '@/utils'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RobotCommentView',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogVisible: false,
|
||||||
|
commentList: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime,
|
||||||
|
getThumbUrl,
|
||||||
|
show(comments) {
|
||||||
|
this.commentList = comments || []
|
||||||
|
this.dialogVisible = true
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.commentList = []
|
||||||
|
this.dialogVisible = false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.comment-list {
|
||||||
|
max-height: 500px;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-item {
|
||||||
|
padding: 15px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-item:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-avatar {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-right: 10px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-meta {
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-title {
|
||||||
|
font-size: 14px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topic-name {
|
||||||
|
color: #409eff;
|
||||||
|
margin-right: 5px;
|
||||||
|
font-weight: bold;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
max-width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-name {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #303133;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-time {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-content {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #606266;
|
||||||
|
line-height: 1.6;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
word-break: break-all;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-footer {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 15px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-footer span {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
120
src/views/systemManagement/robot/components/RobotRatingEdit.vue
Normal file
120
src/views/systemManagement/robot/components/RobotRatingEdit.vue
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="600px" @close="close">
|
||||||
|
<el-form ref="form" label-width="100px" :model="form" :rules="rules">
|
||||||
|
<el-form-item label="评价主题" prop="topicId">
|
||||||
|
<el-select v-model="form.topicId" filterable placeholder="请选择评价主题" style="width: 100%" @change="handleTopicChange">
|
||||||
|
<el-option v-for="item in topicList" :key="item.id" :label="item.title" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="评价项" prop="itemId">
|
||||||
|
<el-select v-model="form.itemId" filterable placeholder="请选择评价项" style="width: 100%">
|
||||||
|
<el-option v-for="item in itemList" :key="item.id" :label="item.name" :value="item.id">
|
||||||
|
<div style="display: flex; align-items: center">
|
||||||
|
<el-image
|
||||||
|
v-if="item.avatarUrl"
|
||||||
|
:src="getThumbUrl(item.avatarUrl)"
|
||||||
|
style="width: 20px; height: 20px; border-radius: 50%; margin-right: 10px"
|
||||||
|
/>
|
||||||
|
<span>{{ item.name }}</span>
|
||||||
|
</div>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="评分" prop="scoreType">
|
||||||
|
<el-radio-group v-model="form.scoreType">
|
||||||
|
<el-radio :label="5">夯</el-radio>
|
||||||
|
<el-radio :label="4">顶级</el-radio>
|
||||||
|
<el-radio :label="3">人上人</el-radio>
|
||||||
|
<el-radio :label="2">NPC</el-radio>
|
||||||
|
<el-radio :label="1">拉</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="close">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="save">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getAllList as getTopicList } from '@/api/rating/topic'
|
||||||
|
import { getAllList as getTopicItemList } from '@/api/rating/topicItem'
|
||||||
|
import { score } from '@/api/rating/topicOperate'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RobotRatingEdit',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '机器人评分',
|
||||||
|
dialogFormVisible: false,
|
||||||
|
form: {
|
||||||
|
topicId: '',
|
||||||
|
itemId: '',
|
||||||
|
scoreType: '',
|
||||||
|
userId: '',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
topicId: [{ required: true, trigger: 'change', message: '请选择评价主题' }],
|
||||||
|
itemId: [{ required: true, trigger: 'change', message: '请选择评价项' }],
|
||||||
|
scoreType: [{ required: true, trigger: 'change', message: '请选择评分' }],
|
||||||
|
},
|
||||||
|
topicList: [],
|
||||||
|
itemList: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getThumbUrl,
|
||||||
|
async showEdit(row) {
|
||||||
|
this.title = '机器人评分'
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.form.userId = row.userId || row.id
|
||||||
|
this.dialogFormVisible = true
|
||||||
|
await this.fetchTopicList()
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$refs['form'].resetFields()
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.itemList = []
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
},
|
||||||
|
async fetchTopicList() {
|
||||||
|
try {
|
||||||
|
const { data } = await getTopicList()
|
||||||
|
this.topicList = data || []
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async handleTopicChange(val) {
|
||||||
|
this.form.itemId = ''
|
||||||
|
this.itemList = []
|
||||||
|
if (val) {
|
||||||
|
try {
|
||||||
|
const { data } = await getTopicItemList({ topicId: val })
|
||||||
|
this.itemList = data || []
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
save() {
|
||||||
|
this.$refs['form'].validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
try {
|
||||||
|
const { msg } = await score(this.form)
|
||||||
|
this.$baseMessage(msg || '评分成功', 'success')
|
||||||
|
this.close()
|
||||||
|
this.$emit('fetch-data')
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
281
src/views/systemManagement/robot/index.vue
Normal file
281
src/views/systemManagement/robot/index.vue
Normal file
@@ -0,0 +1,281 @@
|
|||||||
|
<template>
|
||||||
|
<div class="robot-management-container">
|
||||||
|
<el-tabs v-model="queryForm.appId" type="card" @tab-click="handleTabClick">
|
||||||
|
<el-tab-pane v-for="item in applicationList" :key="item.id" :label="item.name" :name="item.id" />
|
||||||
|
</el-tabs>
|
||||||
|
|
||||||
|
<vab-query-form>
|
||||||
|
<vab-query-form-left-panel :span="12">
|
||||||
|
<el-button icon="el-icon-plus" type="primary" @click="handleGenerate">生成机器人</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-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="left" label="用户信息" width="150">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div v-if="row" style="display: flex; align-items: center; justify-content: flex-start">
|
||||||
|
<el-image
|
||||||
|
v-if="row.avatar"
|
||||||
|
:src="getThumbUrl(row.avatar)"
|
||||||
|
style="width: 40px; height: 40px; border-radius: 50%; margin-right: 10px"
|
||||||
|
/>
|
||||||
|
<div>
|
||||||
|
<div>{{ row.nickname }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else>-</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="left" label="用户ID" prop="id" show-overflow-tooltip width="220" />
|
||||||
|
|
||||||
|
<el-table-column align="center" label="创建时间" prop="createdAt" width="160">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ formatTime(row.createdAt) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column v-if="queryForm.appId === '6a0d7dbe4c5de50f2ba66475'" label="评价信息" min-width="300">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div v-if="row.ratingInfo && row.ratingInfo.length > 0" class="rating-info-list">
|
||||||
|
<div v-for="item in row.ratingInfo" :key="item.id" class="rating-info-item">
|
||||||
|
<el-image
|
||||||
|
v-if="item.itemAvatarUrl"
|
||||||
|
:preview-src-list="[item.itemAvatarUrl]"
|
||||||
|
:src="getThumbUrl(item.itemAvatarUrl)"
|
||||||
|
style="width: 30px; height: 30px; border-radius: 4px; margin-right: 8px; flex-shrink: 0"
|
||||||
|
/>
|
||||||
|
<div class="rating-info-content">
|
||||||
|
<div class="rating-info-title">
|
||||||
|
<span class="topic-name">[{{ item.topicName }}]</span>
|
||||||
|
<span class="item-name">{{ item.itemName }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="rating-info-meta">
|
||||||
|
<el-tag size="mini" :type="getScoreTypeTag(item.scoreType)">{{ getScoreTypeText(item.scoreType) }}</el-tag>
|
||||||
|
<span class="score-count">评价人数: {{ item.itemScoreCount }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else>-</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column v-if="queryForm.appId === '6a0d7dbe4c5de50f2ba66475'" align="center" fixed="right" label="操作" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="text" @click="handleRating(row)">评分</el-button>
|
||||||
|
<el-button type="text" @click="handleComment(row)">去评论</el-button>
|
||||||
|
<el-button type="text" @click="handleViewComment(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"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<robot-rating-edit ref="ratingEdit" @fetch-data="fetchData" />
|
||||||
|
<robot-comment-edit ref="commentEdit" @fetch-data="fetchData" />
|
||||||
|
<robot-comment-view ref="commentView" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getList, generate } from '@/api/system/robot'
|
||||||
|
import { getList as getApplicationList } from '@/api/appManagement'
|
||||||
|
import { formatTime } from '@/utils'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
import RobotRatingEdit from './components/RobotRatingEdit'
|
||||||
|
import RobotCommentEdit from './components/RobotCommentEdit'
|
||||||
|
import RobotCommentView from './components/RobotCommentView'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RobotManagement',
|
||||||
|
components: { RobotRatingEdit, RobotCommentEdit, RobotCommentView },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: [],
|
||||||
|
listLoading: true,
|
||||||
|
layout: 'total, sizes, prev, pager, next, jumper',
|
||||||
|
total: 0,
|
||||||
|
elementLoadingText: '正在加载...',
|
||||||
|
queryForm: {
|
||||||
|
appId: '',
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
keyword: '',
|
||||||
|
},
|
||||||
|
applicationList: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetchApplicationList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatTime,
|
||||||
|
getThumbUrl,
|
||||||
|
async fetchApplicationList() {
|
||||||
|
try {
|
||||||
|
const { data } = await getApplicationList({ pageNo: 1, pageSize: 100 })
|
||||||
|
this.applicationList = data.list
|
||||||
|
if (this.applicationList.length > 0) {
|
||||||
|
this.queryForm.appId = this.applicationList[0].id
|
||||||
|
this.fetchData()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleTabClick() {
|
||||||
|
this.queryForm.pageNo = 1
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
async handleGenerate() {
|
||||||
|
if (!this.queryForm.appId) {
|
||||||
|
this.$baseMessage('请先选择应用', 'error')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const { msg } = await generate(this.queryForm.appId)
|
||||||
|
this.$baseMessage(msg || '生成成功', 'success')
|
||||||
|
this.fetchData()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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() {
|
||||||
|
if (!this.queryForm.appId) return
|
||||||
|
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
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleRating(row) {
|
||||||
|
this.$refs['ratingEdit'].showEdit(row)
|
||||||
|
},
|
||||||
|
handleComment(row) {
|
||||||
|
this.$refs['commentEdit'].showEdit(row)
|
||||||
|
},
|
||||||
|
handleViewComment(row) {
|
||||||
|
this.$refs['commentView'].show(row.commentInfo || [])
|
||||||
|
},
|
||||||
|
getScoreTypeText(type) {
|
||||||
|
const map = {
|
||||||
|
5: '夯',
|
||||||
|
4: '顶级',
|
||||||
|
3: '人上人',
|
||||||
|
2: 'NPC',
|
||||||
|
1: '拉',
|
||||||
|
}
|
||||||
|
return map[type] || '未知'
|
||||||
|
},
|
||||||
|
getScoreTypeTag(type) {
|
||||||
|
const map = {
|
||||||
|
5: 'success', // 夯
|
||||||
|
4: 'primary', // 顶级
|
||||||
|
3: 'warning', // 人上人
|
||||||
|
2: 'info', // NPC
|
||||||
|
1: 'danger', // 拉
|
||||||
|
}
|
||||||
|
return map[type] || 'info'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.robot-management-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating-info-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating-info-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
padding: 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating-info-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating-info-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topic-name {
|
||||||
|
color: #409eff;
|
||||||
|
margin-right: 5px;
|
||||||
|
font-weight: bold;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
max-width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-name {
|
||||||
|
font-weight: bold;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating-info-meta {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.score-count {
|
||||||
|
color: #909399;
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
109
src/views/systemManagement/userSignStat/index.vue
Normal file
109
src/views/systemManagement/userSignStat/index.vue
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
<template>
|
||||||
|
<div class="user-sign-stat-container">
|
||||||
|
<vab-query-form>
|
||||||
|
<vab-query-form-left-panel :span="12">
|
||||||
|
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
||||||
|
<el-form-item>
|
||||||
|
<el-input v-model.trim="queryForm.userId" clearable placeholder="请输入用户ID" />
|
||||||
|
</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-left-panel>
|
||||||
|
</vab-query-form>
|
||||||
|
|
||||||
|
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||||
|
<el-table-column align="center" label="用户信息" width="200">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div v-if="row.user" style="display: flex; align-items: center; justify-content: center">
|
||||||
|
<el-image
|
||||||
|
v-if="row.user.avatar"
|
||||||
|
:src="getThumbUrl(row.user.avatar)"
|
||||||
|
style="width: 40px; height: 40px; border-radius: 50%; margin-right: 10px"
|
||||||
|
/>
|
||||||
|
<div>
|
||||||
|
<div>{{ row.user.nickname }}</div>
|
||||||
|
<div style="font-size: 12px; color: #999">ID: {{ row.user.id }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else>{{ row.userId }}</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="应用ID" prop="appId" show-overflow-tooltip />
|
||||||
|
<el-table-column align="center" label="最后签到日期" prop="lastSignDate" show-overflow-tooltip />
|
||||||
|
<el-table-column align="center" label="当前连续签到天数" prop="continuousDays" show-overflow-tooltip />
|
||||||
|
<el-table-column align="center" label="累计签到天数" prop="totalDays" show-overflow-tooltip />
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<el-pagination
|
||||||
|
background
|
||||||
|
:current-page="queryForm.pageNo"
|
||||||
|
:layout="layout"
|
||||||
|
:page-size="queryForm.pageSize"
|
||||||
|
:total="total"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getUserSignStatList } from '@/api/system/system'
|
||||||
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'UserSignStat',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: [],
|
||||||
|
listLoading: true,
|
||||||
|
layout: 'total, sizes, prev, pager, next, jumper',
|
||||||
|
total: 0,
|
||||||
|
elementLoadingText: '正在加载...',
|
||||||
|
queryForm: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
userId: '',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
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 getUserSignStatList(this.queryForm)
|
||||||
|
this.list = data.list
|
||||||
|
this.total = data.totalCount
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.listLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.user-sign-stat-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user