From 0f2e0147e8990e913d16d99bc1b94fb6bc53abd7 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期四, 03 十二月 2020 15:35:42 +0800
Subject: [PATCH] 2020-12-03-1

---
 HDL_ON/UI/UI1-Login/LoginPage.cs |  228 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 216 insertions(+), 12 deletions(-)

diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs
index d50aa67..4051d39 100644
--- a/HDL_ON/UI/UI1-Login/LoginPage.cs
+++ b/HDL_ON/UI/UI1-Login/LoginPage.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using System.Text.RegularExpressions;
 using System.Threading;
 using HDL_ON.DAL.Server;
 using HDL_ON.UI.CSS;
@@ -142,11 +143,25 @@
         HttpServerRequest pm;
         #endregion
 
+        string verAccount = "";
+
+        /// <summary>
+        /// 
+        /// </summary>
+        string registerPhone;
+        string registerEmail;
+        /// <summary>
+        /// 鎵嬫満鍖哄彿
+        /// </summary>
+        string phoneZoneCode = "86";
+
         /// <summary>
         /// 鍔犺浇瑙嗗浘
         /// </summary>
-        public void LoadView(string account = "")
+        public void LoadView(UserInfo userInfo = null)
         {
+            Language.CurrentLanguage = "Chinese";
+
             var btnIcon = new Button()
             {
                 X = Application.GetRealWidth(28),
@@ -170,7 +185,7 @@
             btnIcon.MouseUpEventHandler += (sender, e) =>
             {
 #if DEBUG
-                etAccount.Text = "464027401@qq.com";
+                etAccount.Text = "464027401@qq.com"; //"2791308028@qq.com";// 
                 etPassword.Text = "qqqqqq";
                 btnLogin.IsSelected = true;
 #endif
@@ -192,7 +207,7 @@
 
             btnEmailLogin = new Button()
             {
-                X = btnPhoneLogin.Right,
+                X = btnPhoneLogin.Right + Application.GetRealWidth(20),
                 Y = Application.GetRealHeight(177),
                 Width = Application.GetRealWidth(100),
                 Height = Application.GetRealHeight(40),
@@ -219,11 +234,29 @@
                 Width = Application.GetRealWidth(65),
                 TextAlignment = TextAlignment.Center,
                 TextColor = CSS_Color.FirstLevelTitleColor,
-                Text = "+86",
+                Text = "+" + phoneZoneCode,
                 TextSize = CSS_FontSize.TextFontSize,
+                Enable = true,
             };
+
+            //璺宠浆鍥藉鍖哄彿閫夋嫨鐣岄潰
+            EventHandler<MouseEventArgs> eHandler = (sender, e) =>
+            {
+                JLCountrycode.CountryCodeView.Current.Show((countryName, code) =>
+                {
+                    if (!string.IsNullOrEmpty(code))
+                    {
+                        phoneZoneCode = code;
+                        btnGlobalRoaming.Text = "+" + phoneZoneCode;
+                    }
+                });
+            };
+            btnGlobalRoaming.MouseUpEventHandler += eHandler;
+
             if (loginType == 0)
+            {
                 accountView.AddChidren(btnGlobalRoaming);
+            }
 
             btnDividingLineVertical_AccountView = new Button()
             {
@@ -247,9 +280,10 @@
             };
             accountView.AddChidren(etAccount);
 
-            if (account != "")
+            if (userInfo != null)
             {
-                etAccount.Text = account;
+                registerEmail = userInfo.userEmailInfo;
+                etAccount.Text = registerPhone = userInfo.userMobileInfo;
             }
 
             btnAccountViewBottomLine = new Button()
@@ -259,7 +293,6 @@
                 Height = Application.GetRealHeight(1),
             };
             accountView.AddChidren(btnAccountViewBottomLine);
-
 
             btnAccountIcon = new Button()
             {
@@ -363,8 +396,11 @@
                 SelectedTextColor = CSS_Color.MainColor,
                 TextAlignment = TextAlignment.CenterRight,
                 TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-                TextColor = CSS_Color.FirstLevelTitleColor,
+                TextColor = CSS_Color.PromptingColor1,
+                Visible = false,
+                IsSelected = false,
             };
+            passwordView.AddChidren(btnGetVerificationCode);
             #endregion
 
             btnPasswordViewBottomLine = new Button()
@@ -377,7 +413,6 @@
             passwordView.AddChidren(btnPasswordViewBottomLine);
 
             #endregion
-
 
             #region 娉ㄥ唽涓庡揩鎹风櫥褰�
             btnRegister = new Button()
@@ -413,8 +448,8 @@
                 Gravity = Gravity.CenterHorizontal,
                 Y = Application.GetRealHeight(403),
                 Width = Application.GetRealWidth(220),
-                Height = Application.GetRealHeight(44),
-                Radius = (uint)Application.GetRealHeight(22),
+                Height = Application.GetRealWidth(44),
+                Radius = (uint)Application.GetRealWidth(22),
                 SelectedBackgroundColor = CSS_Color.MainColor,
                 BackgroundColor = CSS_Color.PromptingColor1,
                 TextID = StringId.Login,
@@ -424,9 +459,178 @@
             };
             bodyView.AddChidren(btnLogin);
 
-
             LoadEventList();
             account = etAccount.Text.Trim();
+
+#if DEBUG1211
+            //鏈湴妯″紡
+            Button btnLocalMode = new Button()
+            {
+                Y = Application.GetRealHeight(600),
+                Height = Application.GetRealHeight(67),
+                Text = "Local Mode",
+                TextAlignment = TextAlignment.Center,
+                BackgroundColor  = CSS_Color.MainColor,
+                TextColor = CSS_Color.TextualColor,
+            };
+            bodyView.AddChidren(btnLocalMode);
+
+            btnLocalMode.MouseUpEventHandler = (sender, e) =>
+            {
+                MainPage.LocalMode = true;
+                 UserInfo.Current = new UserInfo();
+                MainPage.GoUserPage();
+            };
+
+            MainPage.Log("etAccount.TextAlignment : " + etAccount.TextAlignment.ToString());
+
+#endif
+
+            #region 闅愮鏀跨瓥
+            AddServiceAgreementControl(bodyView);
+            #endregion
+
         }
+
+        #region 鈻� 鏈嶅姟鍗忚___________________________
+        bool isAgreePrivacyPolicy = false;
+        /// <summary>
+        /// 娣诲姞鏈嶅姟鍗忚鎺т欢
+        /// </summary>
+        /// <param name="frameBack"></param>
+        private void AddServiceAgreementControl(FrameLayout frameLayout)
+        {
+            isAgreePrivacyPolicy = UserInfo.Current.isAgreePrivacyPolicy;
+            var frameRow = new FrameLayout()
+            {
+                Height = Application.GetRealHeight(28),
+                Y = Application.GetRealHeight(628),
+            };
+            frameLayout.AddChidren(frameRow);
+
+            //鍚屾剰鎸夐挳鑳屾櫙
+            var agreeView = new FrameLayout()
+            {
+                Height = Application.GetRealHeight(28),
+                Width = Application.GetRealWidth(28),
+                X = Application.GetRealWidth(82),
+            };
+            frameRow.AddChidren(agreeView);
+            //鍚屾剰鍥炬爣鎸夐挳
+            var agreeBtn = new Button()
+            {
+                Width = Application.GetMinRealAverage(28),
+                Height = Application.GetMinRealAverage(28),
+                UnSelectedImagePath = "Public/ChooseIcon.png",
+                SelectedImagePath = "Public/ChooseOnIcon.png",
+                IsSelected = isAgreePrivacyPolicy,
+                Gravity = Gravity.Center
+            };
+            agreeView.AddChidren(agreeBtn);
+
+            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
+            {
+                isAgreePrivacyPolicy = !isAgreePrivacyPolicy;
+                agreeBtn.IsSelected = isAgreePrivacyPolicy;
+                UserInfo.Current.isAgreePrivacyPolicy = isAgreePrivacyPolicy;
+                UserInfo.Current.SaveUserInfo();
+            };
+
+            agreeBtn.MouseUpEventHandler = eventHandler;
+            agreeView.MouseUpEventHandler = eventHandler;
+
+            //int btnWidth = 0;
+            //鍚屾剰鏂囨湰
+            var agreeTextBtn = new TextButton()
+            {
+                X = agreeView.Right,
+                Width = Application.GetRealWidth(28),
+                Height = Application.GetRealHeight(28),
+                TextColor = CSS_Color.TextualColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                TextID = StringId.Agree
+            };
+            frameRow.AddChidren(agreeTextBtn);
+            agreeTextBtn.Width = Utlis.GetRealWidthByTextButton(agreeTextBtn);
+
+            //鐢ㄦ埛鍗忚鎸夐挳
+            var userAgreementBtn = new TextButton()
+            {
+                X = agreeTextBtn.Right,
+                Width = Application.GetRealWidth(28),
+                Height = Application.GetRealHeight(28),
+                TextColor = CSS_Color.MainColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                Text = "銆�" + Language.StringByID(StringId.UserAgreement) + "銆�"
+            };
+            frameRow.AddChidren(userAgreementBtn);
+            userAgreementBtn.Width = Utlis.GetRealWidthByTextButton(userAgreementBtn);
+
+            //鍜屾枃鏈�
+            var andTextBtn = new TextButton()
+            {
+                X = userAgreementBtn.Right,
+                Width = Application.GetRealWidth(28),
+                Height = Application.GetRealHeight(28),
+                TextColor = CSS_Color.TextualColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                TextID = StringId.And
+            };
+            frameRow.AddChidren(andTextBtn);
+            andTextBtn.Width = Utlis.GetRealWidthByTextButton(andTextBtn);
+
+            //闅愮鏀跨瓥鎸夐挳
+            var privacyPolicyBtn = new TextButton()
+            {
+                X = andTextBtn.Right,
+                Width = Application.GetRealWidth(28),
+                Height = Application.GetRealHeight(28),
+                TextColor = CSS_Color.MainColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                Text = "銆�" + Language.StringByID(StringId.PrivacyPolicy) + "銆�"
+            };
+            frameRow.AddChidren(privacyPolicyBtn);
+            privacyPolicyBtn.Width = Utlis.GetRealWidthByTextButton(privacyPolicyBtn);
+
+            //鎵撳紑鐢ㄦ埛鍗忚
+            userAgreementBtn.MouseUpEventHandler = (sender, e) =>
+            {
+                OpenWebViewPage(false);
+            };
+
+            //鎵撳紑闅愮鏀跨瓥
+            privacyPolicyBtn.MouseUpEventHandler = (sender, e) =>
+            {
+                OpenWebViewPage(true);
+            };
+        }
+
+        /// <summary>
+        /// OpenWebViewPage
+        /// </summary>
+        /// <param name="isOpenPrivacyPolicy">鏄惁闅愮鏀跨瓥</param>
+        private void OpenWebViewPage(bool isOpenPrivacyPolicy)
+        {
+            string url = isOpenPrivacyPolicy ? Constant.URL_PRIVACYPOLICY : Constant.URL_USERAGREEMENT;
+            string titleStr = isOpenPrivacyPolicy ? Language.StringByID(StringId.PrivacyPolicy) : Language.StringByID(StringId.UserAgreement);
+            new WebViewDialog().LoadPage(titleStr, url);
+        }
+
+        /// <summary>
+        /// 妫�娴嬮殣绉佸崗璁�
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckPrivacyPolicy()
+        {
+            if (isAgreePrivacyPolicy == false)
+            {
+                //璇峰悓鎰忋�婄敤鎴峰崗璁�嬪拰銆婇殣绉佹斂绛栥��
+                Utlis.ShowTip(Language.StringByID(StringId.PleaseReadAndAgreePrivacyPolicyMsg));
+                return false;
+            }
+            return true;
+        }
+
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0