File was renamed from HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/VerificationCodePage.cs |
| | |
| | | using Shared; |
| | | using HDL_ON.UI.CSS; |
| | | using System.Threading; |
| | | using HDL_ON.DAL.Server; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | public partial class VerificationCodePage :FrameLayout |
| | | /// <summary> |
| | | /// 修改绑定或者解绑--验证码验证页面 |
| | | /// </summary> |
| | | public partial class ChangeBindVerificationCodePage : FrameLayout |
| | | { |
| | | FrameLayout bodyView; |
| | | |
| | |
| | | Button btnNum6Line; |
| | | |
| | | EditText et; |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | Button btnResend; |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | Button btnTip; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | Action<string> action; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | int titleId; |
| | | |
| | | /// <summary> |
| | |
| | | /// 倒计时时间 |
| | | /// </summary> |
| | | int time = 0; |
| | | public VerificationCodePage() |
| | | /// <summary> |
| | | /// 是否为解绑验证 |
| | | /// </summary> |
| | | public bool IsUnbind; |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public ChangeBindVerificationCodePage() |
| | | { |
| | | bodyView = this; |
| | | } |
| | |
| | | /// <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) |
| | | public void LoadPage(Action<string> act, int tId, int ot, int t) |
| | | { |
| | | action = act; |
| | | titleId = tId; |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | optionType = ot; |
| | | time = t; |
| | | Action backAction = () => { |
| | | 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), |
| | |
| | | Y = Application.GetRealHeight(276), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(44), |
| | | Height = Application.GetRealWidth(44), |
| | | SelectedBackgroundColor = CSS_Color.MainColor, |
| | | BackgroundColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.Center, |
| | |
| | | |
| | | |
| | | //--------------------------------------------- |
| | | public partial class VerificationCodePage |
| | | public partial class ChangeBindVerificationCodePage |
| | | { |
| | | /// <summary> |
| | | /// 验证码输入变化事件 |
| | | /// </summary> |
| | | void LoadEvent_VerificationEntryEvent() |
| | | { |
| | | EventHandler<MouseEventArgs> clickEvent = (sender, e) => { |
| | | EventHandler<MouseEventArgs> clickEvent = (sender, e) => |
| | | { |
| | | et.Foucs = true; |
| | | var etCode = et.Text; |
| | | switch (etCode.Length) |
| | |
| | | btnNum5.MouseUpEventHandler = clickEvent; |
| | | btnNum6.MouseUpEventHandler = clickEvent; |
| | | |
| | | et.TextChangeEventHandler = (sender, e) => { |
| | | et.TextChangeEventHandler = (sender, e) => |
| | | { |
| | | var etCode = et.Text; |
| | | switch (etCode.Length) |
| | | { |
| | |
| | | { |
| | | act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait)); |
| | | }); |
| | | var verAccount = optionType == 1 ? MainPage.LoginUser.userEmailInfo : MainPage.LoginUser.userMobileInfo; |
| | | var response = new DAL.Server.HttpServerRequest().ValidatorCode(verAccount, etCode, MainPage.LoginUser.areaCode); |
| | | if (response.StateCode.ToUpper() == "SUCCESS") |
| | | var verAccount = optionType == 1 ? UserInfo.Current.userEmailInfo : UserInfo.Current.userMobileInfo; |
| | | var isPhone = optionType == 2; |
| | | var resultObj = new HttpServerRequest().ValidatorCode(VerifyType.SENSITIVE_DATA, verAccount, etCode, isPhone); |
| | | if (resultObj.Code == StateCode.SUCCESS) |
| | | { |
| | | result = true; |
| | | } |
| | | else |
| | | { |
| | | string erorrInfo = ""; |
| | | switch (response.StateCode) |
| | | { |
| | | case "ValidCodeAndPhoneNoEqual"://验证码错误 |
| | | erorrInfo = Language.StringByID(StringId.VerificationCodeWrong); |
| | | break; |
| | | case "NoRecord": |
| | | erorrInfo = Language.StringByID(StringId.PlsGetTheVerificationCode); |
| | | break; |
| | | default: |
| | | erorrInfo = "Server error"; |
| | | break; |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Direction = AMPopTipDirection.None, |
| | | Text = erorrInfo, |
| | | }.Show(bodyView); |
| | | }); |
| | | //失败提示 |
| | | IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | { |
| | | MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | //MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1); |
| | | //if (isUnbind) |
| | | //{ |
| | | // //当前为解绑验证 |
| | | |
| | | //} |
| | | //else |
| | | //{ |
| | | |
| | | //} |
| | | |
| | | if (titleId == StringId.ModifyBindingEmail) |
| | | { |
| | | LoadEvent_SkipBindAccountInfoPage(StringId.BindEmail); |
| | |
| | | var account = ""; |
| | | new Thread(() => |
| | | { |
| | | var result2 = new DAL.Server.HttpServerRequest().BindAccount(account); |
| | | if (result2 == "SUCCESS") |
| | | var result2 = new DAL.Server.HttpServerRequest().UnBindAccount(false); |
| | | if (result2 == StateCode.SUCCESS) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | MainPage.LoginUser.userEmailInfo = account; |
| | | UserInfo.Current.userEmailInfo = account; |
| | | var page = new OperationResultDisPalyPage(); |
| | | page.Show(); |
| | | page.LoadPage(true, Language.StringByID(StringId.UnbindEmail), Language.StringByID(StringId.UnbindEmailSuccess), ""); |
| | |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Direction = AMPopTipDirection.None, |
| | | Text = Language.StringByID(StringId.OperationFailed), |
| | | }.Show(bodyView); |
| | | }); |
| | | //失败提示 |
| | | IMessageCommon.Current.ShowErrorInfoAlter(result2); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | var account = ""; |
| | | new Thread(() => |
| | | { |
| | | var result2 = new DAL.Server.HttpServerRequest().BindAccount(account); |
| | | if (result2 == "SUCCESS") |
| | | var result2 = new DAL.Server.HttpServerRequest().UnBindAccount(true); |
| | | if (result2 == StateCode.SUCCESS) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | MainPage.LoginUser.userEmailInfo = account; |
| | | UserInfo.Current.userMobileInfo = account; |
| | | var page = new OperationResultDisPalyPage(); |
| | | page.Show(); |
| | | page.LoadPage(true, Language.StringByID(StringId.UnbindPhone), Language.StringByID(StringId.UnbindPhoneSuccess), ""); |
| | |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Direction = AMPopTipDirection.None, |
| | | Text = Language.StringByID(StringId.OperationFailed), |
| | | }.Show(bodyView); |
| | | }); |
| | | //失败提示 |
| | | IMessageCommon.Current.ShowErrorInfoAlter(result2); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | time = 60; |
| | | new Thread(() => |
| | | { |
| | | if (optionType == 1) |
| | | //1.获取验证码,采用敏感数据验证 |
| | | ResponsePackNew resultObj; |
| | | if (optionType == 1)//邮箱 |
| | | { |
| | | var result = new DAL.Server.HttpServerRequest().GetLoginVerCode(MainPage.LoginUser.userEmailInfo); |
| | | resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.SENSITIVE_DATA, UserInfo.Current.userEmailInfo); |
| | | } |
| | | else if (optionType == 2) |
| | | else |
| | | { |
| | | var result = new DAL.Server.HttpServerRequest().GetLoginVerCode(MainPage.LoginUser.userMobileInfo); |
| | | resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.SENSITIVE_DATA, UserInfo.Current.userMobileInfo, true, UserInfo.Current.areaCode); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | /// </summary> |
| | | void LoadEvent_Resend() |
| | | { |
| | | btnResend.MouseUpEventHandler = (sender, e) => { |
| | | btnResend.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | LoadThread_SendVerCode(); |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 跳转绑定账号信息事件 |
| | | /// 跳转新绑定账号信息事件 |
| | | /// </summary> |
| | | void LoadEvent_SkipBindAccountInfoPage(int skipTid) |
| | | { |
| | | var vcp = new BindAccountPage(); |
| | | MainPage.BasePageView.AddChidren(vcp); |
| | | vcp.LoadPage(action,skipTid); |
| | | //var vcp = new BindAccountPage(); |
| | | //MainPage.BasePageView.AddChidren(vcp); |
| | | //vcp.LoadPage(action, skipTid); |
| | | //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | |
| | | //是否为换绑手机 |
| | | var isPhone = optionType == 2; |
| | | //跳转新绑定页面 |
| | | var aep = new NewBindAccountPage(); |
| | | MainPage.BasePageView.AddChidren(aep); |
| | | aep.LoadPage(action, isPhone, true); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回二次确认事件 |
| | | /// </summary> |
| | | void BackConfirmAction() |
| | | { |
| | | //验证码发送成功,二次确认退出 |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |