From 7153e420d66bce0a06b7e972ac3a5c34197fa2e5 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 18 十一月 2020 20:02:13 +0800
Subject: [PATCH] 2020-11-18 1.修改完善手机绑定和解绑。

---
 HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs |  131 ++++++++++++++++++++++++++++++++-----------
 1 files changed, 96 insertions(+), 35 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs
index f858c03..5f4c407 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs
@@ -1,17 +1,36 @@
 锘縰sing System;
 using Shared;
 using HDL_ON.UI.CSS;
+using System.Threading;
+using HDL_ON.DAL.Server;
 
 namespace HDL_ON.UI
 {
+    /// <summary>
+    /// 淇敼缁戝畾鎴栬�呰В缁�--鍙戦�侀獙璇佺爜椤甸潰
+    /// </summary>
     public partial class ChangeBindAccountPage : FrameLayout
     {
+        /// <summary>
+        /// 
+        /// </summary>
         FrameLayout bodyView;
+        /// <summary>
+        /// 
+        /// </summary>
         Action<string> action;
         /// <summary>
         /// 鎿嶄綔鐩爣绫诲瀷 1:閭锛�2:鎵嬫満
         /// </summary>
         int optionType;
+        /// <summary>
+        /// 鏄惁涓鸿В缁戦獙璇�
+        /// </summary>
+        public bool isUnbind;
+
+        /// <summary>
+        /// ChangeBindAccountPage
+        /// </summary>
         public ChangeBindAccountPage()
         {
             bodyView = this;
@@ -23,10 +42,19 @@
         /// <param name="optionType">鎿嶄綔鐩爣绫诲瀷 1:閭锛�2:鎵嬫満</param>
         /// <param name="titleId"></param>
         /// <param name="contentTitleId"></param>
-        public void LoadPage(Action<string> act,int opt,int titleId,int contentTitleId)
+        public void LoadPage(Action<string> act, int opt, int titleId, int contentTitleId)
         {
             action = act;
             optionType = opt;
+            string account;
+            if (optionType == 0)
+            {
+                account = MainPage.LoginUser.userEmailInfo;
+            }
+            else
+            {
+                account = MainPage.LoginUser.userMobileInfo;
+            }
             bodyView.BackgroundColor = CSS_Color.BackgroundColor;
             new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView();
 
@@ -77,7 +105,8 @@
             };
             bodyView.AddChidren(btnChangeBind);
 
-            if (!string.IsNullOrEmpty(MainPage.LoginUser.userMobileInfo))
+            //鍚屾椂缁戝畾閭鎴栬�呮墜鏈烘墠鏄剧ず"鏇存崲楠岃瘉鏂瑰紡"
+            if (!string.IsNullOrEmpty(MainPage.LoginUser.userMobileInfo) && !string.IsNullOrEmpty(MainPage.LoginUser.userEmailInfo))
             {
                 Button btnChangeGetVer = new Button()
                 {
@@ -92,10 +121,11 @@
                 };
                 bodyView.AddChidren(btnChangeGetVer);
 
-                LoadEvent_ChangeVerificationMethod(btnChangeGetVer,btnTitle, btnContent);
+                LoadEvent_ChangeVerificationMethod(btnChangeGetVer, btnTitle, btnContent);
             }
 
-            LoadEvent_GetVerification(btnChangeBind,titleId);
+
+            LoadEvent_GetVerification(btnChangeBind, titleId);
         }
     }
 
@@ -123,45 +153,76 @@
             };
         }
 
+        int time = 0;
         /// <summary>
         /// 鐐瑰嚮鑾峰彇楠岃瘉鐮�
         /// </summary>
-        void LoadEvent_GetVerification(Button button,int titleId)
+        void LoadEvent_GetVerification(Button button, int titleId)
         {
             button.MouseUpEventHandler = (sender, e) =>
             {
-                new System.Threading.Thread(() =>
+                if (button.Text == Language.StringByID(StringId.GetVerificationCode))
                 {
-                    if (optionType == 1)
+                    new Thread(() =>
                     {
-                        var result = new DAL.Server.HttpServerRequest().GetLoginVerCode(MainPage.LoginUser.userEmailInfo);
-                    }
-                    else if (optionType == 2)
-                    {
-                        var result = new DAL.Server.HttpServerRequest().GetLoginVerCode(MainPage.LoginUser.userMobileInfo);
-                    }
-                })
-                { IsBackground = true }.Start();
-                var vcp = new VerificationCodePage();
-                MainPage.BasePageView.AddChidren(vcp);
-                //if (titleId == StringId.ModifyBindingEmail)
-                //{
-                //    vcp.LoadPage(action, StringId.ModifyBindingEmail);
-                //}
-                //else if (titleId == StringId.UnbindEmail)
-                //{
-                //    vcp.LoadPage(action, StringId.UnbindEmail);
-                //}
-                //else if(titleId == StringId.ModifyBindingPhone)
-                //{
-                //    vcp.LoadPage(action, StringId.ModifyBindingPhone);
-                //}
-                //else if(titleId == StringId.UnbindPhone)
-                //{
-                //}
-                vcp.LoadPage(action, titleId,optionType);
-                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                        //1.鑾峰彇楠岃瘉鐮�,閲囩敤鏁忔劅鏁版嵁楠岃瘉
+                        ResponsePackNew resultObj;
+                        if (optionType == 1)//閭
+                        {
+                            resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.SENSITIVE_DATA, MainPage.LoginUser.userEmailInfo);
+                        }
+                        else
+                        {
+                            resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.SENSITIVE_DATA, MainPage.LoginUser.userMobileInfo, true, MainPage.LoginUser.areaCode);
+                        }
+
+                        if (resultObj.Code != StateCode.SUCCESS)
+                        {
+                            // 鎻愮ず閿欒
+                            IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Verification_Send, resultObj.Code);
+                        }
+                        else
+                        {
+                            if (time == 0)
+                            {
+                                time = 60;
+                                new Thread(() =>
+                                {
+                                    while (time > 0)
+                                    {
+                                        time--;
+                                        Application.RunOnMainThread(() =>
+                                        {
+                                            button.Text = time.ToString() + "s";
+                                        });
+                                        Thread.Sleep(1000);
+                                    }
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        button.IsSelected = true;
+                                        button.TextID = StringId.GetVerificationCode;
+                                        button.BackgroundColor = CSS_Color.MainColor;
+                                        time = 0;
+                                    });
+                                })
+                                { IsBackground = true }.Start();
+                            }
+                            Application.RunOnMainThread(() =>
+                            {
+                                button.BackgroundColor = CSS_Color.PromptingColor1;
+                                var vcp = new ChangeBindVerificationCodePage();
+                                vcp.isUnbind = isUnbind;
+                                MainPage.BasePageView.AddChidren(vcp);
+                                vcp.LoadPage(action, titleId, optionType, time);
+                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                            });
+                        }
+
+                    }) { IsBackground = true }.Start();
+                }
+
+               
             };
         }
     }
-}
+}
\ No newline at end of file

--
Gitblit v1.8.0