From 691dbe24f5724f153e07947c7b75bdfea5f0b6d5 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期二, 24 九月 2024 16:15:15 +0800
Subject: [PATCH] 离线控制模式

---
 HDL_ON/UI/UI1-Login/LoginPageBLL.cs |   56 ++++++++++----------------------------------------------
 1 files changed, 10 insertions(+), 46 deletions(-)

diff --git a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs
index 13fc4ad..46c3048 100644
--- a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs
+++ b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs
@@ -479,8 +479,8 @@
             //褰撶劍鐐瑰湪瀵嗙爜鏂囨湰妗嗘椂锛岀偣鍑婚敭鐩樺洖鎾ゆ寜閿紝瑙﹀彂鐨勪簨浠�
             etPassword.EditorEnterAction += (obj) =>
             {
-                LoginEvent();
                 Application.HideSoftInput();
+                LoginEvent();
             };
         }
 
@@ -637,6 +637,7 @@
                             {
                                 //璺宠浆椤甸潰----
                                 MainPage.GoUserPage(true);
+                                this.RemoveFromParent();
                                 return;
                             }
                         });
@@ -647,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));
@@ -730,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;
@@ -752,17 +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