From e08a444a9d7acea0cf39f50d22d29179f6a59292 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 01 十二月 2020 09:37:11 +0800
Subject: [PATCH] 2020-12-1

---
 HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs |  155 ++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 108 insertions(+), 47 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs
index 8588606..1faeae0 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs
@@ -2,17 +2,46 @@
 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>
+        Button btnTitle;
+        /// <summary>
+        /// 
+        /// </summary>
+        Button btnContent;
+
+        /// <summary>
+        /// 
+        /// </summary>
         Action<string> action;
+
         /// <summary>
         /// 鎿嶄綔鐩爣绫诲瀷 1:閭锛�2:鎵嬫満
         /// </summary>
         int optionType;
+        /// <summary>
+        /// 鏄惁涓鸿В缁戦獙璇�
+        /// </summary>
+        public bool IsUnbind;
+      
+
+        /// <summary>
+        /// ChangeBindAccountPage
+        /// </summary>
         public ChangeBindAccountPage()
         {
             bodyView = this;
@@ -24,18 +53,18 @@
         /// <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)
         {
             action = act;
             optionType = opt;
             string account;
             if (optionType == 0)
             {
-                account = MainPage.LoginUser.userEmailInfo;
+                account =  UserInfo.Current.userEmailInfo;
             }
             else
             {
-                account = MainPage.LoginUser.userMobileInfo;
+                account =  UserInfo.Current.userMobileInfo;
             }
             bodyView.BackgroundColor = CSS_Color.BackgroundColor;
             new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView();
@@ -48,24 +77,24 @@
             };
             bodyView.AddChidren(rowView);
 
-            Button btnTitle = new Button()
+            btnTitle = new Button()
             {
                 X = Application.GetRealWidth(16),
                 Width = Application.GetRealWidth(180),
                 TextColor = CSS_Color.FirstLevelTitleColor,
                 TextSize = CSS_FontSize.SubheadingFontSize,
                 TextAlignment = TextAlignment.CenterLeft,
-                TextID = contentTitleId,
+                //TextID = contentTitleId,
             };
             rowView.AddChidren(btnTitle);
 
-            Button btnContent = new Button()
+            btnContent = new Button()
             {
                 Width = Application.GetRealWidth(359),
                 TextColor = CSS_Color.PromptingColor1,
                 TextSize = CSS_FontSize.TextFontSize,
                 TextAlignment = TextAlignment.CenterRight,
-                Text = optionType == 1 ? MainPage.LoginUser.userEmailInfo : MainPage.LoginUser.userMobileInfo,
+                //Text = optionType == 1 ?  UserInfo.Current.userEmailInfo :  UserInfo.Current.userMobileInfo,
             };
             rowView.AddChidren(btnContent);
 
@@ -74,7 +103,7 @@
                 Y = Application.GetRealHeight(213),
                 Gravity = Gravity.CenterHorizontal,
                 Width = Application.GetRealWidth(220),
-                Height = Application.GetRealHeight(44),
+                Height = Application.GetRealWidth(44),
                 BackgroundColor = CSS_Color.MainColor,
                 TextAlignment = TextAlignment.Center,
                 TextColor = CSS_Color.MainBackgroundColor,
@@ -87,7 +116,10 @@
             };
             bodyView.AddChidren(btnChangeBind);
 
-            if (!string.IsNullOrEmpty(MainPage.LoginUser.userMobileInfo))
+
+
+            //鍚屾椂缁戝畾閭鎴栬�呮墜鏈烘墠鏄剧ず"鏇存崲楠岃瘉鏂瑰紡"
+            if (!string.IsNullOrEmpty( UserInfo.Current.userMobileInfo) && !string.IsNullOrEmpty( UserInfo.Current.userEmailInfo))
             {
                 Button btnChangeGetVer = new Button()
                 {
@@ -105,7 +137,27 @@
                 LoadEvent_ChangeVerificationMethod(btnChangeGetVer, btnTitle, btnContent);
             }
 
+            SetContentTitleId();
             LoadEvent_GetVerification(btnChangeBind, titleId);
+        }
+
+        /// <summary>
+        /// 璁剧疆鎸夐挳鎻愮ず鏂囧瓧
+        /// 淇敼缁戝畾鏃舵彁绀猴細鎵嬫満楠岃瘉銆侀偖绠遍獙璇�
+        /// 瑙g粦鏃舵彁绀猴細褰撳墠鎵嬫満鎵嬫満鍙风爜銆佸綋鍓嶉偖绠卞湴鍧�
+        /// </summary>
+        void SetContentTitleId()
+        {
+            if (optionType == 2)
+            {
+                btnTitle.TextID = IsUnbind ? StringId.CurPhone : StringId.PhoneNumberVerification;
+                btnContent.Text =  UserInfo.Current.userMobileInfo;
+            }
+            else
+            {
+                btnTitle.TextID = IsUnbind ? StringId.CurrentEmail : StringId.EmailVerification;
+                btnContent.Text =  UserInfo.Current.userEmailInfo;
+            }
         }
     }
 
@@ -120,16 +172,7 @@
             btn.MouseUpEventHandler = (sender, e) =>
             {
                 optionType = optionType == 1 ? 2 : 1;
-                if (optionType == 2)
-                {
-                    btnTitle.TextID = StringId.CurPhone;
-                    btnContent.Text = MainPage.LoginUser.userMobileInfo;
-                }
-                else
-                {
-                    btnTitle.TextID = StringId.CurrentEmail;
-                    btnContent.Text = MainPage.LoginUser.userEmailInfo;
-                }
+                SetContentTitleId();
             };
         }
 
@@ -145,46 +188,64 @@
                 {
                     new Thread(() =>
                     {
-                        if (optionType == 1)
+                        //1.鑾峰彇楠岃瘉鐮�,閲囩敤鏁忔劅鏁版嵁楠岃瘉
+                        ResponsePackNew resultObj;
+                        if (optionType == 1)//閭
                         {
-                            var result = new DAL.Server.HttpServerRequest().GetLoginVerCode(MainPage.LoginUser.userEmailInfo);
+                            resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.SENSITIVE_DATA,  UserInfo.Current.userEmailInfo);
                         }
-                        else if (optionType == 2)
+                        else
                         {
-                            var result = new DAL.Server.HttpServerRequest().GetLoginVerCode(MainPage.LoginUser.userMobileInfo);
+                            resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.SENSITIVE_DATA,  UserInfo.Current.userMobileInfo, true,  UserInfo.Current.areaCode);
                         }
-                    })
-                    { IsBackground = true }.Start();
-                }
-                if (time == 0)
-                {
-                    time = 60;
-                    new Thread(() =>
-                    {
-                        while (time > 0)
+
+                        if (resultObj.Code != StateCode.SUCCESS)
                         {
-                            time--;
+                            // 鎻愮ず閿欒
+                            IMessageCommon.Current.ShowErrorInfoAlter(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.Text = time.ToString() + "s";
+                                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;
                             });
-                            Thread.Sleep(1000);
                         }
-                        Application.RunOnMainThread(() =>
-                        {
-                            button.IsSelected = true;
-                            button.TextID = StringId.GetVerificationCode;
-                            button.BackgroundColor = CSS_Color.MainColor;
-                            time = 0;
-                        });
+
                     })
                     { IsBackground = true }.Start();
                 }
-                button.BackgroundColor = CSS_Color.PromptingColor1;
-                var vcp = new VerificationCodePage();
-                MainPage.BasePageView.AddChidren(vcp);
-                vcp.LoadPage(action, titleId, optionType, time);
-                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+
+
             };
         }
     }

--
Gitblit v1.8.0