pyt
2025-02-24 d99a437b547fbb313ddf15f1a97c25e865f71c91
H5/pages/add-progress/index.vue
@@ -26,12 +26,13 @@
      </view>
      <view class="br-19 mt-38 bs-1 pt-35 pb-33 px-31">
         <view class="fs-27 lh-38 font-bold">办理进度描述</view>
         <textarea class="pt-25 pl-31 mt-27 fs-27 br-8 bgcolor4" style="height: 365rpx;" placeholder="请输入办理进度描述" />
         <textarea v-model="describe" class="pt-25 pl-31 mt-27 fs-27 br-8 bgcolor4" style="height: 365rpx;"
            placeholder="请输入办理进度描述" />
         <view class="fs-27 mt-38 lh-38 font-bold">图片</view>
         <view class="flex wrap mt-27">
            <view class="relative mr-15" v-for="item in 4" :key="item">
               <image src="/static/logo.png" class="w-140 h-140 shrink0 br-8" />
               <view class="absolute w-140 h-140 bgcolor5 top0 left0 br-8">
            <view class="relative mr-15" v-for="item in localImageUrls" :key="item">
               <image v-if="item != 'loading'" src="/static/logo.png" class="w-140 h-140 shrink0 br-8" />
               <view v-if="item != 'loading'" class="absolute w-140 h-140 bgcolor5 top0 left0 br-8">
                  <view class="absolute" style="top: 50%;left: 50%;transform: translate(-50%,-50%);">
                     <image @tap="viewImage(item)" src="@/static/Appeal/amplify.png" class="w-19 h-19 mr-35"
                        mode="" />
@@ -39,19 +40,23 @@
                  </view>
               </view>
            </view>
            <image src="/static/Appeal/add.png" class="w-140 h-140 shrink0" />
            <view v-if="imgUrls.includes('loading')" class="w-140 h-140 flex a-center j-center mr-15 border2 br-8">
               <u-loading-icon></u-loading-icon>
            </view>
            <image @tap="uploadImg" src="/static/Appeal/add.png" class="w-140 h-140 shrink0" />
         </view>
         <view class="fs-27 mt-37 lh-38 font-bold">视频</view>
         <view class="flex wrap mt-27">
            <view class="relative mr-15" v-for="item in 4" :key="item">
               <image src="@/static/logo.png" class="w-140 h-140 shrink0 br-8" />
               <view class="absolute w-140 h-140 bgcolor5 top0 left0 br-8">
            <view class="relative mr-15">
               <!-- <image src="@/static/logo.png" class="w-140 h-140 shrink0 br-8" /> -->
               <video src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4" />
               <!-- <view class="absolute w-140 h-140 bgcolor5 top0 left0 br-8">
                  <view class="absolute" style="top: 50%;left: 50%;transform: translate(-50%,-50%);">
                     <image @tap="viewImage(item)" src="@/static/Appeal/amplify.png" class="w-19 h-19 mr-35"
                        mode="" />
                     <image src="@/static/Appeal/trash.png" class="w-19 h-19" />
                  </view>
               </view>
               </view> -->
            </view>
            <image src="@/static/Appeal/add.png" class="w-140 h-140 shrink0" />
         </view>
@@ -62,16 +67,82 @@
</template>
<script>
   import {
      saveProcess,
   } from './service'
   import config from '@/config/index.js'
   export default {
      data() {
         return {
            id: '',
            describe: '',
            localImageUrls: [],
            imgUrls: [],
            video: [],
            againCklicFlag: true,
         }
      },
      onLoad(params) {
         this.id = params.id
      },
      methods: {
         viewImage(item) {
            uni.previewImage({
               urls:[require('@/static/logo.png')]
               urls: [require('@/static/logo.png')]
            })
         },
         uploadImg() {
            if (!this.againCklicFlag) return
            this.againCklicFlag = false
            uni.chooseImage({
               count: 1,
               sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
               sourceType: ['camera'], //x相机拍照
               success: (chooseImageRes) => {
                  this.againCklicFlag = true
                  let imgPathList = chooseImageRes.tempFilePaths;
                  if (imgPathList.length > 0) {
                     uni.uploadFile({
                        url: config.BASE_URL + '/master/oss/pic',
                        filePath: imgPathList[0],
                        timeout: 1000 * 45,
                        name: 'file',
                        header: {
                           Authorization: uni.getStorageSync('token')
                        },
                        success: (res) => {
                           if (JSON.parse(res.data).code == 200) {
                              let imgUrl = JSON.parse(res.data)
                              this.imageUrls = this.imageUrls.filter(item => item !=
                                 'loading')
                              this.$nextTick(() => {
                                 this.imageUrls.push(imgUrl)
                                 this.localImageUrls.push(imgPathList[0])
                              })
                           } else {
                              this.againCklicFlag = true
                              this.imgUrls = this.imgUrls.filter(
                                 item => item != 'loading')
                              uni.showToast({
                                 title: '上传失败,请重新上传',
                                 icon: 'none',
                                 mask: true
                              })
                           }
                        },
                        fail: (err) => {
                           this.againCklicFlag = true
                           this.imgUrls = this.imgUrls.filter(
                              item => item != 'loading')
                           uni.showToast({
                              title: '上传失败,请重新上传',
                              icon: 'none',
                              mask: true
                           })
                        }
                     })
                  }
               },
            })
         }
      }
@@ -127,6 +198,10 @@
      border: 2rpx solid #FFF1B8;
   }
   .border2 {
      border: 2rpx solid #F8F8F8;
   }
   .safe-box {
      height: env(safe-area-inset-bottom);
   }