From e86013cd8d4b88ca916067b01eeb452401b38c7b Mon Sep 17 00:00:00 2001
From: 朱桂飞 <18597012158>
Date: 星期二, 11 四月 2023 14:46:00 +0800
Subject: [PATCH] 修改首页草药名称过长UI错乱问题

---
 pages/login/login.vue |   66 +++++++++++++++++++++-----------
 1 files changed, 43 insertions(+), 23 deletions(-)

diff --git a/pages/login/login.vue b/pages/login/login.vue
index bcfacf9..20d828c 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -13,7 +13,8 @@
 				</u-form-item>
 
 				<u-form-item label="瀵嗙爜" prop="password" borderBottom ref="item1">
-					<u-input v-model="model.password" placeholder="璇疯緭鍏ュ瘑鐮�" border="none" clearable></u-input>
+					<u-input type="password" v-model="model.password" placeholder="璇疯緭鍏ュ瘑鐮�" border="none" clearable>
+					</u-input>
 				</u-form-item>
 
 			</view>
@@ -54,38 +55,57 @@
 			};
 		},
 		onLoad() {
+			const account = uni.getStorageSync('account');
+			if (account) {
+				this.model = account
+			}
 
 		},
+
 		methods: {
-			submit() {
-				
+			forget() {
+				uni.navigateTo({
+					url: "/pages/tabBar/demo"
+				})
+			},
+			submit() {
+
 				this.$refs.form.validate().then(res => {
-					uni.$u.toast('鏍¢獙閫氳繃')
-					//this.login()
-					uni.switchTab({
-						url:'/pages/tabBar/general'
-					})
+					this.login()
+
 				}).catch(errors => {
 					uni.$u.toast('鏍¢獙澶辫触')
 				})
 			},
 			login() {
-				this.$api.test({
-					id: 4
-				}).then((res) => {
-				 
-					console.log('request success', res)
-					uni.showToast({
-						title: '璇锋眰鎴愬姛',
-						icon: 'success',
-						mask: true
-					});
-					
-					uni.switchTab({
-						url:'/pages/tabBar/general'
-					})
+				this.$api.login(this.model).then((res) => {
+					if (res.success) {
+
+						console.log('request success', res)
+						uni.showToast({
+							title: '鐧诲綍鎴愬姛',
+							icon: 'success',
+							mask: true
+						});
+
+						uni.setStorageSync('account', this.model);
+						uni.setStorageSync('userinfo', res.result.userInfo);
+						uni.setStorageSync('token', res.result.token);
+
+						uni.switchTab({
+							url: '/pages/tabBar/general'
+						})
+					}else {
+						uni.showToast({
+							title:  res.message,
+							icon: 'none',
+							mask: true
+						});
+					}
+
+
 				}).catch((err) => {
-			 
+
 					console.log('request fail', err);
 				})
 			},

--
Gitblit v1.9.3