parent
f6c4182e68
commit
9722f26b90
@ -1,106 +0,0 @@
|
||||
<!--
|
||||
* @Author: ch
|
||||
* @Date: 2022-06-20 16:36:14
|
||||
* @LastEditors: ch
|
||||
* @LastEditTime: 2022-06-23 11:41:09
|
||||
* @Description: file content
|
||||
-->
|
||||
<template>
|
||||
<view>
|
||||
<view class="rate">
|
||||
<text class="rate--title">满意度评分</text>
|
||||
<u-rate :count="5" v-model="rate" size="47rpx" activeColor="#FFA35B" inactiveColor="#DDD"></u-rate>
|
||||
<text class="rate--desc">满意</text>
|
||||
</view>
|
||||
<view>
|
||||
<textarea class="textarea" placeholder="从多个维度评价,可以帮助更多想买的人哦~"
|
||||
:maxlength="500" v-model="commentContent"></textarea>
|
||||
<u-upload class="upload"
|
||||
@afterRead="handleUpdateImg" @delete="handleDelImg"
|
||||
:fileList="fileList" :maxCount="6" :previewFullImage="true">
|
||||
</u-upload>
|
||||
</view>
|
||||
<view class="footer">
|
||||
<UiButton type="solid" :disable="!rate" @click="handleSubmit">发表评价</UiButton>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import UiButton from '@/components/UiButton.vue';
|
||||
import {ApiPostComment} from '@/common/api/comment';
|
||||
import COMMENT from '@/common/dicts/comment';
|
||||
import {uploadFileOss} from '@/common/utils';
|
||||
export default {
|
||||
components: { UiButton },
|
||||
props:{
|
||||
commentDetail : {
|
||||
type : Object,
|
||||
default : ()=> ({})
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
rate : 0,
|
||||
commentContent : '',
|
||||
fileList : []
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
async handleSubmit(){
|
||||
let data = {
|
||||
commentScore : this.rate,
|
||||
commentContent : this.commentContent,
|
||||
commentType : COMMENT.TYPE.COMMENT,
|
||||
orderProductId : this.commentDetail.orderProductId,
|
||||
productId : this.commentDetail.productId,
|
||||
pictureUrl : this.fileList.map(i => i.url).join(',')
|
||||
}
|
||||
const {error, result} = await ApiPostComment(data);
|
||||
if(error){
|
||||
uni.$u.toast(error.message);
|
||||
return false;
|
||||
}
|
||||
this.$emit('submit',result);
|
||||
},
|
||||
async handleUpdateImg(val){
|
||||
const {error, result} = await uploadFileOss(val.file, {
|
||||
configId : 'account-comment',
|
||||
serviceName : 'comment'
|
||||
})
|
||||
if(error){
|
||||
uni.$u.toast(error);
|
||||
}
|
||||
this.fileList.push({url : result});
|
||||
},
|
||||
handleDelImg(target){
|
||||
this.fileList.splice(target.index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.rate{
|
||||
display: flex;
|
||||
margin: 50rpx 0;
|
||||
align-items: center;
|
||||
&--title{
|
||||
font-size: 28rpx;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
&--desc{
|
||||
font-size: 30rpx;
|
||||
color: #999;
|
||||
margin-left: 40rpx;
|
||||
}
|
||||
}
|
||||
.textarea{
|
||||
height: 200rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
.footer{
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
margin-top: 50rpx;
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue