rating
This commit is contained in:
@@ -22,7 +22,7 @@ export function score(data) {
|
|||||||
export function comment(data) {
|
export function comment(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'management/api/rating/topicItemOperate/comment',
|
url: 'management/api/rating/topicItemOperate/comment',
|
||||||
method: 'get',
|
method: 'post',
|
||||||
params: data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
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>
|
||||||
@@ -73,6 +73,7 @@
|
|||||||
<el-table-column v-if="queryForm.appId === '6a0d7dbe4c5de50f2ba66475'" align="center" fixed="right" label="操作" width="100">
|
<el-table-column v-if="queryForm.appId === '6a0d7dbe4c5de50f2ba66475'" align="center" fixed="right" label="操作" width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button type="text" @click="handleRating(row)">评分</el-button>
|
<el-button type="text" @click="handleRating(row)">评分</el-button>
|
||||||
|
<el-button type="text" @click="handleComment(row)">评论</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -88,6 +89,7 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<robot-rating-edit ref="ratingEdit" @fetch-data="fetchData" />
|
<robot-rating-edit ref="ratingEdit" @fetch-data="fetchData" />
|
||||||
|
<robot-comment-edit ref="commentEdit" @fetch-data="fetchData" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -97,10 +99,11 @@
|
|||||||
import { formatTime } from '@/utils'
|
import { formatTime } from '@/utils'
|
||||||
import { getThumbUrl } from '@/utils/blessing'
|
import { getThumbUrl } from '@/utils/blessing'
|
||||||
import RobotRatingEdit from './components/RobotRatingEdit'
|
import RobotRatingEdit from './components/RobotRatingEdit'
|
||||||
|
import RobotCommentEdit from './components/RobotCommentEdit'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RobotManagement',
|
name: 'RobotManagement',
|
||||||
components: { RobotRatingEdit },
|
components: { RobotRatingEdit, RobotCommentEdit },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
list: [],
|
list: [],
|
||||||
@@ -180,6 +183,9 @@
|
|||||||
handleRating(row) {
|
handleRating(row) {
|
||||||
this.$refs['ratingEdit'].showEdit(row)
|
this.$refs['ratingEdit'].showEdit(row)
|
||||||
},
|
},
|
||||||
|
handleComment(row) {
|
||||||
|
this.$refs['commentEdit'].showEdit(row)
|
||||||
|
},
|
||||||
getScoreTypeText(type) {
|
getScoreTypeText(type) {
|
||||||
const map = {
|
const map = {
|
||||||
1: '夯',
|
1: '夯',
|
||||||
|
|||||||
Reference in New Issue
Block a user