commentDetail.vue
2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!-- 查看产品 - 评价信息 -->
<template>
<div class="comment-detail container edit-container">
<div style="padding: 20px">
<!-- 表格区域 开始 -->
<GLTable ref="commentRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun">
<div slot="starLevel" slot-scope="scope">
<img v-for="(item, index) in scope.scope.starLevel" :key="index" class="icon-star" src="@/assets/icon-star.png" />
</div>
<div slot="goodsImage" class="table-image" slot-scope="scope">
<span v-if="!scope.scope.imgUrls">-</span>
<img v-else class="img-60" :src="scope.scope.imgUrls[0]" @click="handleImgLook(scope.scope.imgUrls)" />
</div>
</GLTable>
<el-dialog v-if="isImgVisible" title="查看" :visible.sync="isImgVisible" :close-on-click-modal="false">
<div class="dialog-look">
<span v-for="(item, index) in dialogObj.imgUrls" :key="index">
<el-image style="width: 200px; height: 200px; margin-right: 10px" :src="item" :preview-src-list="[item]"></el-image>
</span>
</div>
</el-dialog>
</div>
</div>
</template>
<script>
import url from '@/assets/empty.png'
export default {
name: 'commentDetail',
data() {
return {
size: 'small',
url: url,
searchForm: {
goodsId: ''
},
isImgVisible: false,
// imgUrls: [],,
dialogObj: {
imgUrls: [],
uploadType: 'img'
},
// 表格
getListApi: this.$apis.proManage.getGoodsCommentListApi,
tableParams: {
listName: 'list',
tableColumns: [
{
label: '评价用户名称',
prop: 'customerName'
},
{
label: '评价时间',
prop: 'createdDateStr'
},
{
label: '评价星级',
prop: 'starLevel',
addHtml: 'starLevel'
},
{
label: '评价内容',
prop: 'commentContent',
line: 3
},
{
label: '图片',
prop: 'goodsImage',
addHtml: 'goodsImage'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
}
},
props: {
goodsId: {
type: Object,
default: () => {}
}
},
methods: {
beforeSearchFn() {
return new Promise(resolve => {
this.searchForm.goodsId = this.goodsId
resolve()
})
},
setTableFinishFun() {
//接收到的数据为空
// this.$refs.commentRef.data.length ? (this.$refs.commentRef.tableHeightValues = '') : this.$refs.commentRef.setTableHeightFun()
},
handleImgLook(imgUrls) {
this.isImgVisible = !this.isImgVisible
this.dialogObj = {
imgUrls: imgUrls,
uploadType: 'img'
}
}
}
}
</script>
<style></style>