evaluateDetails.vue
8.43 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<template>
<view class="container">
<global-loading />
<!-- 评论详情 -->
<view class="evaluate-contentbox">
<view class="evaluate-content flex-items flex-row flex-sp-between">
<view class="flex-items">
<image class="user-headSmallImg" v-if="commentVOList.headImage" :src="commentVOList.headImage"></image>
<image class="user-headSmallImg" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/images/storeLogo.png" v-else ></image>
<label class="fs28 mar-left-20" v-if="commentVOList.name">{{commentVOList.name}}</label>
<label class="fs28 mar-left-20" v-else>匿名</label>
</view>
<label class="font-color-999 fs22">{{commentVOList.createTime}}</label>
</view>
<view class="fs22 font-color-999 mar-top-10">
{{commentVOList.value}}
</view>
<view class="fs26 pad-topbot-20">{{commentVOList.comment}}</view>
<view class="evaluateImg-box" v-if="commentVOList.image">
<view v-for="(cItem, index) in imageList" :key="index" @click="previewImg(1, index)">
<image class="evaluate-Img" :src="$baseURL+cItem"></image>
</view>
</view>
<!-- <view class="addComments-box flex-column-plus" v-if="commentVOList.addComment">
<label class="font-color-C5AA7B mar-top-30">用户追评</label>
<label class="mar-top-20">{{commentVOList.addComment}}</label>
<view class="evaluateImg-box mar-top-20" v-if="commentVOList.addImage">
<view v-for="(dItem, index) in imgDataResult" :key="index" @click="previewImg(2, index)">
<image class="evaluate-Img" :src="$baseURL+dItem"></image>
</view>
</view>
</view> -->
<!-- <view class="goodsDes-box flex-column-plus mar-top-30">
<view class="flex-row-plus" @click="goGoodsDetails">
<image class="goodsDes-img" :src="commentVOList.productImage"></image>
<view class="goodsDesText-box">
<label class="fs26 goodsDes-text">{{commentVOList.productName}}</label>
<view class="mar-top-70">
<label>¥ {{commentVOList.productPrice}}</label>
</view>
</view>
</view>
</view> -->
</view>
<!-- {{commentVOList}}-->
<view class="linkBox">
<view class="butBox flex-row-plus" v-if="commentVOList.addComment != ''">
<view class="addPraise-box1 flex-items-plus" @click="zanTap">
<image class="addPraise-icon" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/images/addPraiseIcon.png" v-if="!commentVOList.ifLike"/>
<image class="addPraise-icon" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/images/415f93719fa64af58b8d7cafb734ec4a_22.png" v-else/>
<label :class="['mar-left-10',commentVOList.ifLike?'font-color-FFEBC4':'font-color-DDD']">点赞</label>
</view>
</view>
<view class="butBox flex-row-plus" v-else>
<view class="addComments-box flex-items-plus" @click="addCommentsClick()">
<image class="addComments-cion" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/images/addCommentsIcon.png"></image>
<label class="mar-left-10 font-color-333">追加评价</label>
</view>
<view class="addPraise-box flex-items-plus" @click="zanTap">
<image class="addPraise-icon" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/images/addPraiseIcon.png" v-if="!commentVOList.ifLike"/>
<image class="addPraise-icon" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/images/415f93719fa64af58b8d7cafb734ec4a_22.png" v-else/>
<label :class="['mar-left-10',commentVOList.ifLike?'font-color-FFEBC4':'font-color-DDD']">点赞</label>
</view>
</view>
</view>
</view>
</template>
<script>
const NET = require('../../utils/request')
const API = require('../../config/api')
export default {
data() {
return {
commentVOList:{},
actionType:true,
imgDataResult: [],
imageList: []
}
},
onLoad() {
this.commentVOList = uni.getStorageSync('commentVOList');
uni.removeStorageSync('commentVOList')
this.commentImgData(this.commentVOList.image)
this.imgDataResultData(this.commentVOList.addImage)
},
onBackPress(e) {
if (e.from === 'navigateBack') {
return false;
}
this.back();
return true;
},
methods: {
goGoodsDetails(){
let shopId = this.commentVOList.shopId
let productId = this.commentVOList.productId
let skuId = this.commentVOList.skuId
uni.navigateTo({
url:'goodsDetails?shopId='+shopId+'&productId='+productId+'&skuId='+skuId
})
},
back(){
uni.navigateTo({
url:'userEvaluate'
})
},
commentImgData(imgData){
this.imageList = imgData.split(",");
console.log(this.imageList)
},
imgDataResultData(imgData){
this.imgDataResult = imgData.split(",");
console.log(this.imgDataResult)
},
//点赞
zanTap(){
// uni.showLoading({
// title:''
// })
this.actionType = this.commentVOList.ifLike == 1 ?0:1
NET.request(API.LikeOrUnLikeComment,{
commentId: this.commentVOList.commentId,
ifLike: this.actionType
},'POST').then(res => {
this.commentVOList.ifLike = !this.commentVOList.ifLike
this.commentVOList.likes = this.commentVOList.ifLike ? this.commentVOList.likes + 1 : this.commentVOList.likes - 1
if(this.actionType == 1){
uni.showToast({
title: '点赞成功',
})
}else{
uni.showToast({
title: '已取消点赞',
icon:"none"
})
}
}).catch(res => {
uni.hideLoading()
}).finally(()=>{uni.hideLoading()})
},
//追加评论
addCommentsClick(){
uni.setStorageSync('addCommentVOList', this.commentVOList);
uni.navigateTo({
url:'addEvaluate?type=2'
})
},
// 查看图片
// previewImg(img) {
// console.log(img, 'img')
// let imgsArray = [];
// imgsArray[0] = img
// uni.previewImage({
// current: 0,
// urls: imgsArray
// });
// },
// 预览图片多张
previewImg(type, index) {
let imgsArray = [];
if (type === 1) {
for (let i = 0; i < this.imageList.length - 1; i++) {
imgsArray.push(this.$baseURL+this.imageList[i]);
}
} else {
for (let i = 0; i < this.imgDataResult.length - 1; i++) {
imgsArray.push(this.$baseURL+this.imgDataResult[i]);
}
}
console.log(imgsArray, 'imgs')
uni.previewImage({
current: index,
urls: imgsArray,
});
},
}
}
</script>
<style lang="scss">
.container{
padding-bottom: 30upx;
.evaluate-contentbox{
display: flex;
justify-content: center;
flex-direction: column;
padding: 30upx 30upx;
background-color: #FFFFFF;
.evaluate-content{
width: 670upx;
display: flex;
justify-content: space-between;
.user-headSmallImg{
width: 46upx;
height: 46upx;
border-radius: 50%;
}
}
.evaluateImg-box{
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-left: -9upx;
.evaluate-Img{
width: 224upx;
height: 224upx;
border-radius: 10upx;
margin-left: 9upx;
margin-top: 9upx;
}
}
.goodsDes-box{
background-color: #F7F7F7;
padding: 20upx 44upx 20upx 20upx;
.goodsDes-img{
width: 180upx;
height: 180upx;
border-radius: 10upx;
}
.goodsDesText-box{
width: 416upx;
margin-left: 30upx;
}
.addCommentsBut{
width: 150upx;
height: 56upx;
border: 1upx solid #FF7800;
border-radius: 28upx;
font-size: 26upx;
line-height: 56upx;
text-align: center;
color: #FF7800;
}
.praise-box{
.praise-icon{
width: 36upx;
height: 36upx;
}
}
}
.addComments-box{
border-top: 1upx solid #EEEEEE;
margin-top: 35upx;
}
}
.butBox{
padding: 0 30rpx;
display: flex;
justify-content: space-between;
.addComments-box{
height: 100upx;
width: 330upx;
background-color: #FFFFFF;
color: #333333;
border: 2rpx solid #333333;
.addComments-cion{
width: 50upx;
height: 50upx;
}
}
.addPraise-box{
height: 100upx;
width: 330upx;
background: #333333;
color: #FFFFFF;
.addPraise-icon{
width: 50upx;
height: 50upx;
}
}
.addPraise-box1{
height: 100upx;
width: 690upx;
background: #333333;
color: #FFFFFF;
.addPraise-icon{
width: 50upx;
height: 50upx;
}
}
}
}
.linkBox{
position: absolute;
bottom: 20upx;
width: 100%;
}
</style>