From ed3bfb7462d44747230437717e8673a5192f833f Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 30 十一月 2020 20:34:51 +0800
Subject: [PATCH] 2020-11-30-2

---
 HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/VerificationCodePage.cs |  182 +++++++++++++++++----------------------------
 1 files changed, 70 insertions(+), 112 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindVerificationCodePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/VerificationCodePage.cs
similarity index 85%
rename from HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindVerificationCodePage.cs
rename to HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/VerificationCodePage.cs
index b599c70..858578d 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindVerificationCodePage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/VerificationCodePage.cs
@@ -2,14 +2,10 @@
 using Shared;
 using HDL_ON.UI.CSS;
 using System.Threading;
-using HDL_ON.DAL.Server;
 
 namespace HDL_ON.UI
 {
-    /// <summary>
-    /// 淇敼缁戝畾鎴栬�呰В缁�--楠岃瘉鐮侀獙璇侀〉闈�
-    /// </summary>
-    public partial class ChangeBindVerificationCodePage : FrameLayout
+    public partial class VerificationCodePage :FrameLayout
     {
         FrameLayout bodyView;
 
@@ -32,21 +28,10 @@
         Button btnNum6Line;
 
         EditText et;
-        /// <summary>
-        /// 
-        /// </summary>
+
         Button btnResend;
-        /// <summary>
-        /// 
-        /// </summary>
-        Button btnTip;
-        /// <summary>
-        /// 
-        /// </summary>
+
         Action<string> action;
-        /// <summary>
-        /// 
-        /// </summary>
         int titleId;
 
         /// <summary>
@@ -57,15 +42,7 @@
         /// 鍊掕鏃舵椂闂�
         /// </summary>
         int time = 0;
-        /// <summary>
-        /// 鏄惁涓鸿В缁戦獙璇�
-        /// </summary>
-        public bool IsUnbind;
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public ChangeBindVerificationCodePage()
+        public VerificationCodePage()
         {
             bodyView = this;
         }
@@ -76,21 +53,19 @@
         /// <param name="tId">椤甸潰鏍囬</param>
         /// <param name="ot">鎿嶄綔绫诲瀷1:閭锛�2:鎵嬫満</param>
         /// <param name="time">鍊掕鏃舵椂闂�</param>
-        public void LoadPage(Action<string> act, int tId, int ot, int t)
+        public void LoadPage(Action<string> act,int tId,int ot,int t)
         {
             action = act;
             titleId = tId;
             bodyView.BackgroundColor = CSS_Color.BackgroundColor;
             optionType = ot;
             time = t;
-            Action backAction = () =>
-            {
+            Action backAction = () => {
                 Application.HideSoftInput();
-                BackConfirmAction();
             };
-            new TopViewDiv(bodyView, Language.StringByID(tId), false).LoadTopView(backAction);
+            new TopViewDiv(bodyView, Language.StringByID(tId)).LoadTopView(backAction);
 
-            btnTip = new Button()
+            Button btnTip = new Button()
             {
                 Y = Application.GetRealHeight(64),
                 Height = Application.GetRealHeight(84),
@@ -262,7 +237,7 @@
                 Y = Application.GetRealHeight(276),
                 Gravity = Gravity.CenterHorizontal,
                 Width = Application.GetRealWidth(220),
-                Height = Application.GetRealWidth(44),
+                Height = Application.GetRealHeight(44),
                 SelectedBackgroundColor = CSS_Color.MainColor,
                 BackgroundColor = CSS_Color.PromptingColor1,
                 TextAlignment = TextAlignment.Center,
@@ -284,15 +259,14 @@
 
 
     //---------------------------------------------
-    public partial class ChangeBindVerificationCodePage
+    public partial class VerificationCodePage
     {
         /// <summary>
         /// 楠岃瘉鐮佽緭鍏ュ彉鍖栦簨浠�
         /// </summary>
         void LoadEvent_VerificationEntryEvent()
         {
-            EventHandler<MouseEventArgs> clickEvent = (sender, e) =>
-            {
+            EventHandler<MouseEventArgs> clickEvent = (sender, e) => {
                 et.Foucs = true;
                 var etCode = et.Text;
                 switch (etCode.Length)
@@ -390,8 +364,7 @@
             btnNum5.MouseUpEventHandler = clickEvent;
             btnNum6.MouseUpEventHandler = clickEvent;
 
-            et.TextChangeEventHandler = (sender, e) =>
-            {
+            et.TextChangeEventHandler = (sender, e) => {
                 var etCode = et.Text;
                 switch (etCode.Length)
                 {
@@ -516,17 +489,36 @@
                             {
                                 act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait));
                             });
-                            var verAccount = optionType == 1 ? UserInfo.Current.userEmailInfo : UserInfo.Current.userMobileInfo;
-                            var isPhone = optionType == 2;
-                            var resultObj = new HttpServerRequest().ValidatorCode(VerifyType.SENSITIVE_DATA, verAccount, etCode, isPhone);
-                            if (resultObj.Code == StateCode.SUCCESS)
+                            var verAccount = optionType == 1 ? MainPage.LoginUser.userEmailInfo : MainPage.LoginUser.userMobileInfo;
+                            var response = new DAL.Server.HttpServerRequest().ValidatorCode(verAccount, etCode, MainPage.LoginUser.areaCode);
+                            if (response.StateCode.ToUpper() == "SUCCESS")
                             {
                                 result = true;
                             }
                             else
                             {
-                                //澶辫触鎻愮ず
-                                IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code);
+                                string erorrInfo = "";
+                                switch (response.StateCode)
+                                {
+                                    case "ValidCodeAndPhoneNoEqual"://楠岃瘉鐮侀敊璇�
+                                        erorrInfo = Language.StringByID(StringId.VerificationCodeWrong);
+                                        break;
+                                    case "NoRecord":
+                                        erorrInfo = Language.StringByID(StringId.PlsGetTheVerificationCode);
+                                        break;
+                                    default:
+                                        erorrInfo = "Server error";
+                                        break;
+                                }
+                                Application.RunOnMainThread(() =>
+                                {
+                                    new Tip()
+                                    {
+                                        CloseTime = 1,
+                                        Direction = AMPopTipDirection.None,
+                                        Text = erorrInfo,
+                                    }.Show(bodyView);
+                                });
                             }
                             Application.RunOnMainThread(() =>
                             {
@@ -543,16 +535,6 @@
                                 {
                                     MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
                                     //MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1);
-                                    //if (isUnbind)
-                                    //{
-                                    //    //褰撳墠涓鸿В缁戦獙璇�
-
-                                    //}
-                                    //else
-                                    //{
-
-                                    //}
-
                                     if (titleId == StringId.ModifyBindingEmail)
                                     {
                                         LoadEvent_SkipBindAccountInfoPage(StringId.BindEmail);
@@ -566,12 +548,12 @@
                                         var account = "";
                                         new Thread(() =>
                                         {
-                                            var result2 = new DAL.Server.HttpServerRequest().UnBindAccount(false);
-                                            if (result2 == StateCode.SUCCESS)
+                                            var result2 = new DAL.Server.HttpServerRequest().BindAccount(account);
+                                            if (result2 == "SUCCESS")
                                             {
                                                 Application.RunOnMainThread(() =>
                                                 {
-                                                    UserInfo.Current.userEmailInfo = account;
+                                                    MainPage.LoginUser.userEmailInfo = account;
                                                     var page = new OperationResultDisPalyPage();
                                                     page.Show();
                                                     page.LoadPage(true, Language.StringByID(StringId.UnbindEmail), Language.StringByID(StringId.UnbindEmailSuccess), "");
@@ -585,8 +567,15 @@
                                             }
                                             else
                                             {
-                                                //澶辫触鎻愮ず
-                                                IMessageCommon.Current.ShowErrorInfoAlter(result2);
+                                                Application.RunOnMainThread(() =>
+                                                {
+                                                    new Tip()
+                                                    {
+                                                        CloseTime = 1,
+                                                        Direction = AMPopTipDirection.None,
+                                                        Text = Language.StringByID(StringId.OperationFailed),
+                                                    }.Show(bodyView);
+                                                });
                                             }
                                         })
                                         { IsBackground = true }.Start();
@@ -596,12 +585,12 @@
                                         var account = "";
                                         new Thread(() =>
                                         {
-                                            var result2 = new DAL.Server.HttpServerRequest().UnBindAccount(true);
-                                            if (result2 == StateCode.SUCCESS)
+                                            var result2 = new DAL.Server.HttpServerRequest().BindAccount(account);
+                                            if (result2 == "SUCCESS")
                                             {
                                                 Application.RunOnMainThread(() =>
                                                 {
-                                                    UserInfo.Current.userMobileInfo = account;
+                                                    MainPage.LoginUser.userEmailInfo = account;
                                                     var page = new OperationResultDisPalyPage();
                                                     page.Show();
                                                     page.LoadPage(true, Language.StringByID(StringId.UnbindPhone), Language.StringByID(StringId.UnbindPhoneSuccess), "");
@@ -615,8 +604,15 @@
                                             }
                                             else
                                             {
-                                                //澶辫触鎻愮ず
-                                                IMessageCommon.Current.ShowErrorInfoAlter(result2);
+                                                Application.RunOnMainThread(() =>
+                                                {
+                                                    new Tip()
+                                                    {
+                                                        CloseTime = 1,
+                                                        Direction = AMPopTipDirection.None,
+                                                        Text = Language.StringByID(StringId.OperationFailed),
+                                                    }.Show(bodyView);
+                                                });
                                             }
                                         })
                                         { IsBackground = true }.Start();
@@ -643,15 +639,13 @@
                 time = 60;
                 new Thread(() =>
                 {
-                    //1.鑾峰彇楠岃瘉鐮�,閲囩敤鏁忔劅鏁版嵁楠岃瘉
-                    ResponsePackNew resultObj;
-                    if (optionType == 1)//閭
+                    if (optionType == 1)
                     {
-                        resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.SENSITIVE_DATA, UserInfo.Current.userEmailInfo);
+                        var result = new DAL.Server.HttpServerRequest().GetLoginVerCode(MainPage.LoginUser.userEmailInfo);
                     }
-                    else
+                    else if (optionType == 2)
                     {
-                        resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.SENSITIVE_DATA, UserInfo.Current.userMobileInfo, true, UserInfo.Current.areaCode);
+                        var result = new DAL.Server.HttpServerRequest().GetLoginVerCode(MainPage.LoginUser.userMobileInfo);
                     }
                 })
                 { IsBackground = true }.Start();
@@ -681,55 +675,19 @@
         /// </summary>
         void LoadEvent_Resend()
         {
-            btnResend.MouseUpEventHandler = (sender, e) =>
-            {
+            btnResend.MouseUpEventHandler = (sender, e) => {
                 LoadThread_SendVerCode();
             };
         }
         /// <summary>
-        /// 璺宠浆鏂扮粦瀹氳处鍙蜂俊鎭簨浠�
+        /// 璺宠浆缁戝畾璐﹀彿淇℃伅浜嬩欢
         /// </summary>
         void LoadEvent_SkipBindAccountInfoPage(int skipTid)
         {
-            //var vcp = new BindAccountPage();
-            //MainPage.BasePageView.AddChidren(vcp);
-            //vcp.LoadPage(action, skipTid);
-            //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-
-            //鏄惁涓烘崲缁戞墜鏈�
-            var isPhone = optionType == 2;
-            //璺宠浆鏂扮粦瀹氶〉闈�
-            var aep = new NewBindAccountPage();
-            MainPage.BasePageView.AddChidren(aep);
-            aep.LoadPage(action, isPhone, true);
+            var vcp = new BindAccountPage();
+            MainPage.BasePageView.AddChidren(vcp);
+            vcp.LoadPage(action,skipTid);
             MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-        }
-
-        /// <summary>
-        /// 杩斿洖浜屾纭浜嬩欢
-        /// </summary>
-        void BackConfirmAction()
-        {
-            //楠岃瘉鐮佸彂閫佹垚鍔燂紝浜屾纭閫�鍑�
-            if (btnTip.TextID == StringId.VerificationCodePrompt)
-            {
-                Action cancelAction = () =>
-                {
-                    if (bodyView != null)
-                    {
-                        bodyView.RemoveFromParent();
-                    }
-                };
-                new ConfirmDialog().ShowDialog(StringId.Tip, StringId.VerificationCodeMayBeDelayed, null, cancelAction, StringId.ReturnStr, StringId.WaitAMoment);
-            }
-            else
-            {
-                //鐩存帴鍏抽棴
-                if (bodyView != null)
-                {
-                    bodyView.RemoveFromParent();
-                }
-            }
         }
     }
 }

--
Gitblit v1.8.0