更新登录

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2023-11-08 02:32:54 +08:00
parent 0b9cf0ea9b
commit c4e2798430
34 changed files with 3330 additions and 53 deletions

View File

@@ -0,0 +1,32 @@
import { app } from "../App";
import { GUI } from "../ui/UIConfig";
const http = app.api;
const RData = (data:any) => {
if(data.data.state == 200){
return data.data.data;
}else{
//弹出提示
app.layer.Open(GUI.Tips,{text:data.data.msg});
return null;
}
}
export interface UserVO{
userId:number, //玩家Id
userName:string, //玩家名称
userPass:string, //玩家密码
}
export interface UserLoginVO{
token:string, //token
user:UserVO, //玩家信息
}
export const API = {
UserRegister : async () => RData(await http.post(`/user/register`)) as UserVO,
UserLogin : async (account:string,password:string) => RData(await http.post(`/user/login`,{userId:account,userPass:password})) as UserLoginVO,
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "503f2086-2c48-470c-90e0-98e92c5dd354",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,5 @@
export enum GAction {
TOKEN_EXPIRED = 1001, //Token过期
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "ed7dee3c-9396-4f08-bd29-deb690ca6cf8",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,30 @@
import { sys } from "cc";
export enum StorageEnum{
Token = "Storage_Token", // Token
}
export class StorageData {
static get(key:string):string{
return sys.localStorage.getItem(key);
}
static set(key:string,value:string){
sys.localStorage.setItem(key,value);
}
static delect(key:string){
sys.localStorage.removeItem(key);
}
}
export const GData = {
layer: {
World: 1,
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "d784fece-1a89-44ad-9119-29b965912c7d",
"files": [],
"subMetas": {},
"userData": {}
}