From 7153e420d66bce0a06b7e972ac3a5c34197fa2e5 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期三, 18 十一月 2020 20:02:13 +0800 Subject: [PATCH] 2020-11-18 1.修改完善手机绑定和解绑。 --- HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindVerificationCodePage.cs | 260 ++++++++++++++++++++++++++------------------------- 1 files changed, 132 insertions(+), 128 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/VerificationCodePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindVerificationCodePage.cs similarity index 75% copy from HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/VerificationCodePage.cs copy to HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindVerificationCodePage.cs index 5744a72..1ce3c56 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/VerificationCodePage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindVerificationCodePage.cs @@ -6,7 +6,10 @@ namespace HDL_ON.UI { - public partial class VerificationCodePage :FrameLayout + /// <summary> + /// 鏂扮粦瀹氭垨鑰呮崲缁�--楠岃瘉鐮侀獙璇佸苟缁戝畾 + /// </summary> + public partial class NewBindVerificationCodePage : FrameLayout { FrameLayout bodyView; @@ -33,34 +36,59 @@ Button btnResend; Action<string> action; + int titleId; - /// <summary> - /// 鎿嶄綔鐩爣绫诲瀷 1:閭锛�2:鎵嬫満 - /// </summary> - int optionType; + ///// <summary> + ///// 鎿嶄綔鐩爣绫诲瀷 1:閭锛�2:鎵嬫満 + ///// </summary> + //int optionType; /// <summary> /// 鍊掕鏃舵椂闂� /// </summary> int time = 0; - public VerificationCodePage() + /// <summary> + /// 鏄惁鎵嬫満 + /// </summary> + public bool isPhone; + /// <summary> + /// 鏄惁鎹㈢粦 + /// </summary> + public bool isModifyBind; + + /// <summary> + /// 鏂扮粦瀹氱殑璐﹀彿 + /// </summary> + public string verAccount; + /// <summary> + /// 鎵嬫満鍖哄彿 + /// </summary> + public string phoneZoneCode = "86"; + + + public NewBindVerificationCodePage() { bodyView = this; } - /// <summary> - /// + /// </summary> /// <param name="act">鍥炴帀鍑芥暟</param> /// <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) + /// <param name="account">璐﹀彿</param> + /// <param name="bPhone">鏄惁鎵嬫満</param> + /// <param name="t">鍊掕鏃舵椂闂�</param> + /// <param name="isModifyBind">鏄惁涓轰慨鏀圭粦瀹�</param> + public void LoadPage(Action<string> act, int tId, string account, bool bPhone, int t, bool isModifyBind) { action = act; titleId = tId; bodyView.BackgroundColor = CSS_Color.BackgroundColor; - optionType = ot; + isPhone = bPhone; time = t; + this.verAccount = account; + this.isModifyBind = isModifyBind; + + Action backAction = () => { Application.HideSoftInput(); }; @@ -260,7 +288,7 @@ //--------------------------------------------- - public partial class VerificationCodePage + public partial class NewBindVerificationCodePage { /// <summary> /// 楠岃瘉鐮佽緭鍏ュ彉鍖栦簨浠� @@ -490,17 +518,16 @@ { act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait)); }); - var verAccount = optionType == 1 ? MainPage.LoginUser.userEmailInfo : MainPage.LoginUser.userMobileInfo; - var isPhone = optionType == 2; - var resultObj = new HttpServerRequest().ValidatorCode(VerifyType.REGISTER_USER_SYSTEM, verAccount, etCode, isPhone); - if (resultObj.Code == StateCode.SUCCESS) + + var resultObj = new HttpServerRequest().BindAccount(verAccount, etCode, isPhone); + if (resultObj == StateCode.SUCCESS) { result = true; } else { //澶辫触鎻愮ず - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Verification_Check, resultObj.Code); + IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Member_BindWithAccount, resultObj); } Application.RunOnMainThread(() => { @@ -508,99 +535,9 @@ }); if (result) { - //Application.RunOnMainThread(() => - //{ - // new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.ValidationSuccessful), true); - //}); - //Thread.Sleep(1600); - Application.RunOnMainThread(() => - { - MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); - //MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1); - if (titleId == StringId.ModifyBindingEmail) - { - LoadEvent_SkipBindAccountInfoPage(StringId.BindEmail); - } - else if (titleId == StringId.ModifyBindingPhone) - { - LoadEvent_SkipBindAccountInfoPage(StringId.BindPhone); - } - else if (titleId == StringId.UnbindEmail)//瑙i櫎缁戝畾閭 - { - var account = ""; - new Thread(() => - { - var result2 = new DAL.Server.HttpServerRequest().BindAccount(account); - if (result2 == StateCode.SUCCESS) - { - Application.RunOnMainThread(() => - { - MainPage.LoginUser.userEmailInfo = account; - var page = new OperationResultDisPalyPage(); - page.Show(); - page.LoadPage(true, Language.StringByID(StringId.UnbindEmail), Language.StringByID(StringId.UnbindEmailSuccess), ""); - - for (int i = 0; i < 2; i++) - { - MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); - } - action(account); - }); - } - else - { - Application.RunOnMainThread(() => - { - new Tip() - { - CloseTime = 1, - Direction = AMPopTipDirection.None, - Text = Language.StringByID(StringId.OperationFailed), - }.Show(bodyView); - }); - } - }) - { IsBackground = true }.Start(); - } - else if (titleId == StringId.UnbindPhone) - { - var account = ""; - new Thread(() => - { - var result2 = new DAL.Server.HttpServerRequest().BindAccount(account); - if (result2 == StateCode.SUCCESS) - { - Application.RunOnMainThread(() => - { - MainPage.LoginUser.userEmailInfo = account; - var page = new OperationResultDisPalyPage(); - page.Show(); - page.LoadPage(true, Language.StringByID(StringId.UnbindPhone), Language.StringByID(StringId.UnbindPhoneSuccess), ""); - - for (int i = 0; i < 2; i++) - { - MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); - } - action(account); - }); - } - else - { - Application.RunOnMainThread(() => - { - new Tip() - { - CloseTime = 1, - Direction = AMPopTipDirection.None, - Text = Language.StringByID(StringId.OperationFailed), - }.Show(bodyView); - }); - } - }) - { IsBackground = true }.Start(); - - } - }); + //缁戝畾鎴愬姛 + BindSuccess(); + } }) { IsBackground = true }.Start(); @@ -609,6 +546,78 @@ } }; } + + /// <summary> + /// 缁戝畾鎴愬姛 + /// </summary> + void BindSuccess() + { + Application.RunOnMainThread(() => + { + var tipTitle = ""; + var tipMsg = ""; + if (isPhone) + { + MainPage.LoginUser.userMobileInfo = verAccount; + tipMsg = "璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP"; + if (isModifyBind) + { + //鐧诲綍鎵嬫満淇敼瀹屾垚 + tipTitle = "鐧诲綍鎵嬫満淇敼瀹屾垚"; + } + else + { + //鐧诲綍鎵嬫満缁戝畾瀹屾垚 + tipTitle = "鐧诲綍鎵嬫満缁戝畾瀹屾垚"; + } + } + else + { + MainPage.LoginUser.userEmailInfo = verAccount; + tipMsg = "璇蜂娇鐢ㄦ柊鐨勯偖绠辫处鍙风櫥褰旳PP"; + if (isModifyBind) + { + //鐧诲綍閭淇敼瀹屾垚 + tipTitle = "鐧诲綍閭淇敼瀹屾垚"; + } + else + { + //鐧诲綍閭缁戝畾瀹屾垚 + tipTitle = "鐧诲綍閭缁戝畾瀹屾垚"; + + } + } + + var page = new OperationResultDisPalyPage(); + page.Show(); + page.LoadPage(true, Language.StringByID(titleId), tipTitle, tipMsg); + + if (isModifyBind) + { + ClosePageWithCount(3); + } + else + { + ClosePageWithCount(2); + } + + action(verAccount); + }); + } + + /// <summary> + /// 鎸囧畾鍏抽棴椤甸潰涓暟 + /// </summary> + /// <param name="countPage"></param> + void ClosePageWithCount(int countPage) + { + //鍏抽棴澶氬皯涓〉闈� + for (int i = 0; i < countPage; i++) + { + MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); + } + } + /// <summary> /// 閲嶅彂楠岃瘉鐮佺瓑寰呯嚎绋� /// </summary> @@ -621,15 +630,18 @@ time = 60; new Thread(() => { - if (optionType == 1) + //2.2 鑾峰彇楠岃瘉鐮� + ResponsePackNew resultObj; + if (!isPhone)//閭 { - var resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, MainPage.LoginUser.userEmailInfo); + resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, verAccount); + } + else + { + resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, verAccount, true, phoneZoneCode); + } - } - else if (optionType == 2) - { - var resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, MainPage.LoginUser.userMobileInfo, true, MainPage.LoginUser.areaCode.ToString()); - } + }) { IsBackground = true }.Start(); } @@ -653,6 +665,7 @@ }) { IsBackground = true }.Start(); } + /// <summary> /// 閲嶅彂楠岃瘉鐮佷簨浠� /// </summary> @@ -662,15 +675,6 @@ LoadThread_SendVerCode(); }; } - /// <summary> - /// 璺宠浆缁戝畾璐﹀彿淇℃伅浜嬩欢 - /// </summary> - void LoadEvent_SkipBindAccountInfoPage(int skipTid) - { - var vcp = new BindAccountPage(); - MainPage.BasePageView.AddChidren(vcp); - vcp.LoadPage(action,skipTid); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - } + } } -- Gitblit v1.8.0