JLChen
2020-11-13 017af840d60fd6a56da9711308bf8239cb7fc1e6
HDL_ON/UI/UI1-Login/RegisterPage.cs
@@ -119,7 +119,11 @@
        /// <summary>
        /// 获取验证码按钮
        /// </summary>
        Button btnGetVerificationCode;
        Button btnGetVerificationCode_Phone;
        /// <summary>
        /// 获取验证码按钮
        /// </summary>
        Button btnGetVerificationCode_Mail;
        /// <summary>
        /// 验证码子区域底部分割线
        /// </summary>
@@ -160,6 +164,13 @@
        /// 1:邮箱
        /// </summary>
        int registerType;
        /// <summary>
        /// 手机区号
        /// </summary>
        string phoneZoneCode = "86";
        string registerPhone;
        string registerEmail;
        #endregion
        public RegisterPage()
        {
@@ -195,7 +206,7 @@
                Y = Application.GetRealHeight(112),
                Width = Application.GetRealWidth(120),
                Height = Application.GetRealHeight(40),
                TextID = StringId.LoginByPhone,
                TextID = StringId.RegisterByPhone,
                TextColor = CSS_Color.MainColor,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
@@ -208,7 +219,7 @@
                Y = Application.GetRealHeight(112),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealHeight(40),
                TextID = StringId.LoginByEmail,
                TextID = StringId.RegisterByEmail,
                TextColor = CSS_Color.PromptingColor1,
                TextAlignment = TextAlignment.Center,
                TextSize = CSS_FontSize.TextFontSize,
@@ -232,12 +243,25 @@
                X = Application.GetRealWidth(9),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Text = "+86",
                Text = "+" + phoneZoneCode,
                TextSize = CSS_FontSize.TextFontSize,
            };
            if (accountType == 0)
            {
                accountView.AddChidren(btnGlobalRoaming);
                EventHandler<MouseEventArgs> eHandler = (sender, e) => {
                    JLCountrycode.CountryCodeView.Current.Show((countryName, code) => {
                        if (!string.IsNullOrEmpty(code))
                        {
                            phoneZoneCode = code;
                            btnGlobalRoaming.Text = "+" + phoneZoneCode;
                        }
                    });
                };
                btnGlobalRoaming.MouseUpEventHandler += eHandler;
            }
            //btnDividingLineVertical_AccountView = new Button()
@@ -460,7 +484,7 @@
            };
            verificationCodeView.AddChidren(etVerificationCode);
            btnGetVerificationCode = new Button()
            btnGetVerificationCode_Phone = new Button()
            {
                X = Application.GetRealWidth(219),
                Width = Application.GetRealWidth(100),
@@ -470,7 +494,20 @@
                TextAlignment = TextAlignment.CenterRight,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            };
            verificationCodeView.AddChidren(btnGetVerificationCode);
            verificationCodeView.AddChidren(btnGetVerificationCode_Phone);
            btnGetVerificationCode_Mail = new Button()
            {
                X = Application.GetRealWidth(219),
                Width = Application.GetRealWidth(100),
                TextID = StringId.GetVerificationCode,
                SelectedTextColor = CSS_Color.MainColor,
                TextColor = CSS_Color.PromptingColor1,
                TextAlignment = TextAlignment.CenterRight,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                Visible = false
            };
            verificationCodeView.AddChidren(btnGetVerificationCode_Mail);
            btnVerificationCodeViewBottomLine = new Button()
            {
@@ -584,6 +621,7 @@
                    var loginThread = LoadThread_Login(account, password);
                    waitPage = new Loading();
                    new PublicAssmebly().LoadPage_WaitPage(loginThread, bodyView, waitPage);
                    dialog.Close();
                });
            })
            { IsBackground = true }.Start();
@@ -639,52 +677,30 @@
            var result = false;
            //调用登录接口
            var loginResult = pm.LoginByPassword(account, password);
            if (loginResult.StateCode.ToUpper() == "SUCCESS")
            if (loginResult.Code == HttpUtil.SUCCESS_CODE)
            {
                var loginDataStr = Newtonsoft.Json.Linq.JObject.FromObject(loginResult.ResponseData);
                //记录用户数据
                var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(loginResult.Data.ToString());
                MainPage.LoginUser = new UserInfo
                {
                    ID = (int)loginDataStr.GetValue("UserID"),
                    masterID = (int)loginDataStr.GetValue("MainUserID"),
                    accountType = (int)loginDataStr.GetValue("UserType"),
                    userType = revertData.userType,
                    accountString = account,
                    password = password,
                    lastTime = DateTime.Now,
                    SIP_Account = loginDataStr.GetValue("AllVisionRegisterDevUserNameGuid").ToString(),
                    userName = loginDataStr.GetValue("Remark").ToString(),
                    ID = revertData.userId,
                    loginTokenString = revertData.headerPrefix + revertData.accessToken,
                    refreshToken = revertData.refreshToken,
                    userName = revertData.name
                };
                MainPage.LoginUser.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(NewAPI.API_POST_Login, loginResult.Code);
                Application.RunOnMainThread(() =>
                {
                    //提示原因
                    var tip = new Tip()
                    {
                        Text = tipStr,
                        CloseTime = 3,
                        Direction = AMPopTipDirection.None
                    };
                    tip.Show(bodyView);
                    btnPasswordViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2;
                    btnPasswordViewBottomLine.Height = Application.GetRealHeight(2);
                });
@@ -699,7 +715,7 @@
        {
            var result = false;
            var responsePack = pm.GetHomePager();
            if (responsePack == "Success")
            if (responsePack == HttpUtil.SUCCESS_CODE)
            {
            }
            else
@@ -717,7 +733,7 @@
                    var tip = new Tip()
                    {
                        Text = tipStr,
                        CloseTime = 3,
                        CloseTime = 1,
                        Direction = AMPopTipDirection.None
                    };
                    tip.Show(bodyView);