hejianhao
2025-03-17 816b0cd5708aceb205c0124e2427967ab8d1200f
H5/pages/evaluate/evaluate.vue
@@ -5,19 +5,18 @@
      <view class="allContent">
         <view class="fs-27 lh-38 font-bold">评价打分</view>
         <view class="mt-25 flex j-between">
            <view class="evaluateItem" v-for="(item,index) in list" :key="index" @click="activeType=item.value"
               :class="activeType==item.value && 'activeBg'">
            <view class="evaluateItem" v-for="(item,index) in list" :key="index" @click="rate=item.value"
               :class="rate==item.value && 'activeBg'">
               <image :src="item.img" class="statusImg" />
               <view class="title">{{item.tit}}</view>
            </view>
         </view>
         <view class="mt-38">
            <view class="fs-27 lh-38 font-bold">评价内容</view>
            <textarea v-model="describe" class="pt-25 pl-31 mt-27 fs-27 br-8 bgcolor4"
               :class="(rulsFlag && !describe) && 'bgcolor-border'"
            <textarea v-model="content" class="pt-25 pl-31 mt-27 fs-27 br-8 bgcolor4"
               :class="(rulsFlag && !content) && 'bgcolor-border'"
               style="height: 365rpx;width: calc(100% - 31rpx);" placeholder="请输入不超过200字评价" />
            <view v-if="rulsFlag && !describe" class="flex a-center mt-19">
            <view v-if="rulsFlag && !content" class="flex a-center mt-19">
               <image src="@/static/noNull.png" class="w-35 h-35 mr-13 shrink0" />
               <view class="fs-23 color99">评价内容不能为空</view>
            </view>
@@ -72,47 +71,39 @@
<script>
   import {
      saveProcess,
      getComplaintDetail
   } from './service'
   import config from '@/config/index.js'
   export default {
      data() {
         return {
            complaintId: '', //诉求id
            info: {}, //工单详情
            describe: '', //办理进度描述
            content: '', //评价内容
            localImageUrls: [], //本地回显的图片
            imgUrls: [], //传给后端的url
            video: [],
            againCklicFlag: true,
            rulsFlag: false,
            activeType: 1,
            rate: null, //评价打分
            list: [{
               img: '../../static/detailImg/img1.png',
               tit: '不满意',
               value: 1
               value: 0
            }, {
               img: '../../static/detailImg/img2.png',
               tit: '一般',
               value: 2
               value: 1
            }, {
               img: '../../static/detailImg/img3.png',
               tit: '满意',
               value: 3
               value: 2
            }, {
               img: '../../static/detailImg/img4.png',
               tit: '非常满意',
               value: 4
               value: 3
            }],
         }
      },
      onLoad(params) {
         // this.complaintId = params.id
         // getComplaintDetail({
         //    id: params.id
         // }).then(res => {
         //    this.info = res.data
         // })
         this.complaintId = params.id
      },
      methods: {
         back() {
@@ -121,16 +112,17 @@
            })
         },
         submit() {
            if (!this.describe) {
               this.rulsFlag = true
               return uni.showToast({
            if (!this.rate) {
               uni.showToast({
                  icon: 'none',
                  title: '请输入办理进度描述'
                  title: '请评价打分',
               })
               return
            }
            let obj = {
               complaintId: this.complaintId,
               describe: this.describe,
               content: this.content,
               rate: this.rate,
               imgUrl: this.imgUrls.join(','),
               video: this.video.join(',')
            }
@@ -166,14 +158,11 @@
            })
         },
         uploadImg(type) {
            // if (!this.againCklicFlag) return
            this.againCklicFlag = false
            if (type == 1) {
               uni.chooseImage({
                  count: 1,
                  count: 9 - this.imgUrls.length,
                  success: (chooseImageRes) => {
                     this.imgUrls.push('loading')
                     this.againCklicFlag = true
                     let imgPathList = chooseImageRes.tempFilePaths;
                     if (imgPathList.length > 0) {
                        uni.uploadFile({
@@ -194,7 +183,6 @@
                                    this.localImageUrls.push(imgPathList[0])
                                 })
                              } else {
                                 this.againCklicFlag = true
                                 this.imgUrls = this.imgUrls.filter(
                                    item => item != 'loading')
                                 uni.showToast({
@@ -205,7 +193,6 @@
                              }
                           },
                           fail: (err) => {
                              this.againCklicFlag = true
                              this.imgUrls = this.imgUrls.filter(
                                 item => item != 'loading')
                              uni.showToast({
@@ -217,16 +204,12 @@
                        })
                     }
                  },
                  fail: () => {
                     this.againCklicFlag = true
                  }
               })
            } else {
               uni.chooseVideo({
                  camera: 'back',
                  count: 9 - this.video.length,
                  success: (res) => {
                     this.video.push('loading')
                     this.againCklicFlag = true
                     const tempFilePath = res.tempFilePath;
                     uni.uploadFile({
                        url: config.imageUrl,
@@ -234,7 +217,7 @@
                        timeout: 1000 * 45,
                        name: 'file',
                        header: {
                           Authorization: cuni.getStorageSync('token')
                           Authorization: uni.getStorageSync('token')
                        },
                        success: (res) => {
                           if (JSON.parse(res.data).code == 200) {
@@ -244,7 +227,6 @@
                                 this.video.push(JSON.parse(res.data).data)
                              })
                           } else {
                              this.againCklicFlag = true
                              this.video = this.video.filter(
                                 item => item != 'loading')
                              uni.showToast({
@@ -255,7 +237,6 @@
                           }
                        },
                        fail: (err) => {
                           this.againCklicFlag = true
                           this.video = this.video.filter(
                              item => item != 'loading')
                           uni.showToast({
@@ -266,9 +247,6 @@
                        }
                     })
                  },
                  fail: () => {
                     this.againCklicFlag = true
                  }
               })
            }
         },