106 lines
2.6 KiB
TypeScript
106 lines
2.6 KiB
TypeScript
import request from '@/utils/request';
|
|
|
|
//登录
|
|
// export const userLogin = (params: Record<string, unknown>): Promise<API.LoginResponse> => (
|
|
// request.post('/api/user/login', params)
|
|
// );
|
|
|
|
// 登录
|
|
export async function userLogin(params: any) {
|
|
const data = await request.post('/auth/admin/login', params)
|
|
return data
|
|
}
|
|
|
|
|
|
//获取用户信息
|
|
export async function retrieveUserInfo(params: any) {
|
|
const data = await request.get('/auth/admin/profile', params)
|
|
return data
|
|
}
|
|
// export const retrieveUserInfo = (): Promise<API.UserInfoResponse> => (
|
|
// request.get('/api/user/info')
|
|
// );
|
|
|
|
//获取用户权限
|
|
export async function retrieveUserAuthority(params: any) {
|
|
const data = await request.get('/api/user/authority', params)
|
|
return data
|
|
}
|
|
// export const retrieveUserAuthority = (): Promise<API.UserAuthorityResponse> => (
|
|
// request.get('/api/user/authority')
|
|
// );
|
|
|
|
//获取菜单数据
|
|
export async function retrieveMenuData(params: any) {
|
|
// const data = await request.get('/menus', params)
|
|
// return data
|
|
return [
|
|
{
|
|
path: '/standard/index',
|
|
redirect: '',
|
|
name: '生成标准页面',
|
|
component: "@/pages/standard/index",
|
|
},
|
|
{
|
|
path: '/examine',
|
|
redirect: '',
|
|
name: '走动式管理',
|
|
children: [
|
|
{
|
|
path: '/examine/index',
|
|
name: '考评分类管理',
|
|
component: "@/pages/examine/index",
|
|
},
|
|
{
|
|
path: '/examine/question',
|
|
name: '考核问题管理',
|
|
component: "@/pages/examine/question",
|
|
},
|
|
{
|
|
path: '/examine/modal',
|
|
name: '考核模版管理',
|
|
component: "@/pages/examine/modal",
|
|
},
|
|
{
|
|
path: '/examine/record',
|
|
name: '考核记录管理',
|
|
component: "@/pages/examine/record",
|
|
}
|
|
]
|
|
|
|
},
|
|
]
|
|
}
|
|
// export const retrieveMenuData = (): Promise<API.MenuDataResponse> => (
|
|
// request.get('/api/user/menu')
|
|
// );
|
|
|
|
|
|
|
|
//获取用户信息和权限以及菜单
|
|
export const retrieveUserInfoAuthorityMenu = (): Promise<API.UserInfoAuthMenuResponse> => (
|
|
Promise.all([
|
|
retrieveUserInfo(),
|
|
// retrieveUserAuthority(),
|
|
retrieveMenuData(),
|
|
])
|
|
);
|
|
|
|
//获取用户权限以及菜单
|
|
export const retrieveUserAuthorityMenu = (): Promise<API.UserAuthMenuResponse> => (
|
|
Promise.all([
|
|
// retrieveUserAuthority(),
|
|
retrieveMenuData(),
|
|
])
|
|
);
|
|
|
|
//登出
|
|
export const userLogout = (): Promise<API.LogoutResponse> => (
|
|
request.post('/auth/logout')
|
|
);
|
|
|
|
//获取验证码
|
|
export const retrieveCaptcha = (params: Record<string, string>): Promise<API.CaptchaResponse> => (
|
|
request.get('/api/user/captcha', { params })
|
|
);
|