dangsn
2024-06-06 8c8c59c1f2005fa3ca89ac2117ca1a3c0c618913
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import request from '@/router/axios';
import website from "@/config/website";
 
export const loginByUsername = (tenantId, deptId, roleId, username, password, type, key) => request({
  url: '/api/framework/loginController/login',
  method: 'post',
  headers: {
    'Tenant-Id': tenantId,
    'Dept-Id': (website.switchMode ? deptId : ''),
    'Role-Id': (website.switchMode ? roleId : ''),
    'Captcha-Key': key,
 
  },
  params: {
    tenantId,
    username,
    password,
    grant_type: (website.captchaMode ? "captcha" : "password"),
    scope: "all",
    type
  }
});
 
export const loginBySocial = (tenantId, source, state) => request({
  url: '/api/blade-auth/oauth/token',
  method: 'post',
  headers: {
    'Tenant-Id': tenantId
  },
  params: {
    tenantId,
    source,
    state,
    grant_type: "social",
    scope: "all",
  }
})
 
export const loginBySso = (state) => request({
  url: '/api/blade-auth/oauth/token',
  method: 'post',
  headers: {
    'Tenant-Id': state
  },
  params: {
    tenantId: state,
    grant_type: "authorization_code",
    scope: "all",
    redirect_uri: website.redirectUri,
  }
})
 
export const refreshToken = (refresh_token, tenantId, deptId, roleId) => request({
  url: '/api/blade-auth/oauth/token',
  method: 'post',
  headers: {
    'Tenant-Id': tenantId,
    'Dept-Id': (website.switchMode ? deptId : ''),
    'Role-Id': (website.switchMode ? roleId : '')
  },
  params: {
    tenantId,
    refresh_token,
    grant_type: "refresh_token",
    scope: "all",
  }
});
 
export const registerGuest = (form, oauthId) => request({
  url: '/api/blade-user/register-guest',
  method: 'post',
  params: {
    tenantId: form.tenantId,
    name: form.name,
    account: form.account,
    password: form.password,
    oauthId
  }
});
 
export const getButtons = () => request({
  url: '/api/blade-system/menu/buttons',
  method: 'get'
});
 
export const getCaptcha = () => request({
  url: '/api/blade-auth/oauth/captcha',
  method: 'get',
  authorization: false
});
 
export const logout = () => request({
  url: '/api/blade-auth/oauth/logout',
  method: 'get',
  authorization: false
});
 
export const getUserInfo = () => request({
  url: '/api/blade-auth/oauth/user-info',
  method: 'get'
});
 
export const sendLogs = (list) => request({
  url: '/api/blade-auth/oauth/logout',
  method: 'post',
  data: list
});
 
export const clearCache = () => request({
  url: '/api/blade-auth/oauth/clear-cache',
  method: 'get',
  authorization: false
});
 
export const selcetList = () => request({
  url: '/api/blade-system/tenant/tenant-map',
  method: 'get',
});