From 8c1bf42c5fca66625b59728006bd47bae0b6a3ad Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期一, 23 十一月 2020 10:18:16 +0800 Subject: [PATCH] Revert "Merge branch 'CJL' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into CJL" --- HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs | 313 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 277 insertions(+), 36 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs index 5597092..ff630c4 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs @@ -2,12 +2,46 @@ using Shared; using HDL_ON.UI.CSS; using HDL_ON.DAL.Server; +using System.Threading; namespace HDL_ON.UI { public partial class ResetPasswordPage : FrameLayout { + /// <summary> + /// 鏄惁鎵嬫満 + /// </summary> + public bool isPhone; + /// <summary> + /// 璐﹀彿 + /// </summary> + public string account; + /// <summary> + /// 楠岃瘉鐮� + /// </summary> + public string verCode; + + #region 鎺т欢View + /// <summary> + /// 瀵嗙爜鏂囨湰妗� + /// </summary> + EditText etPassword; + /// <summary> + /// 纭瀵嗙爜鏂囨湰妗� + /// </summary> + EditText etRepeatPassword; + + /// <summary> + /// 淇敼鎸夐挳 + /// </summary> + Button btnReset; + + /// <summary> + /// + /// </summary> FrameLayout bodyView; + #endregion + public ResetPasswordPage() { bodyView = this; @@ -15,60 +49,267 @@ public void LoadPage() { - bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; + bodyView.BackgroundColor = CSS_Color.BackgroundColor; new TopViewDiv(bodyView, Language.StringByID(StringId.ModifyPassword)).LoadTopView(); + #region 鏂板瘑鐮� + FrameLayout rowView = new FrameLayout() + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(50), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + bodyView.AddChidren(rowView); + //鏂板瘑鐮� + Button btnTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(180), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.CenterLeft, + Text = Language.StringByID(StringId.NewPassword) + ":" + }; + rowView.AddChidren(btnTitle); + etPassword = new EditText() + { + Width = Application.GetRealWidth(359), + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + SecureTextEntry = true, + TextAlignment = TextAlignment.CenterRight, + Foucs = true + }; + rowView.AddChidren(etPassword); + var lineView = new LineView(); + rowView.AddChidren(lineView); + lineView.Y = rowView.Height - lineView.Height; + #endregion + + #region 鍐嶆杈撳叆鏂板瘑鐮� + FrameLayout rowView2 = new FrameLayout() + { + Y = rowView.Bottom, + Height = Application.GetRealHeight(50), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + bodyView.AddChidren(rowView2); + + //鍐嶆杈撳叆鏂板瘑鐮� + Button btnTitle2 = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(180), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.CenterLeft, + //TextID = StringId.NewPasswordAgain, + Text = Language.StringByID(StringId.NewPasswordAgain) + ":" + }; + rowView2.AddChidren(btnTitle2); + + etRepeatPassword = new EditText() + { + Width = Application.GetRealWidth(359), + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + SecureTextEntry = true, + TextAlignment = TextAlignment.CenterRight, + }; + rowView2.AddChidren(etRepeatPassword); + #endregion + + btnReset = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(224), + Width = Application.GetRealWidth(220), + Height = Application.GetRealHeight(44), + Radius = (uint)Application.GetRealHeight(22), + SelectedBackgroundColor = CSS_Color.MainColor, + BackgroundColor = CSS_Color.PromptingColor1, + TextID = StringId.Confirm, + TextSize = CSS_FontSize.SubheadingFontSize, + TextColor = CSS_Color.MainBackgroundColor, + TextAlignment = TextAlignment.Center, + }; + bodyView.AddChidren(btnReset); + + LoadEvent_Reset(); + LoadEvent_EditTextFcousChange(); } } public partial class ResetPasswordPage { - public void ResetPassword(string password,string repeatPassword ) + + /// <summary> + /// 鎸囧畾鍏抽棴椤甸潰涓暟 + /// </summary> + /// <param name="countPage"></param> + void ClosePageWithCount(int countPage) { + //鍏抽棴澶氬皯涓〉闈� + for (int i = 0; i < countPage; i++) + { + MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); + } + } + + /// <summary> + /// + /// </summary> + /// <param name="password"></param> + void ResetPassword(string password) + { + + //鏍¢獙瀵嗙爜鏄惁绗﹀悎瑕佹眰 + if (etPassword.Text.Trim().Length < 6 || etPassword.Text.Trim().Length > 13) + { + new Tip() + { + CloseTime = 1, + Direction = AMPopTipDirection.None, + Text = Language.StringByID(StringId.PasswordIsUnqualified) + }.Show(bodyView); + return; + } + + //鏍¢獙涓ゆ杈撳叆鐨勫瘑鐮佹槸鍚︿竴鑷� + if (etPassword.Text.Trim() != etRepeatPassword.Text.Trim()) + { + new Tip() + { + CloseTime = 1, + Direction = AMPopTipDirection.None, + Text = Language.StringByID(StringId.IncorrectRepeatPassword) + }.Show(bodyView); + + return; + } + var waitPage = new Loading(); waitPage.Start("Please wait..."); - var resetResult = new HttpServerRequest().ResetPassword(MainPage.LoginUser.accountString, password, repeatPassword, 86); - if (resetResult.StateCode.ToUpper() == StateCode.SUCCESS) - { - Application.RunOnMainThread(() => - { - var page = new OperationResultDisPalyPage(); - page.Show(); - page.LoadPage(true, Language.StringByID(StringId.UnbindEmail), Language.StringByID(StringId.UnbindEmailSuccess), ""); - for (int i = 0; i < 2; i++) + new Thread(() => + { + try + { + // 蹇樿瀵嗙爜 + var resultObj = new HttpServerRequest().ForgetPassword(account, password, verCode, isPhone); + if (resultObj.Code == StateCode.SUCCESS) { - MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); + Application.RunOnMainThread(() => + { + Utlis.ShowTip(Language.StringByID(StringId.PasswordChangeSuccessfully)); + ClosePageWithCount(2); + }); } - }); + else + { + // 鎻愮ず閿欒 + IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); + } + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + waitPage.Hide(); + }); + } + }) + { IsBackground = true }.Start(); + + } + + /// <summary> + /// 鍔犺浇鏂瑰紡鎸夐挳浜嬩欢 + /// </summary> + void LoadEvent_Reset() + { + btnReset.MouseUpEventHandler += (sender, e) => + { + if (btnReset.IsSelected) + { + ResetPassword(etPassword.Text.ToString()); + } + }; + } + + /// <summary> + /// 鍔犺浇鏂囨湰妗嗙劍鐐瑰彉鍖栦簨浠� + /// </summary> + void LoadEvent_EditTextFcousChange() { + //瀵嗙爜鏂囨湰妗嗙劍鐐瑰彉鍖栦簨浠� + etPassword.FoucsChanged += (sender, e) => + { + if (etPassword.Foucs) + { + + } + else + { + //鏍¢獙瀵嗙爜鏄惁绗﹀悎瑕佹眰 + if (etPassword.Text.Trim().Length < 6 || etPassword.Text.Trim().Length > 13) + { + new Tip() + { + CloseTime = 1, + Direction = AMPopTipDirection.None, + Text = Language.StringByID(StringId.PasswordIsUnqualified) + }.Show(bodyView); + } + else + { + LoadMothed_EnableResetButton(); + } + } + }; + + //纭瀵嗙爜鏂囨湰妗嗙劍鐐瑰彉鍖栦簨浠� + etRepeatPassword.FoucsChanged += (sender, e) => + { + if (etRepeatPassword.Foucs) + { + + } + else + { + //鏍¢獙涓ゆ杈撳叆鐨勫瘑鐮佹槸鍚︿竴鑷� + if (etPassword.Text.Trim() != etRepeatPassword.Text.Trim()) + { + new Tip() + { + CloseTime = 1, + Direction = AMPopTipDirection.None, + Text = Language.StringByID(StringId.IncorrectRepeatPassword) + }.Show(bodyView); + } + else + { + LoadMothed_EnableResetButton(); + } + } + }; + + } + + /// <summary> + /// 浣胯兘淇敼纭畾鎸夐挳 + /// </summary> + void LoadMothed_EnableResetButton() + { + if (!string.IsNullOrEmpty(etPassword.Text) && (etPassword.Text.Trim() == etRepeatPassword.Text.Trim())) + { + btnReset.IsSelected = true; } else { - string erorrInfo = ""; - switch (resetResult.StateCode) - { - case "PwdNoConfirm"://涓ゆ杈撳叆鐨勫瘑鐮佷笉涓�鑷� - erorrInfo = Language.StringByID(StringId.IncorrectRepeatPassword); - break; - case "AccountNoExists"://涓ゆ杈撳叆鐨勫瘑鐮佷笉涓�鑷� - erorrInfo = Language.StringByID(StringId.AccountNotExist); - break; - default: - erorrInfo = "Server error"; - break; - } - Application.RunOnMainThread(() => - { - waitPage.Hide(); - new Tip() - { - CloseTime = 1, - Direction = AMPopTipDirection.None, - Text = erorrInfo, - }.Show(bodyView); - }); + btnReset.IsSelected = false; } } } -- Gitblit v1.8.0