From 84e76cf2fcbe26142750131d3c27eaac0335e40a Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 11 三月 2021 11:04:08 +0800
Subject: [PATCH] 上传一个添加红外宝 Ios 版本
---
HDL_ON/UI/UI1-Login/RegisterPage.cs | 284 ++++++++++++++++++++++++++++++++------------------------
1 files changed, 161 insertions(+), 123 deletions(-)
diff --git a/HDL_ON/UI/UI1-Login/RegisterPage.cs b/HDL_ON/UI/UI1-Login/RegisterPage.cs
index 1cc2e76..0885191 100644
--- a/HDL_ON/UI/UI1-Login/RegisterPage.cs
+++ b/HDL_ON/UI/UI1-Login/RegisterPage.cs
@@ -166,12 +166,12 @@
#endregion
#region 灞�閮ㄥ彉閲忓垪琛�
- /// <summary>
- /// 璐﹀彿绫诲瀷
- /// 0:鎵嬫満
- /// 1:閭
- /// </summary>
- int accountType = 0;
+ ///// <summary>
+ ///// 璐﹀彿绫诲瀷
+ ///// 0:鎵嬫満
+ ///// 1:閭
+ ///// </summary>
+ //int accountType = 0;
/// <summary>
/// 鎵嬫満鍙风爜鏄惁鏈夋晥
/// </summary>
@@ -193,7 +193,7 @@
/// 0:鎵嬫満
/// 1:閭
/// </summary>
- int registerType;
+ int registerType = 0;
/// <summary>
/// 鎵嬫満鍖哄彿
/// </summary>
@@ -205,14 +205,37 @@
string registerPhone;
string registerEmail;
+ /// <summary>
+ /// 鏄惁鐐瑰嚮浜嗚繑鍥烇紝鐢ㄤ簬灞忚斀EditText澶卞幓鐒︾偣妫�娴嬩簨浠�
+ /// </summary>
+ bool isHitBack;
#endregion
- public RegisterPage()
+
+ /// <summary>
+ /// 鍥炶皟浜嬩欢
+ /// 璐﹀彿锛屽瘑鐮侊紝鏄惁鎵嬫満
+ /// account锛宲assword锛宨sPhone
+ /// </summary>
+ Action<string, string, bool> AutoLoginAction;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="autoLoginAction">娉ㄥ唽鎴愬姛鍥炶皟浜嬩欢</param>
+ public RegisterPage(Action<string, string, bool> autoLoginAction)
{
+ AutoLoginAction = autoLoginAction;
+
bodyView = new FrameLayout()
{
- BackgroundColor = CSS_Color.BackgroundColor,
+ BackgroundColor = CSS_Color.MainBackgroundColor,
};
AddChidren(bodyView);
+
+ //2020-12-22 澧炲姞鐐瑰嚮闅愯棌閿洏浜嬩欢
+ bodyView.MouseDownEventHandler += (sender, e) => {
+ Application.HideSoftInput();
+ };
pm = new HttpServerRequest();
}
@@ -230,7 +253,14 @@
public void ShowDialog()
{
- new TopViewDiv(this, bodyView, Language.StringByID(StringId.Register)).LoadTopView();
+ Action backAction = () =>
+ {
+ isHitBack = true;
+ //2020-12-22 澧炲姞鐐瑰嚮闅愯棌閿洏浜嬩欢
+ Application.HideSoftInput();
+ };
+
+ new TopViewDiv(this, bodyView, Language.StringByID(StringId.Register)).LoadTopView(backAction);
//new PublicAssmebly().LoadTopView(this, bodyView, Language.StringByID(StringId.Register));
#region 娉ㄥ唽鏂瑰紡閫夋嫨
@@ -259,6 +289,11 @@
TextSize = CSS_FontSize.TextFontSize,
};
bodyView.AddChidren(btnEmailLogin);
+ if(Language.CurrentLanguage!= "Chinese")
+ {
+ btnPhoneLogin.Width = Application.GetRealWidth(180);
+ btnEmailLogin.Width = Application.GetRealWidth(180);
+ }
#endregion
#region 鏈嶅姟鍣ㄩ�夋嫨
@@ -348,7 +383,7 @@
};
btnGlobalRoaming.MouseUpEventHandler += eHandler;
- if (accountType == 0)
+ if (registerType == 0)
{
accountView.AddChidren(btnGlobalRoaming);
}
@@ -392,7 +427,7 @@
Height = Application.GetMinRealAverage(20),
UnSelectedImagePath = "LoginIcon/AccountIcon.png",
};
- if (accountType == 1)
+ if (registerType == 1)
{
accountView.AddChidren(btnAccountIcon);
}
@@ -709,127 +744,130 @@
Thread.Sleep(1500);
Application.RunOnMainThread(() =>
{
- //鍒涘缓鐧诲綍绾跨▼
- var loginThread = LoadThread_Login(account, password);
- waitPage = new Loading();
- new PublicAssmebly().LoadPage_WaitPage(loginThread, bodyView, waitPage);
+ ////鍒涘缓鐧诲綍绾跨▼
+ //var loginThread = LoadThread_Login(account, password);
+ //waitPage = new Loading();
+ //new PublicAssmebly().LoadPage_WaitPage(loginThread, bodyView, waitPage);
dialog.Close();
+
+ var isPhone = registerType == 0;
+ AutoLoginAction?.Invoke(account, password, isPhone);
});
})
{ 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 : 鎺ㄩ�佹敞鍐�
- */
+ //#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;
+ // Application.RunOnMainThread(() =>
+ // {
+ // waitPage.RemoveFromParent();
+ // waitPage = null;
- //璺宠浆椤甸潰----
- MainPage.GoUserPage();
- });
- }
- }
- }
- catch (Exception ex)
- {
- MainPage.Log($"LoginPage : {ex.Message}");
- }
- })
- { IsBackground = true };
- return loginThread;
- }
+ // //璺宠浆椤甸潰----
+ // 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.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;
+ ///// <summary>
+ ///// 璋冪敤鐧诲綍鎺ュ彛鐧诲綍
+ ///// </summary>
+ //bool LoadMethod_Login(string account, string password)
+ //{
+ // var result = false;
+ // //璋冪敤鐧诲綍鎺ュ彛
+ // var loginResult = pm.LoginByPassword(account, password);
+ // 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.Log("鐧诲綍鎴愬姛銆�");
- result = true;
- }
- else
- {
- //鐧诲綍澶辫触
- IMessageCommon.Current.ShowErrorInfoAlter(loginResult.Code);
- Application.RunOnMainThread(() =>
- {
- btnPasswordViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2;
- btnPasswordViewBottomLine.Height = Application.GetRealHeight(2);
- });
- }
- return result;
- }
+ // UserInfo.Current.SaveUserInfo();
+ // MainPage.Log("鐧诲綍鎴愬姛銆�");
+ // result = true;
+ // }
+ // else
+ // {
+ // //鐧诲綍澶辫触
+ // IMessageCommon.Current.ShowErrorInfoAlter(loginResult.Code);
+ // Application.RunOnMainThread(() =>
+ // {
+ // 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 == StateCode.SUCCESS)
- {
- //2020-11-13 寰呯‘璁わ紝娌℃湁浣忓畢锛屼笉绠楃櫥褰曟垚鍔�
- if (UserInfo.Current.regionList != null && UserInfo.Current.regionList.Count > 0)
- {
- result = true;
- }
- }
- else
- {
- IMessageCommon.Current.ShowErrorInfoAlter(responsePack);
- }
- return result;
- }
- #endregion
+ ///// <summary>
+ ///// 鑾峰彇浣忓畢鍒楄〃
+ ///// </summary>
+ //bool LoadMethod_GetResidences()
+ //{
+ // var result = false;
+ // var responsePack = pm.GetHomePager();
+ // if (responsePack == StateCode.SUCCESS)
+ // {
+ // //2020-11-13 寰呯‘璁わ紝娌℃湁浣忓畢锛屼笉绠楃櫥褰曟垚鍔�
+ // if (UserInfo.Current.regionList != null && UserInfo.Current.regionList.Count > 0)
+ // {
+ // result = true;
+ // }
+ // }
+ // else
+ // {
+ // IMessageCommon.Current.ShowErrorInfoAlter(responsePack);
+ // }
+ // return result;
+ //}
+ //#endregion
}
}
\ No newline at end of file
--
Gitblit v1.8.0