New file |
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | |
|
| | | namespace Shared.Phone.UserCenter.Password
|
| | | {
|
| | | /// <summary>
|
| | | /// 验证原手机的画面
|
| | | /// </summary>
|
| | | public class CheckOldPhoneForm : EditorCommonForm
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 错误信息控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnErrorMsg = null;
|
| | | /// <summary>
|
| | | /// 标记是否能够校验验证码了
|
| | | /// </summary>
|
| | | private bool canCheckCode = false;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | public void ShowForm()
|
| | | {
|
| | | //设定标题
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uEditorPhoneNumber));
|
| | |
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部控件
|
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | {
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | //已绑定手机号
|
| | | var btnMsg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(63), false);
|
| | | btnMsg1.Y = Application.GetRealHeight(167);
|
| | | btnMsg1.TextAlignment = TextAlignment.Center;
|
| | | btnMsg1.TextSize = 16;
|
| | | btnMsg1.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | btnMsg1.TextID = R.MyInternationalizationString.uHadBindPhoneNumber;
|
| | | bodyFrameLayout.AddChidren(btnMsg1);
|
| | |
|
| | | //手机
|
| | | var btnPhone = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(55), false);
|
| | | btnPhone.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | btnPhone.TextAlignment = TextAlignment.Center;
|
| | | btnPhone.TextSize = 16;
|
| | | btnPhone.Text = UserCenterResourse.UserInfo.Email;
|
| | | btnPhone.Y = btnMsg1.Bottom + Application.GetRealHeight(12);
|
| | | bodyFrameLayout.AddChidren(btnPhone);
|
| | | if (UserCenterResourse.UserInfo.Phone.Length >= 11)
|
| | | {
|
| | | var phone = UserCenterResourse.UserInfo.Phone;
|
| | | phone = phone.Substring(0, 3) + "".PadLeft(phone.Length - 7, '*') + phone.Substring(phone.Length - 4, 4);
|
| | | btnPhone.Text = "+" + UserCenterResourse.UserInfo.AreaCode + " " + phone;
|
| | | }
|
| | | else
|
| | | {
|
| | | //或许这是国外的手机吧
|
| | | var phone = UserCenterResourse.UserInfo.Phone;
|
| | | phone = phone.Substring(0, 3) + "".PadLeft(phone.Length - 5, '*') + phone.Substring(phone.Length - 2, 2);
|
| | | btnPhone.Text = "+" + UserCenterResourse.UserInfo.AreaCode + " " + phone;
|
| | | }
|
| | |
|
| | | //修改手机号前,请输入验证码确认您的身份
|
| | | var btnMsg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(49), false);
|
| | | btnMsg2.Y = btnPhone.Bottom + Application.GetRealHeight(37);
|
| | | btnMsg2.TextAlignment = TextAlignment.Center;
|
| | | btnMsg2.TextSize = 12;
|
| | | btnMsg2.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnMsg2.TextID = R.MyInternationalizationString.uCheckAuthenticationBeforeEditorPhoneNumber;
|
| | | bodyFrameLayout.AddChidren(btnMsg2);
|
| | |
|
| | | //初始化验证码控件
|
| | | var btnCodeControl = new VerificationCodeControl(6);
|
| | | btnCodeControl.Y = Application.GetRealHeight(475);
|
| | | bodyFrameLayout.AddChidren(btnCodeControl);
|
| | | btnCodeControl.InitControl();
|
| | | btnCodeControl.TxtCodeChangeEvent += (sender, e) =>
|
| | | {
|
| | | if (btnErrorMsg.Visible == true)
|
| | | {
|
| | | btnErrorMsg.Visible = false;
|
| | | }
|
| | | };
|
| | | btnCodeControl.FinishInputEvent += (value) =>
|
| | | {
|
| | | //校验验证码
|
| | | this.CheckVerificationCode(value);
|
| | | };
|
| | |
|
| | | //验证码错误,请重新输入
|
| | | this.btnErrorMsg = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false);
|
| | | btnErrorMsg.Y = Application.GetRealHeight(677);
|
| | | btnErrorMsg.TextAlignment = TextAlignment.Center;
|
| | | btnErrorMsg.TextColor = 0xfff75858;
|
| | | btnErrorMsg.TextID = R.MyInternationalizationString.uVerificationCodeErrorInputAgain;
|
| | | btnErrorMsg.IsBold = true;
|
| | | bodyFrameLayout.AddChidren(btnErrorMsg);
|
| | | btnErrorMsg.Visible = false;
|
| | |
|
| | | //获取验证码
|
| | | var btnNext = new BottomClickButton(688);
|
| | | btnNext.Y = Application.GetRealHeight(792);
|
| | | btnNext.TextID = R.MyInternationalizationString.uGetVerificationCode;
|
| | | bodyFrameLayout.AddChidren(btnNext);
|
| | | btnNext.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //清空输入的值
|
| | | btnCodeControl.ClearInputValue();
|
| | | //发送验证码到手机
|
| | | this.SendCodeToPhone(btnNext);
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 发送验证码到手机___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 发送验证码到手机
|
| | | /// </summary>
|
| | | private async void SendCodeToPhone(BottomClickButton btnNext)
|
| | | {
|
| | | var sendCodePra = new SendCodePra();
|
| | |
|
| | | bool flage = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/LoginSendVerCode", false, sendCodePra);
|
| | | if (flage == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | //可以开始校验验证码了
|
| | | this.canCheckCode = true;
|
| | | //控件不能再次按下
|
| | | btnNext.CanClick = false;
|
| | | //?s后重发
|
| | | string repeat = Language.StringByID(R.MyInternationalizationString.RepeatSend1);
|
| | | //有效时间60秒
|
| | | int waitime = 60;
|
| | | btnNext.Text = waitime + "s" + repeat;
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | while (this.Parent != null)
|
| | | {
|
| | | waitime--;
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | if (waitime == 0)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | if (btnNext != null)
|
| | | {
|
| | | //获取验证码
|
| | | btnNext.TextID = R.MyInternationalizationString.uGetVerificationCode;
|
| | | //按键可以按下
|
| | | btnNext.CanClick = true;
|
| | | }
|
| | | });
|
| | | break;
|
| | | }
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | if (btnNext != null)
|
| | | {
|
| | | btnNext.Text = waitime + "s" + repeat;
|
| | | }
|
| | | });
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 校验验证码_________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 验证验证码
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private async void CheckVerificationCode(string code)
|
| | | {
|
| | | if (this.canCheckCode == false)
|
| | | {
|
| | | //验证码错误,请重新输入
|
| | | this.btnErrorMsg.Visible = true;
|
| | | return;
|
| | | }
|
| | | var checkCodePra = new CheckCodePra();
|
| | | checkCodePra.Code = code;
|
| | |
|
| | | bool flage = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ValidatorCode", false, checkCodePra);
|
| | | if (flage == false)
|
| | | {
|
| | | //验证码错误,请重新输入
|
| | | this.btnErrorMsg.Visible = true;
|
| | | return;
|
| | | }
|
| | |
|
| | | var from = new CheckNewPhoneForm();
|
| | | base.AddFromAndRemoveNowForm(from);
|
| | | }
|
| | |
|
| | | #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 = 0;
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|