DESKTOP-B78GIPM\admin 2 роки тому
батько
коміт
cf4ba4ebee
2 змінених файлів з 38 додано та 37 видалено
  1. 36 35
      pages/face/index.vue
  2. 2 2
      pages/index/index.vue

+ 36 - 35
pages/face/index.vue

@@ -253,41 +253,42 @@
 				let ctx = uni.createCanvasContext('cvs', this);
 				// let ctx = this.$refs.canvas.getContext("2d");
 				const _this = this
-				this.intervalTakeImg = setInterval(() => {
-					// 把当前视频帧内容渲染到canvas上
-					// ctx.drawImage(document.createElement('canvas'), 0, 0, 520, 520);
-					// 修改后代码 将 html2Cvs 修改为 (window.html2Cvs || html2Cvs)
-					html2Cvs(document.querySelector('video'), {
-						backgroundColor: null,
-						useCORS: true
-					}).then(cvs => {
-						let imgData = cvs.toDataURL('image/png')
-						this.faceImgData = imgData
-						// this.type = 2
-						this.faceRecognition()
-						// this.intervalTakeImg = null
-						// clearInterval(this.intervalTakeImg)
-						// ctx.drawImage(imgData, 0, 0, 520, 520);
-					})
-					// 转base64格式、图片格式转换、图片质量压缩
-					// console.log('canvas', document.createElement('canvas').toDataURL("image/jpeg", 0.7))
-					// return
-					let imgBase64 = document.createElement('canvas').toDataURL("image/jpeg", 0.7); // 由字节转换为KB 判断大小
-					// let imgBase64 = this.$refs["canvas"].toDataURL("image/jpeg", 0.7); // 由字节转换为KB 判断大小
-					// console.log('canver', this.$refs["canvas"])
-
-					// console.log('%cHealthEduOnline.vue line:92 imgBase64', 'color: white; background-color: #26bfa5;', imgBase64);
-					let str = imgBase64.replace("data:image/jpeg;base64,", "");
-					let strLength = str.length;
-					let fileLength = parseInt(strLength - (strLength / 8) * 2); // 图片尺寸  用于判断
-					let size = (fileLength / 1024).toFixed(2);
-					console.log(size); // 上传拍照信息  调用接口上传图片 .........
-
-					// 保存到本地
-					this.dialogCamera = false;
-					// this.faceRecognition()
-					clearInterval(this.intervalTakeImg)
-				}, 4000)
+				// this.intervalTakeImg = setInterval(() => {
+					
+				// }, 4000)
+				// 把当前视频帧内容渲染到canvas上
+				// ctx.drawImage(document.createElement('canvas'), 0, 0, 520, 520);
+				// 修改后代码 将 html2Cvs 修改为 (window.html2Cvs || html2Cvs)
+				html2Cvs(document.querySelector('video'), {
+					backgroundColor: null,
+					useCORS: true
+				}).then(cvs => {
+					let imgData = cvs.toDataURL('image/png')
+					this.faceImgData = imgData
+					// this.type = 2
+					this.faceRecognition()
+					// this.intervalTakeImg = null
+					// clearInterval(this.intervalTakeImg)
+					// ctx.drawImage(imgData, 0, 0, 520, 520);
+				})
+				// 转base64格式、图片格式转换、图片质量压缩
+				// console.log('canvas', document.createElement('canvas').toDataURL("image/jpeg", 0.7))
+				// return
+				let imgBase64 = document.createElement('canvas').toDataURL("image/jpeg", 0.7); // 由字节转换为KB 判断大小
+				// let imgBase64 = this.$refs["canvas"].toDataURL("image/jpeg", 0.7); // 由字节转换为KB 判断大小
+				// console.log('canver', this.$refs["canvas"])
+				
+				// console.log('%cHealthEduOnline.vue line:92 imgBase64', 'color: white; background-color: #26bfa5;', imgBase64);
+				let str = imgBase64.replace("data:image/jpeg;base64,", "");
+				let strLength = str.length;
+				let fileLength = parseInt(strLength - (strLength / 8) * 2); // 图片尺寸  用于判断
+				let size = (fileLength / 1024).toFixed(2);
+				console.log(size); // 上传拍照信息  调用接口上传图片 .........
+				
+				// 保存到本地
+				this.dialogCamera = false;
+				// this.faceRecognition()
+				clearInterval(this.intervalTakeImg)
 				// let ADOM = document.createElement("a");
 				// ADOM.href = imgBase64 ;
 				// ADOM.download = new Date().getTime() + ".jpeg";

+ 2 - 2
pages/index/index.vue

@@ -220,8 +220,8 @@
 							this.$request({
 								url: this.$api.index.getPortrait,
 								data: {
-									id: item.id,
-									studentId: item.id,
+									id: item.studentId,
+									studentId: item.studentId,
 									// id: '1612686444118147074',
 									// studentId: '1612686444118147074',
 								}