From ca73a173f008c8d7a9d700bad897ca24fe2d2203 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 16 十月 2023 09:29:57 +0800
Subject: [PATCH] 111

---
 minipro_standard/pages_inspect/pages/equipmentInspection/equipmentInspection.vue |   81 +++++++++++++++++++++-------------------
 1 files changed, 43 insertions(+), 38 deletions(-)

diff --git a/minipro_standard/pages_inspect/pages/equipmentInspection/equipmentInspection.vue b/minipro_standard/pages_inspect/pages/equipmentInspection/equipmentInspection.vue
index a730917..fb83d85 100644
--- a/minipro_standard/pages_inspect/pages/equipmentInspection/equipmentInspection.vue
+++ b/minipro_standard/pages_inspect/pages/equipmentInspection/equipmentInspection.vue
@@ -50,9 +50,9 @@
 					<view class="box_list1_club_list_item" v-for="(item, index) in form.files" :key="index"
 						@click="seeBigFile(index)">
 						<image class="close" src="@/static/ic_delete@2x.png" @click.stop="dele(index)" />
-						<image class="play" src="@/static/ic_play@2x.png" v-if="item.type === 1" />
+						<image class="play" src="@/static/ic_play@2x.png" v-if="item.typec === 1" />
 						<view class="type">
-							<video :src="item.url" v-if="item.type === 1"></video>
+							<video :src="item.url" v-if="item.typec === 1"></video>
 							<image v-else class="type_img" :src="item.url" mode="widthFix" />
 						</view>
 					</view>
@@ -63,14 +63,13 @@
 		</view>
 		<view class="box_list2">
 			<view class="box_list2_label">澶囨敞</view>
-			<textarea name="" id="" v-model="form.remarks" cols="20" rows="5" maxlength="300"
-				placeholder="璇疯缁嗘弿杩板贰妫�鎯呭喌"></textarea>
+			<textarea v-model="form.remarks" cols="20" rows="5" maxlength="300" placeholder="璇疯缁嗘弿杩板贰妫�鎯呭喌"></textarea>
 		</view>
 		<view class="box_footer">
 			<button class="box_footer_submit" v-preventReClick @click="submit">鎻愪氦</button>
 		</view>
 		<!-- 鏌ョ湅澶у浘 -->
-		<Preview :list="form.files" :current="current" v-if="isOpen" />
+		<Preview :list="form.files.map(item => item.url)" :current="current" @close="isOpen = false" v-if="isOpen" />
 		<!-- 閫夋嫨璁惧 -->
 		<ytyDataPicker :show="show" :dataList="columns" @select="handleSelect" @search="handleSearch" @close="show = false" />
 		<!-- 閫夋嫨鏃堕棿 -->
@@ -86,16 +85,11 @@
 	import { setTime, judgmentType } from '@/util/utils.js'
 	import { mapState } from 'vuex'
 	import ytyDataPicker from '@/components/yty-data-picker/yty-data-picker.vue'
-	import Preview from '@/components/Preview/Preview.vue'
+	import Preview from '@/components/Preview.vue'
 
 	export default {
 		data() {
 			return {
-				list1: [
-					'https://cloudfactory.oss-cn-hangzhou.aliyuncs.com/deviceCheck/20230911/e228a809-0a6b-443c-9a2c-78d5c1b1b633.mp4',
-					'https://cdn.uviewui.com/uview/swiper/swiper2.png',
-					'https://cdn.uviewui.com/uview/swiper/swiper3.png',
-				],
 				status: [{
 						name: '姝e父',
 						active: true,
@@ -108,6 +102,7 @@
 					}
 				],
 				columns: [],
+				isOpen: false,
 				path: '',
 				show: false,
 				showTime: false,
@@ -136,6 +131,11 @@
 			...mapState(['session'])
 		},
 		methods: {
+			// 鏌ョ湅澶у浘/瑙嗛
+			seeBigFile(i) {
+				this.current = i
+				this.isOpen = true
+			},
 			// 鍒犻櫎鎸囧畾鏂囦欢
 			dele(i) {
 				this.form.files.splice(i, 1)
@@ -255,36 +255,41 @@
 			// 鐐瑰嚮涓婁紶
 			uploadFile() {
 				var that = this
-				uni.chooseImage({
+				uni.chooseMedia({
+					mediaType: ['image', 'video'],
+					sourceType: ['album', 'camera'],
 					success: (chooseImageRes) => {
-						const tempFilePaths = chooseImageRes.tempFilePaths;
-						console.log(tempFilePaths)
-						uni.uploadFile({
-							url: baseUrl + '/ext/routeCardExt/upload',
-							filePath: tempFilePaths[0],
-							name: 'file',
-							header: {
-								'Cookie': 'eva-auth-token=' + that.session
-							},
-							formData: {
-								'folder': that.path
-							},
-							success: (uploadFileRes) => {
-								let res = JSON.parse(uploadFileRes.data)
-								let type = ''
-								for (let i = 0; i < fileType.length; i++) {
-									if (tempFilePaths[0].indexOf(fileType[i].name) !== -1) {
-										type = fileType[i].type
+						uni.showLoading({ title: '涓婁紶涓�' });
+						const tempFilePaths = chooseImageRes.tempFiles;
+						for (let i = 0; i < tempFilePaths.length; i++) {
+							uni.uploadFile({
+								url: baseUrl + '/ext/routeCardExt/upload',
+								filePath: tempFilePaths[i].tempFilePath,
+								name: 'file',
+								header: {
+									'Cookie': 'eva-auth-token=' + that.session
+								},
+								formData: {
+									'folder': that.path
+								},
+								success: (uploadFileRes) => {
+									let res = JSON.parse(uploadFileRes.data)
+									let typec = ''
+									for (let s = 0; s < fileType.length; s++) {
+										if (tempFilePaths[i].tempFilePath.indexOf(fileType[s].name) !== -1) {
+											typec = fileType[s].type
+										}
 									}
+									that.form.files.push({
+										fileUrl: res.data.imgaddr,
+										filename: res.data.imgname,
+										typec,
+										url: res.data.url
+									})
+									uni.hideLoading();
 								}
-								that.form.files.push({
-									fileUrl: res.data.imgaddr,
-									filename: res.data.imgname,
-									type,
-									url: res.data.url
-								})
-							}
-						});
+							});
+						}
 					}
 				});
 			},

--
Gitblit v1.9.3