using System; using System.Collections; using System.Collections.Generic; using UnityEngine; /* 角色适配: 1.指挥员(长)指挥能力考评系统 角色类型 0.管理员1.考官2.考生 2.消防救援单位信息考核系统 角色类型 0.管理员1.教员2.学员 3.中高级指挥长考评系统 角色类型 -1.超级管理员0.学员1.教员2.管理员 */ #region 登录界面需要信息类 /// /// 角色类型 /// public enum RoleType { 超级管理员 = -1, 学员 = 0, 教员 = 1, 管理员 = 2 } /// /// 用户 /// public class User { public string username;//用户名 public string password;//密码 } /// /// 登录成功返回类型 /// [Serializable] public class IdentityInfo { public string token = ""; //令牌 public string refreshToken;//刷新令牌 public double expires; //到期时间:分钟 public string realName; //用户真实姓名 public RoleType roleType;//用户类型 public string avatarUri;//用户头像路径 public bool changePasswordRequired;//是否需要修改密码 } /// /// 用户注册信息 /// public class RegistorUser { public string realName = ""; public string username; public string password; public string phoneNumber; public string citizenIdentificationNumber; public int gender; public string avatarUri = ""; public string organizationId; public List postIds = new List(); public RoleType roleType; } /// /// 用户修改密码 /// public class ChangePasswordData { public string oldPassword; public string newPassword; } /// /// 用户重置为默认密码 /// public class LostPasswordData { //public string username; //public string citizenIdentificationNumber; public string phoneNumber; public string realName; public string newPassword; } /// /// 登录界面常见错误提示(需配置提示信息) /// public enum LoginErrorHints { accountNo = 0, accountPwdNo, nameNo, phoneNo, orgNo, postNo, identyNo, pwdNeedSame, pwdCannotSame, pwdInvalid, identyInvalid, phoneInvalid, nameInvalid, accountInvalid, } /// /// 岗位职级 /// public class Posts { public string Id; public string Name; public int level; } /// /// 分页结果集。 /// /// public class Page { /// /// 数据集。 /// public List Items { get; set; } /// /// 当前页。 /// public int PageNumber { get; set; } /// /// 分页大小。 /// public int PageSize { get; set; } /// /// 总共多少页。 /// public int TotalPages { get; set; } /// /// 总个数。 /// public int TotalCount { get; set; } } #endregion public class PanelsManager : MonoBehaviour { public LoginManager loginPanel; public RegisterManager registerPanel; public LostPwdManager lostPwdPanel; public ChangePwdManager changePwdPanel; public SelectPanelManager selectPanelManager; private readonly string[] LoginErrorHintsStr = new string[]//登录界面常见错误提示信息配置 { "请输入账号!", "请输入密码!", "请输入名字!", "请输入电话!", "请输入组织机构!", "请输入岗位!", "请输入身份证!", "两次密码不一致!", "新密码不能与旧密码相同!", "密码长度8-24位,且至少需要包含大小写字符、数字、特殊字符4种中的3种", "身份证格式有误!", "手机号码格式有误!", "姓名长度2-10位,且只能包含中文、英文、数字!", "登录账号长度4-24位,且只能包含英文、数字、特殊字符!", }; public static PanelsManager Instance; public Dictionary LoginErrorHintsDic = new Dictionary(); public RoleType NowRoleType = RoleType.教员; void Awake() { foreach (LoginErrorHints item in Enum.GetValues(typeof(LoginErrorHints))) { LoginErrorHintsDic.Add(item, LoginErrorHintsStr[(int)item]); } Instance = this; } /// /// 切换到登录界面 /// /// public void GotoLoginWindow(string userName = null) { registerPanel.gameObject.SetActive(false); lostPwdPanel.gameObject.SetActive(false); changePwdPanel.gameObject.SetActive(false); selectPanelManager.gameObject.SetActive(false); loginPanel.gameObject.SetActive(true); loginPanel.OnShow(userName); } /// /// 切换到注册界面 /// public void GotoRegistorWindow() { loginPanel.gameObject.SetActive(false); lostPwdPanel.gameObject.SetActive(false); changePwdPanel.gameObject.SetActive(false); selectPanelManager.gameObject.SetActive(false); registerPanel.gameObject.SetActive(true); registerPanel.OnShow(); } /// /// 切换到修改密码界面 /// public void GotoChangePasswordWindow(string account) { TipPanelManager.GetInstance.Show("初始密码不安全,请重新设置密码!", () => { loginPanel.gameObject.SetActive(false); registerPanel.gameObject.SetActive(false); lostPwdPanel.gameObject.SetActive(false); selectPanelManager.gameObject.SetActive(false); changePwdPanel.gameObject.SetActive(true); changePwdPanel.OnShow(account); }); } /// /// 切换到忘记密码界面 /// /// public void GotoLostPasswordWindow(string userName) { loginPanel.gameObject.SetActive(false); registerPanel.gameObject.SetActive(false); changePwdPanel.gameObject.SetActive(false); selectPanelManager.gameObject.SetActive(false); lostPwdPanel.gameObject.SetActive(true); lostPwdPanel.OnShow(userName); } /// /// 切换到选择系统界面 /// /// public void GotoSystemSelectWindow(string password) { loginPanel.gameObject.SetActive(false); registerPanel.gameObject.SetActive(false); changePwdPanel.gameObject.SetActive(false); lostPwdPanel.gameObject.SetActive(false); selectPanelManager.gameObject.SetActive(true); selectPanelManager.OnShow(password); } }