Browse Source

2023-12-6 上传人脸照片

zhiquz 1 year ago
parent
commit
a3c7cbfe8d
3 changed files with 50 additions and 44 deletions
  1. 1 0
      common/util/request.js
  2. 49 44
      pages/payment/payment.vue
  3. BIN
      static/icon/uploadF.png

+ 1 - 0
common/util/request.js

@@ -101,3 +101,4 @@ export const uploadCollectionImg = `${host}:${port}${url}/sharon/sharon/uploadCo
 export const uploadSharonImg = `${host}:${port}${url}/sharon/sharon/uploadSharonImg` //添加沙龙图片
 export const hostUrl = `${host}:${port}${url}` //添加沙龙图片
 export const uploadFiveImage = `${host}:${port}${url}/team/uploadFiveImage` //上传申请人零售的收款凭证
+export const UploadSzyImg = `${host}:${port}${url}/HuiFuSZ/ImageEnroll` //实战营人脸照片上传

+ 49 - 44
pages/payment/payment.vue

@@ -25,6 +25,15 @@
 					<view class="timed">
 						举办时间:{{ data.start+ '-' +data.end }}
 					</view>
+					<view class="timed">
+						<view class="left">人脸照片:</view>
+						<view class="right">
+							<image v-if="data.path" :src="data.path" @click="initFace" mode="widthFix" style="width: 160rpx;height: 160rpx;">
+							</image>
+							<image v-else src="../../static/icon/uploadF.png" mode="widthFix" style="width: 160rpx;"
+								@click="initFace"></image>
+						</view>
+					</view>
 				</view>
 			</view>
 		</view>
@@ -36,9 +45,10 @@
 		_API_payment,
 		_API_SearchStatus,
 		GetEnrollInfo
-		
 	} from '@/apis/szy.js';
-	import { _API_HuiFuCheck } from '../../apis/szy.js';
+	import {
+		UploadSzyImg
+	} from '@/common/util/request'
 	export default {
 		data() {
 			return {
@@ -69,47 +79,40 @@
 			this.getInfo()
 		},
 		methods: {
-			// 获取赛季信息
-			getInfo() {
-				GetEnrollInfo().then(res => {
-					if (res.code == 200) {
-						// res.data = {
-						// 	cost: 199,
-						// 	end: "2023.11.25",
-						// 	end_time: "2023-11-25 18:00:00",
-						// 	enroll_end_time: "2023-11-21 16:00:00",
-						// 	enroll_start_time: "2023-11-14 10:30:00", // 报名时间
-						// 	limit_num: 100000,
-						// 	num: 0,
-						// 	pay_status: 1, // 是否支付
-						// 	season: 63,
-						// 	start: "2023.10.24",
-						// 	start_time: "2023-11-24 08:00:00", // 举办时间
-						// 	status: 0 // 是否报名
-						// }
-						// res.data.enroll_start_time = "2023-11-14 10:30:00" // 报名时间
-						this.data = res.data
-						this.data.start = this.getTimes(res.data.start_time)
-						this.data.end = this.getTimes(res.data.end_time)
-						
-						const a = new Date(res.data.enroll_start_time.replace(/-/g,'/')).getTime()
-						const b = new Date(res.data.enroll_end_time.replace(/-/g,'/')).getTime()
-						const now = Date.parse(new Date())
-						if (now > a && now < b &&  res.data.limit_num >  res.data.num) {
-							this.status = true
-						}
-						if (res.data.status == 1) {
-							this.showSignup = true
-						} else {
-							this.showSignup = false
+			initFace() {
+				uni.chooseImage({
+						count: 1, //默认9
+						sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+						sourceType: ['album'], //从相册选择
+						success: res => {
+							const tempFilePaths = res.tempFilePaths;
+							uni.uploadFile({
+								url: UploadSzyImg,
+								filePath: tempFilePaths[0],
+								name: 'image',
+								header: {
+									Authorization: 'Bearer ' + this.$store.state.app.token
+								},
+								success: (res) => {
+									const data = JSON.parse(res.data)
+									if (data.code == 200) {
+										this.getInfo()
+									} else {
+										uni.showToast({
+											title: res.message || '上传失败',
+											icon: 'none'
+										})
+									}
+								},
+								fail: err => {
+									uni.showToast({
+										title: '上传失败1',
+										icon: 'none'
+									})
+								}
+							});
 						}
-					} else {
-						uni.showModal({
-							content: res.message || '获取失败',
-							showCancel: false
-						})
-					}
-				})
+					})
 			},
 			getTimes(data) {
 				var time = new Date(data)
@@ -308,9 +311,11 @@
 
 				.timed {
 					margin-top: 36rpx;
-					font-size: 40rpx;
+					font-size: 30rpx;
 					font-weight: bold;
-					color: #FF0000;
+					// color: #FF0000;
+					display: flex;
+					padding-left: 60rpx;
 				}
 			}
 

BIN
static/icon/uploadF.png