he2802 пре 4 година
родитељ
комит
068334caf1
1 измењених фајлова са 21 додато и 1 уклоњено
  1. 21 1
      pages2/wd/info.vue

+ 21 - 1
pages2/wd/info.vue

@@ -218,7 +218,27 @@ export default {
 		async submitForm() {
 			var self = this;
 			if (this.fileList.length > 0) {
-				const waitUpload = await self.uploadFile(this.fileList[0].url, 0);
+				uni.getImageInfo({
+					src:self.fileList[0].url,
+					success(res) {
+						let canvasWidth = res.width //图片原始长宽
+						let canvasHeight = res.height
+						if(canvasWidth>1000||canvasHeight>1000){
+							uni.compressImage({
+							  src: self.fileList[0].url,
+							  quality: 75,
+							  width:"50%",
+							  height:"50%",
+							  success: res => {
+							    console.log(res.tempFilePath,66)
+							  }
+							})
+						}else{
+							//无需压缩
+						}
+					}
+					})
+			//	const waitUpload = await self.uploadFile(dataURL, 0);
 			}
 			var data = {
 				userId: this.form.userId,