wxr
2021-07-01 adc150efb13a0506f45a3c344c3ee2ef2dba8e90
HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindAccountPage.cs
@@ -16,6 +16,10 @@
        FrameLayout bodyView;
        Button btnBind;
        EditText etContent;
        /// <summary>
        ///
        /// </summary>
        Action<string> action;
        /// <summary>
@@ -30,7 +34,6 @@
        /// 是否换绑
        /// </summary>
        bool isModifyBind;
        /// <summary>
        /// 手机区号
        /// </summary>
@@ -57,7 +60,7 @@
            if (isModifyBind)
            {
                //修改绑定
                titleId = isPhone ? StringId.ModifyBindingPhone : StringId.ModifyBindingEmail;
                titleId = isPhone ? StringId.EntryNewPhone : StringId.EntryNewEmail;
            }
            else
            {
@@ -65,20 +68,59 @@
                titleId = isPhone ? StringId.BoundMobileInfo : StringId.BoundEmailInfo;
            }
         
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView();
            if (isPhone)
            {
                AddPhoneFrameLayout();
            }
            else
            {
                AddEmailFrameLayout();
            }
            //点击获取验证码
            LoadEvent_GetVerification(btnBind);
        }
        /// <summary>
        ///
        /// </summary>
        void AddPhoneFrameLayout() {
            #region 如果是手机
            //手机国家区号选择按钮
            ListCellView codeView = new ListCellView() {
                Y = Application.GetRealHeight(64),
            };
            bodyView.AddChidren(codeView);
            //跳转国家区号选择界面
            Action selectAction = () =>
            {
                JLCountrycode.CountryCodeView.Current.Show((countryName, code) => {
                    if (!string.IsNullOrEmpty(code))
                    {
                        phoneZoneCode = code;
                        codeView.BtnSubtitle.Text = "+" + phoneZoneCode;
                    }
                });
            };
            codeView.GoAction = selectAction;
            codeView.BtnTilte.Text = Language.StringByID(StringId.CountryOrRegion);
            codeView.BtnSubtitle.Text = "+" + phoneZoneCode;
            //手机号输入框
            FrameLayout rowView = new FrameLayout()
            {
                Y = Application.GetRealHeight(72),
                Y = codeView.Bottom,
                Height = Application.GetRealHeight(50),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            bodyView.AddChidren(rowView);
            //绑定邮箱或者绑定手机号
            //绑定手机号
            Button btnTitle = new Button()
            {
                X = Application.GetRealWidth(16),
@@ -105,7 +147,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,
@@ -117,11 +159,65 @@
                BorderWidth = 0,
            };
            bodyView.AddChidren(btnBind);
            //点击获取验证码
            LoadEvent_GetVerification(btnBind);
            #endregion
        }
        /// <summary>
        ///
        /// </summary>
        void AddEmailFrameLayout()
        {
            #region 如果是邮箱
            FrameLayout rowView = new FrameLayout()
            {
                Y = Application.GetRealHeight(72),
                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,
                TextID = titleId,
            };
            rowView.AddChidren(btnTitle);
            etContent = new EditText()
            {
                Width = Application.GetRealWidth(359),
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.TextFontSize,
                TextAlignment = TextAlignment.CenterRight,
                Foucs = true
            };
            rowView.AddChidren(etContent);
            btnBind = new Button()
            {
                Y = Application.GetRealHeight(213),
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(220),
                Height = Application.GetRealWidth(44),
                BackgroundColor = CSS_Color.MainColor,
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.MainBackgroundColor,
                TextID = StringId.GetVerificationCode,
                TextSize = CSS_FontSize.SubheadingFontSize,
                IsBold = true,
                Radius = (uint)Application.GetRealWidth(22),
                BorderColor = 0x00000000,
                BorderWidth = 0,
            };
            bodyView.AddChidren(btnBind);
            #endregion
        }
    }
@@ -139,6 +235,32 @@
                {
                    Application.HideSoftInput();
                    var account = etContent.Text.Trim();
                    //如果是换绑检测是否相同帐号
                    if (isModifyBind)
                    {
                        if (isPhone)
                        {
                            if(account == UserInfo.Current.userMobileInfo)
                            {
                                //提示换绑帐号相同
                                Utlis.ShowTip(Language.StringByID(StringId.EntryNewPhone));
                                return;
                            }
                        }
                        else
                        {
                            if (account == UserInfo.Current.userEmailInfo)
                            {
                                //提示换绑帐号相同
                                Utlis.ShowTip(Language.StringByID(StringId.EntryNewEmail));
                                return;
                            }
                        }
                    }
                    #region 正则表达式
                    //1.检测账号是否合法
                    if (!isPhone)
@@ -158,63 +280,82 @@
                        }
                    }
                    #endregion
                    //加载Loading效果
                    var waitPage = new Loading();
                    bodyView.AddChidren(waitPage);
                    waitPage.Start(Language.StringByID(StringId.PleaseWait));
                    int time = 0;
                    //2.检验通过
                    new Thread(() =>
                    {
                        //2.2  获取验证码
                        ResponsePackNew resultObj;
                        if (!isPhone)//邮箱
                        try
                        {
                            resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, account);
                        }
                        else
                        {
                            resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, account, true, phoneZoneCode);
                        }
                        if (resultObj.Code != StateCode.SUCCESS)
                        {
                            // 提示错误
                            IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code);
                        }
                        else
                        {
                            if (time == 0)
                            //2.2  获取验证码
                            ResponsePackNew resultObj;
                            if (!isPhone)//邮箱
                            {
                                time = 60;
                                new Thread(() =>
                                resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, account);
                            }
                            else
                            {
                                resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, account, true, phoneZoneCode);
                            }
                            if (resultObj.Code != StateCode.SUCCESS)
                            {
                                // 提示错误
                                IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code);
                            }
                            else
                            {
                                if (time == 0)
                                {
                                    while (time > 0)
                                    time = 60;
                                    new Thread(() =>
                                    {
                                        time--;
                                        while (time > 0)
                                        {
                                            time--;
                                            Application.RunOnMainThread(() =>
                                            {
                                                button.Text = time.ToString() + "s";
                                            });
                                            Thread.Sleep(1000);
                                        }
                                        Application.RunOnMainThread(() =>
                                        {
                                            button.Text = time.ToString() + "s";
                                            button.IsSelected = true;
                                            button.TextID = StringId.GetVerificationCode;
                                            button.BackgroundColor = CSS_Color.MainColor;
                                            time = 0;
                                        });
                                        Thread.Sleep(1000);
                                    }
                                    Application.RunOnMainThread(() =>
                                    {
                                        button.IsSelected = true;
                                        button.TextID = StringId.GetVerificationCode;
                                        button.BackgroundColor = CSS_Color.MainColor;
                                        time = 0;
                                    });
                                })
                                { IsBackground = true }.Start();
                                    })
                                    { IsBackground = true }.Start();
                                }
                                Application.RunOnMainThread(() =>
                                {
                                    button.BackgroundColor = CSS_Color.PromptingColor1;
                                    var vcp = new NewBindVerificationCodePage();
                                    vcp.PhoneZoneCode = phoneZoneCode;
                                    MainPage.BasePageView.AddChidren(vcp);
                                    vcp.LoadPage(action, titleId, account, isPhone, time, isModifyBind);
                                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                                });
                            }
                        }
                        catch { }
                        finally
                        {
                            Application.RunOnMainThread(() =>
                            {
                                button.BackgroundColor = CSS_Color.PromptingColor1;
                                var vcp = new NewBindVerificationCodePage();
                                vcp.phoneZoneCode = phoneZoneCode;
                                MainPage.BasePageView.AddChidren(vcp);
                                vcp.LoadPage(action, titleId, account, isPhone, time, isModifyBind);
                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                                if (waitPage != null)
                                {
                                    waitPage.RemoveFromParent();
                                    waitPage = null;
                                }
                            });
                        }
                    })
                    { IsBackground = true }.Start();
                }