user.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import request from "@/config/axios";
  2. // 钉钉扫码登录
  3. export async function socialLogin(type: string, code: string, state: string) {
  4. return await request.post({
  5. url: "/admin-api/system/auth/social-login",
  6. data: {
  7. type,
  8. code,
  9. state,
  10. },
  11. });
  12. }
  13. // 登出
  14. export const loginOut = () => {
  15. return request.post({ url: "/admin-api/system/auth/logout" });
  16. };
  17. // 获取用户权限信息
  18. export const getUserInfo = () => {
  19. return request.get({ url: "/admin-api/system/auth/get-permission-info" });
  20. };
  21. // 密码登陆
  22. type UserLoginVO = {
  23. username: string;
  24. password: string;
  25. captchaVerification: string;
  26. socialType?: string;
  27. socialCode?: string;
  28. socialState?: string;
  29. };
  30. export const login = (data: UserLoginVO) => {
  31. return request.post({
  32. url: "/admin-api/system/auth/login",
  33. data,
  34. });
  35. };
  36. // SSO登录
  37. export const ssoLogin = (data: any) => {
  38. return request.post({
  39. url: "/admin-api/system/auth/oaSsoToken",
  40. headers: { "Content-Type": "application/json" },
  41. data,
  42. });
  43. };
  44. export const getUnreadNotifyMessageCount = async () => {
  45. return await request.get({
  46. url: "/admin-api/system/notify-message/get-unread-count",
  47. });
  48. };