From acc8caee31c4be90bd38d1af18136b0e84f6fe94 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期五, 27 九月 2024 14:01:19 +0800
Subject: [PATCH] Merge branch 'feature/v2.7_迭代' into feature/V2.7_Google

---
 HDL_ON/UI/UI1-Login/LoginPageBLL.cs |  187 +++++++++++++++++++++++-----------------------
 1 files changed, 95 insertions(+), 92 deletions(-)

diff --git a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs
index 7b9c9c7..46c3048 100644
--- a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs
+++ b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs
@@ -60,6 +60,7 @@
                     {
                         var tip = new Tip()
                         {
+                            MaxWidth = Application.GetRealWidth(300),
                             Text = Language.StringByID(StringId.PlsEntryPhoneNumber),
                             CloseTime = 1,
                             Direction = AMPopTipDirection.None
@@ -74,6 +75,7 @@
                     {
                         var tip = new Tip()
                         {
+                            MaxWidth = Application.GetRealWidth(300),
                             Text = Language.StringByID(StringId.PlsEntryCorrectMobilNeumber),
                             CloseTime = 1,
                             Direction = AMPopTipDirection.None
@@ -84,6 +86,9 @@
                         btnAccountViewBottomLine.Height = Application.GetRealHeight(2);
                         return;
                     }
+#if __IOS__
+                    etPassword.Foucs = true;
+#endif
                     //鍔犺浇Loading鏁堟灉
                     var waitPage = new Loading();
                     bodyView.AddChidren(waitPage);
@@ -225,6 +230,9 @@
                     }
                     //楠岃瘉鐮佷笉闇�瑕侀殣钘�
                     etPassword.SecureTextEntry = false;
+#if __IOS__
+                    etPassword.SetTextContentTypeToOneTimeCode();
+#endif
                 }
                 #endregion
             }
@@ -313,6 +321,7 @@
                 //}
                 //闅愯棌瀵嗙爜
                 etPassword.SecureTextEntry = true;
+                //etPassword.IsNumberKeyboardType = false;
             }
             //楠岃瘉鐮佺櫥褰�
             else if (logintMode == 1)
@@ -340,6 +349,9 @@
                 }
                 //楠岃瘉鐮佷笉闇�瑕侀殣钘�
                 etPassword.SecureTextEntry = false;
+                etPassword.Text = smsCode;
+                //etPassword.IsNumberKeyboardType = true;
+
             }
         }
 
@@ -390,6 +402,7 @@
                         {
                             var tip = new Tip()
                             {
+                                MaxWidth = Application.GetRealWidth(300),
                                 Text = Language.StringByID(StringId.PlsEntryCorrectMobilNeumber),
                                 CloseTime = 1,
                                 Direction = AMPopTipDirection.None
@@ -413,6 +426,7 @@
                         {
                             var tip = new Tip()
                             {
+                                MaxWidth = Application.GetRealWidth(300),
                                 Text = Language.StringByID(StringId.PlsEntryCorrectEmailAddress),
                                 CloseTime = 1,
                                 Direction = AMPopTipDirection.None
@@ -431,9 +445,27 @@
                 {
                     btnPasswordViewBottomLine.BackgroundColor = CSS_Color.MainColor;
                     btnPasswordViewBottomLine.Height = Application.GetRealHeight(2);
+
+#if __IOS__
+      new Thread(() => {
+                            for(var i = 0; i < 10; i++)
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    this.Y = 0-Application.GetRealHeight(10 * i);
+                                });
+                                Thread.Sleep(10);
+                            }
+                        }) { IsBackground = true }.Start();
+
+                    var sst = etPassword.MyTextContentType;
+                    Console.WriteLine(sst);
+                    etPassword.SetTextContentTypeToOneTimeCode();
+#endif
                 }
                 else
                 {
+                    this.Y = 0;
                     btnPasswordViewBottomLine.BackgroundColor = CSS_Color.DividingLineColor;
                     btnPasswordViewBottomLine.Height = Application.GetRealHeight(1);
                 }
@@ -448,12 +480,8 @@
             etPassword.EditorEnterAction += (obj) =>
             {
                 Application.HideSoftInput();
+                LoginEvent();
             };
-            etPassword.MouseUpEventHandler = (sender, e) =>
-            {
-                etPassword.Foucs = true;
-            };
-
         }
 
         /// <summary>
@@ -482,48 +510,7 @@
         {
             btnLogin.MouseUpEventHandler += (sender, e) =>
             {
-                if (btnLogin.IsSelected)
-                {
-                    //鍒ゆ柇鏄惁鍚屾剰浜嗛殣绉佹斂绛�
-                    if (CheckPrivacyPolicy() == false) return;
-
-                    account = etAccount.Text.Trim();
-                    password = etPassword.Text.Trim();
-
-                    if (loginType == 0)
-                    {
-                        if (!Utlis.CheckPhoneNumber(account, phoneZoneCode))
-                        {
-                            var tip = new Tip()
-                            {
-                                Text = Language.StringByID(StringId.PlsEntryCorrectMobilNeumber),
-                                CloseTime = 1,
-                                Direction = AMPopTipDirection.None
-                            };
-                            tip.Show(bodyView);
-                            return;
-                        }
-                    }
-                    else
-                    {
-                        if (!Utlis.CheckEmail(account))
-                        {
-                            var tip = new Tip()
-                            {
-                                Text = Language.StringByID(StringId.PlsEntryCorrectEmailAddress),
-                                CloseTime = 1,
-                                Direction = AMPopTipDirection.None
-                            };
-                            tip.Show(bodyView);
-                            return;
-                        }
-                    }
-
-                    //鍒涘缓鐧诲綍绾跨▼
-                    var loginThread = LoadThread_Login();
-                    waitPage = new Loading();
-                    new PublicAssmebly().LoadPage_WaitPage(loginThread, bodyView, waitPage);
-                }
+                LoginEvent();
             };
             #region 褰撹处鍙峰瘑鐮侀兘杈撳叆鏃讹紝鎵嶈兘鐐瑰嚮鐧诲綍鎸夐挳
             etAccount.TextChangeEventHandler = (sender, e) =>
@@ -561,7 +548,58 @@
             };
             #endregion
         }
+        /// <summary>
+        /// 鐧诲綍浜嬩欢
+        /// </summary>
+        void LoginEvent()
+        {
+            if (btnLogin.IsSelected)
+            {
+                //鍒ゆ柇鏄惁鍚屾剰浜嗛殣绉佹斂绛�
+                if (CheckPrivacyPolicy() == false)
+                {
+                    Application.HideSoftInput();
+                    return;
+                }
+                account = etAccount.Text.Trim();
+                password = etPassword.Text.Trim();
 
+                if (loginType == 0)
+                {
+                    if (!Utlis.CheckPhoneNumber(account, phoneZoneCode))
+                    {
+                        var tip = new Tip()
+                        {
+                            MaxWidth = Application.GetRealWidth(300),
+                            Text = Language.StringByID(StringId.PlsEntryCorrectMobilNeumber),
+                            CloseTime = 1,
+                            Direction = AMPopTipDirection.None
+                        };
+                        tip.Show(bodyView);
+                        return;
+                    }
+                }
+                else
+                {
+                    if (!Utlis.CheckEmail(account))
+                    {
+                        var tip = new Tip()
+                        {
+                            Text = Language.StringByID(StringId.PlsEntryCorrectEmailAddress),
+                            CloseTime = 1,
+                            Direction = AMPopTipDirection.None
+                        };
+                        tip.Show(bodyView);
+                        return;
+                    }
+                }
+
+                //鍒涘缓鐧诲綍绾跨▼
+                var loginThread = LoadThread_Login();
+                waitPage = new Loading();
+                new PublicAssmebly().LoadPage_WaitPage(loginThread, bodyView, waitPage);
+            }
+        }
         /// <summary>
         /// 鍔犺浇鐧诲綍绾跨▼
         /// </summary>
@@ -599,6 +637,7 @@
                             {
                                 //璺宠浆椤甸潰----
                                 MainPage.GoUserPage(true);
+                                this.RemoveFromParent();
                                 return;
                             }
                         });
@@ -609,46 +648,20 @@
                         var getResidencesResult = LoadMethod_GetResidences();
                         if (getResidencesResult)
                         {
-                            /*
-                             * Wait : 鎺ㄩ�佹敞鍐�
-                             */
-
-                            /*
-                             * 鏌ョ湅鏈湴鏄惁瀛樺湪鏁版嵁
-                             * 瀛樺湪鍒欏鍑�
-                             */
-                            //var isExis = FileUtils.IsExisFolder(DB_ResidenceData.residenceData.CurReginID);
-                            //if (isExis)
-                            //{
-                            //    FileUtils.DeleteAllFile();
-                            //    string regionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID);
-                            //    FileUtils.RestoreRegionFiles(regionRootPath);
-                            //    DB_ResidenceData.residenceData.EixtAccount();
-                            //    OnAppConfig.Instance.RefreshUserConfig();
-                            //    SpatialInfo.CurrentSpatial.InitRoomFunction();
-                            //}
                             Application.RunOnMainThread(() =>
                             {
                                 //20201223-鐧诲綍鎴愬姛涔嬪悗锛屽皢涓嬭浇鏁版嵁瀹屾垚鏍囪鏍囪涓篺alse锛岄槻姝富椤垫彁鍓嶅姞杞�
                                 Common.ApiUtlis.Ins.DownloadDataComplete = false;
                                 //璺宠浆椤甸潰----
                                 MainPage.GoUserPage(true);
+                                this.RemoveFromParent();
                             });
                         }
                         else
                         {
-                            //Application.RunOnMainThread(() =>
-                            //{
-                            //    BindingResidencePage page = new BindingResidencePage();
-                            //    MainPage.BaseView.AddChidren(page);
-                            //    page.LoadView();
-                            //});
-
-
-
                             //2020-11-13 寰呯‘璁�
                             //鑾峰彇浣忓畢澶辫触锛岄噸鏂版爣璁颁负鏈櫥褰曠姸鎬�
-                            UserInfo.Current.LastTime = DateTime.MinValue;
+                            UserInfo.Current.ValidToken = false;
                             UserInfo.Current.SaveUserInfo();
                             //鐧诲綍澶辫触锛岃鍏堟坊鍔犱綇瀹咃紒
                             //Utlis.ShowAlertOnMainThread(Language.StringByID(StringId.FailedGetHomeList));
@@ -692,20 +705,14 @@
                 //璋冪敤楠岃瘉鐮佺櫥褰曟帴鍙�
                 loginResult = pm.LoginValidCode(account, password);
             }
+            if(loginResult == null)
+            {
+
+                return false;
+            }
             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
-                //};
                 if (OnAppConfig.Instance.LastLoginUserId != revertData.userId)
                 {
                     OnAppConfig.Instance.LastLoginUserId = revertData.userId;
@@ -714,16 +721,12 @@
                 UserInfo.Current.ClearUserInfo();
                 UserInfo.Current.userType = revertData.userType;
                 UserInfo.Current.AccountString = account;
-                //UserInfo.Current.password = password;
-                UserInfo.Current.LastTime = DateTime.Now;
+                UserInfo.Current.ValidToken = true;
                 UserInfo.Current.ID = revertData.userId;
                 UserInfo.Current.LoginTokenString = revertData.headerPrefix + revertData.accessToken;
+                UserInfo.Current.AccessToken = revertData.accessToken;
                 UserInfo.Current.RefreshToken = revertData.refreshToken;
                 UserInfo.Current.userName = revertData.name;
-                //UserInfo.Current.userMobileInfo = "";//閲嶇疆鐢ㄦ埛鎵嬫満
-                //UserInfo.Current.userEmailInfo = "";//閲嶇疆鐢ㄦ埛閭
-                //UserInfo.Current.headImagePagePath = "LoginIcon/2.png";//
-                //UserInfo.Current.CurrentRegion.RegionID = "";
                 UserInfo.Current.SaveUserInfo();
                 MainPage.Log("鐧诲綍鎴愬姛銆�");
 #if __IOS__

--
Gitblit v1.8.0