瀏覽代碼

no message

linwenxin 2 月之前
父節點
當前提交
7dbcb5a9f5
共有 3 個文件被更改,包括 74 次插入12 次删除
  1. 74 12
      src/packageWorkorder/pages/nandufysq.vue
  2. 二進制
      src/static/common/guanbi.png
  3. 二進制
      src/static/common/shipin.png

+ 74 - 12
src/packageWorkorder/pages/nandufysq.vue

@@ -80,7 +80,13 @@
         <view class="images">
           <block v-for="(item, index) in imageList" :key="index">
             <view class="img">
-              <image :src="item.url" mode="aspectFill" @tap="prevImg(item.url)"></image>
+              <image v-if="isImage(item.url)" :src="item.url" mode="aspectFill" @tap="prevImg(item.url)"></image>
+              <image
+                v-if="!isImage(item.url)"
+                src="@/static/common/shipin.png"
+                mode="aspectFill"
+                @tap="prevVideo(item.url)"
+              ></image>
               <text v-if="type !== 'view'" class="iconfont icon-guanbi1" @tap="delImage(index)"></text>
             </view>
           </block>
@@ -138,6 +144,26 @@
         <u-button text="重新申请" type="primary" size="large" @click="shenheapi"></u-button>
       </view>
     </template>
+
+    <video
+      v-if="videoUrl"
+      :src="videoUrl"
+      style="width: 100%; height: 100%; position: fixed; top: 0; left: 0; z-index: 99999999999999"
+    ></video>
+    <cover-image
+      v-if="videoUrl"
+      style="
+        width: 120rpx;
+        height: 120rpx;
+        position: fixed;
+        right: 10rpx;
+        top: 10rpx;
+        z-index: 9999999999999999;
+        border-radius: 50%;
+      "
+      @click="videoUrl = ''"
+      src="@/static/common/guanbi.png"
+    ></cover-image>
   </zj-page-layout>
 </template>
 
@@ -152,7 +178,8 @@ export default {
       imageList: [],
       orderDetail: null,
       canClickBtn: true,
-      oldData: {}
+      oldData: {},
+      videoUrl: ''
     }
   },
 
@@ -198,20 +225,51 @@ export default {
 
     // 添加图片
     async addImage() {
-      uni.chooseImage({
-        count: 6 - this.imageList.length,
-        success: res => {
-          uni.showLoading()
-          res.tempFilePaths.forEach(async item => {
-            let data = await uploadImgFull(item)
-            this.imageList.push(data)
-          })
-          uni.hideLoading()
+      uni.showActionSheet({
+        title: '上传图片或视频',
+        itemList: ['图片', '视频'],
+        itemColor: '#000',
+        success: e => {
+          if (e.tapIndex === 0) {
+            uni.chooseImage({
+              count: 6 - this.imageList.length,
+              success: res => {
+                uni.showLoading()
+                res.tempFilePaths.forEach(async item => {
+                  let data = await uploadImgFull(item)
+                  this.imageList.push(data)
+                })
+                uni.hideLoading()
+              },
+              fail: err => {}
+            })
+          } else if (e.tapIndex === 1) {
+            uni.chooseVideo({
+              compressed: true,
+              sourceType: ['camera', 'album'],
+              camera: 'back',
+              maxDuration: 300,
+              success: async res => {
+                uni.showLoading()
+                let data = await uploadImgFull(res.tempFilePath)
+                this.imageList.push(data)
+                uni.hideLoading()
+              }
+            })
+          }
         },
-        fail: err => {}
+        fail: e => {
+          console.log(e)
+        }
       })
     },
 
+    isImage(ext) {
+      return ['png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].includes(
+        ext.substr(ext.lastIndexOf('.') + 1)
+      )
+    },
+
     // 删除图片
     delImage(index) {
       this.imageList.splice(index, 1)
@@ -227,6 +285,10 @@ export default {
       })
     },
 
+    prevVideo(current) {
+      this.videoUrl = current
+    },
+
     // 提交
     async submitData() {
       if (!this.canClickBtn) return this.$toast('请勿频繁操作')

二進制
src/static/common/guanbi.png


二進制
src/static/common/shipin.png