import { $http } from "@/api/httpInstance.uts" export type RegisteredUserReq = { userName: string, userPassword: string, rndcode: string } // 获取pinCode export async function GetPindCodeReqApi(params: RegisteredUserReq): Promise{ const body: UTSJSONObject = { userName: params.userName, userPassword: params.userPassword, rndcode: params.rndcode } as UTSJSONObject const res = await $http({ url: "/ocpp-mtapp-api/api/v1/users/getPinCode", method: "POST", data: body }) return res } // 注册用户 export async function RegisteredUserReqApi(params: RegisteredUserReq): Promise{ const body: UTSJSONObject = { userName: params.userName, userPassword: params.userPassword, rndcode: params.rndcode } as UTSJSONObject const res = await $http({ url: "/ocpp-mtapp-api/api/v1/users/add", method: "POST", data: body }) return res } export type LoginReq = { username: string password: string } // 登录请求 export async function LoginReqApi(params: LoginReq): Promise{ const body: UTSJSONObject = { username: params.username, password: params.password, expirationTime: 0 } as UTSJSONObject const res = await $http({ url: "/ocpp-mtapp-api/api/v1/auth/login", method: "POST", data: body }) return res } export type ModifyUserInfoReq = { name?: string | null, phone?: string | null, password?: string | null, nickName?: string | null } // 修改用户信息 export async function ModifyUserInfoReqApi(params: ModifyUserInfoReq): Promise{ const body: UTSJSONObject = { name: params.name, phone: params.phone, password: params.password } as UTSJSONObject const res = await $http({ url: `/ocpp-mtapp-api/api/v1/users/${params.name}`, method: "GET", data: body }) return res }