parent
ddf5b860fc
commit
ba92438b91
6 changed files with 470 additions and 304 deletions
@ -1,126 +1,147 @@ |
|||||||
import request from '@/router/axios'; |
import request from "@/router/axios"; |
||||||
import website from "@/config/website"; |
import website from "@/config/website"; |
||||||
|
|
||||||
export const loginByUsername = (tenantId, deptId, roleId, username, password, type, key, code) => request({ |
export const loginByUsername = ( |
||||||
url: '/api/blade-auth/oauth/token', |
tenantId, |
||||||
method: 'post', |
deptId, |
||||||
headers: { |
roleId, |
||||||
'Tenant-Id': tenantId, |
username, |
||||||
'Dept-Id': (website.switchMode ? deptId : ''), |
password, |
||||||
'Role-Id': (website.switchMode ? roleId : ''), |
type, |
||||||
'Captcha-Key': key, |
key, |
||||||
'Captcha-Code': code, |
code |
||||||
}, |
) => |
||||||
params: { |
request({ |
||||||
tenantId, |
url: "/api/blade-auth/oauth/token", |
||||||
username, |
method: "post", |
||||||
password, |
headers: { |
||||||
grant_type: (website.captchaMode ? "captcha" : "password"), |
"Tenant-Id": tenantId, |
||||||
scope: "all", |
"Dept-Id": website.switchMode ? deptId : "", |
||||||
type |
"Role-Id": website.switchMode ? roleId : "", |
||||||
} |
"Captcha-Key": key, |
||||||
}); |
"Captcha-Code": code, |
||||||
|
}, |
||||||
|
params: { |
||||||
|
tenantId, |
||||||
|
username, |
||||||
|
password, |
||||||
|
grant_type: website.isTokenMode ? "nopassword" : "password", |
||||||
|
scope: "all", |
||||||
|
type, |
||||||
|
}, |
||||||
|
}); |
||||||
|
|
||||||
export const loginBySocial = (tenantId, source, code, state) => request({ |
export const loginBySocial = (tenantId, source, code, state) => |
||||||
url: '/api/blade-auth/oauth/token', |
request({ |
||||||
method: 'post', |
url: "/api/blade-auth/oauth/token", |
||||||
headers: { |
method: "post", |
||||||
'Tenant-Id': tenantId |
headers: { |
||||||
}, |
"Tenant-Id": tenantId, |
||||||
params: { |
}, |
||||||
tenantId, |
params: { |
||||||
source, |
tenantId, |
||||||
code, |
source, |
||||||
state, |
code, |
||||||
grant_type: "social", |
state, |
||||||
scope: "all", |
grant_type: "social", |
||||||
} |
scope: "all", |
||||||
}) |
}, |
||||||
|
}); |
||||||
|
|
||||||
export const loginBySso = (state, code) => request({ |
export const loginBySso = (state, code) => |
||||||
url: '/api/blade-auth/oauth/token', |
request({ |
||||||
method: 'post', |
url: "/api/blade-auth/oauth/token", |
||||||
headers: { |
method: "post", |
||||||
'Tenant-Id': state |
headers: { |
||||||
}, |
"Tenant-Id": state, |
||||||
params: { |
}, |
||||||
tenantId: state, |
params: { |
||||||
code, |
tenantId: state, |
||||||
grant_type: "authorization_code", |
code, |
||||||
scope: "all", |
grant_type: "authorization_code", |
||||||
redirect_uri: website.redirectUri, |
scope: "all", |
||||||
} |
redirect_uri: website.redirectUri, |
||||||
}) |
}, |
||||||
|
}); |
||||||
|
|
||||||
export const refreshToken = (refresh_token, tenantId, deptId, roleId) => request({ |
export const refreshToken = (refresh_token, tenantId, deptId, roleId) => |
||||||
url: '/api/blade-auth/oauth/token', |
request({ |
||||||
method: 'post', |
url: "/api/blade-auth/oauth/token", |
||||||
headers: { |
method: "post", |
||||||
'Tenant-Id': tenantId, |
headers: { |
||||||
'Dept-Id': (website.switchMode ? deptId : ''), |
"Tenant-Id": tenantId, |
||||||
'Role-Id': (website.switchMode ? roleId : '') |
"Dept-Id": website.switchMode ? deptId : "", |
||||||
}, |
"Role-Id": website.switchMode ? roleId : "", |
||||||
params: { |
}, |
||||||
tenantId, |
params: { |
||||||
refresh_token, |
tenantId, |
||||||
grant_type: "refresh_token", |
refresh_token, |
||||||
scope: "all", |
grant_type: "refresh_token", |
||||||
} |
scope: "all", |
||||||
}); |
}, |
||||||
|
}); |
||||||
|
|
||||||
export const registerGuest = (form, oauthId) => request({ |
export const registerGuest = (form, oauthId) => |
||||||
url: '/api/blade-system/user/register-guest', |
request({ |
||||||
method: 'post', |
url: "/api/blade-system/user/register-guest", |
||||||
params: { |
method: "post", |
||||||
tenantId: form.tenantId, |
params: { |
||||||
name: form.name, |
tenantId: form.tenantId, |
||||||
account: form.account, |
name: form.name, |
||||||
password: form.password, |
account: form.account, |
||||||
oauthId |
password: form.password, |
||||||
} |
oauthId, |
||||||
}); |
}, |
||||||
|
}); |
||||||
|
|
||||||
export const getButtons = () => request({ |
export const getButtons = () => |
||||||
url: '/api/blade-system/menu/buttons', |
request({ |
||||||
method: 'get' |
url: "/api/blade-system/menu/buttons", |
||||||
}); |
method: "get", |
||||||
|
}); |
||||||
|
|
||||||
export const getCaptcha = () => request({ |
export const getCaptcha = () => |
||||||
url: '/api/blade-auth/oauth/captcha', |
request({ |
||||||
method: 'get', |
url: "/api/blade-auth/oauth/captcha", |
||||||
authorization: false |
method: "get", |
||||||
}); |
authorization: false, |
||||||
|
}); |
||||||
|
|
||||||
export const logout = () => request({ |
export const logout = () => |
||||||
url: '/api/blade-auth/oauth/logout', |
request({ |
||||||
method: 'get', |
url: "/api/blade-auth/oauth/logout", |
||||||
authorization: false |
method: "get", |
||||||
}); |
authorization: false, |
||||||
|
}); |
||||||
|
|
||||||
export const getUserInfo = () => request({ |
export const getUserInfo = () => |
||||||
url: '/api/blade-auth/oauth/user-info', |
request({ |
||||||
method: 'get' |
url: "/api/blade-auth/oauth/user-info", |
||||||
}); |
method: "get", |
||||||
|
}); |
||||||
|
|
||||||
export const sendLogs = (list) => request({ |
export const sendLogs = (list) => |
||||||
url: '/api/blade-auth/oauth/logout', |
request({ |
||||||
method: 'post', |
url: "/api/blade-auth/oauth/logout", |
||||||
data: list |
method: "post", |
||||||
}); |
data: list, |
||||||
|
}); |
||||||
|
|
||||||
export const clearCache = () => request({ |
export const clearCache = () => |
||||||
url: '/api/blade-auth/oauth/clear-cache', |
request({ |
||||||
method: 'get', |
url: "/api/blade-auth/oauth/clear-cache", |
||||||
authorization: false |
method: "get", |
||||||
}); |
authorization: false, |
||||||
|
}); |
||||||
|
|
||||||
//授权登录
|
//授权登录
|
||||||
export const loginByAuth = (applyType, username, password) => request({ |
export const loginByAuth = (applyType, username, password) => |
||||||
url: '/authApi/system/sys-sub/login', |
request({ |
||||||
method: 'post', |
url: "/authApi/system/sys-sub/login", |
||||||
data: { |
method: "post", |
||||||
applyType, |
data: { |
||||||
username, |
applyType, |
||||||
password |
username, |
||||||
} |
password, |
||||||
}); |
}, |
||||||
|
}); |
||||||
|
|||||||
Loading…
Reference in new issue