xto-fronted 0.1.1 → 0.1.3
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 +3 -4
- package/.env.production +3 -4
- package/bin/cli.js +104 -0
- package/dist/{403-MQkNUulz.js → 403-DM5wfQkM.js} +6 -6
- package/dist/{404-BOFYLq4X.js → 404-BurAu5LC.js} +7 -7
- package/dist/api/auth.d.ts +9 -8
- package/dist/api/menu.d.ts +3 -0
- package/dist/api/user.d.ts +2 -12
- package/dist/composables/index.d.ts +8 -0
- package/dist/composables/useApp.d.ts +64 -0
- package/dist/composables/useAuth.d.ts +19 -4
- package/dist/composables/useMenu.d.ts +34 -0
- package/dist/config/index.d.ts +11 -0
- package/dist/index-BNiEld34.js +15 -0
- package/dist/index-Be9RiEfo.js +98 -0
- package/dist/index-BqRv1bdN.js +1185 -0
- package/dist/index-CQLVXvNJ.js +15 -0
- package/dist/index-CyiE8n2V.js +15 -0
- package/dist/index-xauR1bOL.js +15 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.es.js +50 -66
- package/dist/index.umd.js +1 -1
- package/dist/stores/auth.d.ts +60 -23
- package/dist/stores/menu.d.ts +40 -29
- package/dist/stores/user.d.ts +63 -84
- package/dist/style.css +1 -1
- package/dist/utils/auth.d.ts +15 -7
- package/dist/utils/permission.d.ts +1 -6
- package/dist/views/system/menu/index.vue.d.ts +1 -3
- package/dist/views/system/role/index.vue.d.ts +1 -3
- package/dist/views/system/user/index.vue.d.ts +1 -3
- package/package.json +27 -19
- package/src/api/auth.ts +34 -25
- package/src/api/menu.ts +13 -0
- package/src/api/user.ts +11 -45
- package/src/components/Layout/Header.vue +334 -389
- package/src/components/Layout/Sidebar.vue +212 -296
- package/src/components/Layout/Tabs.vue +19 -133
- package/src/composables/index.ts +9 -0
- package/src/composables/useApp.ts +170 -0
- package/src/composables/useAuth.ts +69 -44
- package/src/composables/useMenu.ts +141 -0
- package/src/config/index.ts +19 -0
- package/src/directives/permission.ts +40 -37
- package/src/index.ts +9 -4
- package/src/router/index.ts +70 -80
- package/src/stores/auth.ts +44 -31
- package/src/stores/menu.ts +157 -79
- package/src/stores/user.ts +40 -72
- package/src/types/api.d.ts +102 -83
- package/src/types/xto.d.ts +148 -148
- package/src/utils/auth.ts +85 -61
- package/src/utils/permission.ts +29 -41
- package/src/utils/request.ts +125 -125
- package/src/utils/storage.ts +10 -1
- package/src/views/dashboard/index.vue +31 -283
- package/src/views/login/index.vue +140 -247
- package/src/views/system/menu/index.vue +31 -380
- package/src/views/system/role/index.vue +31 -303
- package/src/views/system/user/index.vue +31 -326
- package/vite.config.ts +3 -3
- package/dist/index-BJxYdNPy.js +0 -475
- package/dist/index-BvnIIBR1.js +0 -142
- package/dist/index-CEvAq6KE.js +0 -372
- package/dist/index-DPkqej__.js +0 -345
- package/dist/index-pq9Z5K62.js +0 -184
- package/dist/index-vVfjShJR.js +0 -1183
package/.env.development
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
VITE_USE_MOCK = true
|
|
1
|
+
VITE_APP_NAME=analysis-web
|
|
2
|
+
VITE_APP_ID=DBU-CONTENT-ANALYSIS
|
|
3
|
+
VITE_APP_CLIENT_ID=Tineco
|
package/.env.production
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
VITE_USE_MOCK = false
|
|
1
|
+
VITE_APP_NAME=analysis-web
|
|
2
|
+
VITE_APP_ID=DBU-CONTENT-ANALYSIS
|
|
3
|
+
VITE_APP_CLIENT_ID=Tineco
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* xto-fronted CLI
|
|
5
|
+
* 用于初始化前端项目脚手架
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { execSync } = require('child_process')
|
|
9
|
+
const { existsSync, mkdirSync, cpSync, writeFileSync } = require('fs')
|
|
10
|
+
const { resolve, basename } = require('path')
|
|
11
|
+
|
|
12
|
+
// 获取命令行参数
|
|
13
|
+
const args = process.argv.slice(2)
|
|
14
|
+
const targetDir = args[0] || 'my-app'
|
|
15
|
+
const targetPath = resolve(process.cwd(), targetDir)
|
|
16
|
+
|
|
17
|
+
console.log('\n🚀 创建项目:', targetDir)
|
|
18
|
+
console.log('📁 目标路径:', targetPath)
|
|
19
|
+
|
|
20
|
+
// 模板目录(CLI 所在目录的上级目录)
|
|
21
|
+
const templateDir = resolve(__dirname, '..')
|
|
22
|
+
|
|
23
|
+
// 创建目标目录
|
|
24
|
+
if (existsSync(targetPath)) {
|
|
25
|
+
console.error('❌ 目录已存在:', targetPath)
|
|
26
|
+
process.exit(1)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
mkdirSync(targetPath, { recursive: true })
|
|
30
|
+
|
|
31
|
+
// 需要复制的文件和目录
|
|
32
|
+
const filesToCopy = [
|
|
33
|
+
'src',
|
|
34
|
+
'public',
|
|
35
|
+
'index.html',
|
|
36
|
+
'vite.config.ts',
|
|
37
|
+
'tsconfig.json',
|
|
38
|
+
'tsconfig.node.json',
|
|
39
|
+
'.env.development',
|
|
40
|
+
'.env.production'
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
// 复制文件
|
|
44
|
+
filesToCopy.forEach(file => {
|
|
45
|
+
const src = resolve(templateDir, file)
|
|
46
|
+
const dest = resolve(targetPath, file)
|
|
47
|
+
if (existsSync(src)) {
|
|
48
|
+
cpSync(src, dest, { recursive: true })
|
|
49
|
+
console.log('✅ 复制:', file)
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
// 创建 package.json
|
|
54
|
+
const packageJson = {
|
|
55
|
+
name: basename(targetPath),
|
|
56
|
+
version: '0.0.1',
|
|
57
|
+
private: true,
|
|
58
|
+
type: 'module',
|
|
59
|
+
scripts: {
|
|
60
|
+
dev: 'vite',
|
|
61
|
+
build: 'vue-tsc && vite build',
|
|
62
|
+
preview: 'vite preview'
|
|
63
|
+
},
|
|
64
|
+
dependencies: {
|
|
65
|
+
'@xto/base': '^0.1.0',
|
|
66
|
+
'@xto/feedback': '^0.1.0',
|
|
67
|
+
'@xto/form': '^0.1.0',
|
|
68
|
+
'@xto/navigation': '^0.1.0',
|
|
69
|
+
'axios': '^1.6.8',
|
|
70
|
+
'pinia': '^2.1.7',
|
|
71
|
+
'vue': '^3.4.21',
|
|
72
|
+
'vue-router': '^4.3.0',
|
|
73
|
+
'xto-fronted': '^0.1.3'
|
|
74
|
+
},
|
|
75
|
+
devDependencies: {
|
|
76
|
+
'@types/node': '^20.11.30',
|
|
77
|
+
'@vitejs/plugin-vue': '^5.0.4',
|
|
78
|
+
'sass': '^1.72.0',
|
|
79
|
+
'sass-embedded': '^1.72.0',
|
|
80
|
+
'typescript': '^5.4.2',
|
|
81
|
+
'vite': '^5.2.0',
|
|
82
|
+
'vue-tsc': '^2.0.6'
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
writeFileSync(
|
|
87
|
+
resolve(targetPath, 'package.json'),
|
|
88
|
+
JSON.stringify(packageJson, null, 2)
|
|
89
|
+
)
|
|
90
|
+
console.log('✅ 创建: package.json')
|
|
91
|
+
|
|
92
|
+
// 安装依赖
|
|
93
|
+
console.log('\n📦 安装依赖...')
|
|
94
|
+
try {
|
|
95
|
+
execSync('npm install', { cwd: targetPath, stdio: 'inherit' })
|
|
96
|
+
console.log('✅ 依赖安装完成')
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.log('⚠️ 依赖安装失败,请手动运行: npm install')
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
console.log('\n✨ 项目创建成功!')
|
|
102
|
+
console.log('\n👉 接下来执行:')
|
|
103
|
+
console.log(` cd ${targetDir}`)
|
|
104
|
+
console.log(' npm run dev\n')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as s, openBlock as n, createElementBlock as p, createElementVNode as o, createVNode as
|
|
1
|
+
import { defineComponent as s, openBlock as n, createElementBlock as p, createElementVNode as o, createVNode as a, unref as d, withCtx as _, createTextVNode as i } from "vue";
|
|
2
2
|
import { useRouter as m } from "vue-router";
|
|
3
|
-
import { Button as
|
|
4
|
-
import {
|
|
3
|
+
import { Button as l } from "@xto/base";
|
|
4
|
+
import { a as c } from "./index-BqRv1bdN.js";
|
|
5
5
|
const f = { class: "error-page" }, u = { class: "error-page__content" }, g = /* @__PURE__ */ s({
|
|
6
6
|
__name: "403",
|
|
7
7
|
setup(v) {
|
|
@@ -13,11 +13,11 @@ const f = { class: "error-page" }, u = { class: "error-page__content" }, g = /*
|
|
|
13
13
|
e[1] || (e[1] = o("div", { class: "error-page__code" }, "403", -1)),
|
|
14
14
|
e[2] || (e[2] = o("div", { class: "error-page__title" }, "无访问权限", -1)),
|
|
15
15
|
e[3] || (e[3] = o("div", { class: "error-page__desc" }, "抱歉,您没有权限访问此页面", -1)),
|
|
16
|
-
d(
|
|
16
|
+
a(d(l), {
|
|
17
17
|
type: "primary",
|
|
18
18
|
onClick: t
|
|
19
19
|
}, {
|
|
20
|
-
default:
|
|
20
|
+
default: _(() => [...e[0] || (e[0] = [
|
|
21
21
|
i("返回首页", -1)
|
|
22
22
|
])]),
|
|
23
23
|
_: 1
|
|
@@ -25,7 +25,7 @@ const f = { class: "error-page" }, u = { class: "error-page__content" }, g = /*
|
|
|
25
25
|
])
|
|
26
26
|
]));
|
|
27
27
|
}
|
|
28
|
-
}), V = /* @__PURE__ */
|
|
28
|
+
}), V = /* @__PURE__ */ c(g, [["__scopeId", "data-v-f6105e3d"]]);
|
|
29
29
|
export {
|
|
30
30
|
V as default
|
|
31
31
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { defineComponent as s, openBlock as n, createElementBlock as
|
|
2
|
-
import { useRouter as
|
|
3
|
-
import { Button as
|
|
4
|
-
import {
|
|
1
|
+
import { defineComponent as s, openBlock as n, createElementBlock as a, createElementVNode as o, createVNode as p, unref as _, withCtx as d, createTextVNode as i } from "vue";
|
|
2
|
+
import { useRouter as m } from "vue-router";
|
|
3
|
+
import { Button as c } from "@xto/base";
|
|
4
|
+
import { a as l } from "./index-BqRv1bdN.js";
|
|
5
5
|
const f = { class: "error-page" }, u = { class: "error-page__content" }, g = /* @__PURE__ */ s({
|
|
6
6
|
__name: "404",
|
|
7
7
|
setup(v) {
|
|
8
|
-
const r =
|
|
8
|
+
const r = m(), t = () => {
|
|
9
9
|
r.push("/");
|
|
10
10
|
};
|
|
11
|
-
return (x, e) => (n(),
|
|
11
|
+
return (x, e) => (n(), a("div", f, [
|
|
12
12
|
o("div", u, [
|
|
13
13
|
e[1] || (e[1] = o("div", { class: "error-page__code" }, "404", -1)),
|
|
14
14
|
e[2] || (e[2] = o("div", { class: "error-page__title" }, "页面不存在", -1)),
|
|
15
15
|
e[3] || (e[3] = o("div", { class: "error-page__desc" }, "抱歉,您访问的页面不存在或已被删除", -1)),
|
|
16
|
-
|
|
16
|
+
p(_(c), {
|
|
17
17
|
type: "primary",
|
|
18
18
|
onClick: t
|
|
19
19
|
}, {
|
package/dist/api/auth.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ApiResponse } from '../utils/request';
|
|
2
|
+
import { LoginResult } from '../types/api';
|
|
3
|
+
export interface LoginParams {
|
|
4
|
+
uid: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function login(data: LoginParams): Promise<ApiResponse<LoginResult>>;
|
|
8
|
+
export declare function logout(): Promise<ApiResponse<null>>;
|
|
9
|
+
export declare function loginByCode(appId: string, code: string): Promise<ApiResponse<LoginResult>>;
|
package/dist/api/user.d.ts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiResponse } from '../utils/request';
|
|
2
2
|
import { UserInfo } from '../types/api';
|
|
3
|
-
export declare function
|
|
4
|
-
status?: number;
|
|
5
|
-
keyword?: string;
|
|
6
|
-
}): Promise<import('../utils/request').ApiResponse<PageResponse<UserInfo>>>;
|
|
7
|
-
export declare function getUserDetail(id: string | number): Promise<import('../utils/request').ApiResponse<UserInfo>>;
|
|
8
|
-
export declare function createUser(data: Partial<UserInfo>): Promise<import('../utils/request').ApiResponse<UserInfo>>;
|
|
9
|
-
export declare function updateUser(id: string | number, data: Partial<UserInfo>): Promise<import('../utils/request').ApiResponse<UserInfo>>;
|
|
10
|
-
export declare function deleteUser(id: string | number): Promise<import('../utils/request').ApiResponse<unknown>>;
|
|
11
|
-
export declare function batchDeleteUsers(ids: (string | number)[]): Promise<import('../utils/request').ApiResponse<unknown>>;
|
|
12
|
-
export declare function updateUserStatus(id: string | number, status: number): Promise<import('../utils/request').ApiResponse<unknown>>;
|
|
13
|
-
export declare function resetPassword(id: string | number): Promise<import('../utils/request').ApiResponse<unknown>>;
|
|
3
|
+
export declare function getCurrentUser(): Promise<ApiResponse<UserInfo>>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { UserInfo, LoginResult } from '../types/api';
|
|
2
|
+
export declare function useApp(): {
|
|
3
|
+
loading: import('vue').Ref<boolean, boolean>;
|
|
4
|
+
isLoggedIn: import('vue').ComputedRef<boolean>;
|
|
5
|
+
userInfo: import('vue').ComputedRef<{
|
|
6
|
+
uId: string;
|
|
7
|
+
appId: string;
|
|
8
|
+
userId: string;
|
|
9
|
+
userName: string;
|
|
10
|
+
departmentName?: string | undefined;
|
|
11
|
+
email?: string | undefined;
|
|
12
|
+
mobilePhone?: string | undefined;
|
|
13
|
+
positionName?: string | undefined;
|
|
14
|
+
avatar?: string | undefined;
|
|
15
|
+
workNo?: string | undefined;
|
|
16
|
+
} | null>;
|
|
17
|
+
userName: import('vue').ComputedRef<string>;
|
|
18
|
+
menuList: import('vue').ComputedRef<{
|
|
19
|
+
code: string;
|
|
20
|
+
name: string;
|
|
21
|
+
path: string;
|
|
22
|
+
component?: string | undefined;
|
|
23
|
+
redirect?: string | undefined;
|
|
24
|
+
icon?: string | undefined;
|
|
25
|
+
title: string;
|
|
26
|
+
hidden?: boolean | undefined;
|
|
27
|
+
keepAlive?: boolean | undefined;
|
|
28
|
+
affix?: boolean | undefined;
|
|
29
|
+
default?: boolean | undefined;
|
|
30
|
+
out?: boolean | undefined;
|
|
31
|
+
closable?: boolean | undefined;
|
|
32
|
+
children?: /*elided*/ any[] | undefined;
|
|
33
|
+
}[]>;
|
|
34
|
+
indexPath: import('vue').ComputedRef<string>;
|
|
35
|
+
login: (uid: string, password: string) => Promise<{
|
|
36
|
+
success: boolean;
|
|
37
|
+
data: LoginResult;
|
|
38
|
+
error?: undefined;
|
|
39
|
+
} | {
|
|
40
|
+
success: boolean;
|
|
41
|
+
error: any;
|
|
42
|
+
data?: undefined;
|
|
43
|
+
}>;
|
|
44
|
+
logout: (showMessage?: boolean) => Promise<void>;
|
|
45
|
+
loadUserInfo: () => Promise<UserInfo>;
|
|
46
|
+
loadMenu: () => Promise<{
|
|
47
|
+
code: string;
|
|
48
|
+
name: string;
|
|
49
|
+
path: string;
|
|
50
|
+
component?: string | undefined;
|
|
51
|
+
redirect?: string | undefined;
|
|
52
|
+
icon?: string | undefined;
|
|
53
|
+
title: string;
|
|
54
|
+
hidden?: boolean | undefined;
|
|
55
|
+
keepAlive?: boolean | undefined;
|
|
56
|
+
affix?: boolean | undefined;
|
|
57
|
+
default?: boolean | undefined;
|
|
58
|
+
out?: boolean | undefined;
|
|
59
|
+
closable?: boolean | undefined;
|
|
60
|
+
children?: /*elided*/ any[] | undefined;
|
|
61
|
+
}[]>;
|
|
62
|
+
initApp: () => Promise<boolean>;
|
|
63
|
+
clearAllState: () => void;
|
|
64
|
+
};
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 权限 Hook
|
|
3
|
+
* 封装权限检查、按钮权限等逻辑
|
|
3
4
|
*/
|
|
4
5
|
export declare function useAuth(): {
|
|
5
|
-
hasPermission: (permission: string | string[]) => boolean;
|
|
6
|
-
hasRole: (role: string | string[]) => boolean;
|
|
7
|
-
isAdmin: import('vue').ComputedRef<boolean>;
|
|
8
6
|
isLoggedIn: import('vue').ComputedRef<boolean>;
|
|
7
|
+
userName: import('vue').ComputedRef<string>;
|
|
8
|
+
userInfo: import('vue').ComputedRef<{
|
|
9
|
+
uId: string;
|
|
10
|
+
appId: string;
|
|
11
|
+
userId: string;
|
|
12
|
+
userName: string;
|
|
13
|
+
departmentName?: string | undefined;
|
|
14
|
+
email?: string | undefined;
|
|
15
|
+
mobilePhone?: string | undefined;
|
|
16
|
+
positionName?: string | undefined;
|
|
17
|
+
avatar?: string | undefined;
|
|
18
|
+
workNo?: string | undefined;
|
|
19
|
+
} | null>;
|
|
20
|
+
hasPermission: (permission: string | string[]) => boolean;
|
|
21
|
+
hasAnyPermission: (permissions: string[]) => boolean;
|
|
22
|
+
hasAllPermissions: (permissions: string[]) => boolean;
|
|
23
|
+
getCurrentPagePermissions: () => string[];
|
|
9
24
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { MenuItem } from '../types/api';
|
|
2
|
+
export declare function useMenu(iconMap?: Record<string, string>): {
|
|
3
|
+
searchKeyword: import('vue').Ref<string, string>;
|
|
4
|
+
activeMenu: import('vue').ComputedRef<string>;
|
|
5
|
+
isCollapsed: import('vue').ComputedRef<boolean>;
|
|
6
|
+
menuList: import('vue').ComputedRef<{
|
|
7
|
+
code: string;
|
|
8
|
+
name: string;
|
|
9
|
+
path: string;
|
|
10
|
+
component?: string | undefined;
|
|
11
|
+
redirect?: string | undefined;
|
|
12
|
+
icon?: string | undefined;
|
|
13
|
+
title: string;
|
|
14
|
+
hidden?: boolean | undefined;
|
|
15
|
+
keepAlive?: boolean | undefined;
|
|
16
|
+
affix?: boolean | undefined;
|
|
17
|
+
default?: boolean | undefined;
|
|
18
|
+
out?: boolean | undefined;
|
|
19
|
+
closable?: boolean | undefined;
|
|
20
|
+
children?: /*elided*/ any[] | undefined;
|
|
21
|
+
}[]>;
|
|
22
|
+
hasMenu: import('vue').ComputedRef<boolean>;
|
|
23
|
+
searchResults: import('vue').ComputedRef<(MenuItem & {
|
|
24
|
+
parentTitle: string;
|
|
25
|
+
})[]>;
|
|
26
|
+
filteredMenuList: import('vue').ComputedRef<MenuItem[]>;
|
|
27
|
+
flattenMenus: (menus: MenuItem[], parentTitle?: string) => (MenuItem & {
|
|
28
|
+
parentTitle: string;
|
|
29
|
+
})[];
|
|
30
|
+
getMenuIcon: (icon?: string) => string;
|
|
31
|
+
handleMenuSelect: (index: string) => void;
|
|
32
|
+
handleSearchItemClick: (path: string) => void;
|
|
33
|
+
clearSearch: () => void;
|
|
34
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { openBlock as t, createElementBlock as c, createElementVNode as e } from "vue";
|
|
2
|
+
import { a as n } from "./index-BqRv1bdN.js";
|
|
3
|
+
const r = {}, s = { class: "page" };
|
|
4
|
+
function a(l, o) {
|
|
5
|
+
return t(), c("div", s, [...o[0] || (o[0] = [
|
|
6
|
+
e("div", { class: "page__placeholder" }, [
|
|
7
|
+
e("h2", null, "角色管理"),
|
|
8
|
+
e("p", null, "功能开发中...")
|
|
9
|
+
], -1)
|
|
10
|
+
])]);
|
|
11
|
+
}
|
|
12
|
+
const p = /* @__PURE__ */ n(r, [["render", a], ["__scopeId", "data-v-0802c3db"]]);
|
|
13
|
+
export {
|
|
14
|
+
p as default
|
|
15
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { defineComponent as c, reactive as f, ref as w, openBlock as y, createElementBlock as V, createElementVNode as s, createVNode as l, unref as o, withCtx as t, withKeys as b, createTextVNode as v } from "vue";
|
|
2
|
+
import { u as x, _ as h, a as k } from "./index-BqRv1bdN.js";
|
|
3
|
+
import { Button as z } from "@xto/base";
|
|
4
|
+
import { Form as B, FormItem as i, Input as p } from "@xto/form";
|
|
5
|
+
import "vue-router";
|
|
6
|
+
const C = { class: "login" }, I = { class: "login__container" }, N = /* @__PURE__ */ c({
|
|
7
|
+
__name: "index",
|
|
8
|
+
setup(q) {
|
|
9
|
+
const { login: m, loading: _ } = x(), r = f({
|
|
10
|
+
uid: "",
|
|
11
|
+
password: ""
|
|
12
|
+
}), g = {
|
|
13
|
+
uid: [
|
|
14
|
+
{ required: !0, message: "请输入账号", trigger: "blur" }
|
|
15
|
+
],
|
|
16
|
+
password: [
|
|
17
|
+
{ required: !0, message: "请输入密码", trigger: "blur" }
|
|
18
|
+
]
|
|
19
|
+
}, n = w(), u = async () => {
|
|
20
|
+
var a;
|
|
21
|
+
try {
|
|
22
|
+
await ((a = n.value) == null ? void 0 : a.validate()), await m(r.uid, r.password);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.error("登录失败", e);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return (a, e) => (y(), V("div", C, [
|
|
28
|
+
s("div", I, [
|
|
29
|
+
e[3] || (e[3] = s("div", { class: "login__header" }, [
|
|
30
|
+
s("img", {
|
|
31
|
+
src: h,
|
|
32
|
+
alt: "Logo",
|
|
33
|
+
class: "login__logo"
|
|
34
|
+
}),
|
|
35
|
+
s("h1", { class: "login__title" }, "Analysis Web"),
|
|
36
|
+
s("p", { class: "login__subtitle" }, "后台管理系统")
|
|
37
|
+
], -1)),
|
|
38
|
+
l(o(B), {
|
|
39
|
+
ref_key: "formRef",
|
|
40
|
+
ref: n,
|
|
41
|
+
model: r,
|
|
42
|
+
rules: g,
|
|
43
|
+
class: "login__form",
|
|
44
|
+
"label-width": "0"
|
|
45
|
+
}, {
|
|
46
|
+
default: t(() => [
|
|
47
|
+
l(o(i), { prop: "uid" }, {
|
|
48
|
+
default: t(() => [
|
|
49
|
+
l(o(p), {
|
|
50
|
+
modelValue: r.uid,
|
|
51
|
+
"onUpdate:modelValue": e[0] || (e[0] = (d) => r.uid = d),
|
|
52
|
+
placeholder: "请输入账号",
|
|
53
|
+
size: "large"
|
|
54
|
+
}, null, 8, ["modelValue"])
|
|
55
|
+
]),
|
|
56
|
+
_: 1
|
|
57
|
+
}),
|
|
58
|
+
l(o(i), { prop: "password" }, {
|
|
59
|
+
default: t(() => [
|
|
60
|
+
l(o(p), {
|
|
61
|
+
modelValue: r.password,
|
|
62
|
+
"onUpdate:modelValue": e[1] || (e[1] = (d) => r.password = d),
|
|
63
|
+
type: "password",
|
|
64
|
+
placeholder: "请输入密码",
|
|
65
|
+
size: "large",
|
|
66
|
+
"show-password": "",
|
|
67
|
+
onKeyup: b(u, ["enter"])
|
|
68
|
+
}, null, 8, ["modelValue"])
|
|
69
|
+
]),
|
|
70
|
+
_: 1
|
|
71
|
+
}),
|
|
72
|
+
l(o(i), null, {
|
|
73
|
+
default: t(() => [
|
|
74
|
+
l(o(z), {
|
|
75
|
+
type: "primary",
|
|
76
|
+
size: "large",
|
|
77
|
+
loading: o(_),
|
|
78
|
+
class: "login__submit",
|
|
79
|
+
onClick: u
|
|
80
|
+
}, {
|
|
81
|
+
default: t(() => [...e[2] || (e[2] = [
|
|
82
|
+
v(" 登录 ", -1)
|
|
83
|
+
])]),
|
|
84
|
+
_: 1
|
|
85
|
+
}, 8, ["loading"])
|
|
86
|
+
]),
|
|
87
|
+
_: 1
|
|
88
|
+
})
|
|
89
|
+
]),
|
|
90
|
+
_: 1
|
|
91
|
+
}, 8, ["model"])
|
|
92
|
+
])
|
|
93
|
+
]));
|
|
94
|
+
}
|
|
95
|
+
}), R = /* @__PURE__ */ k(N, [["__scopeId", "data-v-728dba9d"]]);
|
|
96
|
+
export {
|
|
97
|
+
R as default
|
|
98
|
+
};
|