import Http from "../utils/net/Http";
import Urls from "./Urls";
const User = {
    /**
     * 用户登录
     * @param phone 
     * @param password 
     * @returns 
     */
    async login(phone: string, password: string): Promise<any> {
        let url = Urls.index.login;
        let res = await Http.get(url, { phone, password });
        return res;
    },
    /**
     * 添加用户
     * @params params 
     * @returns 
     */
    async add(params: any): Promise<any> {
        let url = Urls.user.add;
        let res = await Http.post(url, params);
        return res;
    },
    /**
     * 用户详情
     */
    async detail(id: number): Promise<any> {
        let url = Urls.user.detail;
        let params = {
            id
        };
        let res = await Http.get(url, params);
        return res;
    },
    /**
     * 用户编辑
     * @param params 
     * @returns 
     */
    async edit(params: any): Promise<any> {
        let url = Urls.user.edit;
        let res = await Http.post(url, params);
        return res;
    },
    /**
     * 用户列表
     * @param params 
     * @returns 
     */
    async list(params: any): Promise<any> {
        let url = Urls.user.list;
        let res = await Http.get(url, params);
        return res;
    },
    async staffList(params: any): Promise<any> {
        let url = Urls.user.staffList;
        let res = await Http.get(url, params);
        return res;
    }

};
export default User;