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/CheckNewPhoneForm.cs | 168 ++++++++++++++------------------------------------------ 1 files changed, 42 insertions(+), 126 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewPhoneForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewPhoneForm.cs index ad42b58..0539ccc 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewPhoneForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewPhoneForm.cs @@ -23,6 +23,10 @@ /// 鏂版墜鏈�(闃叉鎭舵剰鍙樻洿) /// </summary> private string newPhone = string.Empty; + /// <summary> + /// 鑳藉惁鍙戦�侀獙璇佺爜 + /// </summary> + private bool canSendCode = true; #endregion @@ -74,20 +78,20 @@ //}; //杈撳叆妗� - 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); @@ -113,12 +117,8 @@ }; btnCodeControl.FinishInputEvent += (value) => { - //鏍¢獙楠岃瘉鐮� - if (this.CheckVerificationCode(value) == false) - { - //娓呯┖楠岃瘉鐮� - btnCodeControl.ClearInputValue(); - } + //缁戝畾鏂版墜鏈� + this.SaveNewPhoneNumber(btnCodeControl, value); }; //楠岃瘉鐮侀敊璇紝璇烽噸鏂拌緭鍏� @@ -177,16 +177,16 @@ /// </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; //璁板綍璧疯繖涓墜鏈�,闃叉鎭舵剰鍙樻洿 @@ -201,22 +201,12 @@ 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(() => @@ -227,57 +217,44 @@ } }, 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; } @@ -296,12 +273,12 @@ 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(); } @@ -332,67 +309,6 @@ 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> - /// 鍥藉鍦板尯浠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 SaveNewPhoneNumPra - { - /// <summary> - /// 鏂扮敤鎴疯处鍙� - /// </summary> - public string Account = string.Empty; } #endregion -- Gitblit v1.8.0