From fe3b2466c68b5db70d38e78039703add3b8b1dfe Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 31 十二月 2020 19:29:43 +0800 Subject: [PATCH] 合并了代码 --- ZigbeeApp/Shared/Phone/UserCenter/Password/ForgotAccountPasswordForm.cs | 763 ++++++++++++++++++---------------------------------------- 1 files changed, 234 insertions(+), 529 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Password/ForgotAccountPasswordForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Password/ForgotAccountPasswordForm.cs index 63eb329..e526f3d 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Password/ForgotAccountPasswordForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Password/ForgotAccountPasswordForm.cs @@ -1,5 +1,4 @@ -锘縰sing Shared.Common; -using System; +锘縰sing System; using System.Collections.Generic; using System.Text; @@ -13,446 +12,150 @@ #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> - /// 1锛氭墜鏈哄彿 2:閭 + /// 鏍囪鏄惁鑳藉鏍¢獙楠岃瘉鐮佷簡 /// </summary> - private int SelectIndex = 1; + private bool canCheckCode = false; /// <summary> - /// 褰撳墠鐨勮緭鍏ユ帶浠� 0:鎵嬫満鍙锋垨鑰呴偖绠� 1:楠岃瘉鐮� 2:绗竴娆″瘑鐮� 3:绗簩娆″瘑鐮� + /// 鎵嬫満鎴栬�呴偖绠� /// </summary> - private List<TextInputControl> ListNowInputControl = new List<TextInputControl> { null, null, null }; + private string strPhoneEmail = string.Empty; /// <summary> - /// 閿欒鎻愮ず鎺т欢 + /// 閿欒淇℃伅鎺т欢 /// </summary> - private NormalViewControl btnErrorMsg = null; - /// <summary> - /// 閲嶇疆鎸夐挳 - /// </summary> - private BottomClickButton btnReset = null; + private NormalViewControl btnMsgControl = null; #endregion #region 鈻� 鍒濆鍖朹____________________________ /// <summary> - /// 鐣岄潰鏄剧ず + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) /// </summary> public void ShowForm() { + //璁剧疆澶撮儴淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.ForgotPassword)); - //閲嶇疆鎸夐挳 - this.btnReset = new BottomClickButton(688); - btnReset.Y = Application.GetRealHeight(1290); - btnReset.TextID = R.MyInternationalizationString.ComfirmReset; - btnReset.oldBackgroundColor = UserCenterColor.Current.ClickButtonDefultColor; - bodyFrameLayout.AddChidren(btnReset); - btnReset.CanClick = false; - btnReset.ButtonClickEvent += (sender, e) => - { - //娉ㄥ唽鐢ㄦ埛 - this.ResetPassword(); - }; - - //鍑犱釜杈撳叆鎺т欢鐨勯泦鍚� - var listControl = new List<TextInputControl>(); - //鍒濆鍖栨墜鏈哄彿杈撳叆鎺т欢 - var framePhone = this.InitPhoneInputView(ref listControl); - //鍒濆鍖栭偖绠辫緭鍏ユ帶浠� - var frameEmail = this.InitEmailInputView(ref listControl); - - //閿欒鎻愮ずBtn - this.btnErrorMsg = new NormalViewControl(700, 58, true); - btnErrorMsg.X = Application.GetRealWidth(127); - btnErrorMsg.Y = Application.GetRealHeight(1060); - btnErrorMsg.TextColor = Common.ZigbeeColor.Current.GXCTextRed; - btnErrorMsg.IsBold = true; - bodyFrameLayout.AddChidren(btnErrorMsg); - - //閭,鎵嬫満鍙风殑鍒囨崲鎺т欢 - var sitchControl = new Login.Controls.PhoneEmailSelectControl(); - sitchControl.Y = Application.GetRealHeight(127); - bodyFrameLayout.AddChidren(sitchControl); - - sitchControl.SelectMenuEvent += (selectMenu) => - { - this.SelectIndex = selectMenu; - //鎵嬫満鍙� - if (this.SelectIndex == 1) - { - framePhone.Visible = true; - frameEmail.Visible = false; - //褰撳墠鐨勮緭鍏ユ帶浠� - ListNowInputControl[0] = listControl[0]; - ListNowInputControl[1] = listControl[1]; - ListNowInputControl[2] = listControl[2]; - } - //閭 - else if (this.SelectIndex == 2) - { - framePhone.Visible = false; - frameEmail.Visible = true; - //褰撳墠鐨勮緭鍏ユ帶浠� - ListNowInputControl[0] = listControl[3]; - ListNowInputControl[1] = listControl[4]; - ListNowInputControl[2] = listControl[5]; - } - //妫�娴嬫敞鍐屾寜閽殑鐘舵�� - this.CheckResetButtonStatu(); - }; - //鎵ц鍒濆鍖� - sitchControl.InitControl(ZigbeeColor.Current.GXCButtonBlackSelectedColor, HdlUserCenterResourse.UserInfo.UserPhone != string.Empty ? 1 : 2); - //鑿滃崟闄愬埗 - sitchControl.PhoneEnable = HdlUserCenterResourse.UserInfo.UserPhone != string.Empty; - sitchControl.EmailEnable = HdlUserCenterResourse.UserInfo.UserEmail != string.Empty; + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); } /// <summary> - /// 鍒濆鍖栨墜鏈哄彿杈撳叆鐨勭晫闈� + /// 鍒濆鍖栦腑閮ㄤ俊鎭� /// </summary> - /// <param name="listControl">鍑犱釜杈撳叆鎺т欢鐨勯泦鍚�</param> - /// <returns></returns> - private FrameLayout InitPhoneInputView(ref List<TextInputControl> listControl) + private void InitMiddleFrame() { - //鑳屾櫙妗� + //娓呯┖bodyFrame + this.ClearBodyFrame(); + var frameBack = new FrameLayout(); - frameBack.Y = Application.GetRealHeight(334); - frameBack.Height = Application.GetRealHeight(852); - frameBack.Width = Application.GetRealWidth(942); - frameBack.Gravity = Gravity.CenterHorizontal; - frameBack.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; - frameBack.Radius = (uint)Application.GetRealHeight(17); + frameBack.Height = Application.GetRealHeight(323); + frameBack.BackgroundColor = UserCenterColor.Current.White; bodyFrameLayout.AddChidren(frameBack); - //鎵嬫満鍙疯鐨勫鍣� - var framePhone = new FrameLayout(); - framePhone.X = Application.GetRealWidth(29); - framePhone.Y = Application.GetRealHeight(29); - framePhone.Width = Application.GetRealWidth(884); - framePhone.Height = Application.GetRealHeight(138); - frameBack.AddChidren(framePhone); - //鍦板尯鐮� - var btnAreaCode = new NormalViewControl(160, 92, true); - btnAreaCode.Gravity = Gravity.CenterVertical; - btnAreaCode.TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor; - btnAreaCode.Text = "+" + HdlUserCenterResourse.UserInfo.PhoneAreaCode; - btnAreaCode.TextAlignment = TextAlignment.Center; - framePhone.AddChidren(btnAreaCode); - //鎵嬫満鍙疯緭鍏ユ - var btnPhone = new NormalViewControl(600, 92, true); - btnPhone.X = Application.GetRealWidth(222); - btnPhone.Gravity = Gravity.CenterVertical; - btnPhone.Text = HdlUserCenterResourse.UserInfo.UserPhone; - btnPhone.TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor; - framePhone.AddChidren(btnPhone); - //鎵嬫満鍙疯緭鍏ユ鐨勫簳绾� - var btnPhoneLine = new NormalViewControl(framePhone.Width, HdlControlResourse.BottomLineHeight, false); - btnPhoneLine.BackgroundColor = UserCenterColor.Current.ButtomLine; - btnPhoneLine.Y = framePhone.Height - HdlControlResourse.BottomLineHeight; - framePhone.AddChidren(btnPhoneLine); + var rowPhone = new FrameRowControl(); + //鍙宠竟鍋忕Щ閲�->澧炲姞瀹藉害 + rowPhone.RightOffset = -ControlCommonResourse.XXLeft; + rowPhone.Y = Application.GetRealHeight(23); + rowPhone.Width = this.GetPictrueRealSize(628); + bodyFrameLayout.AddChidren(rowPhone); + //璇疯緭鍏ラ偖绠辨垨鎵嬫満鍙� + string phoneValue = string.IsNullOrEmpty(UserCenterResourse.UserInfo.Phone) == true ? string.Empty : "+" + UserCenterResourse.UserInfo.AreaCode + " " + UserCenterResourse.UserInfo.Phone; + var txtPhone = rowPhone.AddLeftCaption(string.IsNullOrEmpty(phoneValue) == true ? UserCenterResourse.UserInfo.Email : phoneValue, 600); + txtPhone.TextColor = UserCenterColor.Current.TextGrayColor2; + //搴曠嚎 + rowPhone.AddBottomLine(); + //褰撳墠閫夋嫨鐨勬柟寮� + this.strPhoneEmail = txtPhone.Text; - //楠岃瘉鐮佺殑瀹瑰櫒 - var frameCode = new FrameLayout(); - frameCode.X = Application.GetRealWidth(29); - frameCode.Y = Application.GetRealHeight(196); - frameCode.Width = framePhone.Width; - frameCode.Height = framePhone.Height; - frameBack.AddChidren(frameCode); - //楠岃瘉鐮佽緭鍏ユ - var txtCode = new TextInputControl(536, 92, true); - txtCode.X = Application.GetRealWidth(29); - txtCode.Gravity = Gravity.CenterVertical; - txtCode.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputVerificationCode); - txtCode.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor; - frameCode.AddChidren(txtCode); - listControl.Add(txtCode); + var rowCode = new FrameRowControl(); + rowCode.Y = rowPhone.Bottom + Application.GetRealHeight(20); + rowCode.Width = this.GetPictrueRealSize(628); + bodyFrameLayout.AddChidren(rowCode); + //璇疯緭鍏ラ獙璇佺爜 + var txtCode = rowCode.AddLeftInput("", 600); + txtCode.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputVerificationCode); + txtCode.TextChangeEventHandler += this.txtCodeValueChangedEvent; + //鑾峰彇楠岃瘉鐮� - var btnSendCode = new NormalViewControl(300, 127, true); - btnSendCode.X = frameCode.Width - Application.GetRealWidth(300); - btnSendCode.Gravity = Gravity.CenterVertical; - btnSendCode.TextID = R.MyInternationalizationString.SendVerificationCode; - btnSendCode.TextColor = ZigbeeColor.Current.GXCTextWhiteColor; - btnSendCode.TextAlignment = TextAlignment.Center; - btnSendCode.BackgroundColor = 0xFFFC744B; - btnSendCode.Radius = (uint)Application.GetRealHeight(12); - btnSendCode.IsBold = true; - frameCode.AddChidren(btnSendCode); - btnSendCode.ButtonClickEvent += (sender, e) => + var btnCode = new NormalViewControl(302, 127, true); + btnCode.X = rowPhone.Right + Application.GetRealWidth(35); + btnCode.Y = Application.GetRealHeight(23); + btnCode.RadiusEx = 12; + btnCode.TextID = R.MyInternationalizationString.uGetVerificationCode; + btnCode.TextColor = UserCenterColor.Current.White; + btnCode.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnCode.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(btnCode); + btnCode.ButtonClickEvent += (sender, e) => { //鍙戦�侀獙璇佺爜 - this.SendVerificationCode(btnSendCode); - }; - //鑾峰彇楠岃瘉鐮佺殑搴曠嚎 - var btnCodeLine = new NormalViewControl(Application.GetRealWidth(536), HdlControlResourse.BottomLineHeight, false); - btnCodeLine.BackgroundColor = UserCenterColor.Current.ButtomLine; - btnCodeLine.Y = frameCode.Height - HdlControlResourse.BottomLineHeight; - frameCode.AddChidren(btnCodeLine); - //鑱斿姩搴曠嚎 - txtCode.btnLine = btnCodeLine; - - //绗竴娆″瘑鐮佺殑瀹瑰櫒 - var framePswOne = new FrameLayout(); - framePswOne.X = Application.GetRealWidth(29); - framePswOne.Y = Application.GetRealHeight(363); - framePswOne.Width = framePhone.Width; - framePswOne.Height = framePhone.Height; - frameBack.AddChidren(framePswOne); - //绗竴娆″瘑鐮佺殑杈撳叆妗� - var txtPswOne = new TextInputControl(700, 92, true); - txtPswOne.X = Application.GetRealWidth(29); - txtPswOne.Gravity = Gravity.CenterVertical; - txtPswOne.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD); - txtPswOne.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor; - txtPswOne.SecureTextEntry = true; - framePswOne.AddChidren(txtPswOne); - listControl.Add(txtPswOne); - //绗竴娆″瘑鐮佸彲瑙嗗浘鏍� - var btnPswOneHiden = new IconViewControl(92); - btnPswOneHiden.X = Application.GetRealWidth(775); - btnPswOneHiden.Gravity = Gravity.CenterVertical; - btnPswOneHiden.SelectedImagePath = "Account/HidePwd.png"; - btnPswOneHiden.UnSelectedImagePath = "Account/UnhidePwd.png"; - btnPswOneHiden.IsSelected = true; - framePswOne.AddChidren(btnPswOneHiden); - btnPswOneHiden.ButtonClickEvent += (sender, e) => - { - btnPswOneHiden.IsSelected = !btnPswOneHiden.IsSelected; - txtPswOne.SecureTextEntry = btnPswOneHiden.IsSelected; - }; - //绗竴娆″瘑鐮佽緭鍏ユ鐨勫簳绾� - var btnPswOneLine = new NormalViewControl(framePswOne.Width, HdlControlResourse.BottomLineHeight, false); - btnPswOneLine.BackgroundColor = UserCenterColor.Current.ButtomLine; - btnPswOneLine.Y = framePswOne.Height - HdlControlResourse.BottomLineHeight; - framePswOne.AddChidren(btnPswOneLine); - //鑱斿姩搴曠嚎 - txtPswOne.btnLine = btnPswOneLine; - - //绗簩娆″瘑鐮佺殑瀹瑰櫒 - var framePswTwo = new FrameLayout(); - framePswTwo.X = Application.GetRealWidth(29); - framePswTwo.Y = Application.GetRealHeight(530); - framePswTwo.Width = framePhone.Width; - framePswTwo.Height = framePhone.Height; - frameBack.AddChidren(framePswTwo); - //绗簩娆″瘑鐮佺殑杈撳叆妗� - var txtPswTwo = new TextInputControl(700, 92, true); - txtPswTwo.X = Application.GetRealWidth(29); - txtPswTwo.Gravity = Gravity.CenterVertical; - txtPswTwo.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD); - txtPswTwo.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor; - txtPswTwo.SecureTextEntry = true; - framePswTwo.AddChidren(txtPswTwo); - listControl.Add(txtPswTwo); - //绗簩娆″瘑鐮佸彲瑙嗗浘鏍� - var btnPswTwoHiden = new IconViewControl(92); - btnPswTwoHiden.X = Application.GetRealWidth(775); - btnPswTwoHiden.Gravity = Gravity.CenterVertical; - btnPswTwoHiden.SelectedImagePath = "Account/HidePwd.png"; - btnPswTwoHiden.UnSelectedImagePath = "Account/UnhidePwd.png"; - btnPswTwoHiden.IsSelected = true; - framePswTwo.AddChidren(btnPswTwoHiden); - btnPswTwoHiden.ButtonClickEvent += (sender, e) => - { - btnPswTwoHiden.IsSelected = !btnPswTwoHiden.IsSelected; - txtPswTwo.SecureTextEntry = btnPswTwoHiden.IsSelected; - }; - //绗簩娆″瘑鐮佽緭鍏ユ鐨勫簳绾� - var btnPswTwoLine = new NormalViewControl(framePswTwo.Width, HdlControlResourse.BottomLineHeight, false); - btnPswTwoLine.BackgroundColor = UserCenterColor.Current.ButtomLine; - btnPswTwoLine.Y = framePswTwo.Height - HdlControlResourse.BottomLineHeight; - framePswTwo.AddChidren(btnPswTwoLine); - //鑱斿姩搴曠嚎 - txtPswTwo.btnLine = btnPswTwoLine; - - //楠岃瘉鐮佽緭鍏ュ彉鏇存椂 - txtCode.TextChangeEventHandler += (sender, value) => - { - //妫�娴嬫敞鍐屾寜閽殑鐘舵�� - this.CheckResetButtonStatu(); - }; - //瀵嗙爜杈撳叆鍙樻洿鏃� - txtPswOne.TextChangeEventHandler += (sender, value) => - { - //妫�娴嬫敞鍐屾寜閽殑鐘舵�� - this.CheckResetButtonStatu(); - }; - txtPswTwo.TextChangeEventHandler += (sender, value) => - { - //妫�娴嬫敞鍐屾寜閽殑鐘舵�� - this.CheckResetButtonStatu(); + this.SetVerificationCode(btnCode); }; - return frameBack; - } + //閿欒淇℃伅鎺т欢 + btnMsgControl = new NormalViewControl(800, 58, true); + btnMsgControl.X = ControlCommonResourse.XXLeft; + btnMsgControl.Y = rowCode.Bottom + Application.GetRealHeight(46); + btnMsgControl.TextColor = 0xfff75858; + btnMsgControl.TextID = R.MyInternationalizationString.uVerificationCodeErrorInputAgain; + bodyFrameLayout.AddChidren(btnMsgControl); + btnMsgControl.Visible = false; - /// <summary> - /// 鍒濆鍖栭偖绠辫緭鍏ョ殑鐣岄潰 - /// </summary> - /// <param name="listControl">鍑犱釜杈撳叆鎺т欢鐨勯泦鍚�</param> - /// <returns></returns> - private FrameLayout InitEmailInputView(ref List<TextInputControl> listControl) - { - //鑳屾櫙妗� - var frameBack = new FrameLayout(); - frameBack.Y = Application.GetRealHeight(334); - frameBack.Height = Application.GetRealHeight(852); - frameBack.Width = Application.GetRealWidth(942); - frameBack.Gravity = Gravity.CenterHorizontal; - frameBack.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; - frameBack.Radius = (uint)Application.GetRealHeight(17); - bodyFrameLayout.AddChidren(frameBack); - - //閭琛岀殑瀹瑰櫒 - var frameEmail = new FrameLayout(); - frameEmail.X = Application.GetRealWidth(29); - frameEmail.Y = Application.GetRealHeight(29); - frameEmail.Width = Application.GetRealWidth(884); - frameEmail.Height = Application.GetRealHeight(138); - frameBack.AddChidren(frameEmail); - //閭杈撳叆妗� - var btnEmail = new NormalViewControl(700, 92, true); - btnEmail.X = Application.GetRealWidth(29); - btnEmail.Gravity = Gravity.CenterVertical; - btnEmail.TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor; - btnEmail.Text = HdlUserCenterResourse.UserInfo.UserEmail; - frameEmail.AddChidren(btnEmail); - //閭杈撳叆妗嗙殑搴曠嚎 - var btnEmailLine = new NormalViewControl(frameEmail.Width, HdlControlResourse.BottomLineHeight, false); - btnEmailLine.BackgroundColor = UserCenterColor.Current.ButtomLine; - btnEmailLine.Y = frameEmail.Height - HdlControlResourse.BottomLineHeight; - frameEmail.AddChidren(btnEmailLine); - - //楠岃瘉鐮佺殑瀹瑰櫒 - var frameCode = new FrameLayout(); - frameCode.X = Application.GetRealWidth(29); - frameCode.Y = Application.GetRealHeight(196); - frameCode.Width = frameEmail.Width; - frameCode.Height = frameEmail.Height; - frameBack.AddChidren(frameCode); - //楠岃瘉鐮佽緭鍏ユ - var txtCode = new TextInputControl(536, 92, true); - txtCode.X = Application.GetRealWidth(29); - txtCode.Gravity = Gravity.CenterVertical; - txtCode.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputVerificationCode); - txtCode.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor; - frameCode.AddChidren(txtCode); - listControl.Add(txtCode); - //鑾峰彇楠岃瘉鐮� - var btnSendCode = new NormalViewControl(300, 127, true); - btnSendCode.X = frameCode.Width - Application.GetRealWidth(300); - btnSendCode.Gravity = Gravity.CenterVertical; - btnSendCode.TextID = R.MyInternationalizationString.SendVerificationCode; - btnSendCode.TextColor = ZigbeeColor.Current.GXCTextWhiteColor; - btnSendCode.TextAlignment = TextAlignment.Center; - btnSendCode.BackgroundColor = 0xFFFC744B; - btnSendCode.Radius = (uint)Application.GetRealHeight(12); - btnSendCode.IsBold = true; - frameCode.AddChidren(btnSendCode); - btnSendCode.ButtonClickEvent += (sender, e) => + if (string.IsNullOrEmpty(UserCenterResourse.UserInfo.Phone) == true + || string.IsNullOrEmpty(UserCenterResourse.UserInfo.Email) == true) { - //鍙戦�侀獙璇佺爜 - this.SendVerificationCode(btnSendCode); - }; - //鑾峰彇楠岃瘉鐮佺殑搴曠嚎 - var btnCodeLine = new NormalViewControl(Application.GetRealWidth(536), HdlControlResourse.BottomLineHeight, false); - btnCodeLine.BackgroundColor = UserCenterColor.Current.ButtomLine; - btnCodeLine.Y = frameCode.Height - HdlControlResourse.BottomLineHeight; - frameCode.AddChidren(btnCodeLine); - //鑱斿姩搴曠嚎 - txtCode.btnLine = btnCodeLine; + rowPhone.UseClickStatu = false; + return; + } - //绗竴娆″瘑鐮佺殑瀹瑰櫒 - var framePswOne = new FrameLayout(); - framePswOne.X = Application.GetRealWidth(29); - framePswOne.Y = Application.GetRealHeight(363); - framePswOne.Width = frameEmail.Width; - framePswOne.Height = frameEmail.Height; - frameBack.AddChidren(framePswOne); - //绗竴娆″瘑鐮佺殑杈撳叆妗� - var txtPswOne = new TextInputControl(700, 92, true); - txtPswOne.X = Application.GetRealWidth(29); - txtPswOne.Gravity = Gravity.CenterVertical; - txtPswOne.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD); - txtPswOne.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor; - txtPswOne.SecureTextEntry = true; - framePswOne.AddChidren(txtPswOne); - listControl.Add(txtPswOne); - //绗竴娆″瘑鐮佸彲瑙嗗浘鏍� - var btnPswOneHiden = new IconViewControl(92); - btnPswOneHiden.X = Application.GetRealWidth(775); - btnPswOneHiden.Gravity = Gravity.CenterVertical; - btnPswOneHiden.SelectedImagePath = "Account/HidePwd.png"; - btnPswOneHiden.UnSelectedImagePath = "Account/UnhidePwd.png"; - btnPswOneHiden.IsSelected = true; - framePswOne.AddChidren(btnPswOneHiden); - btnPswOneHiden.ButtonClickEvent += (sender, e) => + //鏄剧ず鍙互鍒囨崲閭->涓�涓彲浠ラ伄浣廈ody鐨勪笢瑗� + var frameTran = new FrameLayoutStatuControl(); + frameTran.UseClickStatu = false; + frameTran.BackgroundColor = UserCenterColor.Current.Transparent; + bodyFrameLayout.AddChidren(frameTran); + frameTran.Visible = false; + frameTran.ButtonClickEvent += (sender, e) => { - btnPswOneHiden.IsSelected = !btnPswOneHiden.IsSelected; - txtPswOne.SecureTextEntry = btnPswOneHiden.IsSelected; + frameTran.Visible = false; }; - //绗竴娆″瘑鐮佽緭鍏ユ鐨勫簳绾� - var btnPswOneLine = new NormalViewControl(framePswOne.Width, HdlControlResourse.BottomLineHeight, false); - btnPswOneLine.BackgroundColor = UserCenterColor.Current.ButtomLine; - btnPswOneLine.Y = framePswOne.Height - HdlControlResourse.BottomLineHeight; - framePswOne.AddChidren(btnPswOneLine); - //鑱斿姩搴曠嚎 - txtPswOne.btnLine = btnPswOneLine; + var frameList = new FrameLayout(); + frameList.X = ControlCommonResourse.XXLeft - Application.GetRealWidth(17); + frameList.Y = rowPhone.Bottom - ControlCommonResourse.BottomLineHeight - 1; + frameList.Width = this.GetPictrueRealSize(628); + frameList.Height = this.GetPictrueRealSize(176); + frameTran.AddChidren(frameList); + //鍔ㄧ敾鐢� + var frameAnimate = new FrameLayoutStatuControl(); + frameAnimate.UseClickStatu = false; + frameList.AddChidren(frameAnimate); - //绗簩娆″瘑鐮佺殑瀹瑰櫒 - var framePswTwo = new FrameLayout(); - framePswTwo.X = Application.GetRealWidth(29); - framePswTwo.Y = Application.GetRealHeight(530); - framePswTwo.Width = frameEmail.Width; - framePswTwo.Height = frameEmail.Height; - frameBack.AddChidren(framePswTwo); - //绗簩娆″瘑鐮佺殑杈撳叆妗� - var txtPswTwo = new TextInputControl(700, 92, true); - txtPswTwo.X = Application.GetRealWidth(29); - txtPswTwo.Gravity = Gravity.CenterVertical; - txtPswTwo.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD); - txtPswTwo.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor; - txtPswTwo.SecureTextEntry = true; - framePswTwo.AddChidren(txtPswTwo); - listControl.Add(txtPswTwo); - //绗簩娆″瘑鐮佸彲瑙嗗浘鏍� - var btnPswTwoHiden = new IconViewControl(92); - btnPswTwoHiden.X = Application.GetRealWidth(775); - btnPswTwoHiden.Gravity = Gravity.CenterVertical; - btnPswTwoHiden.SelectedImagePath = "Account/HidePwd.png"; - btnPswTwoHiden.UnSelectedImagePath = "Account/UnhidePwd.png"; - btnPswTwoHiden.IsSelected = true; - framePswTwo.AddChidren(btnPswTwoHiden); - btnPswTwoHiden.ButtonClickEvent += (sender, e) => + var btnPic = new PicViewControl(frameList.Width, frameList.Height, false); + btnPic.UnSelectedImagePath = "Item/ForgotPswList.png"; + frameAnimate.AddChidren(btnPic); + var btnEmail = new NormalViewControl(450, 58, true); + btnEmail.X = this.GetPictrueRealSize(46); + btnEmail.Y = this.GetPictrueRealSize(32); + btnEmail.TextColor = UserCenterColor.Current.TextGrayColor3; + btnEmail.Text = UserCenterResourse.UserInfo.Email; + frameAnimate.AddChidren(btnEmail); + frameAnimate.ButtonClickEvent += (sender, e) => { - btnPswTwoHiden.IsSelected = !btnPswTwoHiden.IsSelected; - txtPswTwo.SecureTextEntry = btnPswTwoHiden.IsSelected; - }; - //绗簩娆″瘑鐮佽緭鍏ユ鐨勫簳绾� - var btnPswTwoLine = new NormalViewControl(framePswTwo.Width, HdlControlResourse.BottomLineHeight, false); - btnPswTwoLine.BackgroundColor = UserCenterColor.Current.ButtomLine; - btnPswTwoLine.Y = framePswTwo.Height - HdlControlResourse.BottomLineHeight; - framePswTwo.AddChidren(btnPswTwoLine); - //鑱斿姩搴曠嚎 - txtPswTwo.btnLine = btnPswTwoLine; + frameTran.Visible = false; + string oldValue = txtPhone.Text; + txtPhone.Text = btnEmail.Text; + btnEmail.Text = oldValue; - //楠岃瘉鐮佽緭鍏ュ彉鏇存椂 - txtCode.TextChangeEventHandler += (sender, value) => - { - //妫�娴嬫敞鍐屾寜閽殑鐘舵�� - this.CheckResetButtonStatu(); + //褰撳墠閫夋嫨鐨勬柟寮� + this.strPhoneEmail = txtPhone.Text; }; - //瀵嗙爜杈撳叆鍙樻洿鏃� - txtPswOne.TextChangeEventHandler += (sender, value) => + rowPhone.ButtonClickEvent += (sender, e) => { - //妫�娴嬫敞鍐屾寜閽殑鐘舵�� - this.CheckResetButtonStatu(); + if (frameTran.Visible == false) + { + frameTran.Visible = true; + } }; - txtPswTwo.TextChangeEventHandler += (sender, value) => - { - //妫�娴嬫敞鍐屾寜閽殑鐘舵�� - this.CheckResetButtonStatu(); - }; - - return frameBack; } #endregion @@ -462,175 +165,177 @@ /// <summary> /// 鍙戦�侀獙璇佺爜 /// </summary> - /// <param name="control"></param> - private void SendVerificationCode(NormalViewControl control) + /// <param name="btnCode"></param> + private void SetVerificationCode(NormalViewControl btnCode) { - //妫�娴嬭緭鍏ョ殑璐﹀彿 - if (this.CheckInputAccount(1) == false) + string account = this.strPhoneEmail.StartsWith("+") == true ? UserCenterResourse.UserInfo.Phone : UserCenterResourse.UserInfo.Email; + var sendCodePra = new SendCodePra(); + sendCodePra.Account = account; + sendCodePra.AreaCode = Convert.ToInt32(UserCenterResourse.UserInfo.AreaCode); + bool flage = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ForgetPassword", false, sendCodePra); + if (flage == false) { return; } - //涓嶈兘鍐嶇偣鍑� - control.CanClick = false; - var errorMsg = string.Empty; - //鎵嬫満 - if (this.SelectIndex == 1) - { - errorMsg = HdlAccountLogic.Current.SendVeriCodeToPhone(HdlUserCenterResourse.UserInfo.PhoneAreaCode, HdlUserCenterResourse.UserInfo.UserPhone, VerCodeType.A鎵惧洖瀵嗙爜); - } - //閭 - else - { - errorMsg = HdlAccountLogic.Current.SendVeriCodeToEmail(HdlUserCenterResourse.UserInfo.UserEmail, VerCodeType.A鎵惧洖瀵嗙爜); - } - if (errorMsg == null) - { - //鍙戦�侀獙璇佺爜鎴愬姛锛岃娉ㄦ剰鏌ユ敹 - this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.SendVerificationCodeSuccess)); + //鍙互寮�濮嬫牎楠岄獙璇佺爜浜� + this.canCheckCode = true; + //鎺т欢涓嶈兘鍐嶆鎸変笅 + btnCode.CanClick = false; + btnCode.BackgroundColor = 0xfffebca9; + //?s鍚庨噸鍙� + string repeat = Language.StringByID(R.MyInternationalizationString.RepeatSend1); + //鏈夋晥鏃堕棿60绉� + int waitime = 60; + btnCode.Text = waitime + "s" + repeat; - control.BackgroundColor = UserCenterColor.Current.White; - control.TextColor = ZigbeeColor.Current.GXCTextBlackColor; - - //鍚姩鍊掕鏃� - HdlThreadLogic.Current.RunThread(() => + HdlThreadLogic.Current.RunThread(() => + { + while (this.Parent != null) { - //鍚庨噸鍙� - string txtValue = Language.StringByID(R.MyInternationalizationString.SendVerificationCodeAgain); - int timeOut = 60; - while (timeOut > 0 && control.Parent != null) + waitime--; + System.Threading.Thread.Sleep(1000); + if (waitime == 0) { HdlThreadLogic.Current.RunMain(() => { - control.Text = timeOut + "s" + txtValue; + if (btnCode != null) + { + //鑾峰彇楠岃瘉鐮� + btnCode.TextID = R.MyInternationalizationString.uGetVerificationCode; + //鎸夐敭鍙互鎸変笅 + btnCode.CanClick = true; + btnCode.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + } }); - timeOut--; - System.Threading.Thread.Sleep(1000); + break; } HdlThreadLogic.Current.RunMain(() => { - control.TextID = R.MyInternationalizationString.SendVerificationCode; - control.BackgroundColor = 0xFFFC744B; - control.TextColor = ZigbeeColor.Current.GXCTextWhiteColor; - control.CanClick = true; - }); - }); - return; - } - this.btnErrorMsg.Text = errorMsg; - control.CanClick = true; + if (btnCode != null) + { + btnCode.Text = waitime + "s" + repeat; + } + }, ShowErrorMode.NO); + } + }); } #endregion - #region 鈻� 閲嶇疆瀵嗙爜___________________________ + #region 鈻� 楠岃瘉鐮佷簨浠禵________________________ /// <summary> - /// 閲嶇疆瀵嗙爜 + /// 楠岃瘉鐮佷簨浠� /// </summary> - private void ResetPassword() + /// <param name="control"></param> + /// <param name="value"></param> + private void txtCodeValueChangedEvent(View control, string value) { - //妫�娴嬭緭鍏ョ殑璐﹀彿 - if (this.CheckInputAccount(2) == false) + if (btnMsgControl.Visible == true) + { + btnMsgControl.Visible = false; + } + + //楠岃瘉鐮侀暱搴� + int CodeLength = 6; + if (value.Length < CodeLength) { return; } - //涓嶈兘鍐嶇偣鍑� - this.btnReset.CanClick = false; - - var errorMsg = string.Empty; - //鎵嬫満 - if (this.SelectIndex == 1) + if (value.Length == CodeLength) { - errorMsg = HdlAccountLogic.Current.ResetPassword(HdlUserCenterResourse.UserInfo.UserPhone, ListNowInputControl[2].Text.Trim(), ListNowInputControl[0].Text.Trim()); - } - //閭 - else - { - errorMsg = HdlAccountLogic.Current.ResetPassword(HdlUserCenterResourse.UserInfo.UserEmail, ListNowInputControl[2].Text.Trim(), ListNowInputControl[0].Text.Trim()); - } - if (errorMsg == null) - { - //瀵嗙爜宸茬粡淇敼锛岃閲嶆柊鐧诲綍 - string msg = Language.StringByID(R.MyInternationalizationString.uPasswordIsHadChangedAndLoginAgain); - this.ShowMassage(ShowMsgType.Normal, msg, () => + //杩樹笉鑳芥娴嬮獙璇佺爜 + if (this.canCheckCode == false) { - //浠庢柊鐧诲綍 - HdlAccountLogic.Current.ReLoginAgain(Common.Config.Instance.Account); - }, Language.StringByID(R.MyInternationalizationString.Login)); - return; + btnMsgControl.Visible = true; + return; + } + var txtCode = (TextInputControl)control; + //缁堟浜嬩欢 + txtCode.TextChangeEventHandler -= this.txtCodeValueChangedEvent; + //楠岃瘉楠岃瘉鐮� + this.CheckVerificationCode(txtCode, value); } - this.btnErrorMsg.Text = errorMsg; - //鍙互鍐嶆鐐瑰嚮 - this.btnReset.CanClick = true; } #endregion - #region 鈻� 涓�鑸柟娉昣__________________________ + #region 鈻� 鏍¢獙楠岃瘉鐮乢________________________ /// <summary> - /// 妫�娴嬮噸缃寜閽殑鐘舵�� - /// </summary> - private void CheckResetButtonStatu() - { - this.btnErrorMsg.Text = string.Empty; - //鍙鏈変竴涓负绌�,鍒欓噸缃寜閽笉鍙敤 - if (this.ListNowInputControl[0].Text.Trim() == string.Empty - || this.ListNowInputControl[1].Text.Trim() == string.Empty - || this.ListNowInputControl[2].Text.Trim() == string.Empty) - { - this.btnReset.CanClick = false; - return; - } - - this.btnReset.CanClick = true; - } - - /// <summary> - /// 妫�娴嬭緭鍏ョ殑璐﹀彿 + /// 楠岃瘉楠岃瘉鐮� /// </summary> /// <returns></returns> - private bool CheckInputAccount(int div) + private void CheckVerificationCode(TextInputControl txtCode, string code) { - this.btnErrorMsg.Text = string.Empty; - //鎵嬫満 - if (this.SelectIndex == 1) + string account = this.strPhoneEmail.StartsWith("+") == true ? UserCenterResourse.UserInfo.Phone : UserCenterResourse.UserInfo.Email; + var checkCodePra = new CheckCodePra(); + checkCodePra.Code = code; + checkCodePra.Account = account; + + bool flage = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ValidatorCode", false, checkCodePra); + if (flage == false) { - if (HdlCheckLogic.Current.CheckPhoneNumber(HdlUserCenterResourse.UserInfo.UserPhone, CommonPage.PhoneZoneStr) == false) - { - this.btnErrorMsg.TextID = R.MyInternationalizationString.ThePhoneError; - return false; - } - } - //閭 - else - { - if (HdlCheckLogic.Current.CheckEmail(HdlUserCenterResourse.UserInfo.UserEmail) == false) - { - this.btnErrorMsg.TextID = R.MyInternationalizationString.TheEmailError; - return false; - } - } - if (div == 1) - { - //濡傛灉鏄彂閫侀獙璇佺爜,鍒欎笉闇�瑕佹娴嬪瘑鐮� - return true; + //楠岃瘉鐮侀敊璇紝璇烽噸鏂拌緭鍏� + this.btnMsgControl.Visible = true; + //浜嬩欢杩樺師 + txtCode.TextChangeEventHandler += this.txtCodeValueChangedEvent; + return; } - //鍏堝垽鏂�2娆″瘑鐮佽緭鍏ユ槸鍚︿竴鑷� - if (ListNowInputControl[1].Text != ListNowInputControl[2].Text) - { - this.btnErrorMsg.TextID = R.MyInternationalizationString.TwoPasswordInconsistency; - return false; - } - if (HdlCheckLogic.Current.CheckPwdLength(ListNowInputControl[2].Text.Trim()) == false) - { - this.btnErrorMsg.TextID = R.MyInternationalizationString.ThePWDLengthError; - return false; - } + var from = new ResetAccountPasswordForm(); + base.AddFromAndRemoveNowForm(from); + } - return true; + #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 = Convert.ToInt32(UserCenterResourse.UserInfo.AreaCode); } #endregion -- Gitblit v1.8.0