From 56c8021dcbfc13a24ad13c783bb5fb23a9afd318 Mon Sep 17 00:00:00 2001
From: zjh <2207896513@qq.com>
Date: 星期四, 22 五月 2025 13:53:56 +0800
Subject: [PATCH] 图片查看文件上传

---
 pages/QC/LLJ/ImageItemALL.vue |   59 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 37 insertions(+), 22 deletions(-)

diff --git a/pages/QC/LLJ/ImageItemALL.vue b/pages/QC/LLJ/ImageItemALL.vue
index 40abd71..6340a2e 100644
--- a/pages/QC/LLJ/ImageItemALL.vue
+++ b/pages/QC/LLJ/ImageItemALL.vue
@@ -107,7 +107,8 @@
 
       uni.chooseImage({
         sourceType: sourceTypeArray[this.sourceTypeIndex],
-        sizeType: sizeTypeArray[this.sizeTypeIndex],
+        //sizeType: sizeTypeArray[this.sizeTypeIndex],
+		 sizeType: ['compressed'], // 寮哄埗浣跨敤鍘嬬缉妯″紡
         crop: this.isCrop ? {
           "quality": this.cropPercent,
           "width": this.cropWidth,
@@ -116,25 +117,26 @@
         } : null,
         count: this.qsImage.length + this.count[this.countIndex] > 9 ? 9 - this.qsImage.length : this.count[this.countIndex],
         success: (res) => {
-          let url = res.tempFilePaths[0];
-          pathToBase64(url)
-              .then(base64 => {
-                // 鎵惧埌鏈�鍚庝竴涓枩鏉犵殑浣嶇疆
-                let lastSlashIndex = url.lastIndexOf("/");
-                // 鎻愬彇鏂囦欢鍚�
-                let fileName = url.substring(lastSlashIndex + 1);
-                let entity = {};
-                entity.img = base64;
-                entity.Picturename = fileName;
-                entity.fid = this.fid;
-                entity.qsType = 4;
-                entity.base64Date = base64.split(',')[1];
-
-                this.qsImage.push(entity);
-              })
-              .catch(error => {
-                console.error(error)
-              })
+        
+		  pathToBase64(url)
+		      .then(base64 => {
+		        // 鎵惧埌鏈�鍚庝竴涓枩鏉犵殑浣嶇疆
+		        let lastSlashIndex = url.lastIndexOf("/");
+		        // 鎻愬彇鏂囦欢鍚�
+		        let fileName = url.substring(lastSlashIndex + 1);
+		        let entity = {};
+		        entity.img = base64;
+		        entity.Picturename = fileName;
+		        entity.fid = this.fid;
+		        entity.qsType = 4;
+		        entity.base64Date = base64.split(',')[1];
+		  
+		        this.qsImage.push(entity);
+		      })
+		      .catch(error => {
+		        console.error(error)
+		      })
+          
         },
         fail: (err) => {
           console.log("err: ", JSON.stringify(err));
@@ -142,11 +144,24 @@
       });
     },
     previewImage(index) {
+		// console.log(this.qsImage.map(s=>s.img)[0])
+		let imagesArry = [];
+		base64ToPath(this.qsImage.map(s=>s.img)[index]).then(path => {
+						uni.hideLoading();
+						 imagesArry[0] = path
+						console.log(path);
+						uni.previewImage({
+							current: 0,
+							urls: imagesArry
+						})
+					})
+		
+		
       // uni.previewImage({
-      //   current: index, // 璁剧疆褰撳墠鏄剧ず鍥剧墖鐨勯摼鎺�
+      //   current: '0', // 璁剧疆褰撳墠鏄剧ず鍥剧墖鐨勯摼鎺�
       //   urls: this.qsImage.map(s=>s.img), // 闇�瑕侀瑙堢殑鍥剧墖閾炬帴鍒楄〃
       //   loop: false, // 鏄惁寮�鍚浘鐗囪疆鎾紝榛樿涓� false
-      //   indicator: 'default',// 鍥剧墖鎸囩ず鍣ㄧ被鍨嬶紝鍙�夊�间负 "default"銆�"number"銆�"pointer"锛岄粯璁や负 "default"
+      //   indicator: 'pointer',// 鍥剧墖鎸囩ず鍣ㄧ被鍨嬶紝鍙�夊�间负 "default"銆�"number"銆�"pointer"锛岄粯璁や负 "default"
       // });
     },
     init() {

--
Gitblit v1.9.3