This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2023-11-10 03:56:07 +08:00
parent 9157e123b6
commit 620bcd3e53
36 changed files with 3246 additions and 32 deletions

View File

@@ -1,15 +1,15 @@
import { app } from "../App";
import { GUI } from "../ui/UIConfig";
const http = app.api;
const RData = (data:any) => {
const RData = (data:any,isTips:boolean = true) => {
if(data.data.state == 200){
return data.data.data;
}else{
//弹出提示
app.layer.Open(GUI.Tips,{text:data.data.msg});
return null;
if(isTips){
app.layer.Open(GUI.Tips,{text:data.data.msg});
}
return data.data.data;
}
}
@@ -27,12 +27,22 @@ export interface UserLoginVO{
token:string, //token
user:UserVO, //玩家信息
}
export interface PlayerInfoOV{
playerId:number, //玩家Id
userId: number, //用户Id
playerName:string, //玩家名
playerCreateTime:number, //玩家创建时间
novice: false, //是否过引导
}
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, //玩家登录
GetPlayerInfo : async () => (await http.get(`/game/player/info`)).data as NewsContext, //获取玩家信息
UserRegister : async () => RData(await app.api.post(`/user/register`)) as UserVO, //玩家注册
UserLogin : async (account:string,password:string) => RData(await app.api.post(`/user/login`,{userId:account,userPass:password})) as UserLoginVO, //玩家登录
GetPlayerInfo : async () => RData(await app.api.get(`/game/player/info`),false) as NewsContext, //获取玩家信息
/********** 新手引导接口 *****************/
SavePlayerInfo : async (playerName:string,novice:boolean = true) => (await app.api.post(`/game/player/info/save`,{playerName,novice})).data as NewsContext, //保存玩家信息
}

View File

@@ -1,5 +1,6 @@
export enum GAction {
TOKEN_EXPIRED = 1001, //Token过期
NOT_CREATE_PLAYER_INFO = 2001, //没有玩家信息 - 前往引导页面
}

View File

@@ -23,6 +23,7 @@ export class StorageData {
}
export const GData = {
//层级
layer: {
World: 1,
}