copy from HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/VerificationCodePage.cs
copy to HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindVerificationCodePage.cs
File was copied from HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/VerificationCodePage.cs |
| | |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | public partial class VerificationCodePage :FrameLayout |
| | | /// <summary> |
| | | /// 新绑定或者换绑--验证码验证并绑定 |
| | | /// </summary> |
| | | public partial class NewBindVerificationCodePage : FrameLayout |
| | | { |
| | | FrameLayout bodyView; |
| | | |
| | |
| | | |
| | | Button btnResend; |
| | | |
| | | Button btnTip; |
| | | |
| | | Action<string> action; |
| | | |
| | | int titleId; |
| | | |
| | | /// <summary> |
| | | /// 操作目标类型 1:邮箱,2:手机 |
| | | /// </summary> |
| | | int optionType; |
| | | ///// <summary> |
| | | ///// 操作目标类型 1:邮箱,2:手机 |
| | | ///// </summary> |
| | | //int optionType; |
| | | /// <summary> |
| | | /// 倒计时时间 |
| | | /// </summary> |
| | | int time = 0; |
| | | public VerificationCodePage() |
| | | /// <summary> |
| | | /// 是否手机 |
| | | /// </summary> |
| | | public bool isPhone; |
| | | /// <summary> |
| | | /// 是否换绑 |
| | | /// </summary> |
| | | public bool isModifyBind; |
| | | |
| | | /// <summary> |
| | | /// 新绑定的账号 |
| | | /// </summary> |
| | | public string verAccount; |
| | | /// <summary> |
| | | /// 手机区号 |
| | | /// </summary> |
| | | public string phoneZoneCode = "86"; |
| | | |
| | | |
| | | public NewBindVerificationCodePage() |
| | | { |
| | | bodyView = this; |
| | | } |
| | | /// <summary> |
| | | /// |
| | | |
| | | /// </summary> |
| | | /// <param name="act">回掉函数</param> |
| | | /// <param name="tId">页面标题</param> |
| | | /// <param name="ot">操作类型1:邮箱;2:手机</param> |
| | | /// <param name="time">倒计时时间</param> |
| | | public void LoadPage(Action<string> act,int tId,int ot,int t) |
| | | /// <param name="account">账号</param> |
| | | /// <param name="bPhone">是否手机</param> |
| | | /// <param name="t">倒计时时间</param> |
| | | /// <param name="isModifyBind">是否为修改绑定</param> |
| | | public void LoadPage(Action<string> act, int tId, string account, bool bPhone, int t, bool isModifyBind) |
| | | { |
| | | action = act; |
| | | titleId = tId; |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | optionType = ot; |
| | | isPhone = bPhone; |
| | | time = t; |
| | | this.verAccount = account; |
| | | this.isModifyBind = isModifyBind; |
| | | |
| | | Action backAction = () => { |
| | | Application.HideSoftInput(); |
| | | BackConfirmAction(); |
| | | }; |
| | | new TopViewDiv(bodyView, Language.StringByID(tId)).LoadTopView(backAction); |
| | | new TopViewDiv(bodyView, Language.StringByID(tId), false).LoadTopView(backAction); |
| | | |
| | | Button btnTip = new Button() |
| | | btnTip = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(84), |
| | |
| | | |
| | | |
| | | //--------------------------------------------- |
| | | public partial class VerificationCodePage |
| | | public partial class NewBindVerificationCodePage |
| | | { |
| | | /// <summary> |
| | | /// 验证码输入变化事件 |
| | |
| | | { |
| | | act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait)); |
| | | }); |
| | | var verAccount = optionType == 1 ? MainPage.LoginUser.userEmailInfo : MainPage.LoginUser.userMobileInfo; |
| | | var isPhone = optionType == 2; |
| | | var resultObj = new HttpServerRequest().ValidatorCode(VerifyType.REGISTER_USER_SYSTEM, verAccount, etCode, isPhone); |
| | | if (resultObj.Code == StateCode.SUCCESS) |
| | | |
| | | var resultObj = new HttpServerRequest().BindAccount(verAccount, etCode, isPhone); |
| | | if (resultObj == StateCode.SUCCESS) |
| | | { |
| | | result = true; |
| | | } |
| | | else |
| | | { |
| | | //失败提示 |
| | | IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Verification_Check, resultObj.Code); |
| | | IMessageCommon.Current.ShowErrorInfoAlter(resultObj); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | }); |
| | | if (result) |
| | | { |
| | | //Application.RunOnMainThread(() => |
| | | //{ |
| | | // new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.ValidationSuccessful), true); |
| | | //}); |
| | | //Thread.Sleep(1600); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | //MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1); |
| | | if (titleId == StringId.ModifyBindingEmail) |
| | | { |
| | | LoadEvent_SkipBindAccountInfoPage(StringId.BindEmail); |
| | | } |
| | | else if (titleId == StringId.ModifyBindingPhone) |
| | | { |
| | | LoadEvent_SkipBindAccountInfoPage(StringId.BindPhone); |
| | | } |
| | | else if (titleId == StringId.UnbindEmail)//解除绑定邮箱 |
| | | { |
| | | var account = ""; |
| | | new Thread(() => |
| | | { |
| | | var result2 = new DAL.Server.HttpServerRequest().BindAccount(account); |
| | | if (result2 == StateCode.SUCCESS) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | MainPage.LoginUser.userEmailInfo = account; |
| | | var page = new OperationResultDisPalyPage(); |
| | | page.Show(); |
| | | page.LoadPage(true, Language.StringByID(StringId.UnbindEmail), Language.StringByID(StringId.UnbindEmailSuccess), ""); |
| | | |
| | | for (int i = 0; i < 2; i++) |
| | | { |
| | | MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | } |
| | | action(account); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Direction = AMPopTipDirection.None, |
| | | Text = Language.StringByID(StringId.OperationFailed), |
| | | }.Show(bodyView); |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | else if (titleId == StringId.UnbindPhone) |
| | | { |
| | | var account = ""; |
| | | new Thread(() => |
| | | { |
| | | var result2 = new DAL.Server.HttpServerRequest().BindAccount(account); |
| | | if (result2 == StateCode.SUCCESS) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | MainPage.LoginUser.userEmailInfo = account; |
| | | var page = new OperationResultDisPalyPage(); |
| | | page.Show(); |
| | | page.LoadPage(true, Language.StringByID(StringId.UnbindPhone), Language.StringByID(StringId.UnbindPhoneSuccess), ""); |
| | | |
| | | for (int i = 0; i < 2; i++) |
| | | { |
| | | MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | } |
| | | action(account); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Direction = AMPopTipDirection.None, |
| | | Text = Language.StringByID(StringId.OperationFailed), |
| | | }.Show(bodyView); |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | }); |
| | | //绑定成功 |
| | | BindSuccess(); |
| | | |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | } |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定成功 |
| | | /// </summary> |
| | | void BindSuccess() |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var tipTitle = ""; |
| | | var tipMsg = ""; |
| | | if (isPhone) |
| | | { |
| | | UserInfo.Current.userMobileInfo = verAccount; |
| | | //请使用新的手机账号登录APP |
| | | tipMsg = Language.StringByID(StringId.PleaseLoginWithNewMobileAccount); |
| | | if (isModifyBind) |
| | | { |
| | | //登录手机修改完成 |
| | | tipTitle = Language.StringByID(StringId.LoginMobileAccountModificationCompleted); |
| | | } |
| | | else |
| | | { |
| | | //登录手机绑定完成 |
| | | tipTitle = Language.StringByID(StringId.LoginMobileAccountBindCompleted); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | UserInfo.Current.userEmailInfo = verAccount; |
| | | //请使用新的邮箱账号登录APP |
| | | tipMsg = Language.StringByID(StringId.PleaseLoginWithNewEmailAccount); |
| | | if (isModifyBind) |
| | | { |
| | | //登录邮箱修改完成 |
| | | tipTitle = Language.StringByID(StringId.LoginEmailAccountModificationCompleted); |
| | | } |
| | | else |
| | | { |
| | | //登录邮箱绑定完成 |
| | | tipTitle = Language.StringByID(StringId.LoginEmailAccountBindCompleted); |
| | | |
| | | } |
| | | } |
| | | |
| | | var page = new OperationResultDisPalyPage(); |
| | | page.Show(); |
| | | page.LoadPage(true, Language.StringByID(titleId), tipTitle, tipMsg); |
| | | |
| | | if (isModifyBind) |
| | | { |
| | | ClosePageWithCount(3); |
| | | } |
| | | else |
| | | { |
| | | ClosePageWithCount(2); |
| | | } |
| | | |
| | | action(verAccount); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 指定关闭页面个数 |
| | | /// </summary> |
| | | /// <param name="countPage"></param> |
| | | void ClosePageWithCount(int countPage) |
| | | { |
| | | //关闭多少个页面 |
| | | for (int i = 0; i < countPage; i++) |
| | | { |
| | | MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 重发验证码等待线程 |
| | | /// </summary> |
| | |
| | | time = 60; |
| | | new Thread(() => |
| | | { |
| | | if (optionType == 1) |
| | | //2.2 获取验证码 |
| | | ResponsePackNew resultObj; |
| | | if (!isPhone)//邮箱 |
| | | { |
| | | var resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, MainPage.LoginUser.userEmailInfo); |
| | | resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, verAccount); |
| | | } |
| | | else |
| | | { |
| | | resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, verAccount, true, phoneZoneCode); |
| | | } |
| | | |
| | | } |
| | | else if (optionType == 2) |
| | | { |
| | | var resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, MainPage.LoginUser.userMobileInfo, true, MainPage.LoginUser.areaCode.ToString()); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 重发验证码事件 |
| | | /// </summary> |
| | |
| | | LoadThread_SendVerCode(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 跳转绑定账号信息事件 |
| | | /// 返回二次确认事件 |
| | | /// </summary> |
| | | void LoadEvent_SkipBindAccountInfoPage(int skipTid) |
| | | void BackConfirmAction() |
| | | { |
| | | var vcp = new BindAccountPage(); |
| | | MainPage.BasePageView.AddChidren(vcp); |
| | | vcp.LoadPage(action,skipTid); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | //验证码发送成功,二次确认退出 |
| | | if (btnTip.TextID == StringId.VerificationCodePrompt) |
| | | { |
| | | Action cancelAction = () => |
| | | { |
| | | if (bodyView != null) |
| | | { |
| | | bodyView.RemoveFromParent(); |
| | | } |
| | | }; |
| | | new ConfirmDialog().ShowDialog(StringId.Tip, StringId.VerificationCodeMayBeDelayed, null, cancelAction, StringId.ReturnStr, StringId.WaitAMoment); |
| | | } |
| | | else |
| | | { |
| | | //直接关闭 |
| | | if (bodyView != null) |
| | | { |
| | | bodyView.RemoveFromParent(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |