| | |
| | | /// 新手机(防止恶意变更)
|
| | | /// </summary>
|
| | | private string newPhone = string.Empty;
|
| | | /// <summary>
|
| | | /// 能否发送验证码
|
| | | /// </summary>
|
| | | private bool canSendCode = true;
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | //};
|
| | |
|
| | | //输入框
|
| | | var txtValue = new TextInputControl(Application.GetRealWidth(510), frame.Height - ControlCommonResourse.BottomLineHeight, false);
|
| | | var txtValue = new TextInputControl(Application.GetRealWidth(510), frame.Height - HdlControlResourse.BottomLineHeight, false);
|
| | | txtValue.X = btnArea.Right + Application.GetRealWidth(35);
|
| | | txtValue.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputNewPhoneNumber);
|
| | | frame.AddChidren(txtValue);
|
| | |
|
| | | //线
|
| | | var btnLine = new NormalViewControl(frame.Width, ControlCommonResourse.BottomLineHeight, false);
|
| | | var btnLine = new NormalViewControl(frame.Width, HdlControlResourse.BottomLineHeight, false);
|
| | | btnLine.Y = txtValue.Bottom;
|
| | | btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | frame.AddChidren(btnLine);
|
| | | //联动线的状态
|
| | | txtValue.btnLine = btnLine;
|
| | |
|
| | | if (string.IsNullOrEmpty(UserCenterResourse.UserInfo.Phone) == false)
|
| | | if (string.IsNullOrEmpty(HdlUserCenterResourse.UserInfo.UserPhone) == false)
|
| | | {
|
| | | //确认身份成功,请绑定新手机号码
|
| | | var btnMsg1 = new NormalViewControl(800, 49, false);
|
| | |
| | | };
|
| | | btnCodeControl.FinishInputEvent += (value) =>
|
| | | {
|
| | | //校验验证码
|
| | | if (this.CheckVerificationCode(value) == false)
|
| | | {
|
| | | //清空验证码
|
| | | btnCodeControl.ClearInputValue();
|
| | | }
|
| | | //绑定新手机
|
| | | this.SaveNewPhoneNumber(btnCodeControl, value);
|
| | | };
|
| | |
|
| | | //验证码错误,请重新输入
|
| | |
| | | /// </summary>
|
| | | private void SendCodeToPhone(BottomClickButton btnNext,string areaCode, string phoneNum)
|
| | | {
|
| | | var sendCodePra = new SendCodePra();
|
| | | sendCodePra.Account = phoneNum;
|
| | | sendCodePra.AreaCode = Convert.ToInt32(areaCode);
|
| | |
|
| | | bool flage = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/RegisterSendVerCode", false, sendCodePra);
|
| | | if (flage == false)
|
| | | var errorMsg = HdlAccountLogic.Current.SendVeriCodeToPhone(areaCode, phoneNum, VerCodeType.A绑定);
|
| | | if (errorMsg != null)
|
| | | {
|
| | | //显示错误
|
| | | this.btnErrorMsg.Visible = true;
|
| | | this.btnErrorMsg.Text = errorMsg;
|
| | | return;
|
| | | }
|
| | |
|
| | | //不能再发送验证码
|
| | | this.canSendCode = false;
|
| | | //可以开始校验验证码了
|
| | | this.canCheckCode = true;
|
| | | //记录起这个手机,防止恶意变更
|
| | |
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | while (this.Parent != null)
|
| | | while (this.Parent != null && this.canSendCode == false)
|
| | | {
|
| | | waitime--;
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | if (waitime == 0)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | if (btnNext != null)
|
| | | {
|
| | | //获取验证码
|
| | | btnNext.TextID = R.MyInternationalizationString.uGetVerificationCode;
|
| | | //按键可以按下
|
| | | btnNext.CanClick = true;
|
| | | }
|
| | | });
|
| | | break;
|
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | |
| | | }
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | if (btnNext != null)
|
| | | {
|
| | | //获取验证码
|
| | | btnNext.TextID = R.MyInternationalizationString.uGetVerificationCode;
|
| | | //按键可以按下
|
| | | btnNext.CanClick = true;
|
| | | }
|
| | | });
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 校验验证码_________________________
|
| | | #region ■ 变更手机___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 验证验证码
|
| | | /// 变更手机号
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private bool CheckVerificationCode(string code)
|
| | | private void SaveNewPhoneNumber(VerificationCodeControl btnCodeControl, string code)
|
| | | {
|
| | | if (this.canCheckCode == false)
|
| | | {
|
| | | //验证码错误,请重新输入
|
| | | this.btnErrorMsg.Visible = true;
|
| | | this.btnErrorMsg.TextID = R.MyInternationalizationString.uVerificationCodeErrorInputAgain;
|
| | | return false;
|
| | | //清空输入值
|
| | | btnCodeControl.ClearInputValue();
|
| | | return;
|
| | | }
|
| | | var checkCodePra = new CheckCodePra();
|
| | | checkCodePra.Code = code;
|
| | | checkCodePra.Account = newPhone;
|
| | |
|
| | | bool flage = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ValidatorCode", false, checkCodePra);
|
| | | if (flage == false)
|
| | | //执行绑定
|
| | | var errorMsg = HdlAccountLogic.Current.BindAccount(this.newPhone, code);
|
| | | if (errorMsg != null)
|
| | | {
|
| | | //验证码错误,请重新输入
|
| | | this.btnErrorMsg.Visible = true;
|
| | | this.btnErrorMsg.TextID = R.MyInternationalizationString.uVerificationCodeErrorInputAgain;
|
| | | return false;
|
| | | }
|
| | |
|
| | | //变更手机号
|
| | | this.SaveNewPhoneNumber();
|
| | | return true;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 变更手机号
|
| | | /// </summary>
|
| | | private void SaveNewPhoneNumber()
|
| | | {
|
| | | var pra = new SaveNewPhoneNumPra();
|
| | | pra.Account = newPhone;
|
| | |
|
| | | bool flage = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/BindAccount", false, pra);
|
| | | if (flage == false)
|
| | | {
|
| | | //绑定手机失败
|
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uBindPhoneFail));
|
| | | this.ShowMassage(ShowMsgType.Tip, errorMsg);
|
| | | //可以重新发送验证码
|
| | | this.canSendCode = true;
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | private void RefreshUserInfoForm()
|
| | | {
|
| | | //如果修改的是账号的话,则重新登录
|
| | | if (UserCenterResourse.UserInfo.Phone == Shared.Common.Config.Instance.Account)
|
| | | if (HdlUserCenterResourse.UserInfo.UserPhone == Shared.Common.Config.Instance.Account)
|
| | | {
|
| | | UserCenterLogic.ReLoginAgain(newPhone);
|
| | | HdlAccountLogic.Current.ReLoginAgain(newPhone);
|
| | | return;
|
| | | }
|
| | | UserCenterResourse.UserInfo.Phone = newPhone;
|
| | | HdlUserCenterResourse.UserInfo.UserPhone = newPhone;
|
| | | this.CloseForm();
|
| | | }
|
| | |
|
| | |
| | | return false;
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 结构体_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 发送验证码的启动参数
|
| | | /// </summary>
|
| | | private class SendCodePra
|
| | | {
|
| | | /// <summary>
|
| | | /// 用户账号
|
| | | /// </summary>
|
| | | public string Account = string.Empty;
|
| | | /// <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 = string.Empty;
|
| | | /// <summary>
|
| | | /// 验证码
|
| | | /// </summary>
|
| | | public string Code = "0";
|
| | | /// <summary>
|
| | | /// 语言
|
| | | /// </summary>
|
| | | public string Language = Shared.Language.CurrentLanguage;
|
| | | /// <summary>
|
| | | /// 国家地区代码,手机号发送验证码时使用
|
| | | /// </summary>
|
| | | public int AreaCode = 0;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 保存新手机号的启动参数
|
| | | /// </summary>
|
| | | private class SaveNewPhoneNumPra
|
| | | {
|
| | | /// <summary>
|
| | | /// 新用户账号
|
| | | /// </summary>
|
| | | public string Account = string.Empty;
|
| | | }
|
| | |
|
| | | #endregion
|