import { http } from "../utils/http"; import { loadEnv } from "@build/index"; const { VITE_PROXY_DOMAIN_REAL, VITE_PROXY_USER_REAL } = loadEnv(); const userAPi = VITE_PROXY_DOMAIN_REAL; const yewuApi = VITE_PROXY_USER_REAL + "/admin/"; interface userType extends Promise { svg?: string; code?: number; info?: object; } // 获取验证码 export const getVerify = (): userType => { return http.request("get", "/captcha"); }; // 登录 export const getLogin = (data: object) => { return http.request("post", `${yewuApi}/login`, { data }); }; // 钉钉获取用户信息 export function ddDetail(data) { return http.request("post", `${userAPi}/Api/dintalk`, { data }); } // 获取当前账号菜单数据 export const getAsyncRoutes = async (data: object) => { // const company = window.location.search.split("="); const companyNo = window.sessionStorage.getItem("companyNo"); const result = await http.request("post", `${yewuApi}menu`, { data: { ...data, relaComNo: companyNo } }); window.sessionStorage.removeItem("companyNo"); return result; }; // 刷新token export const refreshToken = (data: object) => { return http.request("post", "/refreshToken", { data }); }; export const httpCompany = (data: object): any => { return http.request("post", `${yewuApi}getcompany`, { data }); }; export const httpUserInfo = (data: object): any => { return http.request("post", `${yewuApi}userinfo`, { data }); }; export const httpUserList = (data: object): any => { return http.request("post", `${yewuApi}userlist`, { data }); }; export const httpSupplierall = (data: object): any => { return http.request("post", `${yewuApi}supplierlist`, { data }); }; export const httpSupplierList = (data: object): any => { return http.request("post", `${yewuApi}supplier_by_super`, { data }); }; export const httpBusinessList = (data: object): any => { return http.request("post", `${yewuApi}companylist`, { data }); }; export const httpGetAllCompany = (data: object) => { return http.request("post", `${yewuApi}supplierall`, { data }); }; export const httpGetSupplier = (data: object) => { return http.request("post", `${yewuApi}supplier_by_super`, { data }); }; export const httpGetBusiness = (_data: object) => { return http.request("post", `${yewuApi}companylist`, { data: { ..._data, noRela: true } }); }; export const httpSystemLast = (data: object): any => { return http.request("post", `${yewuApi}systemlast`, { data }); };