From e08a444a9d7acea0cf39f50d22d29179f6a59292 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 01 十二月 2020 09:37:11 +0800
Subject: [PATCH] 2020-12-1
---
HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindVerificationCodePage.cs | 306 +++++++++++++++++++++++++++------------------------
1 files changed, 162 insertions(+), 144 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 72%
copy from HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/VerificationCodePage.cs
copy to HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindVerificationCodePage.cs
index 858578d..3b501fe 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/VerificationCodePage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindVerificationCodePage.cs
@@ -2,10 +2,14 @@
using Shared;
using HDL_ON.UI.CSS;
using System.Threading;
+using HDL_ON.DAL.Server;
namespace HDL_ON.UI
{
- public partial class VerificationCodePage :FrameLayout
+ /// <summary>
+ /// 鏂扮粦瀹氭垨鑰呮崲缁�--楠岃瘉鐮侀獙璇佸苟缁戝畾
+ /// </summary>
+ public partial class NewBindVerificationCodePage : FrameLayout
{
FrameLayout bodyView;
@@ -31,41 +35,68 @@
Button btnResend;
+ Button btnTip;
+
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>
+ bool isPhone;
+ /// <summary>
+ /// 鏄惁鎹㈢粦
+ /// </summary>
+ bool isModifyBind;
+
+ /// <summary>
+ /// 鏂扮粦瀹氱殑璐﹀彿
+ /// </summary>
+ 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();
+ BackConfirmAction();
};
- new TopViewDiv(bodyView, Language.StringByID(tId)).LoadTopView(backAction);
+ new TopViewDiv(bodyView, Language.StringByID(tId), false).LoadTopView(backAction);
- Button btnTip = new Button()
+ btnTip = new Button()
{
Y = Application.GetRealHeight(64),
Height = Application.GetRealHeight(84),
@@ -237,7 +268,7 @@
Y = Application.GetRealHeight(276),
Gravity = Gravity.CenterHorizontal,
Width = Application.GetRealWidth(220),
- Height = Application.GetRealHeight(44),
+ Height = Application.GetRealWidth(44),
SelectedBackgroundColor = CSS_Color.MainColor,
BackgroundColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.Center,
@@ -259,7 +290,7 @@
//---------------------------------------------
- public partial class VerificationCodePage
+ public partial class NewBindVerificationCodePage
{
/// <summary>
/// 楠岃瘉鐮佽緭鍏ュ彉鍖栦簨浠�
@@ -489,36 +520,16 @@
{
act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait));
});
- var verAccount = optionType == 1 ? MainPage.LoginUser.userEmailInfo : MainPage.LoginUser.userMobileInfo;
- var response = new DAL.Server.HttpServerRequest().ValidatorCode(verAccount, etCode, MainPage.LoginUser.areaCode);
- if (response.StateCode.ToUpper() == "SUCCESS")
+
+ var resultObj = new HttpServerRequest().BindAccount(verAccount, etCode, isPhone);
+ if (resultObj == StateCode.SUCCESS)
{
result = true;
}
else
{
- string erorrInfo = "";
- switch (response.StateCode)
- {
- case "ValidCodeAndPhoneNoEqual"://楠岃瘉鐮侀敊璇�
- erorrInfo = Language.StringByID(StringId.VerificationCodeWrong);
- break;
- case "NoRecord":
- erorrInfo = Language.StringByID(StringId.PlsGetTheVerificationCode);
- break;
- default:
- erorrInfo = "Server error";
- break;
- }
- Application.RunOnMainThread(() =>
- {
- new Tip()
- {
- CloseTime = 1,
- Direction = AMPopTipDirection.None,
- Text = erorrInfo,
- }.Show(bodyView);
- });
+ //澶辫触鎻愮ず
+ IMessageCommon.Current.ShowErrorInfoAlter(resultObj);
}
Application.RunOnMainThread(() =>
{
@@ -526,99 +537,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 == "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 == "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();
@@ -627,6 +548,80 @@
}
};
}
+
+ /// <summary>
+ /// 缁戝畾鎴愬姛
+ /// </summary>
+ void BindSuccess()
+ {
+ Application.RunOnMainThread(() =>
+ {
+ var tipTitle = "";
+ var tipMsg = "";
+ if (isPhone)
+ {
+ UserInfo.Current.userMobileInfo = verAccount;
+ //璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP
+ tipMsg = Language.StringByID(StringId.PleaseLoginWithNewMobileAccount);
+ if (isModifyBind)
+ {
+ //鐧诲綍鎵嬫満淇敼瀹屾垚
+ tipTitle = Language.StringByID(StringId.LoginMobileAccountModificationCompleted);
+ }
+ else
+ {
+ //鐧诲綍鎵嬫満缁戝畾瀹屾垚
+ tipTitle = Language.StringByID(StringId.LoginMobileAccountBindCompleted);
+ }
+ }
+ else
+ {
+ UserInfo.Current.userEmailInfo = verAccount;
+ //璇蜂娇鐢ㄦ柊鐨勯偖绠辫处鍙风櫥褰旳PP
+ tipMsg = Language.StringByID(StringId.PleaseLoginWithNewEmailAccount);
+ if (isModifyBind)
+ {
+ //鐧诲綍閭淇敼瀹屾垚
+ tipTitle = Language.StringByID(StringId.LoginEmailAccountModificationCompleted);
+ }
+ else
+ {
+ //鐧诲綍閭缁戝畾瀹屾垚
+ tipTitle = Language.StringByID(StringId.LoginEmailAccountBindCompleted);
+
+ }
+ }
+
+ 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>
@@ -639,14 +634,18 @@
time = 60;
new Thread(() =>
{
- if (optionType == 1)
+ //2.2 鑾峰彇楠岃瘉鐮�
+ ResponsePackNew resultObj;
+ if (!isPhone)//閭
{
- var result = new DAL.Server.HttpServerRequest().GetLoginVerCode(MainPage.LoginUser.userEmailInfo);
+ resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, verAccount);
}
- else if (optionType == 2)
+ else
{
- var result = new DAL.Server.HttpServerRequest().GetLoginVerCode(MainPage.LoginUser.userMobileInfo);
+ resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, verAccount, true, PhoneZoneCode);
}
+
+
})
{ IsBackground = true }.Start();
}
@@ -670,6 +669,7 @@
})
{ IsBackground = true }.Start();
}
+
/// <summary>
/// 閲嶅彂楠岃瘉鐮佷簨浠�
/// </summary>
@@ -679,15 +679,33 @@
LoadThread_SendVerCode();
};
}
+
/// <summary>
- /// 璺宠浆缁戝畾璐﹀彿淇℃伅浜嬩欢
+ /// 杩斿洖浜屾纭浜嬩欢
/// </summary>
- void LoadEvent_SkipBindAccountInfoPage(int skipTid)
+ void BackConfirmAction()
{
- var vcp = new BindAccountPage();
- MainPage.BasePageView.AddChidren(vcp);
- vcp.LoadPage(action,skipTid);
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ //楠岃瘉鐮佸彂閫佹垚鍔燂紝浜屾纭閫�鍑�
+ if (btnTip.TextID == StringId.VerificationCodePrompt)
+ {
+ Action cancelAction = () =>
+ {
+ if (bodyView != null)
+ {
+ bodyView.RemoveFromParent();
+ }
+ };
+ new ConfirmDialog().ShowDialog(StringId.Tip, StringId.VerificationCodeMayBeDelayed, null, cancelAction, StringId.ReturnStr, StringId.WaitAMoment);
+ }
+ else
+ {
+ //鐩存帴鍏抽棴
+ if (bodyView != null)
+ {
+ bodyView.RemoveFromParent();
+ }
+ }
}
+
}
}
--
Gitblit v1.8.0