feedback.vue 10.6 KB
Newer Older
1 2
<template>
  <h-view id="help-detail" class="public-style">
3
    <h-header :proportion="[5,1,1]" class="bar-custom">
4
      <div slot="left" class="h-header-btn">
5
        <img src="@/assets/userBind/arrow.png" @click="$routeGo()" >
6 7 8 9 10 11 12
        <span>帮助与反馈</span>
      </div>
    </h-header>
    <h-content class="my-content">
      <h4>问题反馈</h4>
      <div class="write">
        <div class="box">
786817560's avatar
786817560 committed
13
          <span>问题描述</span>
786817560's avatar
786817560 committed
14
          <textarea v-model="question_desc" placeholder="请输入您的描述……" />
15 16 17 18 19 20
        </div>
      </div>
      <div class="upLoad">
        <div class="upLoad-box">
          <span>添加图片说明</span>
          <div class="file-content">
linxin's avatar
linxin committed
21 22
            <div
              v-for="(item, index) in upload_list"
786817560's avatar
786817560 committed
23
              v-if="item.check_id===question_id"
linxin's avatar
linxin committed
24 25 26
              :key="index"
              class="file"
            >
linxin's avatar
linxin committed
27
              <img :src="item.picture" class="file-img" @click="showBigPicture(item.picture)" >
linxin's avatar
linxin committed
28 29 30
              <div class="close" @click="remove_pic(item.attachment_id,index)">
                <img src="@/assets/userBind/deleteIcon.png" >
              </div>
31
            </div>
786817560's avatar
786817560 committed
32
            <div class="file" @click="imgUploadShow(question_id)">
33
              <img class="photo" src="@/assets/help/photo.png" >
34 35 36 37 38 39 40
            </div>
          </div>
        </div>
      </div>
      <p class="info">欢迎您为我们提出宝贵的意见与建议,您留下的任何信息都将改善我们的软件</p>
    </h-content>
    <bottom-tab>
786817560's avatar
786817560 committed
41
      <tab-button class="bottom-button" @click.native = "handSubmit">&nbsp;&nbsp;</tab-button>
42 43 44 45
    </bottom-tab>
  </h-view>
</template>
<script>
linxin's avatar
linxin committed
46 47
import ps from '../../assets/constractSigning/bank.png'

linxin's avatar
linxin committed
48 49 50
export default {
  data () {
    return {
786817560's avatar
786817560 committed
51
      question_desc: '', // 问题描述
786817560's avatar
786817560 committed
52
      question_id: '',
linxin's avatar
linxin committed
53 54 55
      upload_list: [], // 上传图片列表
    }
  },
786817560's avatar
786817560 committed
56 57 58 59
  beforeRouteEnter (to, from, next) {
    next(vm => {
      if (from.name === 'HelpList') {
        vm.question_desc = ''
786817560's avatar
786817560 committed
60
        vm.upload_list = []
786817560's avatar
786817560 committed
61 62
        vm.question_id = ''
        vm.getQuestionId()
786817560's avatar
786817560 committed
63 64 65
      }
    })
  },
linxin's avatar
linxin committed
66
  methods: {
786817560's avatar
786817560 committed
67 68 69 70 71 72 73
    handSubmit () {
      let vm = this
      let url = process.env.basePath + 'app_question_save'
      let param = {
        'master': {
          user_phone: window.localStorage.user_phone,
          question_desc: vm.question_desc,
786817560's avatar
786817560 committed
74
          question_id: vm.question_id,
786817560's avatar
786817560 committed
75 76 77 78 79
        },
      }
      vm.hlsPopup.showLoading('提交数据中!')
      vm.hlsHttp.post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
786817560's avatar
786817560 committed
80 81 82
        if (res.result === 'S') {
          vm.hlsPopup.showSuccess('提交成功')
        }
786817560's avatar
786817560 committed
83 84 85
      })
    },
    // 图片上传入口
linxin's avatar
linxin committed
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
    imgUploadShow (check_id) {
      let vm = this
      hlsPopup.showActionSheet({
        titleText: '请选择照片',
        buttonArray: ['拍照', '从相册取'],
        callback: index => {
          if (index === 0) {
            vm.imgUploadOpenCamera(check_id)
          } else {
            vm.imgUploadTakePicture(check_id)
          }
        },
      })
    },
    imgUploadOpenCamera (check_id) {
      let vm = this
      let obj = {
786817560's avatar
786817560 committed
103 104 105 106 107 108 109 110
        pkvalue: check_id,
        source_type: 'HLS_APP_QUESTION',
        picture: '',
        check_id: check_id,
        filePath: '',
        attachment_id: '',
        user_id: 1,
        fileName: '',
linxin's avatar
linxin committed
111 112 113 114 115 116 117
      }
      let cameraoptions = {
        quality: 100,
      }
      let success = function (imgdata) {
        obj.picture = imgdata
        obj.filePath = imgdata
786817560's avatar
786817560 committed
118
        // vm.faceListUpload.push(obj)
linxin's avatar
linxin committed
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
        let list = []
        list.push(obj)
        // 拍完一张立马执行保存图片逻辑
        vm.save_picture(list)
      }
      let error = function () {
        hlsPopup.showLongCenter('请拍照')
      }
      hlsUtil.openCamera(cameraoptions, success, error)
    },
    imgUploadTakePicture (check_id) {
      let vm = this
      let cameraoptions = {
        quality: 100,
      }
      let success = function (imgUrl) {
        var list = []
        for (let i = 0; i < imgUrl.length; i++) {
          let obj = {
            'pkvalue': check_id,
786817560's avatar
786817560 committed
139
            'source_type': 'HLS_APP_QUESTION',
linxin's avatar
linxin committed
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
            'picture': '',
            'check_id': check_id,
            'filePath': '',
            'attachment_id': '',
            'user_id': 1,
            'fileName': '',
          }
          obj.picture = imgUrl[i]
          obj.filePath = imgUrl[i]
          list.push(obj)
        }
        // 拍完一张立马执行保存图片逻辑
        vm.save_picture(list)
      }
      let error = function () {
      }
      vm.hlsUtil.takePicture(cameraoptions, success, error)
    },
    openCamera (ocrType, type) {
      let vm = this
      let cameraoptions = {
        quality: 60,
        width: 1843,
        height: 1382,
      }
      let success = function (imgdata) {
        if (!imgdata) {
          hlsPopup.showLongCenter('请拍照')
        }
      }
      let error = function () {
        hlsPopup.showLongCenter('请拍照')
      }
      hlsUtil.openCamera(cameraoptions, success, error)
    },
    takePicture (ocrType, type) {
      let vm = this
      var cameraoptions = {
        quality: 70,
        width: 1843,
        height: 1382,
        maxCount: 1,
      }
      let success = function (imgUrl) {
        if (imgUrl.length === 0) {
          hlsPopup.showLongCenter('请选择一张图片')
        }
      }
      let error = function () {
        hlsPopup.showLongCenter(error)
      }
      vm.hlsUtil.takePicture(cameraoptions, success, error)
    },
    save_picture (list) {
      let vm = this
      if (list.length) {
        // hlsPopup.showLoading('图片上传请稍候')
        var alreadyUploadNum = 0
        var attLength = 0
        var recordUploadInterval = setInterval(function () {
          if (alreadyUploadNum === attLength) {
            clearInterval(recordUploadInterval)
            /* hlsPopup.hideLoading()
            hlsPopup.showLongCenter('图片上传成功') */
786817560's avatar
786817560 committed
204
            hlsPopup.showLongCenter('上传成功')
linxin's avatar
linxin committed
205 206 207 208 209
          }
        }, 500)
        for (var i = 0; i < list.length; i++) {
          let uploadSuccess = function (res) {
            if (res.result === 'S') {
786817560's avatar
786817560 committed
210
              // hlsPopup.showLongCenter('上传成功')
linxin's avatar
linxin committed
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
              alreadyUploadNum++
              for (var j = 0; j < list.length; j++) {
                if (list[j].filePath === res.response.filePath) {
                  list[j].attachment_id = res.response.attachment_id
                  vm.upload_list.push(list[j])
                  break
                }
              }
            } else {
              hlsPopup.hideLoading()
            }
          }
          if (!list[i].attachment_id) {
            attLength++
            hlsUtil.fileUploadSvc(list[i], uploadSuccess)
          }
        }
      } else {
        hlsPopup.hideLoading()
      }
    },
    // 查看大图
    showBigPicture (pic) {
      let vm = this
      vm.hlsPopup.showBigPicture({
        imgUrl: pic,
        width: '100% !important',
      })
    },
    // 移除图片
    remove_pic (attachment_id, index) {
      let vm = this
      var delete_list = []
      let obj = {'attachment_id': attachment_id}
      delete_list.push(obj)
      let url = process.env.basePath + 'app_delete_attment' // 附件删除
      let param = {
        'picturelist': delete_list,
      }
      hlsPopup.showLoading('请稍候')
      vm.hlsHttp.post(url, param).then(function (res) {
        hlsPopup.hideLoading()
        if (res.result === 'S') {
          hlsPopup.showLongCenter('删除成功!')
          vm.remove_upload_list(attachment_id, index)
        } else if (res.result === 'E') {
          hlsPopup.showShortCenter(res.message)
        }
      })
    },
    remove_upload_list (attachment_id, index) {
      let vm = this
      vm.upload_list.remove(index)
      vm.upload_list.sort()
    },
786817560's avatar
786817560 committed
266 267 268

    // 获取question_id
    getQuestionId () {
786817560's avatar
786817560 committed
269
      let vm = this
786817560's avatar
786817560 committed
270 271 272 273
      let url = process.env.basePath + 'get_app_question_id'
      let param = { }
      vm.hlsPopup.showLoading('请稍后!')
      vm.hlsHttp.post(url, param).then(function (res) {
786817560's avatar
786817560 committed
274
        vm.hlsPopup.hideLoading()
786817560's avatar
786817560 committed
275 276 277
        if (res.result === 'S') {
          vm.question_id = res.info.question_id
        }
786817560's avatar
786817560 committed
278 279
      })
    },
linxin's avatar
linxin committed
280 281
  },
}
282 283 284
</script>
<style lang="less" scoped>
#help-detail {
linxin's avatar
linxin committed
285 286 287 288 289 290 291 292 293 294
   .close {
          position: relative;
          color: #f96f68;
          margin-top: -100%;
          margin-left: -10%;
          img {
            width: 14px;
            height: 14px;
          }
        }
295 296 297 298 299 300 301 302 303 304
  textarea::placeholder {
    font-family: PingFangSC-Regular;
    font-size: 13px;
    color: #b4b4b5;
    letter-spacing: 0;
  }
  .my-content {
    h4 {
      font-family: PingFangSC-Semibold;
      font-size: 15px;
305
      color: @headerColor;
306 307 308 309 310 311 312 313 314
      letter-spacing: 0;
      line-height: 20px;
      margin-top: 16px;
      padding-left: 26px;
      position: relative;
    }
    h4::before {
      content: "";
      display: inline-block;
315
      background-color: @headerColor;
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
      position: absolute;
      top: 5px;
      left: 15px;
      width: 4px;
      height: 12px;
    }
  }
  .write {
    width: 100%;
    height: 172px;
    background-color: #fff;
    margin-top: 16px;
    span {
      font-family: PingFangSC-Regular;
      font-size: 14px;
      color: #656464;
      letter-spacing: 0;
    }
    .box {
      width: 343px;
      margin: 0 auto;
      padding-top: 8px;
      textarea {
        width: 343px;
        height: 119px;
        margin-top: 12.5px;
        font-family: PingFangSC-Regular;
        font-size: 13px;
        letter-spacing: 0;
      }
    }
  }
  .upLoad {
    background-color: #ffffff;
    margin-top: 16px;
    padding-bottom: 16px;
    .upLoad-box {
      margin-left: 16px;
      padding-top: 8px;
      span {
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #656464;
        letter-spacing: 0;
      }
    }
    .file-content {
      display: flex;
      justify-content: flex-start;
      flex-wrap: wrap;
      align-items: center;
      .file {
        margin-top: 16px;
        width: 80px;
        height: 80px;
        border: 1px dashed #dcdcdd;
        border-radius: 2px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-left: 20px;
linxin's avatar
linxin committed
377
        .file-img {
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399
          width: 80px;
          height: 80px;
        }
        .photo {
          width: 21px;
          height: 18px;
        }
      }
    }
  }
  .info {
    width: 311px;
    margin: 0 auto;
    font-family: PingFangSC-Regular;
    font-size: 12px;
    color: #b4b4b5;
    text-align: center;
    margin-top: 40px;
    line-height: 20px;
  }
  .bottom-button {
    color: #fff;
400
    background-color: @headerColor;
401 402 403
  }
}
</style>