wxr
2024-04-16 1b6d5116f9f3e291da636b9ec510d65a4fedf639
HDL_ON/UI/UI1-Login/LoginPageBLL.cs
@@ -86,9 +86,6 @@
                        btnAccountViewBottomLine.Height = Application.GetRealHeight(2);
                        return;
                    }
#if __IOS__
                    etPassword.Foucs = true;
#endif
                    //加载Loading效果
                    var waitPage = new Loading();
                    bodyView.AddChidren(waitPage);
@@ -230,9 +227,6 @@
                    }
                    //验证码不需要隐藏
                    etPassword.SecureTextEntry = false;
#if __IOS__
                    etPassword.SetTextContentTypeToOneTimeCode();
#endif
                }
                #endregion
            }
@@ -321,7 +315,6 @@
                //}
                //隐藏密码
                etPassword.SecureTextEntry = true;
                //etPassword.IsNumberKeyboardType = false;
            }
            //验证码登录
            else if (logintMode == 1)
@@ -349,9 +342,6 @@
                }
                //验证码不需要隐藏
                etPassword.SecureTextEntry = false;
                etPassword.Text = smsCode;
                //etPassword.IsNumberKeyboardType = true;
            }
        }
@@ -445,27 +435,9 @@
                {
                    btnPasswordViewBottomLine.BackgroundColor = CSS_Color.MainColor;
                    btnPasswordViewBottomLine.Height = Application.GetRealHeight(2);
#if __IOS__
      new Thread(() => {
                            for(var i = 0; i < 10; i++)
                            {
                                Application.RunOnMainThread(() =>
                                {
                                    this.Y = 0-Application.GetRealHeight(10 * i);
                                });
                                Thread.Sleep(10);
                            }
                        }) { IsBackground = true }.Start();
                    var sst = etPassword.MyTextContentType;
                    Console.WriteLine(sst);
                    etPassword.SetTextContentTypeToOneTimeCode();
#endif
                }
                else
                {
                    this.Y = 0;
                    btnPasswordViewBottomLine.BackgroundColor = CSS_Color.DividingLineColor;
                    btnPasswordViewBottomLine.Height = Application.GetRealHeight(1);
                }
@@ -480,8 +452,12 @@
            etPassword.EditorEnterAction += (obj) =>
            {
                Application.HideSoftInput();
                LoginEvent();
            };
            etPassword.MouseUpEventHandler = (sender, e) =>
            {
                etPassword.Foucs = true;
            };
        }
        /// <summary>
@@ -510,57 +486,11 @@
        {
            btnLogin.MouseUpEventHandler += (sender, e) =>
            {
                LoginEvent();
            };
            #region 当账号密码都输入时,才能点击登录按钮
            etAccount.TextChangeEventHandler = (sender, e) =>
            {
                account = etAccount.Text.Trim();
                if (account.Length > 0 && etPassword.Text.Trim().Length > 0)
                {
                    btnLogin.IsSelected = true;
                }
                else
                {
                    btnLogin.IsSelected = false;
                }
                if (Regex.IsMatch(account, @"^[1]+\d{10}"))//&& account.Length == 11)
                {
                    btnGetVerificationCode.IsSelected = true;
                    btnGetVerificationCode.TextColor = CSS_Color.MainBackgroundColor;
                }
                else
                {
                    btnGetVerificationCode.IsSelected = false;
                    btnGetVerificationCode.TextColor = CSS_Color.PromptingColor1;
                }
            };
            etPassword.TextChangeEventHandler += (sender, e) =>
            {
                if (etAccount.Text.Trim().Length > 0 && etPassword.Text.Trim().Length > 0)
                {
                    btnLogin.IsSelected = true;
                }
                else
                {
                    btnLogin.IsSelected = false;
                }
            };
            #endregion
        }
        /// <summary>
        /// 登录事件
        /// </summary>
        void LoginEvent()
        {
            if (btnLogin.IsSelected)
            {
                //判断是否同意了隐私政策
                if (CheckPrivacyPolicy() == false)
                {
                    Application.HideSoftInput();
                    return;
                }
                    if (CheckPrivacyPolicy() == false) return;
                account = etAccount.Text.Trim();
                password = etPassword.Text.Trim();
@@ -599,7 +529,44 @@
                waitPage = new Loading();
                new PublicAssmebly().LoadPage_WaitPage(loginThread, bodyView, waitPage);
            }
            };
            #region 当账号密码都输入时,才能点击登录按钮
            etAccount.TextChangeEventHandler = (sender, e) =>
            {
                account = etAccount.Text.Trim();
                if (account.Length > 0 && etPassword.Text.Trim().Length > 0)
                {
                    btnLogin.IsSelected = true;
        }
                else
                {
                    btnLogin.IsSelected = false;
                }
                if (Regex.IsMatch(account, @"^[1]+\d{10}"))//&& account.Length == 11)
                {
                    btnGetVerificationCode.IsSelected = true;
                    btnGetVerificationCode.TextColor = CSS_Color.MainBackgroundColor;
                }
                else
                {
                    btnGetVerificationCode.IsSelected = false;
                    btnGetVerificationCode.TextColor = CSS_Color.PromptingColor1;
                }
            };
            etPassword.TextChangeEventHandler += (sender, e) =>
            {
                if (etAccount.Text.Trim().Length > 0 && etPassword.Text.Trim().Length > 0)
                {
                    btnLogin.IsSelected = true;
                }
                else
                {
                    btnLogin.IsSelected = false;
                }
            };
            #endregion
        }
        /// <summary>
        /// 加载登录线程
        /// </summary>
@@ -730,11 +697,6 @@
                //调用验证码登录接口
                loginResult = pm.LoginValidCode(account, password);
            }
            if(loginResult == null)
            {
                return false;
            }
            if (loginResult.Code == StateCode.SUCCESS)
            {
                var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(loginResult.Data.ToString());
@@ -771,9 +733,9 @@
                UserInfo.Current.SaveUserInfo();
                MainPage.Log("登录成功。");
#if __IOS__
                var sdm = new SiriKit.SceneDateManager();
                sdm.AccessToken = UserInfo.Current.LoginTokenString;
                sdm.RefreshToken = UserInfo.Current.RefreshToken;
                //var sdm = new SiriKit.SceneDateManager();
                //sdm.AccessToken = UserInfo.Current.LoginTokenString;
                //sdm.RefreshToken = UserInfo.Current.RefreshToken;
#endif
                result = true;