From f3ce372afc816f947ae64ef2935b282087384b0d Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 01 三月 2024 15:30:32 +0800
Subject: [PATCH] mrshi

---
 h5/pages/userinfo/userinfo.vue |   63 ++++++++++++++++++++++++++++---
 1 files changed, 57 insertions(+), 6 deletions(-)

diff --git a/h5/pages/userinfo/userinfo.vue b/h5/pages/userinfo/userinfo.vue
index 990034a..cc59728 100644
--- a/h5/pages/userinfo/userinfo.vue
+++ b/h5/pages/userinfo/userinfo.vue
@@ -27,15 +27,15 @@
 				</view>
 			</view>
 			<view class="cell">
-				<view class="title">鍏徃</view>
+				<view class="title">鍏徃<b>*</b></view>
 				<view class="content">
 					<input class="input" maxlength="50" placeholder-style="color: #999999;" v-model="visitorData.companyName" placeholder="璇疯緭鍏ユ偍鐨勫叕鍙稿悕绉�" />
 				</view>
 			</view>
 			<view class="cell">
 				<view class="title1">
-					<text class="title1_a">浜鸿劯鐓х墖<b>*</b></text>
-					<text class="title1_b">1銆佽鎻愪緵浜斿畼娓呮櫚锛屼汉鑴稿眳涓殑姝i潰浜鸿劯鍏�</text>
+					<text class="title1_a">浜鸿劯鐓х墖<b style="color: red;">*</b></text>
+					<text class="title1_b">1銆佽鎻愪緵浜斿畼娓呮櫚锛屼汉鑴稿眳涓殑姝i潰浜鸿劯鍏嶅啝鐓х墖锛�</text>
 					<text class="title1_b">2銆佺収鐗囨棤閫嗗厜銆佹棤PS銆佹棤杩囧害缇庨澶勭悊</text>
 				</view>
 				<view class="content">
@@ -73,6 +73,7 @@
 			return {
 				show: false,
 				visit: '',
+				type: '',
 				columns: [[{name: '韬唤璇�', id: 0}, {name: '娓境璇佷欢', id: 1},{name: '鎶ょ収', id: 2}]],
 				fileList: [],
 				visitorData: {
@@ -93,6 +94,9 @@
 		onLoad(option) {
 			this.visitorData.userAnswerId = option.userAnswerId
 			this.getVisit()
+			uni.$on('update', (data) => {
+				this.uploadImg(data.tempFilePath)
+			})
 		},
 
 		methods: {
@@ -105,6 +109,11 @@
 					title: '鎵嬫満鍙蜂笉鑳戒负绌�',
 					icon: 'none'
 				})
+				const regExp = /^1[3456789]\d{9}$/;
+				if (!regExp.test(this.visitorData.phone)) return uni.showToast({
+					title: '鎵嬫満鍙锋牸寮忛敊璇�',
+					icon: 'none'
+				})
 				if (!String(this.visitorData.idcardType)) return uni.showToast({
 					title: '璇佷欢绫诲瀷涓嶈兘涓虹┖',
 					icon: 'none'
@@ -113,13 +122,24 @@
 					title: '璇佷欢鍙风爜涓嶈兘涓虹┖',
 					icon: 'none'
 				})
+				if (this.visitorData.idcardType === 0) {
+					const regex = /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}[\dxX]$/;
+					if (!regex.test(this.visitorData.idcardNo)) return uni.showToast({
+						title: '璇佷欢鍙风爜鏍煎紡閿欒',
+						icon: 'none'
+					})
+				}
+				if (!this.visitorData.companyName) return uni.showToast({
+					title: '鍏徃涓嶈兘涓虹┖',
+					icon: 'none'
+				})
 				if (!this.visitorData.faceImg) return uni.showToast({
 					title: '浜鸿劯鐓х墖涓嶈兘涓虹┖',
 					icon: 'none'
 				})
 				if (this.visit === '1') {
 					if (!this.visitorData.imgurl) return uni.showToast({
-						title: '浜鸿劯鐓х墖涓嶈兘涓虹┖',
+						title: '鍋ュ悍璇佷笉鑳戒负绌�',
 						icon: 'none'
 					})
 				}
@@ -134,14 +154,45 @@
 					label: 'HEALTH_CARD'
 				}).then(res => {
 					if (res.code === 200) {
-						console.log(res)
 						this.visit = res.data.code
 					}
 				})
 			},
+			uploadImg(file) {
+				uni.showLoading({ title: '涓婁紶涓�', mask: true });
+				uni.uploadFile({
+					url: `${this.$baseUrl}public/api/uploadFtp.do`,
+					filePath: file,
+					name: 'file',
+					formData: {
+						folderCode: 'MEMBER_IMG'
+					},
+					success: (uploadFileRes) => {
+						let res = JSON.parse(uploadFileRes.data)
+						if (this.type === 'faceImg') {
+							this.visitorData.faceImg = res.data.halfPath
+							this.visitorData.faceImgUrl = res.data.prefixPath + res.data.folder + res.data.halfPath
+						} else {
+							this.visitorData.imgurl = res.data.halfPath
+							this.visitorData.imgurlUrl = res.data.prefixPath + res.data.folder + res.data.halfPath
+						}
+					},
+					complete() {
+						uni.hideLoading();
+					}
+				});
+			},
 			upload(type) {
+				this.type = type
 				uni.chooseImage({
+					count: 1,
 					success: (chooseImageRes) => {
+						if (type === 'faceImg') {
+							uni.navigateTo({
+								url: `/pages/cropping/cropping?item=${JSON.stringify({ tempFilePath: chooseImageRes.tempFilePaths[0] })}`
+							})
+							return
+						}
 						uni.showLoading({ title: '涓婁紶涓�', mask: true });
 						for (let i = 0; i < chooseImageRes.tempFilePaths.length; i++) {
 							uni.uploadFile({
@@ -151,7 +202,7 @@
 								formData: {
 									folderCode: 'MEMBER_IMG'
 								},
-								success: (uploadFileRes) => {
+								success: (uploadFileRes) => {	
 									let res = JSON.parse(uploadFileRes.data)
 									if (type === 'faceImg') {
 										this.visitorData.faceImg = res.data.halfPath

--
Gitblit v1.9.3