培训考核三期,新版培训,网页版培训登录器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

245 lines
6.8 KiB

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 登录界面需要信息类
/// <summary>
/// 角色类型
/// </summary>
public enum RoleType
{
= -1,
= 0,
= 1,
= 2
}
/// <summary>
/// 用户
/// </summary>
public class User
{
public string username;//用户名
public string password;//密码
}
/// <summary>
/// 登录成功返回类型
/// </summary>
[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;//是否需要修改密码
}
/// <summary>
/// 用户注册信息
/// </summary>
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<string> postIds = new List<string>();
public RoleType roleType;
}
/// <summary>
/// 用户修改密码
/// </summary>
public class ChangePasswordData
{
public string oldPassword;
public string newPassword;
}
/// <summary>
/// 用户重置为默认密码
/// </summary>
public class LostPasswordData
{
//public string username;
//public string citizenIdentificationNumber;
public string phoneNumber;
public string realName;
public string newPassword;
}
/// <summary>
/// 登录界面常见错误提示(需配置提示信息)
/// </summary>
public enum LoginErrorHints
{
accountNo = 0,
accountPwdNo,
nameNo,
phoneNo,
orgNo,
postNo,
identyNo,
pwdNeedSame,
pwdCannotSame,
pwdInvalid,
identyInvalid,
phoneInvalid,
nameInvalid,
accountInvalid,
}
/// <summary>
/// 岗位职级
/// </summary>
public class Posts
{
public string Id;
public string Name;
public int level;
}
/// <summary>
/// 分页结果集。
/// </summary>
/// <typeparam name="T"></typeparam>
public class Page<T>
{
/// <summary>
/// 数据集。
/// </summary>
public List<T> Items { get; set; }
/// <summary>
/// 当前页。
/// </summary>
public int PageNumber { get; set; }
/// <summary>
/// 分页大小。
/// </summary>
public int PageSize { get; set; }
/// <summary>
/// 总共多少页。
/// </summary>
public int TotalPages { get; set; }
/// <summary>
/// 总个数。
/// </summary>
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<LoginErrorHints, string> LoginErrorHintsDic = new Dictionary<LoginErrorHints, string>();
public RoleType NowRoleType = RoleType.;
void Awake()
{
foreach (LoginErrorHints item in Enum.GetValues(typeof(LoginErrorHints)))
{
LoginErrorHintsDic.Add(item, LoginErrorHintsStr[(int)item]);
}
Instance = this;
}
/// <summary>
/// 切换到登录界面
/// </summary>
/// <param name="userName"></param>
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);
}
/// <summary>
/// 切换到注册界面
/// </summary>
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();
}
/// <summary>
/// 切换到修改密码界面
/// </summary>
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);
});
}
/// <summary>
/// 切换到忘记密码界面
/// </summary>
/// <param name="userName"></param>
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);
}
/// <summary>
/// 切换到选择系统界面
/// </summary>
/// <param name="password"></param>
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);
}
}