Browse Source

记住地址功能

LT31650A 1 month ago
parent
commit
3b636838a9
1 changed files with 17 additions and 4 deletions
  1. 17 4
      pages/login/index.vue

+ 17 - 4
pages/login/index.vue

@@ -61,8 +61,14 @@
 		data() {
 			return {
 				loginForm: {
+// <<<<<<< HEAD
 					Env: 'http://10.201.3.146',
 					acctID: '65864d91189ad0',
+// =======
+					// Env: 'http://10.201.3.146',//测试地址
+					// Env: 'http://10.200.0.222',
+// 					acctID: '5d5812913fe36c',
+// >>>>>>> e217401 (记住地址功能)
 					FStockOrgId: '100',
 					UserName: '',
 					Password: '',
@@ -110,6 +116,9 @@
 		},
 		onLoad() {
 			uni.setStorageSync('Url', this.loginForm.Env)
+			if(uni.getStorageSync('Env') == ''){
+				this.loginForm.Env = 'http://10.201.3.146'
+			}
 		},
 		mounted() {
 			//记住密码
@@ -118,18 +127,20 @@
 			//缓存的密码
 			const HBpassword = uni.getStorageSync('HBpassword');
 			//缓存的业务类型
-			const HBFacadeName = uni.getStorageSync('HBFacadeName');
+			const Env = uni.getStorageSync('Env');
 			console.log('缓存的账号:' + HBusername);
 			console.log('缓存的密码:' + HBpassword);
+			console.log('缓存的地址:' + Env);
 			// console.log('缓存的业务类型:' + HBFacadeName);
 			//有缓存就赋值给文本没有就清空
 			if (HBusername && HBpassword) {
 				this.loginForm.UserName = HBusername;
 				this.loginForm.Password = HBpassword;
-				// this.loginForm.FacadeName = HBFacadeName;
+				this.loginForm.Env = Env;
 			} else {
 				this.loginForm.UserName = '';
 				this.loginForm.Password = '';
+				this.loginForm.Env = 'http://10.201.3.146';
 
 			}
 			//自动登录
@@ -148,10 +159,12 @@
 					//获取缓存的账号 赋值
 					uni.getStorageSync('HBusername', this.loginForm.UserName);
 					uni.getStorageSync('HBpassword', this.loginForm.Password);
+					uni.getStorageSync('Env', this.loginForm.Env);
 				} else {
 					//销毁
 					uni.removeStorageSync('HBusername');
 					uni.removeStorageSync('HBpassword');
+					uni.removeStorageSync('Env');
 				}
 			},
 			// 登录方法
@@ -190,12 +203,12 @@
 				if (this.rememberPsw) {
 					uni.setStorageSync('HBusername', this.loginForm.UserName);
 					uni.setStorageSync('HBpassword', this.loginForm.Password);
-					// uni.setStorageSync('HBFacadeName', this.loginForm.FacadeName);
+					uni.setStorageSync('Env', this.loginForm.Env);
 				} else {
 					//销毁缓存
 					uni.removeStorageSync('HBusername');
 					uni.removeStorageSync('HBpassword');
-					// uni.removeStorageSync('HBFacadeName');
+					uni.removeStorageSync('Env');
 				}
 
 				// 设置用户信息