2024-11-18 09:02:57 +08:00
|
|
|
import type { Login } from '@/api/user/interface/user'
|
|
|
|
|
import { ADMIN as rePrefix } from '@/api/system/config/serviceName'
|
2024-10-15 15:37:50 +08:00
|
|
|
import http from '@/api'
|
2024-11-18 09:02:57 +08:00
|
|
|
import type { Dict } from '@/api/interface'
|
2024-10-15 15:37:50 +08:00
|
|
|
/**
|
|
|
|
|
* @name 登录模块
|
|
|
|
|
*/
|
|
|
|
|
// 用户登录
|
2025-03-24 19:22:56 +08:00
|
|
|
export const loginApi = (params: { username: string; password: string }) => {
|
2024-11-04 09:58:00 +08:00
|
|
|
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, { loading: false })
|
2024-11-07 20:55:11 +08:00
|
|
|
// return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
|
2024-10-15 15:37:50 +08:00
|
|
|
}
|
|
|
|
|
// 获取菜单列表
|
|
|
|
|
export const getAuthMenuListApi = () => {
|
2024-11-20 13:53:31 +08:00
|
|
|
return http.get<Menu.MenuOptions[]>(`/sysFunction/getMenu`, {}, { loading: false })
|
2024-11-07 20:55:11 +08:00
|
|
|
// return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false })
|
2024-10-15 15:37:50 +08:00
|
|
|
}
|
|
|
|
|
// 获取按钮权限
|
|
|
|
|
export const getAuthButtonListApi = () => {
|
2024-11-20 13:53:31 +08:00
|
|
|
return http.get<Login.ResAuthButtons>(`/sysFunction/getButton`, {}, { loading: false })
|
2024-11-07 20:55:11 +08:00
|
|
|
// return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false })
|
2024-10-15 15:37:50 +08:00
|
|
|
}
|
|
|
|
|
// 用户退出登录
|
|
|
|
|
export const logoutApi = () => {
|
|
|
|
|
return http.post(`${rePrefix}/logout`)
|
2024-11-04 18:43:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取下拉框列表
|
2024-11-05 11:23:38 +08:00
|
|
|
export const getDictList = () =>{
|
|
|
|
|
return http.get<Dict>('/dictData/dictDataCache')
|
2024-11-04 18:43:24 +08:00
|
|
|
}
|
|
|
|
|
|
2025-02-07 14:28:15 +08:00
|
|
|
//token刷新
|
2025-02-07 10:39:30 +08:00
|
|
|
export const refreshToken = () => {
|
2025-02-07 14:28:15 +08:00
|
|
|
return http.get<Login.ResLogin>(`${rePrefix}/refreshToken`,
|
|
|
|
|
{},
|
|
|
|
|
{ loading: false }
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-14 11:23:49 +08:00
|
|
|
//获取场景
|
|
|
|
|
export const getCurrentScene = () => {
|
2025-03-24 10:46:16 +08:00
|
|
|
return http.get('/sysTestConfig/getCurrentScene', {}, { loading: false })
|
2025-03-14 11:23:49 +08:00
|
|
|
}
|
|
|
|
|
|
2025-03-24 19:22:56 +08:00
|
|
|
/**
|
|
|
|
|
* 获取RSA公钥
|
|
|
|
|
*/
|
|
|
|
|
export const getPublicKey = () => {
|
|
|
|
|
return http.get('/admin/getPublicKey', {}, { loading: false })
|
|
|
|
|
}
|