储能智慧云平台web端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

login.ts 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { Login } from "@/api/interface/index";
  2. // import { PORT1 } from "@/api/config/servicePort";
  3. // import authMenuList from "@/assets/json/authMenuList.json";
  4. import authButtonList from "@/assets/json/authButtonList.json";
  5. import http from "@/api";
  6. import qs from "qs";
  7. /**
  8. * @name 登录模块
  9. */
  10. // 用户登录
  11. // export const loginApi = (params: Login.ReqLoginForm) => {
  12. // return http.post<Login.ResLogin>(`/login`, params, { loading: false }); // 正常 post json 请求 ==> application/json
  13. // // return http.post<Login.ResLogin>(PORT1 + `/login`, params, { loading: false }); // 控制当前请求不显示 loading
  14. // // return http.post<Login.ResLogin>(PORT1 + `/login`, {}, { params }); // post 请求携带 query 参数 ==> ?username=admin&password=123456
  15. // // return http.post<Login.ResLogin>(PORT1 + `/login`, qs.stringify(params)); // post 请求携带表单参数 ==> application/x-www-form-urlencoded
  16. // // return http.get<Login.ResLogin>(PORT1 + `/login?${qs.stringify(params, { arrayFormat: "repeat" })}`); // get 请求可以携带数组等复杂参数
  17. // };
  18. export const loginApi = (params: Login.ReqLoginForm) => {
  19. return http.post<Login.ResLogin>(`/platform/login`, qs.stringify(params), { loading: false }); // 正常 post json 请求 ==> application/json
  20. };
  21. // 登录
  22. export const userloginApi = (params: Login.ReqLoginForm) => {
  23. return http.post<Login.ResLogin>(`/saas/login`, qs.stringify(params), { loading: false }); // 正常 post json 请求 ==> application/json
  24. };
  25. // 重置密码
  26. export const newloginApi = (params: {}) => {
  27. return http.post(`/platform/user/resetPwd`, qs.stringify(params), { loading: false }); // 正常 post json 请求 ==> application/json
  28. };
  29. // 获取菜单列表
  30. export const getAuthMenuListApi = () => {
  31. return http.get<Menu.MenuOptions[]>(`/platform/menu/linke/Menu`, {}, { loading: false });
  32. // 如果想让菜单变为本地数据,注释上一行代码,并引入本地 authMenuList.json 数据
  33. // return authMenuList;
  34. };
  35. // 获取按钮权限
  36. export const getAuthButtonListApi = () => {
  37. // return http.get<Login.ResAuthButtons>(PORT1 + `/auth/buttons`, {}, { loading: false });
  38. // 如果想让按钮权限变为本地数据,注释上一行代码,并引入本地 authButtonList.json 数据
  39. return authButtonList;
  40. };
  41. // 用户退出登录
  42. export const logoutApi = () => {
  43. return http.post(`/logout`);
  44. };