From 716d1b3b705e7d37e6edebd7f60b7613ab5aee87 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 20 十一月 2020 18:46:22 +0800 Subject: [PATCH] 1120-3 --- HDL_ON/UI/UI1-Login/LoginPageBLL.cs | 90 +++++++++++++++++++++++++++++++++------------ 1 files changed, 66 insertions(+), 24 deletions(-) diff --git a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs index d91a9b9..5803f90 100644 --- a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs +++ b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs @@ -28,6 +28,25 @@ } /// <summary> + /// 妫�娴嬪綋鍓嶉厤缃煙鍚嶆槸鍚︿竴鑷达紝涓嶄竴鑷村垯鏇挎崲 + /// </summary> + /// <param name="result"></param> + void CheckAndSetUserRequestHost(ResponsePackNew result) + { + try + { + var mGlobalRegionListObj = Newtonsoft.Json.JsonConvert.DeserializeObject<GlobalRegionListRes>(result.Data.ToString()); + if (UserInfo.Current.RequestHttpsHost != mGlobalRegionListObj.regionUrl) + { + UserInfo.Current.RequestHttpsHost = mGlobalRegionListObj.regionUrl; + UserInfo.Current.GlobalRegion = mGlobalRegionListObj; + UserInfo.Current.SaveUserInfo(); + } + } + catch { } + } + + /// <summary> /// 鐐瑰嚮鎸夐挳鑾峰彇楠岃瘉鐮� /// </summary> void GetVerificationCode() @@ -51,7 +70,7 @@ btnAccountViewBottomLine.Height = Application.GetRealHeight(2); return; } - if (!Regex.IsMatch(account, @"^[1]+\d{10}") || (account.Length != 11)) + if (!Utlis.CheckPhoneNumber(phoneNumber, phoneZoneCode)) { var tip = new Tip() { @@ -73,11 +92,14 @@ var result = pm.GetRegionByAccount(account); if (result.Code != StateCode.SUCCESS) { - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_GetRegionByAccount, result.Code); + IMessageCommon.Current.ShowErrorInfoAlter(result.Code); return; } else { + //妫�娴嬪綋鍓嶉厤缃煙鍚嶆槸鍚︿竴鑷达紝涓嶄竴鑷村垯鏇挎崲 + CheckAndSetUserRequestHost(result); + // Application.RunOnMainThread(() => { btnGetVerificationCode.IsSelected = false; @@ -113,7 +135,7 @@ btnPasswordViewBottomLine.Height = Application.GetRealHeight(2); }); // 鎻愮ず閿欒 - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Verification_Send, resultObj.Code); + IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); } } @@ -395,7 +417,7 @@ return; if (loginType == 0) { - if (!Regex.IsMatch(account, @"^[1]+\d{10}") || (account.Length != 11)) + if (!Utlis.CheckPhoneNumber(registerPhone, phoneZoneCode)) { var tip = new Tip() { @@ -418,7 +440,7 @@ } else { - if (!Regex.IsMatch(account, "([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,5})+")) + if (!Utlis.CheckEmail(registerEmail)) { var tip = new Tip() { @@ -493,12 +515,15 @@ { if (btnLogin.IsSelected) { + //鍒ゆ柇鏄惁鍚屾剰浜嗛殣绉佹斂绛� + if (CheckPrivacyPolicy() == false) return; + account = etAccount.Text.Trim(); password = etPassword.Text.Trim(); if (loginType == 0) { - if (!Regex.IsMatch(account, @"^[1]+\d{10}") && account.Length == 11) + if (!Utlis.CheckPhoneNumber(account, phoneZoneCode)) { var tip = new Tip() { @@ -512,7 +537,7 @@ } else { - if (!Regex.IsMatch(account, "([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,5})+")) + if (!Utlis.CheckEmail(account)) { var tip = new Tip() { @@ -584,8 +609,13 @@ var result = pm.GetRegionByAccount(account); if (result.Code != StateCode.SUCCESS) { - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_GetRegionByAccount, result.Code); + IMessageCommon.Current.ShowErrorInfoAlter(result.Code); return; + } + else + { + //璁剧疆鐢ㄦ埛鎵�娉ㄥ唽鍦板尯鐨勫煙鍚嶏紝鐢ㄦ埛鐩稿叧鎿嶄綔閮界敤杩欎釜鍩熷悕 + CheckAndSetUserRequestHost(result); } } @@ -627,7 +657,7 @@ OnAppConfig.Instance.RefreshUserConfig(); DB_ResidenceData.InitRoomFunction(); } - if (MainPage.LoginUser.userEmailInfo == "464027401@qq.com") + if ( UserInfo.Current.userEmailInfo == "464027401@qq.com") { DB_ResidenceData.residenceData.floors.Add(new Floor() { name = "1F", sid = "09888" }); var r111 = new Room() { sid = "0001", name = "Room-1", floorId = "09888", backgroundImage = "Classification/Room/Roombg.png" }; @@ -901,7 +931,11 @@ else { //2020-11-13 寰呯‘璁� - MainPage.ShowAlertOnMainThread("鐧诲綍澶辫触锛岃鍏堟坊鍔犱綇瀹呫��"); + //鑾峰彇浣忓畢澶辫触锛岄噸鏂版爣璁颁负鏈櫥褰曠姸鎬� + UserInfo.Current.lastTime = DateTime.MinValue; + UserInfo.Current.SaveUserInfo(); + //鐧诲綍澶辫触锛岃鍏堟坊鍔犱綇瀹咃紒 + Utlis.ShowAlertOnMainThread(Language.StringByID(StringId.FailedGetHomeList)); } } } @@ -945,18 +979,26 @@ if (loginResult.Code == StateCode.SUCCESS) { var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(loginResult.Data.ToString()); - MainPage.LoginUser = new UserInfo - { - userType = revertData.userType, - accountString = account, - password = password, - lastTime = DateTime.Now, - ID = revertData.userId, - loginTokenString = revertData.headerPrefix + revertData.accessToken, - refreshToken = revertData.refreshToken, - userName = revertData.name - }; - MainPage.LoginUser.SaveUserInfo(); + // UserInfo.Current = new UserInfo + //{ + // userType = revertData.userType, + // accountString = account, + // password = password, + // lastTime = DateTime.Now, + // ID = revertData.userId, + // loginTokenString = revertData.headerPrefix + revertData.accessToken, + // refreshToken = revertData.refreshToken, + // userName = revertData.name + //}; + UserInfo.Current.userType = revertData.userType; + UserInfo.Current.accountString = account; + //UserInfo.Current.password = password; + UserInfo.Current.lastTime = DateTime.Now; + UserInfo.Current.ID = revertData.userId; + UserInfo.Current.loginTokenString = revertData.headerPrefix + revertData.accessToken; + UserInfo.Current.refreshToken = revertData.refreshToken; + UserInfo.Current.userName = revertData.name; + UserInfo.Current.SaveUserInfo(); MainPage.Log("鐧诲綍鎴愬姛銆�"); result = true; //鑾峰彇鐢ㄦ埛淇℃伅 @@ -1031,7 +1073,7 @@ if (responsePack == StateCode.SUCCESS) { //2020-11-13 寰呯‘璁わ紝娌℃湁浣忓畢锛屼笉绠楃櫥褰曟垚鍔� - if (MainPage.LoginUser.regionList != null && MainPage.LoginUser.regionList.Count > 0){ + if ( UserInfo.Current.regionList != null && UserInfo.Current.regionList.Count > 0){ result = true; } //result = true; @@ -1039,7 +1081,7 @@ else { // 鎻愮ず閿欒 - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Gethomepager, responsePack); + IMessageCommon.Current.ShowErrorInfoAlter(responsePack); } return result; } -- Gitblit v1.8.0