mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-11-10 02:57:12 +08:00
first commit
This commit is contained in:
7
src/apis/area/index.ts
Normal file
7
src/apis/area/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import http from '@/utils/http'
|
||||
import type * as Area from './type'
|
||||
|
||||
/** @desc 获取地区列表 */
|
||||
export const getAreaList = (params: { type: 'province' | 'city' | 'area'; code?: string }) => {
|
||||
return http.get<Area.AreaItem>('/area/list', params)
|
||||
}
|
||||
5
src/apis/area/type.ts
Normal file
5
src/apis/area/type.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export interface AreaItem {
|
||||
label: string
|
||||
code: string
|
||||
children?: AreaItem[]
|
||||
}
|
||||
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
|
||||
}
|
||||
9
src/apis/common/captcha.ts
Normal file
9
src/apis/common/captcha.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import http from '@/utils/http'
|
||||
import type * as Common from './type'
|
||||
|
||||
const BASE_URL = '/captcha'
|
||||
|
||||
/** @desc 获取图片验证码 */
|
||||
export function getImageCaptcha() {
|
||||
return http.get<Common.ImageCaptchaResp>(`${BASE_URL}/img`)
|
||||
}
|
||||
20
src/apis/common/common.ts
Normal file
20
src/apis/common/common.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import http from '@/utils/http'
|
||||
import type { LabelValueState } from '@/types/global'
|
||||
import type { TreeNodeData } from '@arco-design/web-vue'
|
||||
|
||||
const BASE_URL = '/common'
|
||||
|
||||
/** @desc 查询部门树 */
|
||||
export function listDeptTree(query: { description: string }) {
|
||||
return http.get<TreeNodeData[]>(`${BASE_URL}/tree/dept`, query)
|
||||
}
|
||||
|
||||
/** @desc 查询角色列表 */
|
||||
export function listRoleDict(query?: { name: string; status: number }) {
|
||||
return http.get<LabelValueState[]>(`${BASE_URL}/dict/role`, query)
|
||||
}
|
||||
|
||||
/** @desc 查询字典列表 */
|
||||
export function listCommonDict(code: string) {
|
||||
return http.get<LabelValueState[]>(`${BASE_URL}/dict/${code}`)
|
||||
}
|
||||
2
src/apis/common/index.ts
Normal file
2
src/apis/common/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './common'
|
||||
export * from './captcha'
|
||||
5
src/apis/common/type.ts
Normal file
5
src/apis/common/type.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
/** 图形验证码类型 */
|
||||
export interface ImageCaptchaResp {
|
||||
uuid: string
|
||||
img: string
|
||||
}
|
||||
8
src/apis/index.ts
Normal file
8
src/apis/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export * from './area'
|
||||
export * from './auth'
|
||||
export * from './common'
|
||||
|
||||
export * from './area/type'
|
||||
export * from './auth/type'
|
||||
export * from './common/type'
|
||||
|
||||
Reference in New Issue
Block a user