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

---
 pages/freight-forwarder-page/freightForwarder-my/freightForwarder-my.vue |   95 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 93 insertions(+), 2 deletions(-)

diff --git a/pages/freight-forwarder-page/freightForwarder-my/freightForwarder-my.vue b/pages/freight-forwarder-page/freightForwarder-my/freightForwarder-my.vue
index 0930398..e3cbe92 100644
--- a/pages/freight-forwarder-page/freightForwarder-my/freightForwarder-my.vue
+++ b/pages/freight-forwarder-page/freightForwarder-my/freightForwarder-my.vue
@@ -75,6 +75,12 @@
 
 		<!-- <view class="statistics"><u-button text="鍙戣繍缁熻" type="primary" @click="statistics"></u-button></view> -->
 		<view class="utils-button">
+			<view class="utils"><u-button text="淇敼瀵嗙爜"
+					type="primary"
+					@click="modifyPwd"></u-button></view>
+			<view class="utils"><u-button text="閲嶇疆瀵嗙爜"
+					type="primary"
+					@click="initPwd"></u-button></view>
 			<view class="utils"><u-button text="閫�鍑虹櫥褰�"
 					type="primary"
 					@click="logout"></u-button></view>
@@ -99,6 +105,30 @@
 				:content="logoutContent"
 				@confirm="logoutConfirm"
 				@cancel="logoutCancel"></u-modal>
+		</view>
+		<!-- 閲嶇疆瀵嗙爜寮瑰嚭妗� -->
+		<view class="initPwdModal">
+			<u-modal :show="initPwdShow"
+				title="閲嶇疆瀵嗙爜"
+				showCancelButton
+				content="鍒濆瀵嗙爜灏嗗彉鏇翠负123456,鏄惁纭閲嶇疆"
+				@confirm="initPwdConfirm"
+				@cancel="initPwdCancel"></u-modal>
+		</view>
+		<!-- 淇敼瀵嗙爜寮瑰嚭妗� -->
+		<view class="modifyPwdModal">
+			<u-modal :show="modifyPwdShow"
+				title="淇敼瀵嗙爜"
+				showCancelButton
+				@confirm="modifyPwdConfirm"
+				@cancel="modifyPwdCancel">
+				<view class="modifyPwd">
+					<u-input v-model="passwordModified"
+						placeholder="璇疯緭鍏ヤ慨鏀瑰悗鐨勫瘑鐮�"
+						border="surround"
+						type="password"></u-input>
+				</view>
+			</u-modal>
 		</view>
 	</view>
 </template>
@@ -126,15 +156,27 @@
 				// 閫�鍑烘ā鎬佹
 				logoutShow: false,
 				logoutTitle: '鎻愮ず',
-				logoutContent: '鏄惁纭閫�鍑�'
+				logoutContent: '鏄惁纭閫�鍑�',
+				initPwdShow: false,
+				modifyPwdShow: false,
+				passwordModified: '',
+				// 鐢ㄦ埛淇℃伅瀵硅薄
+				userEntity: {},
 			};
 		},
-		onShow() {
+		onLoad() {
 			this.init();
 		},
 		methods: {
 			init() {
 				this.getFleet();
+				this.getUserEntity()
+			},
+			// 鑾峰彇鐢ㄦ埛淇℃伅
+			getUserEntity() {
+				this.$reqGet('getUserEntity').then(res => {
+					this.userEntity = res.data;
+				});
 			},
 			// 鑾峰彇杞﹂槦
 			getFleet() {
@@ -204,6 +246,50 @@
 				uni.navigateTo({
 					url: `/pages/customer-page/fleet-management/fleet-management?id=${id}`
 				});
+			},
+			updateInfo() {
+				this.$reqPost('updateUser', this.userEntity, 'json').then(res => {
+					uni.hideLoading()
+					if (res.code == 0) {
+						uni.showToast({
+							title: '閲嶇疆鎴愬姛',
+							duration: 2000,
+							icon: 'success'
+						})
+					} else {
+						this.$u.toast(res.msg ? res.msg : '淇敼澶辫触');
+					}
+				}).catch(err => {
+					this.$u.toast('淇敼澶辫触');
+				});
+			},
+			initPwd() {
+				this.initPwdShow = true
+			},
+			initPwdConfirm() {
+				this.initPwdShow = false
+				uni.showLoading({
+					title: '鍔犺浇涓�'
+				})
+				this.userEntity.password = '123456'
+				this.updateInfo()
+			},
+			initPwdCancel() {
+				this.initPwdShow = false
+			},
+			modifyPwd() {
+				this.modifyPwdShow = true
+			},
+			modifyPwdConfirm() {
+				if (this.passwordModified.length === 0) {
+					return this.$u.toast('瀵嗙爜涓嶈兘涓虹┖')
+				}
+				this.modifyPwdShow = false
+				this.userEntity.password = this.passwordModified
+				this.updateInfo()
+			},
+			modifyPwdCancel() {
+				this.modifyPwdShow = false
 			},
 			logout() {
 				this.logoutShow = true;
@@ -348,5 +434,10 @@
 				}
 			}
 		}
+
+		.modifyPwd {
+			width: 100%;
+			border: 1rpx solid rgb(220, 223, 230);
+		}
 	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.1