From 0d9f64668fd7350d6a21fd157e32009a96d98134 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期三, 16 十二月 2020 13:09:08 +0800 Subject: [PATCH] 新云端代码Ver1.2 --- ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs | 167 ++++++++++++++----------------------------------------- 1 files changed, 42 insertions(+), 125 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs index 5107160..7fa65a7 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs @@ -23,6 +23,10 @@ /// 鏍囪鏄惁鑳藉鏍¢獙楠岃瘉鐮佷簡 /// </summary> private bool canCheckCode = false; + /// <summary> + /// 鑳藉惁鍙戦�侀獙璇佺爜 + /// </summary> + private bool canSendCode = true; #endregion @@ -55,20 +59,20 @@ frame.Height = Application.GetRealHeight(127); bodyFrameLayout.AddChidren(frame); //杈撳叆妗� - var txtValue = new TextInputControl(frame.Width - Application.GetRealWidth(20), frame.Height - ControlCommonResourse.BottomLineHeight, false); + var txtValue = new TextInputControl(frame.Width - Application.GetRealWidth(20), frame.Height - HdlControlResourse.BottomLineHeight, false); txtValue.X = Application.GetRealWidth(10); txtValue.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputNewEmailAddress); 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.Email) == false) + if (string.IsNullOrEmpty(HdlUserCenterResourse.UserInfo.UserEmail) == false) { //纭韬唤鎴愬姛锛岃缁戝畾鏂伴偖绠� var btnMsg1 = new NormalViewControl(800, 49, false); @@ -94,12 +98,8 @@ }; btnCodeControl.FinishInputEvent += (value) => { - //鏍¢獙楠岃瘉鐮� - if (this.CheckVerificationCode(value) == false) - { - //娓呯┖楠岃瘉鐮� - btnCodeControl.ClearInputValue(); - } + //缁戝畾鏂伴偖绠� + this.SaveNewEmail(btnCodeControl, value); }; //楠岃瘉鐮侀敊璇紝璇烽噸鏂拌緭鍏� @@ -157,15 +157,16 @@ /// </summary> private void SendCodeToEmail(BottomClickButton btnNext, string Email) { - var sendCodePra = new SendCodePra(); - sendCodePra.Account = Email; - - bool falge = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/RegisterSendVerCode", false, sendCodePra); - if (falge == false) + var errorMsg = HdlAccountLogic.Current.SendVeriCodeToEmail(Email, VerCodeType.A缁戝畾); + if (errorMsg != null) { + //鏄剧ず閿欒 + this.btnErrorMsg.Visible = true; + this.btnErrorMsg.Text = errorMsg; return; } - + //涓嶈兘鍐嶅彂閫侀獙璇佺爜 + this.canSendCode = false; //鍙互寮�濮嬫牎楠岄獙璇佺爜浜� this.canCheckCode = true; //璁板綍璧疯繖涓偖绠�,闃叉鎭舵剰鍙樻洿 @@ -180,22 +181,12 @@ HdlThreadLogic.Current.RunThread(() => { - while (this.Parent != null) + while (this.Parent != null && this.canSendCode == false) { waitime--; System.Threading.Thread.Sleep(1000); if (waitime == 0) { - HdlThreadLogic.Current.RunMain(() => - { - if (btnNext != null) - { - //鑾峰彇楠岃瘉鐮� - btnNext.TextID = R.MyInternationalizationString.uGetVerificationCode; - //鎸夐敭鍙互鎸変笅 - btnNext.CanClick = true; - } - }); break; } HdlThreadLogic.Current.RunMain(() => @@ -206,57 +197,44 @@ } }, ShowErrorMode.NO); } + HdlThreadLogic.Current.RunMain(() => + { + 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 SaveNewEmail(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 = newEmail; - - bool flage = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ValidatorCode", false, checkCodePra); - if (flage == false) + //鎵ц缁戝畾 + var errorMsg = HdlAccountLogic.Current.BindAccount(this.newEmail, code); + if (errorMsg != null) { - //楠岃瘉鐮侀敊璇紝璇烽噸鏂拌緭鍏� - this.btnErrorMsg.Visible = true; - this.btnErrorMsg.TextID = R.MyInternationalizationString.uVerificationCodeErrorInputAgain; - return false; - } - - //鍙樻洿閭 - this.SaveNewEmail(); - return true; - } - - /// <summary> - /// 鍙樻洿閭 - /// </summary> - private void SaveNewEmail() - { - var pra = new SaveNewEmailPra(); - pra.Account = this.newEmail; - - bool flage = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/BindAccount", false, pra); - if (flage == false) - { - //缁戝畾閭澶辫触 - this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uBindEmailFail)); + this.ShowMassage(ShowMsgType.Tip, errorMsg); + //鍙互閲嶆柊鍙戦�侀獙璇佺爜 + this.canSendCode = true; return; } @@ -275,13 +253,13 @@ private void RefreshUserInfoForm() { //濡傛灉淇敼鐨勬槸璐﹀彿鐨勮瘽,鍒欓噸鏂扮櫥褰� - if (UserCenterResourse.UserInfo.Email == Shared.Common.Config.Instance.Account) + if (HdlUserCenterResourse.UserInfo.UserEmail == Shared.Common.Config.Instance.Account) { - UserCenterLogic.ReLoginAgain(this.newEmail); + HdlAccountLogic.Current.ReLoginAgain(this.newEmail); return; } - UserCenterResourse.UserInfo.Email = this.newEmail; + HdlUserCenterResourse.UserInfo.UserEmail = this.newEmail; this.CloseForm(); } @@ -313,67 +291,6 @@ } 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> - /// 鍥藉鍦板尯浠g爜锛屾墜鏈哄彿鍙戦�侀獙璇佺爜鏃朵娇鐢� - /// </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> - /// 鍥藉鍦板尯浠g爜锛屾墜鏈哄彿鍙戦�侀獙璇佺爜鏃朵娇鐢� - /// </summary> - public int AreaCode = 0; - } - - /// <summary> - /// 淇濆瓨鏂伴偖绠辩殑鍚姩鍙傛暟 - /// </summary> - private class SaveNewEmailPra - { - /// <summary> - /// 鏂扮敤鎴疯处鍙� - /// </summary> - public string Account = string.Empty; } #endregion -- Gitblit v1.8.0