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/NewBindAccountPage.cs | 347 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 347 insertions(+), 0 deletions(-)
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindAccountPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindAccountPage.cs
new file mode 100644
index 0000000..8362af1
--- /dev/null
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindAccountPage.cs
@@ -0,0 +1,347 @@
+锘縰sing System;
+using Shared;
+using HDL_ON.UI.CSS;
+using System.Threading;
+using System.Text.RegularExpressions;
+using HDL_ON.DAL.Server;
+
+
+namespace HDL_ON.UI
+{
+ /// <summary>
+ /// 鏂扮粦瀹氭垨鑰呮崲缁�--鎵嬫満鎴栬�呴偖绠卞彂閫侀獙璇佺爜
+ /// </summary>
+ public partial class NewBindAccountPage : FrameLayout
+ {
+ FrameLayout bodyView;
+ Button btnBind;
+ EditText etContent;
+
+ /// <summary>
+ ///
+ /// </summary>
+ Action<string> action;
+
+ /// <summary>
+ /// 鏍囬ID
+ /// </summary>
+ int titleId;
+ /// <summary>
+ /// 鏄惁鎵嬫満
+ /// </summary>
+ bool isPhone;
+ /// <summary>
+ /// 鏄惁鎹㈢粦
+ /// </summary>
+ bool isModifyBind;
+ /// <summary>
+ /// 鎵嬫満鍖哄彿
+ /// </summary>
+ string phoneZoneCode = "86";
+
+ /// <summary>
+ ///
+ /// </summary>
+ public NewBindAccountPage()
+ {
+ bodyView = this;
+ }
+
+ /// <summary>
+ /// LoadPage
+ /// </summary>
+ /// <param name="act"></param>
+ /// <param name="isPhone">鏄惁缁戝畾鎵嬫満</param>
+ public void LoadPage(Action<string> act, bool isPhone = false, bool isModifyBind = false)
+ {
+ action = act;
+ this.isPhone = isPhone;
+ this.isModifyBind = isModifyBind;
+ if (isModifyBind)
+ {
+ //淇敼缁戝畾
+ titleId = isPhone ? StringId.EntryNewPhone : StringId.EntryNewEmail;
+ }
+ else
+ {
+ //鏂扮粦瀹�
+ titleId = isPhone ? StringId.BoundMobileInfo : StringId.BoundEmailInfo;
+ }
+
+
+ bodyView.BackgroundColor = CSS_Color.BackgroundColor;
+ new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView();
+
+ if (isPhone)
+ {
+ AddPhoneFrameLayout();
+ }
+ else
+ {
+ AddEmailFrameLayout();
+ }
+
+ //鐐瑰嚮鑾峰彇楠岃瘉鐮�
+ LoadEvent_GetVerification(btnBind);
+
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ void AddPhoneFrameLayout() {
+ #region 濡傛灉鏄墜鏈�
+ //鎵嬫満鍥藉鍖哄彿閫夋嫨鎸夐挳
+ ListCellView codeView = new ListCellView() {
+ Y = Application.GetRealHeight(64),
+ };
+ bodyView.AddChidren(codeView);
+ //璺宠浆鍥藉鍖哄彿閫夋嫨鐣岄潰
+ Action selectAction = () =>
+ {
+ JLCountrycode.CountryCodeView.Current.Show((countryName, code) => {
+ if (!string.IsNullOrEmpty(code))
+ {
+ phoneZoneCode = code;
+ codeView.BtnSubtitle.Text = "+" + phoneZoneCode;
+ }
+ });
+ };
+ codeView.GoAction = selectAction;
+ codeView.BtnTilte.Text = Language.StringByID(StringId.CountryOrRegion);
+ codeView.BtnSubtitle.Text = "+" + phoneZoneCode;
+
+ //鎵嬫満鍙疯緭鍏ユ
+ FrameLayout rowView = new FrameLayout()
+ {
+ Y = codeView.Bottom,
+ Height = Application.GetRealHeight(50),
+ BackgroundColor = CSS_Color.MainBackgroundColor,
+ };
+ bodyView.AddChidren(rowView);
+
+ //缁戝畾鎵嬫満鍙�
+ Button btnTitle = new Button()
+ {
+ X = Application.GetRealWidth(16),
+ Width = Application.GetRealWidth(180),
+ TextColor = CSS_Color.FirstLevelTitleColor,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ TextAlignment = TextAlignment.CenterLeft,
+ TextID = titleId,
+ };
+ rowView.AddChidren(btnTitle);
+
+ etContent = new EditText()
+ {
+ Width = Application.GetRealWidth(359),
+ TextColor = CSS_Color.PromptingColor1,
+ TextSize = CSS_FontSize.TextFontSize,
+ TextAlignment = TextAlignment.CenterRight,
+ Foucs = true
+ };
+ rowView.AddChidren(etContent);
+
+ btnBind = new Button()
+ {
+ Y = Application.GetRealHeight(213),
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(220),
+ Height = Application.GetRealWidth(44),
+ BackgroundColor = CSS_Color.MainColor,
+ TextAlignment = TextAlignment.Center,
+ TextColor = CSS_Color.MainBackgroundColor,
+ TextID = StringId.GetVerificationCode,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ IsBold = true,
+ Radius = (uint)Application.GetRealWidth(22),
+ BorderColor = 0x00000000,
+ BorderWidth = 0,
+ };
+ bodyView.AddChidren(btnBind);
+ #endregion
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ void AddEmailFrameLayout()
+ {
+ #region 濡傛灉鏄偖绠�
+ FrameLayout rowView = new FrameLayout()
+ {
+ Y = Application.GetRealHeight(72),
+ Height = Application.GetRealHeight(50),
+ BackgroundColor = CSS_Color.MainBackgroundColor,
+ };
+ bodyView.AddChidren(rowView);
+
+ //缁戝畾閭
+ Button btnTitle = new Button()
+ {
+ X = Application.GetRealWidth(16),
+ Width = Application.GetRealWidth(180),
+ TextColor = CSS_Color.FirstLevelTitleColor,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ TextAlignment = TextAlignment.CenterLeft,
+ TextID = titleId,
+ };
+ rowView.AddChidren(btnTitle);
+
+ etContent = new EditText()
+ {
+ Width = Application.GetRealWidth(359),
+ TextColor = CSS_Color.PromptingColor1,
+ TextSize = CSS_FontSize.TextFontSize,
+ TextAlignment = TextAlignment.CenterRight,
+ Foucs = true
+ };
+ rowView.AddChidren(etContent);
+
+ btnBind = new Button()
+ {
+ Y = Application.GetRealHeight(213),
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(220),
+ Height = Application.GetRealWidth(44),
+ BackgroundColor = CSS_Color.MainColor,
+ TextAlignment = TextAlignment.Center,
+ TextColor = CSS_Color.MainBackgroundColor,
+ TextID = StringId.GetVerificationCode,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ IsBold = true,
+ Radius = (uint)Application.GetRealWidth(22),
+ BorderColor = 0x00000000,
+ BorderWidth = 0,
+ };
+ bodyView.AddChidren(btnBind);
+ #endregion
+ }
+
+ }
+
+
+ //--------------------------------------------
+ public partial class NewBindAccountPage
+ {
+ /// <summary>
+ /// 鐐瑰嚮鑾峰彇楠岃瘉鐮�
+ /// </summary>
+ void LoadEvent_GetVerification(Button button)
+ {
+ button.MouseUpEventHandler = (sender, e) =>
+ {
+ if (button.Text == Language.StringByID(StringId.GetVerificationCode))
+ {
+ Application.HideSoftInput();
+ var account = etContent.Text.Trim();
+
+ //濡傛灉鏄崲缁戞娴嬫槸鍚︾浉鍚屽笎鍙�
+ if (isModifyBind)
+ {
+ if (isPhone)
+ {
+ if(account == UserInfo.Current.userMobileInfo)
+ {
+ //鎻愮ず鎹㈢粦甯愬彿鐩稿悓
+ Utlis.ShowTip(Language.StringByID(StringId.EntryNewPhone));
+ return;
+ }
+ }
+ else
+ {
+ if (account == UserInfo.Current.userEmailInfo)
+ {
+ //鎻愮ず鎹㈢粦甯愬彿鐩稿悓
+ Utlis.ShowTip(Language.StringByID(StringId.EntryNewEmail));
+ return;
+ }
+
+ }
+ }
+
+
+ #region 姝e垯琛ㄨ揪寮�
+ //1.妫�娴嬭处鍙锋槸鍚﹀悎娉�
+ if (!isPhone)
+ {
+ if (!Utlis.CheckEmail(account))
+ {
+ Utlis.ShowTip(Language.StringByID(StringId.PlsEntryCorrectEmailAddress));
+ return;
+ }
+ }
+ else
+ {
+ if (!Utlis.CheckPhoneNumber(account, phoneZoneCode))
+ {
+ Utlis.ShowTip(Language.StringByID(StringId.PlsEntryCorrectMobilNeumber));
+ return;
+ }
+ }
+ #endregion
+ int time = 0;
+ //2.妫�楠岄�氳繃
+ new Thread(() =>
+ {
+ //2.2 鑾峰彇楠岃瘉鐮�
+ ResponsePackNew resultObj;
+ if (!isPhone)//閭
+ {
+ resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, account);
+ }
+ else
+ {
+ resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, account, true, phoneZoneCode);
+ }
+
+ if (resultObj.Code != StateCode.SUCCESS)
+ {
+ // 鎻愮ず閿欒
+ IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code);
+ }
+ else
+ {
+ if (time == 0)
+ {
+ time = 60;
+ new Thread(() =>
+ {
+ while (time > 0)
+ {
+ time--;
+ Application.RunOnMainThread(() =>
+ {
+ button.Text = time.ToString() + "s";
+ });
+ Thread.Sleep(1000);
+ }
+ Application.RunOnMainThread(() =>
+ {
+ button.IsSelected = true;
+ button.TextID = StringId.GetVerificationCode;
+ button.BackgroundColor = CSS_Color.MainColor;
+ time = 0;
+ });
+ })
+ { IsBackground = true }.Start();
+ }
+ Application.RunOnMainThread(() =>
+ {
+ button.BackgroundColor = CSS_Color.PromptingColor1;
+ var vcp = new NewBindVerificationCodePage();
+ vcp.PhoneZoneCode = phoneZoneCode;
+ MainPage.BasePageView.AddChidren(vcp);
+ vcp.LoadPage(action, titleId, account, isPhone, time, isModifyBind);
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ });
+ }
+
+ })
+ { IsBackground = true }.Start();
+ }
+
+ };
+ }
+ }
+}
--
Gitblit v1.8.0