From a3a48da30bdea132d2bfbb47fa2ccf83f1937c45 Mon Sep 17 00:00:00 2001
From: queenwuli <942534046@qq.com>
Date: Tue, 19 Jan 2021 08:29:55 +0800
Subject: [PATCH] 提交

---
 hive-app/common/jssdk/uploadImg.js |   34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/hive-app/common/jssdk/uploadImg.js b/hive-app/common/jssdk/uploadImg.js
index 52c5733..ce996f9 100644
--- a/hive-app/common/jssdk/uploadImg.js
+++ b/hive-app/common/jssdk/uploadImg.js
@@ -23,7 +23,8 @@
 			count: 1,
 			sourceType: ['camera'],
 			success: (data) => {
-				this.pathToBase64(data.tempFilePaths[0])
+				this.upload(data.tempFilePaths[0])
+				// this.pathToBase64(data.tempFilePaths[0])
 			}
 		})
 	},
@@ -33,7 +34,8 @@
 			count: 1,
 			sourceType: ['album'],
 			success: (data) => {
-				this.pathToBase64(data.tempFilePaths[0])
+				this.upload(data.tempFilePaths[0])
+				// this.pathToBase64(data.tempFilePaths[0])
 			}
 		})
 	},
@@ -51,13 +53,27 @@
 		//#endif  
 	},
 	upload(file){
-		httpUtils.request('/api/common/uploadPhotoBase64', {
-			base64: 'data:image/jpeg;base64,'+ file
-		}, 'POST').then((res) => {
-			if(res.status == 200){
-				this.callback && this.callback(res.mapInfo.file)
-			}else{
-				toast.info(res.info)
+		// httpUtils.request('/api/common/uploadPhotoBase64', {
+		// 	base64: file
+		// }, 'POST').then((res) => {
+		// 	console.log(res)
+		// 	if(res.status == 200){
+		// 		this.callback && this.callback(res.mapInfo.file)
+		// 	}else{
+		// 		toast.info(res.info)
+		// 	}
+		// })
+		uni.uploadFile({
+			url: httpUtils.baseUrl+'/api/common/uploadImg',
+			filePath: file,
+			name: 'file',
+			success: (res) => {
+				let result = JSON.parse(res.data);
+				if(result.status == 200){
+					this.callback && this.callback(result.mapInfo.file)
+				}else{
+					toast.info(result.info)
+				}
 			}
 		})
 	}

--
Gitblit v1.9.1