mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
更新登录
This commit is contained in:
32
JisolGameCocos/assets/script/consts/API.ts
Normal file
32
JisolGameCocos/assets/script/consts/API.ts
Normal 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,
|
||||
|
||||
}
|
||||
|
9
JisolGameCocos/assets/script/consts/API.ts.meta
Normal file
9
JisolGameCocos/assets/script/consts/API.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "503f2086-2c48-470c-90e0-98e92c5dd354",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
5
JisolGameCocos/assets/script/consts/GActionEnum.ts
Normal file
5
JisolGameCocos/assets/script/consts/GActionEnum.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export enum GAction {
|
||||
|
||||
TOKEN_EXPIRED = 1001, //Token过期
|
||||
|
||||
}
|
9
JisolGameCocos/assets/script/consts/GActionEnum.ts.meta
Normal file
9
JisolGameCocos/assets/script/consts/GActionEnum.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "ed7dee3c-9396-4f08-bd29-deb690ca6cf8",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
30
JisolGameCocos/assets/script/consts/GData.ts
Normal file
30
JisolGameCocos/assets/script/consts/GData.ts
Normal 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,
|
||||
}
|
||||
}
|
||||
|
9
JisolGameCocos/assets/script/consts/GData.ts.meta
Normal file
9
JisolGameCocos/assets/script/consts/GData.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "d784fece-1a89-44ad-9119-29b965912c7d",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user