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/ForgetPasswordPageBLL.cs |  226 ++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 171 insertions(+), 55 deletions(-)

diff --git a/HDL_ON/UI/UI1-Login/ForgetPasswordPageBLL.cs b/HDL_ON/UI/UI1-Login/ForgetPasswordPageBLL.cs
index 237a1e9..509ce4c 100644
--- a/HDL_ON/UI/UI1-Login/ForgetPasswordPageBLL.cs
+++ b/HDL_ON/UI/UI1-Login/ForgetPasswordPageBLL.cs
@@ -78,7 +78,7 @@
         {
             etAccount.TextChangeEventHandler += (sender, e) =>
             {
-                Regex reg = new Regex(@"^[1]+\d{9}");
+                Regex reg = new Regex(@"^[1]+\d{10}");
                 var mFalg = reg.Match(etAccount.Text.Trim());
                 if (!mFalg.Success || (btnGlobalRoaming.Text == "+86" && etAccount.Text.Trim().Length != 11))
                 {
@@ -86,7 +86,10 @@
                 }
                 else
                 {
-                    btnGetVerificationCode.IsSelected = true;
+                    if (btnGetVerificationCode.Text == Language.StringByID(StringId.GetVerificationCode))
+                    {
+                        btnGetVerificationCode.IsSelected = true;
+                    }
                 }
             };
         }
@@ -128,7 +131,10 @@
                         }
                         else
                         {
-                            btnGetVerificationCode.IsSelected = true;
+                            if (btnGetVerificationCode.Text == Language.StringByID( StringId.GetVerificationCode))
+                            {
+                                btnGetVerificationCode.IsSelected = true;
+                            }
                             LoadMothed_EnableResetButton();
                         }
                     }
@@ -137,7 +143,7 @@
                         //閭鏂瑰紡-楠岃瘉閭鏄惁姝g‘
                         var reg = new Regex("^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$");
                         var mFalg = reg.Match(etAccount.Text.Trim());
-                        if (!mFalg.Success || (btnGlobalRoaming.Text == "+86" && etAccount.Text.Trim().Length != 11))
+                        if (!mFalg.Success )
                         {
                             btnAccountViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2;
                             btnAccountViewBottomLine.Height = Application.GetRealHeight(2);
@@ -150,7 +156,10 @@
                         }
                         else
                         {
-                            btnGetVerificationCode.IsSelected = true;
+                            if (btnGetVerificationCode.Text == Language.StringByID(StringId.GetVerificationCode))
+                            {
+                                btnGetVerificationCode.IsSelected = true;
+                            }
                             LoadMothed_EnableResetButton();
                         }
                     }
@@ -170,13 +179,13 @@
                     btnPasswordViewBottomLine.BackgroundColor = CSS_Color.DividingLineColor;
                     btnPasswordViewBottomLine.Height = Application.GetRealHeight(1);
                     //鏍¢獙瀵嗙爜鏄惁绗﹀悎瑕佹眰
-                    if (etPassword.Text.Trim().Length < 6)
+                    if (etPassword.Text.Trim().Length < 6 || etPassword.Text.Trim().Length > 13)
                     {
                         new Tip()
                         {
                             CloseTime = 3,
                             Direction = AMPopTipDirection.None,
-                            Text = Language.StringByID(StringId.IncorrectRepeatPassword)
+                            Text = Language.StringByID(StringId.PasswordIsUnqualified)
                         }.Show(bodyView);
                     }
                 }
@@ -260,59 +269,68 @@
         {
             btnGetVerificationCode.MouseUpEventHandler += (sender, e) =>
             {
+                var account = etAccount.Text.Trim();
                 if (btnGetVerificationCode.IsSelected)
                 {
+                    //鐭俊鍙戦�侀棿闅�60s
+                    btnGetVerificationCode.IsSelected = false;
+                    etVerificationCode.Foucs = true;
                     //鑾峰彇楠岃瘉鐮�
-                    var result = pm.SendSms(etAccount.Text.Trim());
-                    if (result.StateCode == "Success")
-                    {
-                        //鐭俊鍙戦�侀棿闅�60s
-                        btnGetVerificationCode.IsSelected = false;
-                        etVerificationCode.Foucs = true;
                         int time = 60;
-                        new Thread(() =>
+                    new Thread(() => {
+                        while (time > 0)
                         {
-                            while (time > 0)
-                            {
-                                time--;
-                                Application.RunOnMainThread(() =>
-                                {
-                                    btnGetVerificationCode.Text = time.ToString() + "s";
-                                });
-                                Thread.Sleep(1000);
-                            }
+                            time--;
                             Application.RunOnMainThread(() =>
                             {
-                                //鍥炲鑾峰彇鐭俊鎸夐挳浜嬩欢
-                                btnGetVerificationCode.IsSelected = true;
-                                btnGetVerificationCode.TextID = StringId.GetVerificationCode;
+                                btnGetVerificationCode.Text = time.ToString() + "s";
                             });
-                        })
-                        { IsBackground = true }.Start();
-                    }
-                    else
-                    {
-                        string tipString = "Server error";
-                        switch (result.StateCode)
-                        {
-                            case "Exist":
-                                tipString = Language.StringByID(StringId.AccountAlreadyExists);
-                                break;
-                            case "SendFail":
-                                tipString = Language.StringByID(StringId.FailedToSendVerificationCode);
-                                break;
-                            case "Self:Net_Error":
-                                tipString = Language.StringByID(StringId.NetworkAnomaly);
-                                break;
+                            Thread.Sleep(1000);
                         }
-
-                        new Tip()
+                        Application.RunOnMainThread(() =>
                         {
-                            CloseTime = 3,
-                            Direction = AMPopTipDirection.None,
-                            Text = tipString
-                        }.Show(bodyView);
-                    }
+                            //鍥炲鑾峰彇鐭俊鎸夐挳浜嬩欢
+                            btnGetVerificationCode.IsSelected = true;
+                            btnGetVerificationCode.TextID = StringId.GetVerificationCode;
+                        });
+                    }){ IsBackground = true}.Start();
+                    new Thread(() =>
+                    {
+                        var result = pm.SendSms(account);
+                        if (result.StateCode.ToUpper() == "SUCCESS")
+                        {
+                        }
+                        else
+                        {
+                            string tipString = "Server error";
+                            switch (result.StateCode)
+                            {
+                                case "Exist":
+                                    tipString = Language.StringByID(StringId.AccountAlreadyExists);
+                                    break;
+                                case "SendFail":
+                                    tipString = Language.StringByID(StringId.FailedToSendVerificationCode);
+                                    break;
+                                case "AccountNoExists":
+                                    tipString = Language.StringByID(StringId.AccountNotExist);
+                                    break;
+                                case "Self:Net_Error":
+                                    tipString = Language.StringByID(StringId.NetworkAnomaly);
+                                    break;
+                            }
+
+                            Application.RunOnMainThread(() =>
+                            {
+                                new Tip()
+                                {
+                                    CloseTime = 3,
+                                    Direction = AMPopTipDirection.None,
+                                    Text = tipString
+                                }.Show(bodyView);
+                            });
+                        }
+                    })
+                    { IsBackground = true }.Start();
                 }
             };
         }
@@ -329,7 +347,7 @@
                     //鍒涘缓淇敼瀵嗙爜绾跨▼
                     var loginThread = LoadMothed_ResetThread();
                     waitPage = new Loading();
-                    new WaitPageMothed().LoadPage_WaitPage(loginThread, bodyView, waitPage);
+                    new PublicAssmebly().LoadPage_WaitPage(loginThread, bodyView, waitPage);
                 }
             };
         }
@@ -353,15 +371,15 @@
             return new Thread(() =>
             {
                 var verResult = pm.ValidatorCode(account, verCode, countryIndex);
-                if (verResult.StateCode == "Success")
+                if (verResult.StateCode.ToUpper() == "SUCCESS")
                 {
                     var resetResult = pm.ResetPassword(account, password, repeatPassword, countryIndex);
-                    if (resetResult.StateCode == "Success")
+                    if (resetResult.StateCode.ToUpper() == "SUCCESS")
                     {
                         Application.RunOnMainThread(() =>
                         {
-                            waitPage.Hide();
-                            this.Close();
+                            LoadEvent_AutoLogin();
+
                             callbackAction?.Invoke(account);
                         });
                     }
@@ -399,6 +417,19 @@
                     {
                         case "ValidCodeAndPhoneNoEqual"://楠岃瘉鐮侀敊璇�
                             erorrInfo = Language.StringByID(StringId.VerificationCodeWrong);
+                            Application.RunOnMainThread(() =>
+                            {
+                                btnVerificationCodeViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2;
+                                btnVerificationCodeViewBottomLine.Height = Application.GetRealHeight(2);
+                            });
+                            break;
+                        case "NoRecord":
+                            erorrInfo = Language.StringByID(StringId.PlsGetTheVerificationCode);
+                            Application.RunOnMainThread(() =>
+                            {
+                                btnVerificationCodeViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2;
+                                btnVerificationCodeViewBottomLine.Height = Application.GetRealHeight(2);
+                            });
                             break;
                         default:
                             erorrInfo = "Server error";
@@ -433,5 +464,90 @@
             }
         }
 
+        /// <summary>
+        /// 浣忓畢鎴愬姛涔嬪悗鑷姩鐧诲綍
+        /// </summary>
+        void LoadEvent_AutoLogin()
+        {
+            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 = "s鏄敓鐢熶笘涓�",
+            };
+            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.PasswordChangeSuccessfully,
+            };
+            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(() =>
+                {
+                    dialog.Close();
+                    this.Close();
+                });
+            })
+            { IsBackground = true }.Start();
+        }
+
+
     }
 }

--
Gitblit v1.8.0