From 546863eae7d337d47260d63a4b3733f7313ce52d Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期一, 16 十月 2023 15:30:20 +0800
Subject: [PATCH] 登录页调整样式 增加重置密码

---
 api/publicInterface.js                        |    6 
 pages/login/forgetPassword/forgetPassword.vue |  120 ++++++++++++++++++++
 api/globalApi.js                              |    7 +
 pages/login/login.vue                         |   46 +++----
 api/request.js                                |   13 +-
 pages/register/register.vue                   |    7 
 pages.json                                    |   20 +++
 pages/login/resetPassword/resetPassword.vue   |  108 ++++++++++++++++++
 8 files changed, 288 insertions(+), 39 deletions(-)

diff --git a/api/globalApi.js b/api/globalApi.js
index 64b4925..c076307 100644
--- a/api/globalApi.js
+++ b/api/globalApi.js
@@ -449,5 +449,12 @@
 	appSaveContact: {
 		url: '/wrzs/tmtaskcoalcontact/appSave',
 		method: 'POST'
+	},
+	/**
+	 * @description 鏌ヨ鏄惁鏈夋鐢ㄦ埛
+	 */
+	phoneAndCard: {
+		url: '/wrzs/userentity/phoneAndCard',
+		method: 'GET'
 	}
 }
\ No newline at end of file
diff --git a/api/publicInterface.js b/api/publicInterface.js
index 13a7b23..3f4918f 100644
--- a/api/publicInterface.js
+++ b/api/publicInterface.js
@@ -3,8 +3,9 @@
 
 
 import { BaseUrl as wrBaseUrl } from '@/api/request.js'
-const BaseUrl = 'http://192.168.31.14:9999'
-// const BaseUrl = 'https://mx.jzeg.cn:9096'
+// const BaseUrl = 'http://192.168.0.110:9999'
+// const BaseUrl = 'http://192.168.0.102:9999'
+const BaseUrl = 'https://mx.jzeg.cn:9096'
 // const BaseUrl = 'http://192.168.31.18:9999' 
 // const BaseUrl = 'http://192.168.0.100:9999'
 // const BaseUrl = 'http://192.168.0.108:9999'
@@ -63,6 +64,7 @@
 	vehicleColour,
 	bodyofcarJpg
 }) {
+	console.log(bodyofcarJpg);
 	uni.showLoading({ title: '鍔犺浇涓�...' })
 	return new Promise((resolve, reject) => {
 		uni.request({
diff --git a/api/request.js b/api/request.js
index d1c1d26..8c5cdca 100644
--- a/api/request.js
+++ b/api/request.js
@@ -100,11 +100,12 @@
 	500: responseError
 }
 
-const BaseUrl = "http://192.168.31.14:9997"
-const webSocketUrl = "ws://192.168.31.14:9997/wrzs/ws/info"
+// const BaseUrl = "http://192.168.0.110:9896"
+// const webSocketUrl = "ws://192.168.0.110:9896/wrzs/ws/info"
 
-// const BaseUrl = "http://localhost:9997";
-// const webSocketUrl = "ws://localhost:9997/wrzs/ws/info"
+// const BaseUrl = "http://192.168.0.102:9896"
+// const webSocketUrl = "ws://192.168.0.102:9896/wrzs/ws/info"
+
 export const onlineurl = "https://mx.jzeg.cn:9096";
 // const BaseUrl = "http://192.168.0.100:9997";
 // const webSocketUrl = "ws://192.168.0.100:9997/wrzs/ws/info"
@@ -112,8 +113,8 @@
 // const BaseUrl = "http://192.168.0.108:9997";
 // const webSocketUrl = "ws://192.168.0.108:9997/wrzs/ws/info"
 // 绾夸笂鐢熶骇
-// const BaseUrl = "https://mx.jzeg.cn:9096";
-// const webSocketUrl = "wss://mx.jzeg.cn:9096/wrzs/ws/info"
+const BaseUrl = "https://mx.jzeg.cn:9096";
+const webSocketUrl = "wss://mx.jzeg.cn:9096/wrzs/ws/info"
 
 
 // 璇锋眰鎷︽埅
diff --git a/pages.json b/pages.json
index 2430afe..5d278b8 100644
--- a/pages.json
+++ b/pages.json
@@ -247,7 +247,25 @@
 			}
 
 		}
-	],
+	    ,{
+            "path" : "pages/login/forgetPassword/forgetPassword",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/login/resetPassword/resetPassword",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+    ],
 	"subPackages": [{
 			"root": "pages/register",
 			"pages": [{
diff --git a/pages/login/forgetPassword/forgetPassword.vue b/pages/login/forgetPassword/forgetPassword.vue
new file mode 100644
index 0000000..2703393
--- /dev/null
+++ b/pages/login/forgetPassword/forgetPassword.vue
@@ -0,0 +1,120 @@
+<template>
+	<view class="main">
+		<u-form :model="modelForm"
+			label-position="top"
+			:rules="rules"
+			ref="uForm"
+			label-width="80px">
+			<u-form-item prop="phone"
+				label="鎵嬫満鍙�"
+				required
+				borderBottom>
+				<u--input v-model="modelForm.phone"
+					border="surround"
+					placeholder="璇疯緭鍏ユ墜鏈哄彿"></u--input>
+			</u-form-item>
+			<u-form-item prop="idCard"
+				label="韬唤璇佸彿"
+				required
+				borderBottom>
+				<u--input v-model="modelForm.idCard"
+					border="surround"
+					placeholder="璇疯緭鍏ヨ韩浠借瘉鍙�"></u--input>
+			</u-form-item>
+			<u-form-item>
+				<view class="process-button">
+					<u-button type="primary"
+						text="楠岃瘉"
+						:loading="processLoading"
+						@click.stop="process"></u-button>
+				</view>
+			</u-form-item>
+		</u-form>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				modelForm: {
+					phone: '',
+					idCard: ''
+				},
+				processLoading: false,
+				rules: {
+					phone: [{
+							required: true,
+							message: '璇疯緭鍏ユ墜鏈哄彿',
+							// blur鍜宑hange浜嬩欢瑙﹀彂妫�楠�
+							trigger: ['blur', 'change']
+						},
+						{
+							min: 11,
+							max: 11,
+							message: '璇疯緭鍏ュ悎娉曟墜鏈哄彿'
+						},
+						{
+							validator: (rule, value, callback) => {
+								return uni.$u.test.mobile(value);
+							},
+							message: '鎵嬫満鍙风爜鏍煎紡涓嶆纭�',
+							trigger: ['change', 'blur']
+						}
+					],
+					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: '韬唤璇佸彿鏍煎紡涓嶆纭�',
+							trigger: ['blur', 'change']
+						}
+					],
+				}
+			}
+		},
+		onReady() {
+			this.$refs.uForm.setRules(this.rules)
+		},
+		methods: {
+			process() {
+				this.$refs.uForm.validate().then(res => {
+					this.processLoading = true;
+					this.$reqGet('phoneAndCard', { phone: this.modelForm.phone, idCard: this.modelForm.idCard })
+						.then(res => {
+							this.processLoading = false;
+							if (res.code === 0) {
+								uni.$u.toast('楠岃瘉鎴愬姛,鍗冲皢璺宠浆閲嶇疆瀵嗙爜鐣岄潰')
+								setTimeout(() => {
+									uni.navigateTo({
+										url: `/pages/login/resetPassword/resetPassword?userInfo=${JSON.stringify(res.data)}`
+									})
+								}, 1000)
+							} else {
+								uni.$u.toast(res.msg ? res.msg : '楠岃瘉澶辫触')
+							}
+						})
+
+				}).catch(errors => {
+					uni.$u.toast('璇峰~鍐欏畬鏁翠俊鎭�')
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss"
+	scoped>
+	.main {
+		width: 94%;
+		margin: vww(10) auto;
+
+		.process-button {
+			margin-top: vww(20);
+		}
+	}
+</style>
\ No newline at end of file
diff --git a/pages/login/login.vue b/pages/login/login.vue
index f2af9b5..276b76e 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -12,13 +12,11 @@
 				type="primary"
 				text="寰俊涓�閿櫥褰�"></u-button>
 		</view>
-		<!-- <view class="loginBtn">
-			<u-button @click.stop="jumpBindBack"
-				type="primary"
-				text="涓�閿粦瀹氭祴璇�"></u-button>
-		</view> -->
-		<view class="register"
-			@click="PrivacyAgreementHandle"><text>娉ㄥ唽</text></view>
+		<view class="utils-block">
+			<view @click="forgetPassword"><text>蹇樿瀵嗙爜?</text></view>
+			<view @click="PrivacyAgreementHandle"><text>鏂扮敤鎴锋敞鍐�</text></view>
+		</view>
+
 		<view class="login-bottom-box">
 			<view class="copyright">鍐�涓兘婧愭棤浜哄�煎畧寰俊灏忕▼搴�</view>
 			<view class="copyright">灏忕▼搴忎粎渚涘凡鎷ユ湁绯荤粺璐﹀彿鐗瑰畾鍐呴儴浜哄憳浣跨敤</view>
@@ -173,6 +171,11 @@
 			openPopup() {
 				console.log('鎵撳紑浜�');
 			},
+			forgetPassword() {
+				uni.navigateTo({
+					url: '/pages/login/forgetPassword/forgetPassword'
+				})
+			},
 			PrivacyAgreementHandle() {
 				uni.navigateTo({
 					url: '/pages/login/PrivacyAgreementText/PrivacyAgreementText'
@@ -190,26 +193,6 @@
 	}
 
 	.login {
-		// height: 100vh;
-		// display: flex;
-		// align-items: center;
-
-		// .loginBtn {
-		//   margin: 0 auto;
-		//   width: 80%;
-
-		//   .u-button {
-		//     .u-icon {
-		//       .u-icon__icon {
-		//         font-size: vww(20) !important;
-		//       }
-		//     }
-		//   }
-
-		//   .u-button--success {
-		//     border-style: none;
-		//   }
-		// }
 		.loginBtn {
 			margin-top: vww(20);
 
@@ -218,6 +201,15 @@
 			}
 		}
 
+		.utils-block {
+			width: 80%;
+			margin: vww(20) auto;
+			display: flex;
+			justify-content: space-between;
+			color: #497bff;
+			font-size: vww(17);
+		}
+
 		.logo {
 			width: 80%;
 			font-size: 64rpx;
diff --git a/pages/login/resetPassword/resetPassword.vue b/pages/login/resetPassword/resetPassword.vue
new file mode 100644
index 0000000..a9f0586
--- /dev/null
+++ b/pages/login/resetPassword/resetPassword.vue
@@ -0,0 +1,108 @@
+<template>
+	<view class="main">
+		<u-form :model="modelForm"
+			label-position="top"
+			:rules="rules"
+			ref="uForm"
+			label-width="80px">
+			<u-form-item prop="password"
+				label="瀵嗙爜"
+				required
+				borderBottom>
+				<u--input v-model="modelForm.password"
+					border="surround"
+					placeholder="璇疯緭鍏ュ瘑鐮�"
+					type='password'></u--input>
+			</u-form-item>
+			<u-form-item prop="secondPassword"
+				label="浜屾纭"
+				required
+				borderBottom>
+				<u--input v-model="modelForm.secondPassword"
+					border="surround"
+					placeholder="璇峰啀娆¤緭鍏ュ瘑鐮�"
+					type='password'></u--input>
+			</u-form-item>
+			<u-form-item>
+				<view class="process-button">
+					<u-button type="primary"
+						text="纭畾"
+						:loading="processLoading"
+						@click.stop="process"></u-button>
+				</view>
+			</u-form-item>
+		</u-form>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				userInfo: {},
+				modelForm: {
+					password: '',
+					secondPassword: ''
+				},
+				processLoading: false,
+				rules: {
+					password: {
+						type: 'string',
+						required: true,
+						message: '璇峰~鍐欏瘑鐮�',
+						trigger: ['blur', 'change']
+					},
+					secondPassword: {
+						type: 'string',
+						required: true,
+						message: '璇峰~鍐欎簩娆″瘑鐮�',
+						trigger: ['blur', 'change']
+					}
+				}
+			}
+		},
+		onLoad(params) {
+			this.userInfo = JSON.parse(params.userInfo)
+		},
+		onReady() {
+			this.$refs.uForm.setRules(this.rules)
+		},
+		methods: {
+			process() {
+				if (this.modelForm.password !== this.modelForm.secondPassword) return uni.$u.toast('瀵嗙爜涓嶄竴鑷�,璇锋鏌�')
+				this.userInfo.password = this.modelForm.secondPassword;
+				this.processLoading = true;
+				this.$refs.uForm.validate().then(res => {
+					this.$reqAllJson('appUpdateById', this
+						.userInfo, { method: 'PUT', 'Content-type': 'application/json' }).then(res => {
+						this.processLoading = false;
+						if (res.code === 0) {
+							this.$u.toast('淇敼鎴愬姛,鍗冲皢鍥炲埌棣栭〉')
+							setTimeout(() => {
+								uni.reLaunch({
+									url: '/pages/login/login'
+								})
+							}, 800)
+						} else {
+							this.$u.toast(res.msg ? res.msg : '淇敼澶辫触')
+						}
+					})
+				}).catch(errors => {
+					uni.$u.toast('鏍¢獙澶辫触')
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss"
+	scoped>
+	.main {
+		width: 94%;
+		margin: vww(10) auto;
+
+		.process-button {
+			margin-top: vww(20);
+		}
+	}
+</style>
\ No newline at end of file
diff --git a/pages/register/register.vue b/pages/register/register.vue
index 3bb222e..5a1fd4e 100644
--- a/pages/register/register.vue
+++ b/pages/register/register.vue
@@ -224,12 +224,13 @@
 						},
 						{
 							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: '韬唤璇佸彿鏍煎紡涓嶆纭�'
+							message: '韬唤璇佸彿鏍煎紡涓嶆纭�',
+							trigger: ['blur', 'change']
 						}
 					],
 					phone: [{
 							required: true,
-							message: '姝ら」涓哄繀濉」',
+							message: '璇疯緭鍏ユ墜鏈哄彿',
 							// blur鍜宑hange浜嬩欢瑙﹀彂妫�楠�
 							trigger: ['blur', 'change']
 						},
@@ -242,7 +243,7 @@
 							validator: (rule, value, callback) => {
 								return uni.$u.test.mobile(value);
 							},
-							message: '鎵嬫満鍙风爜涓嶆纭�',
+							message: '鎵嬫満鍙风爜鏍煎紡涓嶆纭�',
 							trigger: ['change', 'blur']
 						}
 					],

--
Gitblit v1.9.1