From eb51679c618d5027070fbd6f3c0519f0f17e7d7d Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期一, 23 十一月 2020 10:07:53 +0800
Subject: [PATCH] Merge branch 'CJL' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into CJL

---
 HDL_ON/UI/UI1-Login/LoginPageBLL.cs |   90 ++++++++++++---------------------------------
 1 files changed, 24 insertions(+), 66 deletions(-)

diff --git a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs
index 5803f90..d91a9b9 100644
--- a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs
+++ b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs
@@ -28,25 +28,6 @@
         }
 
         /// <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()
@@ -70,7 +51,7 @@
                         btnAccountViewBottomLine.Height = Application.GetRealHeight(2);
                         return;
                     }
-                    if (!Utlis.CheckPhoneNumber(phoneNumber, phoneZoneCode))
+                    if (!Regex.IsMatch(account, @"^[1]+\d{10}") || (account.Length != 11))
                     {
                         var tip = new Tip()
                         {
@@ -92,14 +73,11 @@
                         var result = pm.GetRegionByAccount(account);
                         if (result.Code != StateCode.SUCCESS)
                         {
-                            IMessageCommon.Current.ShowErrorInfoAlter(result.Code);
+                            IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_GetRegionByAccount, result.Code);
                             return;
                         }
                         else
                         {
-                            //妫�娴嬪綋鍓嶉厤缃煙鍚嶆槸鍚︿竴鑷达紝涓嶄竴鑷村垯鏇挎崲
-                            CheckAndSetUserRequestHost(result);
-                            //
                             Application.RunOnMainThread(() =>
                             {
                                 btnGetVerificationCode.IsSelected = false;
@@ -135,7 +113,7 @@
                                     btnPasswordViewBottomLine.Height = Application.GetRealHeight(2);
                                 });
                                 // 鎻愮ず閿欒
-                                IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code);
+                                IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Verification_Send, resultObj.Code);
                             }
                         }
 
@@ -417,7 +395,7 @@
                         return;
                     if (loginType == 0)
                     {
-                        if (!Utlis.CheckPhoneNumber(registerPhone, phoneZoneCode))
+                        if (!Regex.IsMatch(account, @"^[1]+\d{10}") || (account.Length != 11))
                         {
                             var tip = new Tip()
                             {
@@ -440,7 +418,7 @@
                     }
                     else
                     {
-                        if (!Utlis.CheckEmail(registerEmail))
+                        if (!Regex.IsMatch(account, "([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,5})+"))
                         {
                             var tip = new Tip()
                             {
@@ -515,15 +493,12 @@
             {
                 if (btnLogin.IsSelected)
                 {
-                    //鍒ゆ柇鏄惁鍚屾剰浜嗛殣绉佹斂绛�
-                    if (CheckPrivacyPolicy() == false) return;
-
                     account = etAccount.Text.Trim();
                     password = etPassword.Text.Trim();
 
                     if (loginType == 0)
                     {
-                        if (!Utlis.CheckPhoneNumber(account, phoneZoneCode))
+                        if (!Regex.IsMatch(account, @"^[1]+\d{10}") && account.Length == 11)
                         {
                             var tip = new Tip()
                             {
@@ -537,7 +512,7 @@
                     }
                     else
                     {
-                        if (!Utlis.CheckEmail(account))
+                        if (!Regex.IsMatch(account, "([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,5})+"))
                         {
                             var tip = new Tip()
                             {
@@ -609,13 +584,8 @@
                         var result = pm.GetRegionByAccount(account);
                         if (result.Code != StateCode.SUCCESS)
                         {
-                            IMessageCommon.Current.ShowErrorInfoAlter(result.Code);
+                            IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_GetRegionByAccount, result.Code);
                             return;
-                        }
-                        else
-                        {
-                            //璁剧疆鐢ㄦ埛鎵�娉ㄥ唽鍦板尯鐨勫煙鍚嶏紝鐢ㄦ埛鐩稿叧鎿嶄綔閮界敤杩欎釜鍩熷悕
-                            CheckAndSetUserRequestHost(result);
                         }
                     }
 
@@ -657,7 +627,7 @@
                                 OnAppConfig.Instance.RefreshUserConfig();
                                 DB_ResidenceData.InitRoomFunction();
                             }
-                            if ( UserInfo.Current.userEmailInfo == "464027401@qq.com")
+                            if (MainPage.LoginUser.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" };
@@ -931,11 +901,7 @@
                         else
                         {
                             //2020-11-13 寰呯‘璁�
-                            //鑾峰彇浣忓畢澶辫触锛岄噸鏂版爣璁颁负鏈櫥褰曠姸鎬�
-                             UserInfo.Current.lastTime = DateTime.MinValue;
-                             UserInfo.Current.SaveUserInfo();
-                            //鐧诲綍澶辫触锛岃鍏堟坊鍔犱綇瀹咃紒
-                            Utlis.ShowAlertOnMainThread(Language.StringByID(StringId.FailedGetHomeList));
+                            MainPage.ShowAlertOnMainThread("鐧诲綍澶辫触锛岃鍏堟坊鍔犱綇瀹呫��");
                         }
                     }
                 }
@@ -979,26 +945,18 @@
             if (loginResult.Code == StateCode.SUCCESS)
             {
                 var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(loginResult.Data.ToString());
-                // 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.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();
                 MainPage.Log("鐧诲綍鎴愬姛銆�");
                 result = true;
                 //鑾峰彇鐢ㄦ埛淇℃伅
@@ -1073,7 +1031,7 @@
             if (responsePack == StateCode.SUCCESS)
             {
                 //2020-11-13 寰呯‘璁わ紝娌℃湁浣忓畢锛屼笉绠楃櫥褰曟垚鍔�
-                if ( UserInfo.Current.regionList != null &&  UserInfo.Current.regionList.Count > 0){
+                if (MainPage.LoginUser.regionList != null && MainPage.LoginUser.regionList.Count > 0){
                     result = true;
                 }
                 //result = true;
@@ -1081,7 +1039,7 @@
             else
             {
                 // 鎻愮ず閿欒
-                IMessageCommon.Current.ShowErrorInfoAlter(responsePack);
+                IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Gethomepager, responsePack);
             }
             return result;
         }

--
Gitblit v1.8.0