xto-fronted 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.development +4 -0
- package/.env.production +4 -0
- package/README.md +94 -196
- package/dist/{components/Layout/TopMenu.vue.d.ts → App.vue.d.ts} +1 -1
- package/dist/api/auth.d.ts +8 -10
- package/dist/api/system.d.ts +11 -12
- package/dist/api/user.d.ts +12 -3
- package/dist/components/Layout/Footer.vue.d.ts +1 -1
- package/dist/components/Layout/Header.vue.d.ts +3 -14
- package/dist/components/Layout/Sidebar.vue.d.ts +1 -1
- package/dist/components/Layout/Tabs.vue.d.ts +1 -1
- package/dist/components/Layout/index.vue.d.ts +1 -1
- package/dist/composables/useAuth.d.ts +4 -19
- package/dist/directives/permission.d.ts +0 -1
- package/dist/index-CWRs4WMN.js +372 -0
- package/dist/index-CpxpXTQX.js +1462 -0
- package/dist/index-Cu3Z2-PY.js +345 -0
- package/dist/index-DPEVEyik.js +475 -0
- package/dist/index-DYnXaqYf.js +142 -0
- package/dist/index.d.ts +12 -25
- package/dist/index.es.js +76 -1521
- package/dist/index.umd.js +1 -20
- package/dist/main.d.ts +0 -1
- package/dist/router/dynamicRoutes.d.ts +33 -17
- package/dist/router/index.d.ts +4 -26
- package/dist/router/layoutRoute.d.ts +18 -0
- package/dist/router/staticRoutes.d.ts +2 -18
- package/dist/setup.d.ts +17 -0
- package/dist/stores/app.d.ts +15 -9
- package/dist/stores/auth.d.ts +48 -62
- package/dist/stores/index.d.ts +3 -1
- package/dist/stores/menu.d.ts +29 -47
- package/dist/stores/user.d.ts +84 -64
- package/dist/style.css +1 -1
- package/dist/utils/auth.d.ts +10 -10
- package/dist/utils/permission.d.ts +10 -1
- package/dist/utils/request.d.ts +7 -23
- package/dist/{components/Layout/Breadcrumb.vue.d.ts → views/dashboard/index.vue.d.ts} +1 -1
- package/dist/{components/Error → views/error}/403.vue.d.ts +1 -1
- package/dist/{components/Error → views/error}/404.vue.d.ts +1 -1
- package/dist/views/login/index.vue.d.ts +4 -0
- package/dist/views/system/menu/index.vue.d.ts +4 -0
- package/dist/views/system/role/index.vue.d.ts +4 -0
- package/dist/views/system/user/index.vue.d.ts +4 -0
- package/dist/vite.svg +9 -9
- package/index.html +13 -0
- package/package.json +27 -31
- package/public/vite.svg +10 -0
- package/src/App.vue +20 -0
- package/src/api/auth.ts +26 -0
- package/src/api/system.ts +65 -0
- package/src/api/user.ts +46 -0
- package/src/assets/styles/_dark.scss +407 -0
- package/src/assets/styles/_reset.scss +126 -0
- package/src/assets/styles/_root.scss +140 -0
- package/src/assets/styles/_transition.scss +119 -0
- package/src/assets/styles/_variables.scss +45 -0
- package/src/assets/styles/index.scss +187 -0
- package/src/components/Layout/Footer.vue +17 -0
- package/src/components/Layout/Header.vue +390 -0
- package/src/components/Layout/Sidebar.vue +297 -0
- package/src/components/Layout/Tabs.vue +134 -0
- package/src/components/Layout/index.vue +62 -0
- package/src/composables/useAuth.ts +45 -0
- package/src/composables/useForm.ts +79 -0
- package/src/composables/useTable.ts +97 -0
- package/src/directives/permission.ts +38 -0
- package/src/enums/index.ts +63 -0
- package/src/env.d.ts +17 -0
- package/src/index.ts +48 -0
- package/src/main.ts +34 -0
- package/src/router/dynamicRoutes.ts +163 -0
- package/src/router/index.ts +81 -0
- package/src/router/layoutRoute.ts +45 -0
- package/src/router/staticRoutes.ts +43 -0
- package/src/setup.ts +54 -0
- package/src/stores/app.ts +163 -0
- package/src/stores/auth.ts +66 -0
- package/src/stores/index.ts +15 -0
- package/src/stores/menu.ts +80 -0
- package/src/stores/user.ts +73 -0
- package/src/style.css +11 -0
- package/src/types/api.d.ts +84 -0
- package/src/types/global.d.ts +45 -0
- package/src/types/router.d.ts +48 -0
- package/src/types/xto.d.ts +149 -0
- package/src/utils/auth.ts +62 -0
- package/src/utils/permission.ts +42 -0
- package/src/utils/request.ts +124 -0
- package/src/utils/storage.ts +63 -0
- package/src/views/dashboard/index.vue +284 -0
- package/src/views/error/403.vue +57 -0
- package/src/views/error/404.vue +57 -0
- package/src/views/login/index.vue +248 -0
- package/src/views/system/menu/index.vue +381 -0
- package/src/views/system/role/index.vue +304 -0
- package/src/views/system/user/index.vue +327 -0
- package/tsconfig.json +26 -0
- package/tsconfig.node.json +11 -0
- package/vite.config.ts +140 -0
- package/dist/api/menu.d.ts +0 -4
- package/dist/components/Login/index.vue.d.ts +0 -25
- package/dist/components/SettingDrawer/index.vue.d.ts +0 -19
- package/dist/composables/index.d.ts +0 -8
- package/dist/composables/useApp.d.ts +0 -65
- package/dist/composables/useMenu.d.ts +0 -34
- package/dist/config/index.d.ts +0 -31
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {},
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {},
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
2
2
|
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
2
|
+
formRef: any;
|
|
3
|
+
}, HTMLDivElement>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
2
|
+
formRef: any;
|
|
3
|
+
}, HTMLDivElement>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
2
|
+
formRef: any;
|
|
3
|
+
}, HTMLDivElement>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
2
|
+
formRef: any;
|
|
3
|
+
}, HTMLDivElement>;
|
|
4
|
+
export default _default;
|
package/dist/vite.svg
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 256 256">
|
|
2
|
-
<defs>
|
|
3
|
-
<linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
4
|
-
<stop offset="0%" style="stop-color:#409eff;stop-opacity:1" />
|
|
5
|
-
<stop offset="100%" style="stop-color:#67c23a;stop-opacity:1" />
|
|
6
|
-
</linearGradient>
|
|
7
|
-
</defs>
|
|
8
|
-
<rect width="256" height="256" rx="32" fill="url(#gradient)"/>
|
|
9
|
-
<text x="128" y="160" text-anchor="middle" fill="white" font-size="120" font-weight="bold" font-family="Arial">X</text>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 256 256">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
4
|
+
<stop offset="0%" style="stop-color:#409eff;stop-opacity:1" />
|
|
5
|
+
<stop offset="100%" style="stop-color:#67c23a;stop-opacity:1" />
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect width="256" height="256" rx="32" fill="url(#gradient)"/>
|
|
9
|
+
<text x="128" y="160" text-anchor="middle" fill="white" font-size="120" font-weight="bold" font-family="Arial">X</text>
|
|
10
10
|
</svg>
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Xto Demo - 后台管理系统</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xto-fronted",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "XTO
|
|
6
|
+
"description": "XTO 前端应用框架",
|
|
7
7
|
"main": "dist/index.umd.js",
|
|
8
8
|
"module": "dist/index.es.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
@@ -16,49 +16,49 @@
|
|
|
16
16
|
"./style.css": "./dist/style.css"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
|
-
"dist"
|
|
19
|
+
"dist",
|
|
20
|
+
"src",
|
|
21
|
+
"public",
|
|
22
|
+
"index.html",
|
|
23
|
+
"vite.config.ts",
|
|
24
|
+
"tsconfig.json",
|
|
25
|
+
"tsconfig.node.json",
|
|
26
|
+
".env.development",
|
|
27
|
+
".env.production"
|
|
20
28
|
],
|
|
21
|
-
"pnpm": {
|
|
22
|
-
"onlyBuiltDependencies": [
|
|
23
|
-
"@parcel/watcher",
|
|
24
|
-
"esbuild",
|
|
25
|
-
"vue-demi"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
29
|
"scripts": {
|
|
29
30
|
"dev": "vite",
|
|
30
31
|
"build": "vue-tsc && vite build",
|
|
31
|
-
"build:lib": "vite build --mode lib",
|
|
32
|
+
"build:lib": "vue-tsc && vite build --mode lib",
|
|
32
33
|
"preview": "vite preview",
|
|
33
|
-
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix"
|
|
34
|
-
"prepublishOnly": "npm run build:lib"
|
|
34
|
+
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@xto/base": "^1.1.4",
|
|
38
|
-
"@xto/core": "^1.0.1",
|
|
39
|
-
"@xto/feedback": "^1.0.4",
|
|
40
|
-
"@xto/form": "^1.0.3",
|
|
41
|
-
"@xto/navigation": "^1.1.1",
|
|
42
37
|
"axios": "^1.6.0",
|
|
43
38
|
"pinia": "^2.1.0",
|
|
44
39
|
"vue": "^3.4.0",
|
|
45
40
|
"vue-router": "^4.3.0"
|
|
46
41
|
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@xto/base": "^0.1.0",
|
|
44
|
+
"@xto/business": "^0.1.0",
|
|
45
|
+
"@xto/core": "^0.1.0",
|
|
46
|
+
"@xto/data": "^0.1.0",
|
|
47
|
+
"@xto/feedback": "^0.1.0",
|
|
48
|
+
"@xto/form": "^0.1.0",
|
|
49
|
+
"@xto/layout": "^0.1.0",
|
|
50
|
+
"@xto/navigation": "^0.1.0"
|
|
51
|
+
},
|
|
47
52
|
"devDependencies": {
|
|
48
53
|
"@types/node": "^20.11.30",
|
|
49
54
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
50
|
-
"@xto/base": "^1.2.0",
|
|
51
|
-
"@xto/core": "^1.0.1",
|
|
52
|
-
"@xto/feedback": "^1.1.0",
|
|
53
|
-
"@xto/form": "^1.1.0",
|
|
54
|
-
"@xto/navigation": "^1.2.0",
|
|
55
55
|
"axios": "^1.6.8",
|
|
56
56
|
"pinia": "^2.1.7",
|
|
57
|
-
"sass": "^1.
|
|
58
|
-
"sass-embedded": "^1.
|
|
57
|
+
"sass": "^1.72.0",
|
|
58
|
+
"sass-embedded": "^1.72.0",
|
|
59
59
|
"typescript": "^5.4.2",
|
|
60
60
|
"vite": "^5.2.0",
|
|
61
|
-
"vite-plugin-dts": "^
|
|
61
|
+
"vite-plugin-dts": "^4.5.4",
|
|
62
62
|
"vue": "^3.4.21",
|
|
63
63
|
"vue-router": "^4.3.0",
|
|
64
64
|
"vue-tsc": "^2.0.6"
|
|
@@ -68,11 +68,7 @@
|
|
|
68
68
|
"vue3",
|
|
69
69
|
"admin",
|
|
70
70
|
"template",
|
|
71
|
-
"xto"
|
|
72
|
-
"scaffold",
|
|
73
|
-
"login",
|
|
74
|
-
"menu",
|
|
75
|
-
"cli"
|
|
71
|
+
"xto"
|
|
76
72
|
],
|
|
77
73
|
"author": "",
|
|
78
74
|
"license": "MIT",
|
package/public/vite.svg
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 256 256">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
4
|
+
<stop offset="0%" style="stop-color:#409eff;stop-opacity:1" />
|
|
5
|
+
<stop offset="100%" style="stop-color:#67c23a;stop-opacity:1" />
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect width="256" height="256" rx="32" fill="url(#gradient)"/>
|
|
9
|
+
<text x="128" y="160" text-anchor="middle" fill="white" font-size="120" font-weight="bold" font-family="Arial">X</text>
|
|
10
|
+
</svg>
|
package/src/App.vue
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useAppStore } from '@/stores/app'
|
|
3
|
+
|
|
4
|
+
const appStore = useAppStore()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<div class="app" :class="{ dark: appStore.isDark }">
|
|
9
|
+
<router-view />
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<style lang="scss">
|
|
14
|
+
.app {
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
background-color: var(--bg-color-page);
|
|
18
|
+
transition: background-color 0.3s;
|
|
19
|
+
}
|
|
20
|
+
</style>
|
package/src/api/auth.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 认证 API
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { http } from '@/utils/request'
|
|
6
|
+
import type { LoginParams, LoginResult, UserInfo } from '@/types/api'
|
|
7
|
+
|
|
8
|
+
// 登录
|
|
9
|
+
export function login(data: LoginParams) {
|
|
10
|
+
return http.post<LoginResult>('/auth/login', data)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// 登出
|
|
14
|
+
export function logout() {
|
|
15
|
+
return http.post('/auth/logout')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 获取用户信息
|
|
19
|
+
export function getUserInfo() {
|
|
20
|
+
return http.get<UserInfo>('/user/info')
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// 刷新 Token
|
|
24
|
+
export function refreshToken(refreshToken: string) {
|
|
25
|
+
return http.post<{ token: string; expireTime: number }>('/auth/refresh', { refreshToken })
|
|
26
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 系统管理 API
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { http, type PageParams, type PageResponse } from '@/utils/request'
|
|
6
|
+
import type { RoleInfo, MenuItem } from '@/types/api'
|
|
7
|
+
|
|
8
|
+
// ========== 角色管理 ==========
|
|
9
|
+
|
|
10
|
+
// 获取角色列表
|
|
11
|
+
export function getRoleList(params: PageParams & { status?: number; keyword?: string }) {
|
|
12
|
+
return http.get<PageResponse<RoleInfo>>('/role/list', { params })
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// 获取角色详情
|
|
16
|
+
export function getRoleDetail(id: string | number) {
|
|
17
|
+
return http.get<RoleInfo>(`/role/${id}`)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// 创建角色
|
|
21
|
+
export function createRole(data: Partial<RoleInfo>) {
|
|
22
|
+
return http.post<RoleInfo>('/role', data)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 更新角色
|
|
26
|
+
export function updateRole(id: string | number, data: Partial<RoleInfo>) {
|
|
27
|
+
return http.put<RoleInfo>(`/role/${id}`, data)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 删除角色
|
|
31
|
+
export function deleteRole(id: string | number) {
|
|
32
|
+
return http.delete(`/role/${id}`)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 更新角色状态
|
|
36
|
+
export function updateRoleStatus(id: string | number, status: number) {
|
|
37
|
+
return http.patch(`/role/${id}/status`, { status })
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// ========== 菜单管理 ==========
|
|
41
|
+
|
|
42
|
+
// 获取菜单列表
|
|
43
|
+
export function getMenuList() {
|
|
44
|
+
return http.get<MenuItem[]>('/menu/list')
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 获取菜单树
|
|
48
|
+
export function getMenuTree() {
|
|
49
|
+
return http.get<MenuItem[]>('/menu/tree')
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// 创建菜单
|
|
53
|
+
export function createMenu(data: Partial<MenuItem>) {
|
|
54
|
+
return http.post<MenuItem>('/menu', data)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 更新菜单
|
|
58
|
+
export function updateMenu(id: string | number, data: Partial<MenuItem>) {
|
|
59
|
+
return http.put<MenuItem>(`/menu/${id}`, data)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 删除菜单
|
|
63
|
+
export function deleteMenu(id: string | number) {
|
|
64
|
+
return http.delete(`/menu/${id}`)
|
|
65
|
+
}
|
package/src/api/user.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 用户 API
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { http, type PageParams, type PageResponse } from '@/utils/request'
|
|
6
|
+
import type { UserInfo } from '@/types/api'
|
|
7
|
+
|
|
8
|
+
// 获取用户列表
|
|
9
|
+
export function getUserList(params: PageParams & { status?: number; keyword?: string }) {
|
|
10
|
+
return http.get<PageResponse<UserInfo>>('/user/list', { params })
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// 获取用户详情
|
|
14
|
+
export function getUserDetail(id: string | number) {
|
|
15
|
+
return http.get<UserInfo>(`/user/${id}`)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 创建用户
|
|
19
|
+
export function createUser(data: Partial<UserInfo>) {
|
|
20
|
+
return http.post<UserInfo>('/user', data)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// 更新用户
|
|
24
|
+
export function updateUser(id: string | number, data: Partial<UserInfo>) {
|
|
25
|
+
return http.put<UserInfo>(`/user/${id}`, data)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// 删除用户
|
|
29
|
+
export function deleteUser(id: string | number) {
|
|
30
|
+
return http.delete(`/user/${id}`)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 批量删除用户
|
|
34
|
+
export function batchDeleteUsers(ids: (string | number)[]) {
|
|
35
|
+
return http.post('/user/batch-delete', { ids })
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 更新用户状态
|
|
39
|
+
export function updateUserStatus(id: string | number, status: number) {
|
|
40
|
+
return http.patch(`/user/${id}/status`, { status })
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 重置密码
|
|
44
|
+
export function resetPassword(id: string | number) {
|
|
45
|
+
return http.post(`/user/${id}/reset-password`)
|
|
46
|
+
}
|