From c44b10e4447e84dbdfa9105edf460ef364a8f2b3 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 30 十一月 2020 19:53:35 +0800
Subject: [PATCH] Merge branch 'master' into WJC

---
 HDL_ON/UI/UI1-Login/RegisterPage.cs |  212 +++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 148 insertions(+), 64 deletions(-)

diff --git a/HDL_ON/UI/UI1-Login/RegisterPage.cs b/HDL_ON/UI/UI1-Login/RegisterPage.cs
index 4f30528..1cc2e76 100644
--- a/HDL_ON/UI/UI1-Login/RegisterPage.cs
+++ b/HDL_ON/UI/UI1-Login/RegisterPage.cs
@@ -27,6 +27,36 @@
         /// 閫夋嫨閭鐧诲綍鎸夐挳
         /// </summary>
         Button btnEmailLogin;
+        #region 鏈嶅姟鍣ㄩ�夋嫨
+        /// <summary>
+        /// 鏈嶅姟鍣ㄥ尯鍩�
+        /// </summary>
+        FrameLayout serverView;
+        /// <summary>
+        /// 鏈嶅姟鍣↖con鎸夐挳
+        /// </summary>
+        Button btnServerIcon;
+        /// <summary>
+        /// 鏈嶅姟鍣ㄦ枃鏈
+        /// </summary>
+        Button btnServerText;
+        ///// <summary>
+        ///// 鏈嶅姟鍣ㄦ枃鏈
+        ///// </summary>
+        //EditText etServer;
+        ///// <summary>
+        ///// 鏈嶅姟鍣ㄥ瓙鍖哄煙閲岄潰鐨勫垎鍓茬嚎1
+        ///// </summary>
+        //Button btnLineVertical_server;
+        /// <summary>
+        ///鏈嶅姟鍣╣o鎸夐挳
+        /// </summary>
+        Button btnServerGo;
+        /// <summary>
+        /// 鏈嶅姟鍣ㄥ瓙鍖哄煙搴曢儴妯嚎
+        /// </summary>
+        Button btnServerBottomLine;
+        #endregion
         /// <summary>
         /// 璐﹀彿瀛愬尯鍩�
         /// </summary>
@@ -164,6 +194,14 @@
         /// 1:閭
         /// </summary>
         int registerType;
+        /// <summary>
+        /// 鎵嬫満鍖哄彿
+        /// </summary>
+        string phoneZoneCode = "86";
+        /// <summary>
+        /// 鏄惁閫夋嫨杩囨湇鍔″櫒
+        /// </summary>
+        bool isSelectServer;
 
         string registerPhone;
         string registerEmail;
@@ -223,11 +261,66 @@
             bodyView.AddChidren(btnEmailLogin);
             #endregion
 
+            #region 鏈嶅姟鍣ㄩ�夋嫨
+            serverView = new FrameLayout()
+            {
+                X = Application.GetRealWidth(28),
+                Y = Application.GetRealHeight(167),
+                Width = Application.GetRealWidth(319),
+                Height = Application.GetRealHeight(44),
+            };
+            bodyView.AddChidren(serverView);
+
+            btnServerIcon = new Button()
+            {
+                X = Application.GetRealWidth(9),
+                Gravity = Gravity.CenterVertical,
+                Width = Application.GetMinRealAverage(20),
+                Height = Application.GetMinRealAverage(20),
+                UnSelectedImagePath = "LoginIcon/Server.png",
+
+            };
+            serverView.AddChidren(btnServerIcon);
+
+            btnServerText = new Button()
+            {
+                X = Application.GetRealWidth(49),
+                Width = Application.GetRealWidth(319 - 78),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextColor = CSS_Color.PromptingColor1,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextID = StringId.PleaseSelectCountryOrRegion,
+            };
+            serverView.AddChidren(btnServerText);
+
+            #region 瀵嗙爜鐧诲綍-鎺т欢鍔犺浇
+            btnServerGo = new Button()
+            {
+                X = Application.GetRealWidth(303),
+                Gravity = Gravity.CenterVertical,
+                Width = Application.GetMinRealAverage(16),
+                Height = Application.GetMinRealAverage(16),
+                UnSelectedImagePath = "Public/Right.png",
+            };
+            serverView.AddChidren(btnServerGo);
+
+            #endregion
+            btnServerBottomLine = new Button()
+            {
+                Y = Application.GetRealHeight(42),
+                BackgroundColor = CSS_Color.DividingLineColor,
+                SelectedBackgroundColor = CSS_Color.MainColor,
+                Height = Application.GetRealHeight(1),
+            };
+            serverView.AddChidren(btnServerBottomLine);
+            #endregion
+
+            int topPadding = Application.GetRealHeight(12);
             #region 璐﹀彿濉啓
             accountView = new FrameLayout()
             {
                 X = Application.GetRealWidth(28),
-                Y = Application.GetRealHeight(167),
+                Y = serverView.Bottom + topPadding,
                 Width = Application.GetRealWidth(319),
                 Height = Application.GetRealHeight(44),
             };
@@ -239,9 +332,22 @@
                 X = Application.GetRealWidth(9),
                 TextAlignment = TextAlignment.CenterLeft,
                 TextColor = CSS_Color.FirstLevelTitleColor,
-                Text = "+86",
+                Text = "+" + phoneZoneCode,
                 TextSize = CSS_FontSize.TextFontSize,
             };
+
+            //璺宠浆鍥藉鍖哄彿閫夋嫨鐣岄潰
+            EventHandler<MouseEventArgs> eHandler = (sender, e) => {
+                JLCountrycode.CountryCodeView.Current.Show((countryName, code) => {
+                    if (!string.IsNullOrEmpty(code))
+                    {
+                        phoneZoneCode = code;
+                        btnGlobalRoaming.Text = "+" + phoneZoneCode;
+                    }
+                });
+            };
+            btnGlobalRoaming.MouseUpEventHandler += eHandler;
+
             if (accountType == 0)
             {
                 accountView.AddChidren(btnGlobalRoaming);
@@ -266,6 +372,7 @@
                 TextSize = CSS_FontSize.TextFontSize,
                 PlaceholderTextColor = CSS_Color.PromptingColor1,
                 PlaceholderText = Language.StringByID(StringId.PlsEntryPhoneNumber),
+                IsNumberKeyboardType = true
             };
             accountView.AddChidren(etAccount);
 
@@ -295,7 +402,7 @@
             passwordView = new FrameLayout()
             {
                 X = Application.GetRealWidth(28),
-                Y = Application.GetRealHeight(223),
+                Y = accountView.Bottom + topPadding,
                 Width = Application.GetRealWidth(319),
                 Height = Application.GetRealHeight(44),
             };
@@ -361,7 +468,7 @@
             repeatPasswordView = new FrameLayout()
             {
                 X = Application.GetRealWidth(28),
-                Y = Application.GetRealHeight(279),
+                Y = passwordView.Bottom + topPadding,
                 Width = Application.GetRealWidth(319),
                 Height = Application.GetRealHeight(44),
             };
@@ -429,7 +536,8 @@
             verificationCodeView = new FrameLayout()
             {
                 X = Application.GetRealWidth(28),
-                Y = Application.GetRealHeight(335),
+                Y = repeatPasswordView.Bottom + topPadding,
+                //Y = Application.GetRealHeight(335),
                 Width = Application.GetRealWidth(319),
                 Height = Application.GetRealHeight(44),
             };
@@ -506,10 +614,11 @@
             btnRegister = new Button()
             {
                 Gravity = Gravity.CenterHorizontal,
-                Y = Application.GetRealHeight(421),
+                Y = verificationCodeView.Bottom + Application.GetRealHeight(42),
+                //Y = Application.GetRealHeight(421),
                 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.Register,
@@ -660,51 +769,39 @@
             var result = false;
             //璋冪敤鐧诲綍鎺ュ彛
             var loginResult = pm.LoginByPassword(account, password);
-            if (loginResult.StateCode.ToUpper() == "SUCCESS")
+            if (loginResult.Code == StateCode.SUCCESS)
             {
-                var loginDataStr = Newtonsoft.Json.Linq.JObject.FromObject(loginResult.ResponseData);
+                var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(loginResult.Data.ToString());
+                // UserInfo.Current = new UserInfo
+                //{
+                //    userType = revertData.userType,
+                //    accountString = account,
+                //    password = password,
+                //    lastTime = DateTime.Now,
+                //    ID = revertData.userId,
+                //    loginTokenString = revertData.headerPrefix + revertData.accessToken,
+                //    refreshToken = revertData.refreshToken,
+                //    userName = revertData.name
+                //};
+                UserInfo.Current.userType = revertData.userType;
+                UserInfo.Current.AccountString = account;
+                //UserInfo.Current.password = password;
+                UserInfo.Current.LastTime = DateTime.Now;
+                UserInfo.Current.ID = revertData.userId;
+                UserInfo.Current.LoginTokenString = revertData.headerPrefix + revertData.accessToken;
+                UserInfo.Current.RefreshToken = revertData.refreshToken;
+                UserInfo.Current.userName = revertData.name;
 
-                //璁板綍鐢ㄦ埛鏁版嵁
-                MainPage.LoginUser = new UserInfo
-                {
-                    ID = (int)loginDataStr.GetValue("UserID"),
-                    masterID = (int)loginDataStr.GetValue("MainUserID"),
-                    accountType = (int)loginDataStr.GetValue("UserType"),
-                    accountString = account,
-                    password = password,
-                    lastTime = DateTime.Now,
-                    userName = loginDataStr.GetValue("Remark").ToString(),
-                };
-                MainPage.LoginUser.SaveUserInfo();
+                UserInfo.Current.SaveUserInfo();
                 MainPage.Log("鐧诲綍鎴愬姛銆�");
                 result = true;
-
-
             }
-            //鐧诲綍澶辫触
             else
             {
-                string tipStr = "Sever erorr";
-                switch (loginResult.StateCode)
-                {
-                    case "USERNAMEORPWDERROR":
-                        tipStr = Language.StringByID(StringId.LoginFailed_AccountOrPasswordError);
-                        break;
-                    case "Self:Net_Error":
-                        tipStr = Language.StringByID(StringId.NetworkAnomaly);
-                        break;
-                }
-                //璐﹀彿鎴栬�呭瘑鐮侀敊璇�
+                //鐧诲綍澶辫触
+                IMessageCommon.Current.ShowErrorInfoAlter(loginResult.Code);
                 Application.RunOnMainThread(() =>
                 {
-                    //鎻愮ず鍘熷洜
-                    var tip = new Tip()
-                    {
-                        Text = tipStr,
-                        CloseTime = 1,
-                        Direction = AMPopTipDirection.None
-                    };
-                    tip.Show(bodyView);
                     btnPasswordViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2;
                     btnPasswordViewBottomLine.Height = Application.GetRealHeight(2);
                 });
@@ -719,30 +816,17 @@
         {
             var result = false;
             var responsePack = pm.GetHomePager();
-            if (responsePack == "Success")
+            if (responsePack == StateCode.SUCCESS)
             {
+                //2020-11-13 寰呯‘璁わ紝娌℃湁浣忓畢锛屼笉绠楃櫥褰曟垚鍔�
+                if (UserInfo.Current.regionList != null && UserInfo.Current.regionList.Count > 0)
+                {
+                    result = true;
+                }
             }
             else
             {
-                var tipStr = "Server erorr";
-                switch (responsePack)
-                {
-                    case "NoLogin":
-                        tipStr = Language.StringByID(StringId.InvalidLoginCertificate);
-                        break;
-                }
-                Application.RunOnMainThread(() =>
-                {
-                    //鎻愮ず鍘熷洜
-                    var tip = new Tip()
-                    {
-                        Text = tipStr,
-                        CloseTime = 1,
-                        Direction = AMPopTipDirection.None
-                    };
-                    tip.Show(bodyView);
-                });
-
+                IMessageCommon.Current.ShowErrorInfoAlter(responsePack);
             }
             return result;
         }

--
Gitblit v1.8.0