From 7167334c0e89dd84827d59e726123d14776e3a09 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 16 六月 2020 11:14:13 +0800 Subject: [PATCH] 2020-06-16-1 --- HDL_ON/UI/UI1-Login/RegisterPage.cs | 259 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 244 insertions(+), 15 deletions(-) diff --git a/HDL_ON/UI/UI1-Login/RegisterPage.cs b/HDL_ON/UI/UI1-Login/RegisterPage.cs index fd4be00..a8bd49a 100644 --- a/HDL_ON/UI/UI1-Login/RegisterPage.cs +++ b/HDL_ON/UI/UI1-Login/RegisterPage.cs @@ -1,5 +1,8 @@ 锘縰sing System; +using System.Collections.Generic; +using System.Threading; using HDL_ON.DAL.Server; +using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; @@ -47,7 +50,7 @@ /// <summary> /// 璐﹀彿瀛愬尯鍩熷簳閮ㄦí绾� /// </summary> - Button btnAccountViewBottomLine; + Button btnVerificationCodeViewBottomLine; /// <summary> /// 瀵嗙爜瀛愬尯鍩� /// </summary> @@ -120,7 +123,7 @@ /// <summary> /// 楠岃瘉鐮佸瓙鍖哄煙搴曢儴鍒嗗壊绾� /// </summary> - Button btnVerificationCodeViewBottomLine; + Button btnAccountViewBottomLine; /// <summary> /// 娉ㄥ唽鎸夐挳 /// </summary> @@ -150,7 +153,7 @@ /// <summary> /// 鍥炶皟浜嬩欢 /// </summary> - Action<string> callbackAction; + //Action callbackAction; /// <summary> /// 娉ㄥ唽绫诲瀷 /// 0:鎵嬫満 @@ -169,21 +172,21 @@ pm = new HttpServerRequest(); } - public RegisterPage(Action<string> action) - { - bodyView = new FrameLayout() - { - BackgroundColor = CSS_Color.MainBackgroundColor, - }; - AddChidren(bodyView); - - pm = new HttpServerRequest(); - callbackAction = action; - } + //public RegisterPage(Action action) + //{ + // bodyView = new FrameLayout() + // { + // BackgroundColor = CSS_Color.MainBackgroundColor, + // }; + // AddChidren(bodyView); + // pm = new HttpServerRequest(); + // callbackAction = action; + //} public void ShowDialog() { - new PublicAssmebly().LoadTopView(this, bodyView, Language.StringByID(StringId.Register)); + new TopViewDiv(this, bodyView, Language.StringByID(StringId.Register)).LoadTopView(); + //new PublicAssmebly().LoadTopView(this, bodyView, Language.StringByID(StringId.Register)); #region 娉ㄥ唽鏂瑰紡閫夋嫨 btnPhoneLogin = new Button() @@ -498,5 +501,231 @@ LoadEventList(); } + + + /// <summary> + /// 娉ㄥ唽鎴愬姛涔嬪悗鑷姩鐧诲綍 + /// </summary> + void LoadEvent_AutoLogin(string account, string password) + { + Dialog dialog = new Dialog(); + + FrameLayout frame = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(198), + Width = Application.GetRealWidth(288), + Height = Application.GetRealHeight(206), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + BorderWidth = 0, + BorderColor = 0x00000000, + }; + dialog.AddChidren(frame); + + Button btnAccountText = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(40), + Height = Application.GetRealHeight(17 + 14 + 14), + IsMoreLines = true, + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + Text = account, + }; + frame.AddChidren(btnAccountText); + + Button btnTipRegisterSuccess = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(123), + Height = Application.GetRealHeight(30), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.CongratulationsRegistration, + }; + frame.AddChidren(btnTipRegisterSuccess); + + Button btnAutoLoginTip = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = btnTipRegisterSuccess.Bottom, + Height = Application.GetRealHeight(17 + 8), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextID = StringId.AutomaticallyLogin, + }; + frame.AddChidren(btnAutoLoginTip); + + Button btnHeadImage = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(150), + Width = Application.GetRealWidth(84), + Height = Application.GetRealWidth(84), + Radius = (uint)Application.GetRealWidth(42), + BorderColor = 0x00000000, + BorderWidth = 0, + UnSelectedImagePath = "LoginIcon/2.png", + }; + dialog.AddChidren(btnHeadImage); + + dialog.Show(); + + new Thread(() => + { + Thread.Sleep(1500); + Application.RunOnMainThread(() => + { + //鍒涘缓鐧诲綍绾跨▼ + var loginThread = LoadThread_Login(account, password); + waitPage = new Loading(); + new PublicAssmebly().LoadPage_WaitPage(loginThread, bodyView, waitPage); + }); + }) + { IsBackground = true }.Start(); + } + + #region 鐧诲綍绾跨▼閮ㄥ垎 + /// <summary> + /// 鍔犺浇鐧诲綍绾跨▼ + /// </summary> + Thread LoadThread_Login(string account,string password) + { + var loginThread = new Thread(() => + { + try + { + //鐧诲綍 + var loginResult = LoadMethod_Login(account,password); + if (loginResult) + { + //鑾峰彇浣忓畢淇℃伅 + var getResidencesResult = LoadMethod_GetResidences(); + if (getResidencesResult) + { + /* + * Wait : 鎺ㄩ�佹敞鍐� + */ + + Application.RunOnMainThread(() => + { + waitPage.RemoveFromParent(); + waitPage = null; + + //璺宠浆椤甸潰---- + MainPage.GoUserPage(); + }); + } + } + } + catch (Exception ex) + { + MainPage.Log($"LoginPage : {ex.Message}"); + } + }) + { IsBackground = true }; + return loginThread; + } + + /// <summary> + /// 璋冪敤鐧诲綍鎺ュ彛鐧诲綍 + /// </summary> + bool LoadMethod_Login(string account, string password) + { + var result = false; + //璋冪敤鐧诲綍鎺ュ彛 + var loginResult = pm.LoginByPassword(account, password); + if (loginResult.StateCode.ToUpper() == "SUCCESS") + { + var loginDataStr = Newtonsoft.Json.Linq.JObject.FromObject(loginResult.ResponseData); + + //璁板綍鐢ㄦ埛鏁版嵁 + MainPage.LoginUser = new UserInfo + { + ID = (int)loginDataStr.GetValue("UserID"), + masterID = (int)loginDataStr.GetValue("MainUserID"), + accountType = (int)loginDataStr.GetValue("UserType"), + accountString = account, + password = password, + lastTime = DateTime.Now, + SIP_Account = loginDataStr.GetValue("AllVisionRegisterDevUserNameGuid").ToString(), + userName = loginDataStr.GetValue("Remark").ToString(), + }; + MainPage.LoginUser.SaveUserInfo(); + MainPage.Log("鐧诲綍鎴愬姛銆�"); + result = true; + + + } + //鐧诲綍澶辫触 + else + { + string tipStr = "Sever erorr"; + switch (loginResult.StateCode) + { + case "USERNAMEORPWDERROR": + tipStr = Language.StringByID(StringId.LoginFailed_AccountOrPasswordError); + break; + case "Self:Net_Error": + tipStr = Language.StringByID(StringId.NetworkAnomaly); + break; + } + //璐﹀彿鎴栬�呭瘑鐮侀敊璇� + Application.RunOnMainThread(() => + { + //鎻愮ず鍘熷洜 + var tip = new Tip() + { + Text = tipStr, + CloseTime = 3, + Direction = AMPopTipDirection.None + }; + tip.Show(bodyView); + btnPasswordViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2; + btnPasswordViewBottomLine.Height = Application.GetRealHeight(2); + }); + } + return result; + } + + /// <summary> + /// 鑾峰彇浣忓畢鍒楄〃 + /// </summary> + bool LoadMethod_GetResidences() + { + var result = false; + var responsePack = pm.GetHomePager(); + if (responsePack == "Success") + { + } + else + { + var tipStr = "Server erorr"; + switch (responsePack) + { + case "NoLogin": + tipStr = Language.StringByID(StringId.InvalidLoginCertificate); + break; + } + Application.RunOnMainThread(() => + { + //鎻愮ず鍘熷洜 + var tip = new Tip() + { + Text = tipStr, + CloseTime = 3, + Direction = AMPopTipDirection.None + }; + tip.Show(bodyView); + }); + + } + return result; + } + #endregion } } \ No newline at end of file -- Gitblit v1.8.0