黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
ZigbeeApp/Shared/Phone/UserCenter/Password/ForgotSecondaryPasswordForm.cs
@@ -55,13 +55,13 @@
            var rowPhone = new FrameRowControl();
            //右边偏移量->增加宽度
            rowPhone.RightOffset = -ControlCommonResourse.XXLeft;
            rowPhone.RightOffset = -HdlControlResourse.XXLeft;
            rowPhone.Y = Application.GetRealHeight(23);
            rowPhone.Width = Application.GetMinRealAverage(628);
            rowPhone.Width = this.GetPictrueRealSize(628);
            bodyFrameLayout.AddChidren(rowPhone);
            //请输入邮箱或手机号
            string phoneValue = string.IsNullOrEmpty(UserCenterResourse.UserInfo.Phone) == true ? string.Empty : "+" + UserCenterResourse.UserInfo.AreaCode + " " + UserCenterResourse.UserInfo.Phone;
            var txtPhone = rowPhone.AddLeftCaption(string.IsNullOrEmpty(phoneValue) == true ? UserCenterResourse.UserInfo.Email : phoneValue, 600);
            string phoneValue = string.IsNullOrEmpty(HdlUserCenterResourse.UserInfo.UserPhone) == true ? string.Empty : "+" + HdlUserCenterResourse.UserInfo.PhoneAreaCode + " " + HdlUserCenterResourse.UserInfo.UserPhone;
            var txtPhone = rowPhone.AddLeftCaption(string.IsNullOrEmpty(phoneValue) == true ? HdlUserCenterResourse.UserInfo.UserEmail : phoneValue, 600);
            txtPhone.TextColor = UserCenterColor.Current.TextGrayColor2;
            //底线
            rowPhone.AddBottomLine();
@@ -70,7 +70,7 @@
            var rowCode = new FrameRowControl();
            rowCode.Y = rowPhone.Bottom + Application.GetRealHeight(20);
            rowCode.Width = Application.GetMinRealAverage(628);
            rowCode.Width = this.GetPictrueRealSize(628);
            bodyFrameLayout.AddChidren(rowCode);
            //请输入验证码
            var txtCode = rowCode.AddLeftInput("", 600);
@@ -81,7 +81,7 @@
            var btnCode = new NormalViewControl(302, 127, true);
            btnCode.X = rowPhone.Right + Application.GetRealWidth(35);
            btnCode.Y = Application.GetRealHeight(23);
            btnCode.Radius = 4;
            btnCode.RadiusEx = 12;
            btnCode.TextID = R.MyInternationalizationString.uGetVerificationCode;
            btnCode.TextColor = UserCenterColor.Current.White;
            btnCode.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
@@ -95,22 +95,22 @@
            //错误信息控件
            btnMsgControl = new NormalViewControl(800, 58, true);
            btnMsgControl.X = ControlCommonResourse.XXLeft;
            btnMsgControl.X = HdlControlResourse.XXLeft;
            btnMsgControl.Y = rowCode.Bottom + Application.GetRealHeight(46);
            btnMsgControl.TextColor = 0xfff75858;
            btnMsgControl.TextID = R.MyInternationalizationString.uVerificationCodeErrorInputAgain;
            bodyFrameLayout.AddChidren(btnMsgControl);
            btnMsgControl.Visible = false;
            if (string.IsNullOrEmpty(UserCenterResourse.UserInfo.Phone) == true
                || string.IsNullOrEmpty(UserCenterResourse.UserInfo.Email) == true)
            if (string.IsNullOrEmpty(HdlUserCenterResourse.UserInfo.UserPhone) == true
                || string.IsNullOrEmpty(HdlUserCenterResourse.UserInfo.UserEmail) == true)
            {
                rowPhone.UseClickStatu = false;
                return;
            }
            //显示可以切换邮箱->一个可以遮住Body的东西
            var frameTran = new FrameLayoutControl();
            var frameTran = new FrameLayoutStatuControl();
            frameTran.UseClickStatu = false;
            frameTran.BackgroundColor = UserCenterColor.Current.Transparent;
            bodyFrameLayout.AddChidren(frameTran);
@@ -120,13 +120,13 @@
                frameTran.Visible = false;
            };
            var frameList = new FrameLayout();
            frameList.X = ControlCommonResourse.XXLeft - Application.GetRealWidth(17);
            frameList.Y = rowPhone.Bottom - ControlCommonResourse.BottomLineHeight - 1;
            frameList.Width = Application.GetMinRealAverage(628);
            frameList.Height = Application.GetMinRealAverage(176);
            frameList.X = HdlControlResourse.XXLeft - Application.GetRealWidth(17);
            frameList.Y = rowPhone.Bottom - HdlControlResourse.BottomLineHeight - 1;
            frameList.Width = this.GetPictrueRealSize(628);
            frameList.Height = this.GetPictrueRealSize(176);
            frameTran.AddChidren(frameList);
            //动画用
            var frameAnimate = new FrameLayoutControl();
            var frameAnimate = new FrameLayoutStatuControl();
            frameAnimate.UseClickStatu = false;
            frameList.AddChidren(frameAnimate);
@@ -134,10 +134,10 @@
            btnPic.UnSelectedImagePath = "Item/ForgotPswList.png";
            frameAnimate.AddChidren(btnPic);
            var btnEmail = new NormalViewControl(450, 58, true);
            btnEmail.X = Application.GetMinRealAverage(46);
            btnEmail.Y = Application.GetMinRealAverage(32);
            btnEmail.X = this.GetPictrueRealSize(46);
            btnEmail.Y = this.GetPictrueRealSize(32);
            btnEmail.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnEmail.Text = UserCenterResourse.UserInfo.Email;
            btnEmail.Text = HdlUserCenterResourse.UserInfo.UserEmail;
            frameAnimate.AddChidren(btnEmail);
            frameAnimate.ButtonClickEvent += (sender, e) =>
            {
@@ -154,8 +154,6 @@
                if (frameTran.Visible == false)
                {
                    frameTran.Visible = true;
                    //动画效果
                    frameAnimate.Animate = Animate.UpToDown;
                }
            };
        }
@@ -168,18 +166,25 @@
        /// 发送验证码
        /// </summary>
        /// <param name="btnCode"></param>
        private async void SetVerificationCode(NormalViewControl btnCode)
        private void SetVerificationCode(NormalViewControl btnCode)
        {
            string account = this.strPhoneEmail.StartsWith("+") == true ? UserCenterResourse.UserInfo.Phone : UserCenterResourse.UserInfo.Email;
            var sendCodePra = new SendCodePra();
            sendCodePra.Account = account;
            sendCodePra.AreaCode = Convert.ToInt32(UserCenterResourse.UserInfo.AreaCode);
            bool flage = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ForgetPassword", false, sendCodePra);
            if (flage == false)
            var errorMsg = string.Empty;
            if (this.strPhoneEmail.StartsWith("+") == true)
            {
                //手机
                errorMsg = HdlAccountLogic.Current.SendVeriCodeToPhone(HdlUserCenterResourse.UserInfo.PhoneAreaCode, HdlUserCenterResourse.UserInfo.UserPhone, VerCodeType.A其他);
            }
            else
            {
                //邮箱
                errorMsg = HdlAccountLogic.Current.SendVeriCodeToEmail(HdlUserCenterResourse.UserInfo.UserEmail, VerCodeType.A其他);
            }
            if (errorMsg != null)
            {
                this.ShowMassage(ShowMsgType.Tip, errorMsg);
                return;
            }
            //可以开始校验验证码了
            this.canCheckCode = true;
            //控件不能再次按下
@@ -199,7 +204,7 @@
                    System.Threading.Thread.Sleep(1000);
                    if (waitime == 0)
                    {
                        Application.RunOnMainThread(() =>
                        HdlThreadLogic.Current.RunMain(() =>
                        {
                            if (btnCode != null)
                            {
@@ -212,13 +217,13 @@
                        });
                        break;
                    }
                    Application.RunOnMainThread(() =>
                    HdlThreadLogic.Current.RunMain(() =>
                    {
                        if (btnCode != null)
                        {
                            btnCode.Text = waitime + "s" + repeat;
                        }
                    });
                    }, ShowErrorMode.NO);
                }
            });
        }
@@ -269,15 +274,11 @@
        /// 验证验证码
        /// </summary>
        /// <returns></returns>
        private async void CheckVerificationCode(TextInputControl txtCode, string code)
        private void CheckVerificationCode(TextInputControl txtCode, string code)
        {
            string account = this.strPhoneEmail.StartsWith("+") == true ? UserCenterResourse.UserInfo.Phone : UserCenterResourse.UserInfo.Email;
            var checkCodePra = new CheckCodePra();
            checkCodePra.Code = code;
            checkCodePra.Account = account;
            bool flage = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ValidatorCode", false, checkCodePra);
            if (flage == false)
            string account = this.strPhoneEmail.StartsWith("+") == true ? HdlUserCenterResourse.UserInfo.UserPhone : HdlUserCenterResourse.UserInfo.UserEmail;
            var result = HdlAccountLogic.Current.CheckVeriCode(account, VerCodeType.A其他, code);
            if (result == false)
            {
                //验证码错误,请重新输入
                this.btnMsgControl.Visible = true;
@@ -291,56 +292,6 @@
            //指定新建密码模式
            this.LoadFormMethodByName("EditorSecondaryPasswordForm", "SetNewPasswordFormMode");
            this.LoadFormMethodByName("EditorGesturePasswordForm", "SetNewPasswordFormMode");
        }
        #endregion
        #region ■ 结构体_____________________________
        /// <summary>
        /// 发送验证码的启动参数
        /// </summary>
        private class SendCodePra
        {
            /// <summary>
            /// 用户账号
            /// </summary>
            public string Account = UserCenterResourse.UserInfo.Phone;
            /// <summary>
            /// 公司编号,国内使用手机短信验证码时,此字段填入0,国外手机短信验证码,此字段填入4
            /// </summary>
            public int Company = Common.CommonPage.PhoneZoneStr == "86" ? 0 : 4;
            /// <summary>
            /// 语言
            /// </summary>
            public string Language = Shared.Language.CurrentLanguage;
            /// <summary>
            /// 国家地区代码,手机号发送验证码时使用
            /// </summary>
            public int AreaCode = 0;
        }
        /// <summary>
        /// 发送验证码的启动参数
        /// </summary>
        private class CheckCodePra
        {
            /// <summary>
            /// 用户账号
            /// </summary>
            public string Account = UserCenterResourse.UserInfo.Phone;
            /// <summary>
            /// 验证码
            /// </summary>
            public string Code = "0";
            /// <summary>
            /// 语言
            /// </summary>
            public string Language = Shared.Language.CurrentLanguage;
            /// <summary>
            /// 国家地区代码,手机号发送验证码时使用
            /// </summary>
            public int AreaCode = Convert.ToInt32(UserCenterResourse.UserInfo.AreaCode);
        }
        #endregion