1. 新增HomePagePullRefreshTrigger组件实现全局下拉刷新 2. 调整Android最低SDK版本到31 3. 新增密码校验失败的多语言文案 4. 重构密码校验逻辑,添加异常捕获和统一的错误提示 5. 优化首页离线时的页面重置逻辑
72 lines
2.3 KiB
C#
72 lines
2.3 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using Kill.Managers;
|
||
using Kill.Network;
|
||
using Kill.UI.Components;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
namespace Kill.UI.Pages
|
||
{
|
||
public class CheckPasswordPage : MonoBehaviour
|
||
{
|
||
class PasswordRequest
|
||
{
|
||
public string password;
|
||
}
|
||
public InputField passwordInput;
|
||
public Text errorText;
|
||
public GameObject plane;
|
||
public void OnEnable()
|
||
{
|
||
errorText.text="";
|
||
}
|
||
public async void OnConfirm()
|
||
{
|
||
errorText.text="";
|
||
LoadingUI.Show();
|
||
try
|
||
{
|
||
string password = passwordInput != null ? passwordInput.text : "";
|
||
if (string.IsNullOrEmpty(password))
|
||
{
|
||
errorText.text = LanguageManager.Instance.GetLanguage("home_password_check_failed");
|
||
return;
|
||
}
|
||
PasswordRequest requestData=new PasswordRequest
|
||
{
|
||
password=passwordInput.text
|
||
};
|
||
|
||
var response = await NetworkCtrl.Instance.Post<LoginResponse>("/api/v1/auth/password/verify", requestData);
|
||
|
||
if (response != null && response.Data != null && response.Data.code == 200)
|
||
{
|
||
plane.SetActive(false);
|
||
gameObject.SetActive(false);
|
||
errorText.text="";
|
||
passwordInput.text="";
|
||
UIManager.Instance.isFirstTime=false;
|
||
}
|
||
else
|
||
{
|
||
errorText.text = LanguageManager.Instance.GetLanguage("home_password_check_failed");
|
||
passwordInput.text="";
|
||
}
|
||
}
|
||
catch (System.Exception ex)
|
||
{
|
||
Debug.LogError($"[CheckPasswordPage] 校验密码异常: {ex.Message}");
|
||
errorText.text = LanguageManager.Instance.GetLanguage("home_password_check_failed");
|
||
if (passwordInput != null) passwordInput.text = "";
|
||
}
|
||
finally
|
||
{
|
||
// 无论成功/失败/异常都关闭 Loading,避免一直挂着
|
||
LoadingUI.Hide();
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
}
|