From a91bfc924f45ffd47367b28c253b5fc144d65ff5 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期三, 28 十二月 2022 14:38:46 +0800
Subject: [PATCH] #

---
 pages/login/login.vue |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/pages/login/login.vue b/pages/login/login.vue
index 1e2fad5..d1ff7e9 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -44,18 +44,20 @@
 				load: {
 					loading: false,
 					btnText: '鐧诲綍'
-				}
+				},
+				baseUrl: 'http://192.168.4.188:9528'
 			}
 		},
 		onLoad:function(){
+			this.user.userName = uni.getStorageSync('userName')
 			// #ifdef APP-PLUS
 			var that=this
 			plus.runtime.getProperty( plus.runtime.appid, function ( wgtinfo ) {
 				that.version=wgtinfo.version
 			});
 			// #endif
-			let that = this
-			that.user.userName = uni.getStorageSync('userName')
+			
+			
 		},
 		methods: {
 			changePassword: function() {
@@ -64,7 +66,7 @@
 			onLogin() {
 				let that = this
 				uni.request({
-					url: 'http://127.0.0.1:9528/login.action',
+					url: that.baseUrl + '/login.action',
 					fail(result) {
 						uni.showToast({title: '璇锋眰澶辫触'})
 					},
@@ -76,12 +78,17 @@
 						"content-type": "application/json"
 					},
 					success(result) {
+						if (result.statusCode ===  404) {
+							uni.showToast({title: '璇烽噸鏂扮櫥褰�', icon: "none", position: 'top'})
+							return
+						}
 						let res = result.data
 						if (res.code === 200 ){
 							that.load.loading = true;
 							that.load.btnText = '鐧诲綍涓�';
 							uni.setStorageSync('token', res.data.token);
 							uni.setStorageSync('userName', that.user.userName);
+							uni.setStorageSync('baseUrl',that.baseUrl)
 							setTimeout(()=> {
 								uni.showToast({title: '鐧诲綍鎴愬姛'})
 								setTimeout(()=> {

--
Gitblit v1.9.1