From acb2b278663952ce555b06a2e821f359225f15e0 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期五, 10 七月 2020 09:41:15 +0800 Subject: [PATCH] 备份 --- ZigbeeApp/Shared/Phone/UserCenter/Password/CheckOldPhoneForm.cs | 270 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 270 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckOldPhoneForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckOldPhoneForm.cs new file mode 100755 index 0000000..c7230fe --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckOldPhoneForm.cs @@ -0,0 +1,270 @@ +锘縰sing 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> + /// 鍥藉鍦板尯浠g爜锛屾墜鏈哄彿鍙戦�侀獙璇佺爜鏃朵娇鐢� + /// </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> + /// 鍥藉鍦板尯浠g爜锛屾墜鏈哄彿鍙戦�侀獙璇佺爜鏃朵娇鐢� + /// </summary> + public int AreaCode = 0; + } + + #endregion + } +} -- Gitblit v1.8.0