MS-CIAZDCOIXVRW\Administrator преди 3 години
родител
ревизия
f2b72dbed2
променени са 3 файла, в които са добавени 63 реда и са изтрити 31 реда
  1. 39 21
      pagesClockIn/authentication/authentication.vue
  2. 6 6
      pagesClockIn/home/home.vue
  3. 18 4
      pagesClockIn/location/location.vue

+ 39 - 21
pagesClockIn/authentication/authentication.vue

@@ -178,34 +178,52 @@
 			// 上传
 			// 上传
 			handleOkClick() {
 			handleOkClick() {
 				//  这里的 this.tempImg 是经过人脸检测后  拍照拿到的路径  
 				//  这里的 this.tempImg 是经过人脸检测后  拍照拿到的路径  
-				this.upLoadOne()
+				this.upLoadOne(this.tempImg)
 			},
 			},
-			upLoadOne() {
+			upLoadOne(url) {
 				uni.showLoading({
 				uni.showLoading({
 					title: "检测中,请稍后...",
 					title: "检测中,请稍后...",
 				});
 				});
-				setTimeout(async () => {
-					let res = await this.$myRequest_clockIn({
-						url: "/attendance/api/sign/check/in/update",
-						method: "put",
-						header: {
-							'Authorization': uni.getStorageSync("token")
+				setTimeout(() => {
+					uni.uploadFile({
+						url: `https://www.web-server.top/attendance/api/file/upload`,
+						filePath: url,
+						name: 'file',
+						success: (uploadFileRes) => {
+							let imgUrl = JSON.parse(uploadFileRes.data)
+								.data
+							this.handleUploading(imgUrl)
 						},
 						},
-						data: {
-							id: this.id,
-							lat: this.lat,
-							lng: this.lng,
-							location: this.location,
-							matchFaceImage: this.tempImg,
-							sceneImage: this.sceneImage,
+						fail: () => {
+							uni.showToast({
+								title: "上传失败",
+								icon: 'error'
+							})
 						}
 						}
-					})
-					// console.log(res);
-					if (res.code == 200) {
-						this.getNowTime()
-						this.$refs.popup.open()
+					});
+				}, 1000)
+			},
+			async handleUploading(imgUrl) {
+				let res = await this.$myRequest_clockIn({
+					url: "/attendance/api/sign/check/in/update",
+					method: "put",
+					header: {
+						'Authorization': uni.getStorageSync("token")
+					},
+					data: {
+						id: this.id,
+						lat: this.lat,
+						lng: this.lng,
+						location: this.location,
+						matchFaceImage: imgUrl,
+						sceneImage: this.sceneImage,
 					}
 					}
-				}, 2000)
+				})
+				// console.log(res);
+				if (res.code == 200) {
+					this.getNowTime()
+					this.$refs.popup.open()
+				}
 			},
 			},
 			// 点击 我知道了按钮 跳回首页
 			// 点击 我知道了按钮 跳回首页
 			handleGoHome() {
 			handleGoHome() {

+ 6 - 6
pagesClockIn/home/home.vue

@@ -288,12 +288,9 @@
 						this.list = res.data.reverse()
 						this.list = res.data.reverse()
 						this.activeid = this.list[0].id
 						this.activeid = this.list[0].id
 						this.contrastObj = this.list[0]
 						this.contrastObj = this.list[0]
-						// setTimeout(()=>{
-						// 	this.changeType()
-						// },300)
-						this.$nextTick(() => {
+						setTimeout(()=>{
 							this.changeType()
 							this.changeType()
-						})
+						},300)
 						// console.log(this.contrastObj);
 						// console.log(this.contrastObj);
 					}
 					}
 				}
 				}
@@ -317,7 +314,10 @@
 								this.centerLat = ele.lat
 								this.centerLat = ele.lat
 								this.centerLng = ele.lng
 								this.centerLng = ele.lng
 								this.radius = ele.radius
 								this.radius = ele.radius
-
+								console.log(this.myLat);
+								console.log(this.myLng);
+								console.log(this.centerLat);
+								console.log(this.centerLng);
 								let red1 = this.myLat * Math.PI / 180.0;
 								let red1 = this.myLat * Math.PI / 180.0;
 								let red2 = this.centerLat * Math.PI / 180.0;
 								let red2 = this.centerLat * Math.PI / 180.0;
 								let a = red1 - red2;
 								let a = red1 - red2;

+ 18 - 4
pagesClockIn/location/location.vue

@@ -126,10 +126,24 @@
 							sourceType: ['camera'],
 							sourceType: ['camera'],
 							success: (res) => {
 							success: (res) => {
 								// console.log(res);
 								// console.log(res);
-								let imgUrl = res.tempFilePaths[0]
-								uni.navigateTo({
-									url: `/pagesClockIn/authentication/authentication?imgUrl=${imgUrl}&id=${this.id}&address=${this.address}&latitude=${this.latitude}&longitude=${this.longitude}`
-								})
+								uni.uploadFile({
+									url: `https://www.web-server.top/attendance/api/file/upload`,
+									filePath: res.tempFilePaths[0],
+									name: 'file',
+									success: (uploadFileRes) => {
+										let imgUrl = JSON.parse(uploadFileRes.data)
+											.data
+										uni.navigateTo({
+											url: `/pagesClockIn/authentication/authentication?imgUrl=${imgUrl}&id=${this.id}&address=${this.address}&latitude=${this.latitude}&longitude=${this.longitude}`
+										})
+									},
+									fail: () => {
+										uni.showToast({
+											title: "上传失败",
+											icon: 'error'
+										})
+									}
+								});
 							}
 							}
 						});
 						});
 					},
 					},