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
|
@@ -1,248 +1,141 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
>
|
|
142
|
-
<FormItem prop="username">
|
|
143
|
-
<Input
|
|
144
|
-
v-model="formData.username"
|
|
145
|
-
placeholder="用户名"
|
|
146
|
-
prefix-icon="👤"
|
|
147
|
-
size="large"
|
|
148
|
-
/>
|
|
149
|
-
</FormItem>
|
|
150
|
-
|
|
151
|
-
<FormItem prop="password">
|
|
152
|
-
<Input
|
|
153
|
-
v-model="formData.password"
|
|
154
|
-
type="password"
|
|
155
|
-
placeholder="密码"
|
|
156
|
-
prefix-icon="🔒"
|
|
157
|
-
size="large"
|
|
158
|
-
show-password
|
|
159
|
-
@keyup.enter="handleLogin"
|
|
160
|
-
/>
|
|
161
|
-
</FormItem>
|
|
162
|
-
|
|
163
|
-
<FormItem>
|
|
164
|
-
<Checkbox v-model="rememberMe">记住我</Checkbox>
|
|
165
|
-
</FormItem>
|
|
166
|
-
|
|
167
|
-
<FormItem>
|
|
168
|
-
<Button
|
|
169
|
-
type="primary"
|
|
170
|
-
size="large"
|
|
171
|
-
:loading="loading"
|
|
172
|
-
class="login__submit"
|
|
173
|
-
@click="handleLogin"
|
|
174
|
-
>
|
|
175
|
-
登录
|
|
176
|
-
</Button>
|
|
177
|
-
</FormItem>
|
|
178
|
-
</Form>
|
|
179
|
-
|
|
180
|
-
<div class="login__footer">
|
|
181
|
-
<p>提示: 任意用户名密码即可登录 (Mock 模式)</p>
|
|
182
|
-
</div>
|
|
183
|
-
</div>
|
|
184
|
-
</div>
|
|
185
|
-
</template>
|
|
186
|
-
|
|
187
|
-
<style lang="scss" scoped>
|
|
188
|
-
.login {
|
|
189
|
-
width: 100%;
|
|
190
|
-
min-height: 100vh;
|
|
191
|
-
display: flex;
|
|
192
|
-
align-items: center;
|
|
193
|
-
justify-content: flex-end;
|
|
194
|
-
padding-right: 15%;
|
|
195
|
-
background: linear-gradient(135deg, var(--color-primary-light-9) 0%, var(--color-primary-light-7) 100%);
|
|
196
|
-
|
|
197
|
-
&__container {
|
|
198
|
-
width: 400px;
|
|
199
|
-
padding: 40px;
|
|
200
|
-
background-color: var(--bg-color);
|
|
201
|
-
border-radius: var(--border-radius-large);
|
|
202
|
-
box-shadow: var(--box-shadow-dark);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
&__header {
|
|
206
|
-
text-align: center;
|
|
207
|
-
margin-bottom: 30px;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
&__logo {
|
|
211
|
-
width: 60px;
|
|
212
|
-
height: 60px;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
&__title {
|
|
216
|
-
font-size: 28px;
|
|
217
|
-
font-weight: 600;
|
|
218
|
-
color: var(--color-primary);
|
|
219
|
-
margin: 15px 0 5px;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
&__subtitle {
|
|
223
|
-
font-size: 14px;
|
|
224
|
-
color: var(--color-text-secondary);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
&__form {
|
|
228
|
-
:deep(.t-form-item) {
|
|
229
|
-
margin-bottom: 20px;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
:deep(.x-input__prefix) {
|
|
233
|
-
margin-right: 8px;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
&__submit {
|
|
238
|
-
width: 100%;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
&__footer {
|
|
242
|
-
text-align: center;
|
|
243
|
-
margin-top: 20px;
|
|
244
|
-
font-size: 12px;
|
|
245
|
-
color: var(--color-text-placeholder);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* 登录页面
|
|
4
|
+
* 使用统一的 useApp hooks
|
|
5
|
+
*/
|
|
6
|
+
import { ref, reactive } from 'vue'
|
|
7
|
+
import { Button } from '@xto/base'
|
|
8
|
+
import { Form, FormItem, Input } from '@xto/form'
|
|
9
|
+
import { useApp } from '@/composables'
|
|
10
|
+
|
|
11
|
+
const { login, loading } = useApp()
|
|
12
|
+
|
|
13
|
+
const formData = reactive({
|
|
14
|
+
uid: '',
|
|
15
|
+
password: ''
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const rules: Record<string, any[]> = {
|
|
19
|
+
uid: [
|
|
20
|
+
{ required: true, message: '请输入账号', trigger: 'blur' }
|
|
21
|
+
],
|
|
22
|
+
password: [
|
|
23
|
+
{ required: true, message: '请输入密码', trigger: 'blur' }
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const formRef = ref()
|
|
28
|
+
|
|
29
|
+
// 登录
|
|
30
|
+
const handleLogin = async () => {
|
|
31
|
+
try {
|
|
32
|
+
await formRef.value?.validate()
|
|
33
|
+
await login(formData.uid, formData.password)
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.error('登录失败', error)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<div class="login">
|
|
42
|
+
<div class="login__container">
|
|
43
|
+
<div class="login__header">
|
|
44
|
+
<img src="/vite.svg" alt="Logo" class="login__logo" />
|
|
45
|
+
<h1 class="login__title">Analysis Web</h1>
|
|
46
|
+
<p class="login__subtitle">后台管理系统</p>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<Form
|
|
50
|
+
ref="formRef"
|
|
51
|
+
:model="formData"
|
|
52
|
+
:rules="rules"
|
|
53
|
+
class="login__form"
|
|
54
|
+
label-width="0"
|
|
55
|
+
>
|
|
56
|
+
<FormItem prop="uid">
|
|
57
|
+
<Input
|
|
58
|
+
v-model="formData.uid"
|
|
59
|
+
placeholder="请输入账号"
|
|
60
|
+
size="large"
|
|
61
|
+
/>
|
|
62
|
+
</FormItem>
|
|
63
|
+
|
|
64
|
+
<FormItem prop="password">
|
|
65
|
+
<Input
|
|
66
|
+
v-model="formData.password"
|
|
67
|
+
type="password"
|
|
68
|
+
placeholder="请输入密码"
|
|
69
|
+
size="large"
|
|
70
|
+
show-password
|
|
71
|
+
@keyup.enter="handleLogin"
|
|
72
|
+
/>
|
|
73
|
+
</FormItem>
|
|
74
|
+
|
|
75
|
+
<FormItem>
|
|
76
|
+
<Button
|
|
77
|
+
type="primary"
|
|
78
|
+
size="large"
|
|
79
|
+
:loading="loading"
|
|
80
|
+
class="login__submit"
|
|
81
|
+
@click="handleLogin"
|
|
82
|
+
>
|
|
83
|
+
登录
|
|
84
|
+
</Button>
|
|
85
|
+
</FormItem>
|
|
86
|
+
</Form>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<style lang="scss" scoped>
|
|
92
|
+
.login {
|
|
93
|
+
width: 100%;
|
|
94
|
+
min-height: 100vh;
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
justify-content: flex-end;
|
|
98
|
+
padding-right: 15%;
|
|
99
|
+
background: linear-gradient(135deg, var(--color-primary-light-9) 0%, var(--color-primary-light-7) 100%);
|
|
100
|
+
|
|
101
|
+
&__container {
|
|
102
|
+
width: 400px;
|
|
103
|
+
padding: 40px;
|
|
104
|
+
background-color: var(--bg-color);
|
|
105
|
+
border-radius: var(--border-radius-large);
|
|
106
|
+
box-shadow: var(--box-shadow-dark);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&__header {
|
|
110
|
+
text-align: center;
|
|
111
|
+
margin-bottom: 30px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&__logo {
|
|
115
|
+
width: 60px;
|
|
116
|
+
height: 60px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&__title {
|
|
120
|
+
font-size: 28px;
|
|
121
|
+
font-weight: 600;
|
|
122
|
+
color: var(--color-primary);
|
|
123
|
+
margin: 15px 0 5px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&__subtitle {
|
|
127
|
+
font-size: 14px;
|
|
128
|
+
color: var(--color-text-secondary);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&__form {
|
|
132
|
+
:deep(.t-form-item) {
|
|
133
|
+
margin-bottom: 20px;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&__submit {
|
|
138
|
+
width: 100%;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
248
141
|
</style>
|