Browse Source

拍照优化

En route 1 năm trước cách đây
mục cha
commit
f99e63ad16
2 tập tin đã thay đổi với 18 bổ sung14 xóa
  1. 1 1
      common/compressPhoto.js
  2. 17 13
      components/popup/camera.vue

+ 1 - 1
common/compressPhoto.js

@@ -77,7 +77,7 @@ function myCompressImage(url, limitSize = 2048) {
     }
     const size = url.size;
     if (size < limitSize) {
-      return _resolve(url);
+      return _resolve(url.path);
     }
     num++;
     const quality = limitSize / size;

+ 17 - 13
components/popup/camera.vue

@@ -8,9 +8,9 @@
 				<view class="photoCenter">
 					<view class="center_camera" v-if="isTaking">
 						<!-- #ifdef MP-WEIXIN -->
-						<camera device-position="front" flash="off" @error="error" style="width: 100%; height: 100%">
+						<camera device-position="front" flash="off" @error="error" style="width: 400px; height: 400px;margin: 0 auto;">
 							<!-- 加人脸框 -->
-							<cover-view class="head_take">
+							<cover-view class="head_take" v-if="false">
 								<cover-view class="headTake_up color"></cover-view>
 								<cover-view class="headTake_minddle">
 									<cover-view class="min_left color"></cover-view>
@@ -22,8 +22,8 @@
 						</camera>
 						<!-- #endif -->
 						<!-- #ifdef H5 -->
-						<video :controls="false" id="video" width="400" height="300" class="photo_v"></video>
-						<view class="mask"></view>
+						<video :controls="false" id="video" width="400" height="400" class="photo_v"></video>
+						<view class="mask" v-if="false"></view>
 						<!-- #endif -->
 					</view>
 					<view class="custom" v-if="!isTaking">
@@ -122,7 +122,7 @@
 				this.uploadLock = true;
 				let imgUrl = await this.imageInfos()
 				let compareFaceData = await this.faceRecognition(imgUrl);
-				if (compareFaceData >= 80) {
+				if (compareFaceData >= 70) {
 					this.$emit("submitPhoto",imgUrl, compareFaceData);
 				} else {
 					uni.showToast({
@@ -201,7 +201,7 @@
 					this.getUserMedia({
 							video: {
 								width: 400,
-								height: 300,
+								height: 400,
 								facingMode: "user",
 							},
 						},
@@ -280,7 +280,7 @@
 				this.getUserMedia({
 						video: {
 							width: 400,
-							height: 300,
+							height: 400,
 							facingMode: "user",
 						},
 					},
@@ -472,7 +472,7 @@
 				width: 100%;
 				height: 75vh;
 				position: fixed;
-
+				background-color: rgba(0,0,0,.8);
 				.head_take {
 					width: 100%;
 					height: 75vh;
@@ -511,8 +511,10 @@
 				}
 
 				.photo_v {
-					width: 100%;
-					height: 100%;
+					display: block;
+					margin: 0 auto;
+					width: 400px;
+					height: 400px;
 				}
 
 				.mask {
@@ -535,10 +537,12 @@
 				z-index: 1000;
 				top: 0;
 				left: 0;
-
+				background-color: rgba(0,0,0,.8);
 				image {
-					width: 100%;
-					height: 100%;
+					display: block;
+					margin: 0 auto;
+					width: 400px;
+					height: 400px;
 				}
 			}
 		}