user.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 zentaoSsoLogin = (data: any) => {
  45. return request.post({
  46. url: "/admin-api/system/auth/zentaoSsoToken",
  47. headers: { "Content-Type": "application/json" },
  48. data,
  49. });
  50. };
  51. export const getUnreadNotifyMessageCount = async () => {
  52. return await request.get({
  53. url: "/admin-api/system/notify-message/get-unread-count",
  54. });
  55. };
  56. // 经营驾驶舱sso
  57. export const getMCSsoToken = async () => {
  58. // https://portal.deepoil.cc/admin-api/rq/iot-fine-report/createSsoToken
  59. return await request.get({
  60. url: "/admin-api/rq/iot-fine-report/createSsoToken",
  61. });
  62. };
  63. // 分组接口
  64. export const getGroups = async () => {
  65. return await request.get({
  66. url: "/admin-api/portal/flow-group/page",
  67. });
  68. };
  69. // 根据id获取分组详情
  70. export const getGroupById = async (id: string) => {
  71. return await request.get({
  72. url: "/admin-api/portal/flow/get?groupId=" + id,
  73. });
  74. };
  75. // 获取所有的flow
  76. export const getFlows = async (params) => {
  77. return await request.get({
  78. url: "/admin-api/portal/flow-group/all",
  79. params,
  80. });
  81. };
  82. // oa待办任务
  83. export const getOATasks = async (params) => {
  84. return await request.get({
  85. url:
  86. "/admin-api/portal/todo/oa?workcode=" +
  87. params.id +
  88. "&pageNo=" +
  89. params.pageNum +
  90. "&pageSize=" +
  91. params.pageSize,
  92. });
  93. };
  94. // crm待办任务
  95. export const getCRMTasks = async (params) => {
  96. return await request.get({
  97. url:
  98. "/admin-api/portal/todo/crm?workcode=" +
  99. params.id +
  100. "&type=" +
  101. params.type +
  102. "&pageNo=" +
  103. params.pageNum +
  104. "&pageSize=" +
  105. params.pageSize,
  106. });
  107. };
  108. // 消息通知
  109. export const getNotifyMessages = async (id) => {
  110. return await request.get({
  111. url: "/admin-api/portal/todo/crm/notice?workcode=" + id,
  112. });
  113. };
  114. // 消息列表
  115. export const getNotifyMessageList = async (id) => {
  116. return await request.get({
  117. url: "/admin-api/portal/todo/crm/notice/self?workcode=" + id,
  118. });
  119. };
  120. // 标记消息为已读
  121. export const markMessageAsRead = async (id) => {
  122. return await request.get({
  123. url: "/admin-api/portal/todo/crm/notice/readed?workcode=" + id,
  124. });
  125. };