From 07b5244ba8572922728f2663883915861554e7e0 Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期日, 02 七月 2023 17:30:54 +0800
Subject: [PATCH] 验质逻辑修改

---
 pages/register/register.vue |   62 ++++++++++++++++++++++--------
 1 files changed, 45 insertions(+), 17 deletions(-)

diff --git a/pages/register/register.vue b/pages/register/register.vue
index 2ff209a..c901a7b 100644
--- a/pages/register/register.vue
+++ b/pages/register/register.vue
@@ -34,7 +34,7 @@
 				<u-form-item prop="carNo" label="杞︾墝鍙�" labelWidth="20%" borderBottom v-if="radiovalue1 == '鍙告満'" required>
 					<u--input v-model="registerFormModel.carNo" placeholder="璇疯緭鍏ュ唴瀹�" clearable></u--input>
 				</u-form-item>
-				<u-form-item prop="carImg" label="杞﹁締鐓х墖" labelWidth="20%" borderBottom v-if="radiovalue1 == '鍙告満'" required>
+				<u-form-item prop="carImg" label="杞﹁締鐓х墖" labelWidth="20%" borderBottom v-if="radiovalue1 == '鍙告満'" required @click="beforeRead">
 					<u-upload
 						:fileList="fileList1"
 						deletable
@@ -51,7 +51,7 @@
 						mode="widthFix" style="width: 250px;height: 150px;"></image> -->
 					</u-upload>
 				</u-form-item>
-				<u-form-item prop="drivingImg" label="琛岄┒璇�" labelWidth="20%" borderBottom v-if="radiovalue1 == '鍙告満'" required>
+				<u-form-item prop="drivingImg" label="琛岄┒璇�" labelWidth="20%" borderBottom v-if="radiovalue1 == '鍙告満'" required @click="beforeRead">
 					<u-upload
 						:fileList="fileList2"
 						deletable
@@ -89,6 +89,7 @@
 <script>
 import { apiRegister } from '@/api/publicInterface.js';
 import { BaseUrl } from '@/api/publicInterface.js';
+import { mapMutations } from 'vuex';
 export default {
 	// onLoad: function() {
 	//   // 鏌ョ湅鏄惁鎺堟潈
@@ -107,7 +108,7 @@
 	// },
 	// 鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚銆傛敞鎰忓鏋滄覆鏌撻�熷害蹇紝浼氬湪椤甸潰杩涘叆鍔ㄧ敾瀹屾垚鍓嶈Е鍙�
 	onReady() {
-		// this.$refs.regesterFormRef.setRules(this.rules);
+		this.$refs.regesterFormRef.setRules(this.rules);
 		// this.$refs.regesterFormRef.validate().then(res => {}).catch(err => {
 		//   console.log(err);
 		// })
@@ -120,6 +121,9 @@
 	},
 	data() {
 		return {
+			// 杞︾墝鍙烽敭鐩樻帶鍒�
+			carNumShow: false,
+			keyValue: '',
 			registerFormModel: {
 				phone: '',
 				password: '',
@@ -143,16 +147,22 @@
 					message: '璇峰~鍐欏鍚�',
 					trigger: ['blur', 'change']
 				},
-				idCard: {
-					type: 'string',
-					required: true,
-					message: '璇疯緭鍏ヨ韩浠借瘉鍙�',
-					trigger: ['blur', 'change']
-				},
+				idCard: [
+					{
+						type: 'string',
+						required: true,
+						message: '璇疯緭鍏ヨ韩浠借瘉鍙�',
+						trigger: ['blur', 'change']
+					},
+					{
+						pattern: /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
+						message: '韬唤璇佸彿鏍煎紡涓嶆纭�'
+					}
+				],
 				phone: [
 					{
 						required: true,
-						message: '姝や负蹇呭~瀛楁',
+						message: '姝ら」涓哄繀濉」',
 						// blur鍜宑hange浜嬩欢瑙﹀彂妫�楠�
 						trigger: ['blur', 'change']
 					},
@@ -160,6 +170,13 @@
 						min: 11,
 						max: 11,
 						message: '璇疯緭鍏ュ悎娉曟墜鏈哄彿'
+					},
+					{
+						validator: (rule, value, callback) => {
+							return uni.$u.test.mobile(value);
+						},
+						message: '鎵嬫満鍙风爜涓嶆纭�',
+						trigger: ['change', 'blur']
 					}
 				],
 				password: [
@@ -192,6 +209,16 @@
 						required: true,
 						message: '璇疯緭鍏ヨ溅鐗屽彿',
 						trigger: ['blur', 'change']
+					},
+					{
+						transform(value) {
+							return String(value);
+						},
+						validator: (rule, value, callback) => {
+							return uni.$u.test.carNo(value);
+						},
+						message: '璇疯緭鍏ユ纭殑杞︾墝鍙�',
+						trigger: ['change', 'blur']
 					}
 				],
 				carImg: {
@@ -252,6 +279,7 @@
 		}
 	},
 	methods: {
+		...mapMutations(['changeisUploadimg']),
 		registerClick() {
 			if (this.registerFormModel.password == this.registerFormModel.confirmPassword) {
 				this.$refs.regesterFormRef
@@ -271,7 +299,7 @@
 										uni.redirectTo({ url: '/pages/login/login' });
 									}, 1000);
 								} else {
-									this.$u.toast(res.data.data ? res.data.data : '娣诲姞澶辫触');
+									this.$u.toast(res.msg ? res.msg : '娣诲姞澶辫触');
 								}
 							})
 							.catch(err => {
@@ -280,18 +308,15 @@
 					})
 					.catch(err => {
 						console.log('err', err);
-						uni.$u.toast('璇疯鑼冭緭鍏ュ唴瀹�');
+						this.$u.toast('璇疯鑼冭緭鍏ュ唴瀹�');
 					});
 			} else {
 				this.$u.toast('涓ゆ瀵嗙爜涓嶄竴鑷�');
 			}
 		},
 		// 鍗曢�夋浜嬩欢
-		groupChange(e) {
-			console.log('鍗曢�夋灏忕粍', e);
-		},
+		groupChange(e) {},
 		radioChange(e) {
-			console.log('鍗曢�夋', e);
 			if (
 				this.registerFormModel.name == '' &&
 				this.registerFormModel.idCard == '' &&
@@ -299,7 +324,6 @@
 				this.registerFormModel.carNo == '' &&
 				this.registerFormModel.password == ''
 			) {
-				console.log('鍙樹簡');
 				this.$refs.regesterFormRef.clearValidate();
 				this.beforeChangeValue = e;
 			}
@@ -310,8 +334,12 @@
 			}
 		},
 		// 涓婁紶鍥剧墖鏂规硶
+		beforeRead() {
+			this.changeisUploadimg(true);
+		},
 		// 鍒犻櫎鍥剧墖
 		deletePic(event) {
+			this.changeisUploadimg(true);
 			this[`fileList${event.name}`].splice(event.index, 1);
 		},
 		// 鏂板鍥剧墖

--
Gitblit v1.9.1