mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 19:34:47 +00:00
33 lines
804 B
TypeScript
33 lines
804 B
TypeScript
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,
|
|
|
|
}
|
|
|