mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-11-09 16:57:13 +08:00
first commit
This commit is contained in:
24
src/apis/auth/index.ts
Normal file
24
src/apis/auth/index.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import http from '@/utils/http'
|
||||
import type * as Auth from './type'
|
||||
|
||||
const BASE_URL = '/auth'
|
||||
|
||||
/** @desc 账号登录 */
|
||||
export function accountLogin(req: Auth.AccountLoginReq) {
|
||||
return http.post<Auth.LoginResp>(`${BASE_URL}/account`, req)
|
||||
}
|
||||
|
||||
/** @desc 退出登录 */
|
||||
export function logout() {
|
||||
return http.post(`${BASE_URL}/logout`)
|
||||
}
|
||||
|
||||
/** @desc 获取用户信息 */
|
||||
export const getUserInfo = () => {
|
||||
return http.get<Auth.UserInfo>(`${BASE_URL}/user/info`)
|
||||
}
|
||||
|
||||
/** @desc 获取路由信息 */
|
||||
export const getUserRoute = () => {
|
||||
return http.get<Auth.RouteItem[]>(`${BASE_URL}/route`)
|
||||
}
|
||||
53
src/apis/auth/type.ts
Normal file
53
src/apis/auth/type.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
/** 用户类型 */
|
||||
export interface UserInfo {
|
||||
id: string
|
||||
username: string
|
||||
nickname: string
|
||||
gender: 0 | 1 | 2
|
||||
email: string
|
||||
phone: string
|
||||
avatar: string
|
||||
pwdResetTime: string
|
||||
registrationDate: string
|
||||
deptName: string
|
||||
roles: string[]
|
||||
permissions: string[]
|
||||
}
|
||||
|
||||
/** 路由类型 */
|
||||
export interface RouteItem {
|
||||
id: string
|
||||
title: string
|
||||
parentId: string
|
||||
type: 1 | 2 | 3
|
||||
path: string
|
||||
name: string
|
||||
component: string
|
||||
redirect: string
|
||||
icon: string
|
||||
isExternal: boolean
|
||||
isHidden: boolean
|
||||
isCache: boolean
|
||||
permission: string
|
||||
roles: string[]
|
||||
sort: number
|
||||
status: 0 | 1
|
||||
children: RouteItem[]
|
||||
activeMenu: string
|
||||
alwaysShow: boolean
|
||||
breadcrumb: boolean
|
||||
showInTabs: boolean
|
||||
affix: boolean
|
||||
}
|
||||
|
||||
export interface AccountLoginReq {
|
||||
username: string
|
||||
password: string
|
||||
captcha: string
|
||||
uuid: string
|
||||
}
|
||||
|
||||
// 登录响应类型
|
||||
export interface LoginResp {
|
||||
token: string
|
||||
}
|
||||
Reference in New Issue
Block a user