12345678910111213141516171819202122232425262728 |
- import { axios, userLogin, uploadFile as uploadFileUrl } from "@/request";
- import { encodePwd } from "@/util";
- import { user } from "./user";
- import { refreshRole } from "./role";
- import { appConstant } from "@/app";
- export type LoginProps = {
- phoneNum: string;
- code: string;
- password: string;
- };
- export const login = async (props: LoginProps) => {
- const res = await axios.post(userLogin, {
- ...props,
- deptId: appConstant.deptId,
- password: encodePwd(props.password),
- });
- user.value.token = res.data.token;
- user.value.info = res.data.tmUser;
- await refreshRole();
- };
- export const uploadFile = async (file: File) => {
- return (await axios.post<string>(uploadFileUrl, { file })).data;
- };
|