feedback.vue 9.42 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 13 14 15 16 17 18 19 20
        <span>帮助与反馈</span>
      </div>
    </h-header>
    <h-content class="my-content">
      <h4>问题反馈</h4>
      <div class="write">
        <div class="box">
          <span>问题描述</span>
          <textarea placeholder="请输入您的描述……" />
        </div>
      </div>
      <div class="upLoad">
        <div class="upLoad-box">
          <span>添加图片说明</span>
          <div class="file-content">
linxin's avatar
linxin committed
21 22 23 24 25 26
            <div
              v-for="(item, index) in upload_list"
              v-if="item.check_id==list.check_id"
              :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>
linxin's avatar
linxin committed
32
            <!-- <div class="file">
33
              <img src="@/assets/help/1.jpg" >
linxin's avatar
linxin committed
34
            </div> -->
linxin's avatar
linxin committed
35
            <div class="file" @click="imgUploadShow(list.check_id)">
36
              <img class="photo" src="@/assets/help/photo.png" >
37 38 39 40 41 42 43 44 45 46 47 48
            </div>
          </div>
        </div>
      </div>
      <p class="info">欢迎您为我们提出宝贵的意见与建议,您留下的任何信息都将改善我们的软件</p>
    </h-content>
    <bottom-tab>
      <tab-button class="bottom-button">&nbsp;&nbsp;</tab-button>
    </bottom-tab>
  </h-view>
</template>
<script>
linxin's avatar
linxin committed
49 50
import ps from '../../assets/constractSigning/bank.png'

linxin's avatar
linxin committed
51 52 53
export default {
  data () {
    return {
linxin's avatar
linxin committed
54 55 56
      list: {
        chck_id: '123456',
      },
linxin's avatar
linxin committed
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
      upload_list: [], // 上传图片列表
    }
  },
  methods: {
  // 图片上传入口
    imgUploadShow (check_id) {
      let vm = this
      // vm.upload_list = []
      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 = {
        'pkvalue': check_id,
        'source_type': 'PRJ_CDD_ITEM_CHECK',
        'picture': '',
        'check_id': check_id,
        'filePath': '',
        'attachment_id': '',
        'user_id': 1,
        'fileName': '',
      }
      let cameraoptions = {
        quality: 100,
      }
      let success = function (imgdata) {
        obj.picture = imgdata
        obj.filePath = imgdata
        let list = []
        list.push(obj)
        // vm.upload_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,
            'source_type': 'PRJ_CDD_ITEM_CHECK',
            '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('图片上传成功') */
          }
        }, 500)
        for (var i = 0; i < list.length; i++) {
          let uploadSuccess = function (res) {
            if (res.result === 'S') {
              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()
    },
  },
}
243 244 245
</script>
<style lang="less" scoped>
#help-detail {
linxin's avatar
linxin committed
246 247 248 249 250 251 252 253 254 255
   .close {
          position: relative;
          color: #f96f68;
          margin-top: -100%;
          margin-left: -10%;
          img {
            width: 14px;
            height: 14px;
          }
        }
256 257 258 259 260 261 262 263 264 265
  textarea::placeholder {
    font-family: PingFangSC-Regular;
    font-size: 13px;
    color: #b4b4b5;
    letter-spacing: 0;
  }
  .my-content {
    h4 {
      font-family: PingFangSC-Semibold;
      font-size: 15px;
266
      color: @headerColor;
267 268 269 270 271 272 273 274 275
      letter-spacing: 0;
      line-height: 20px;
      margin-top: 16px;
      padding-left: 26px;
      position: relative;
    }
    h4::before {
      content: "";
      display: inline-block;
276
      background-color: @headerColor;
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
      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
338
        .file-img {
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
          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;
361
    background-color: @headerColor;
362 363 364
  }
}
</style>