befly-admin 3.2.0 → 3.3.0
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/package.json +3 -3
- package/src/layouts/0.vue +2 -3
- package/src/layouts/2.vue +7 -4
- package/src/plugins/http.ts +2 -8
- package/src/plugins/router.ts +2 -1
- package/src/plugins/storage.ts +146 -0
- package/src/views/403/403.vue +39 -6
- package/src/views/admin/components/edit.vue +3 -3
- package/src/views/admin/components/role.vue +3 -3
- package/src/views/admin/index.vue +2 -2
- package/src/views/dict/components/edit.vue +3 -3
- package/src/views/dict/index.vue +2 -2
- package/src/views/index/components/{AddonList.vue → addonList.vue} +2 -2
- package/src/views/index/components/{EnvironmentInfo.vue → environmentInfo.vue} +1 -1
- package/src/views/index/components/{OperationLogs.vue → operationLogs.vue} +2 -2
- package/src/views/index/components/{PerformanceMetrics.vue → performanceMetrics.vue} +1 -1
- package/src/views/index/components/{QuickActions.vue → quickActions.vue} +3 -3
- package/src/views/index/components/{ServiceStatus.vue → serviceStatus.vue} +1 -1
- package/src/views/index/components/{SystemNotifications.vue → systemNotifications.vue} +1 -1
- package/src/views/index/components/{SystemOverview.vue → systemOverview.vue} +5 -5
- package/src/views/index/components/{SystemResources.vue → systemResources.vue} +4 -4
- package/src/views/index/components/{UserInfo.vue → userInfo.vue} +1 -1
- package/src/views/index/index.vue +7 -7
- package/src/views/login/components/emailLoginForm.vue +163 -0
- package/src/views/login/components/registerForm.vue +168 -0
- package/src/views/login/components/welcomePanel.vue +61 -0
- package/src/views/login/index_1.vue +16 -521
- package/src/views/menu/components/edit.vue +3 -3
- package/src/views/menu/index.vue +2 -2
- package/src/views/role/components/api.vue +3 -3
- package/src/views/role/components/menu.vue +10 -10
- package/src/views/role/index.vue +2 -2
- package/src/views/user/user.vue +8 -8
- package/src/api/auth.ts +0 -60
- package/temp/router.js +0 -71
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tiny-form :model="$Data.formData" :rules="$Data2.formRules" :ref="(el) => ($From.form = el)" class="login-form" label-width="90px" label-position="left" :show-message="false">
|
|
3
|
+
<tiny-form-item prop="account" label="账号">
|
|
4
|
+
<tiny-input v-model="$Data.formData.account" placeholder="请输入用户名或邮箱" size="large" clearable>
|
|
5
|
+
<template #prefix-icon>
|
|
6
|
+
<Icon name="User" :size="18" />
|
|
7
|
+
</template>
|
|
8
|
+
</tiny-input>
|
|
9
|
+
</tiny-form-item>
|
|
10
|
+
|
|
11
|
+
<tiny-form-item prop="password" label="密码">
|
|
12
|
+
<tiny-input v-model="$Data.formData.password" type="password" placeholder="请输入密码" size="large" clearable>
|
|
13
|
+
<template #prefix-icon>
|
|
14
|
+
<Icon name="Lock" :size="18" />
|
|
15
|
+
</template>
|
|
16
|
+
</tiny-input>
|
|
17
|
+
</tiny-form-item>
|
|
18
|
+
|
|
19
|
+
<div class="form-footer">
|
|
20
|
+
<a href="#" class="forgot-password">忘记密码?</a>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<tiny-button theme="primary" class="auth-btn" size="large" :loading="$Data.loading" @click="$Method.apiLogin"> 登录 </tiny-button>
|
|
24
|
+
</tiny-form>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script setup>
|
|
28
|
+
const router = useRouter();
|
|
29
|
+
|
|
30
|
+
// 表单引用
|
|
31
|
+
const $From = $shallowRef({
|
|
32
|
+
form: null
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// 数据定义
|
|
36
|
+
const $Data = $ref({
|
|
37
|
+
loading: false,
|
|
38
|
+
formData: {
|
|
39
|
+
account: '',
|
|
40
|
+
password: ''
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const $Data2 = $shallowRef({
|
|
45
|
+
formRules: {
|
|
46
|
+
account: [{ required: true, message: '请输入用户名或邮箱', trigger: 'blur' }],
|
|
47
|
+
password: [{ required: true, message: '请输入密码', trigger: 'blur' }]
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// 方法定义
|
|
52
|
+
const $Method = {
|
|
53
|
+
async apiLogin() {
|
|
54
|
+
try {
|
|
55
|
+
const valid = await $From.form.validate();
|
|
56
|
+
|
|
57
|
+
$Data.loading = true;
|
|
58
|
+
|
|
59
|
+
const res = await $Http('/core/auth/login', {
|
|
60
|
+
account: $Data.formData.account,
|
|
61
|
+
password: $Data.formData.password
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// 先保存 token
|
|
65
|
+
$Storage.local.set('token', res.data.token);
|
|
66
|
+
|
|
67
|
+
// 如果返回用户信息,也可以存储
|
|
68
|
+
if (res.data.userInfo) {
|
|
69
|
+
$Storage.local.set('userInfo', res.data.userInfo);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
Modal.message({
|
|
73
|
+
message: '登录成功',
|
|
74
|
+
status: 'success'
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// 跳转到首页,路由守卫会自动加载菜单
|
|
78
|
+
await router.push('/');
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.log('🔥[ error ]-77', error);
|
|
81
|
+
} finally {
|
|
82
|
+
$Data.loading = false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<style scoped lang="scss">
|
|
89
|
+
.login-form {
|
|
90
|
+
width: 100%;
|
|
91
|
+
max-width: 450px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.tiny-form-item {
|
|
95
|
+
width: 100%;
|
|
96
|
+
margin-bottom: 1.2rem;
|
|
97
|
+
|
|
98
|
+
:deep(.tiny-form__controls) {
|
|
99
|
+
width: 100%;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:deep(.tiny-input) {
|
|
103
|
+
width: 100%;
|
|
104
|
+
background: #f8f9fa;
|
|
105
|
+
border: 1px solid #e0e0e0;
|
|
106
|
+
border-radius: 6px;
|
|
107
|
+
transition: all 0.3s;
|
|
108
|
+
|
|
109
|
+
&:hover {
|
|
110
|
+
border-color: #48b19f;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&:focus-within {
|
|
114
|
+
border-color: #48b19f;
|
|
115
|
+
background: #fff;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
input {
|
|
119
|
+
padding: 0.75rem 1rem;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.form-footer {
|
|
125
|
+
width: 100%;
|
|
126
|
+
display: flex;
|
|
127
|
+
justify-content: flex-end;
|
|
128
|
+
margin-bottom: 1rem;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.forgot-password {
|
|
132
|
+
font-size: 0.8rem;
|
|
133
|
+
color: #888;
|
|
134
|
+
text-decoration: none;
|
|
135
|
+
|
|
136
|
+
&:hover {
|
|
137
|
+
color: #48b19f;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.auth-btn {
|
|
142
|
+
width: 100% !important;
|
|
143
|
+
max-width: 100%;
|
|
144
|
+
height: 44px;
|
|
145
|
+
border-radius: 6px;
|
|
146
|
+
background: #48b19f;
|
|
147
|
+
border: none;
|
|
148
|
+
font-size: 0.95rem;
|
|
149
|
+
font-weight: 600;
|
|
150
|
+
margin-top: 0.5rem;
|
|
151
|
+
transition: all 0.3s;
|
|
152
|
+
|
|
153
|
+
&:hover {
|
|
154
|
+
background: #3a9d8f;
|
|
155
|
+
transform: translateY(-1px);
|
|
156
|
+
box-shadow: 0 3px 10px rgba(72, 177, 159, 0.3);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
:deep(.tiny-button__text) {
|
|
160
|
+
color: #fff;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
</style>
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tiny-form :model="$Data.formData" :rules="$Data2.formRules" :ref="(el) => ($From.form = el)" class="login-form" label-width="70px" label-position="left">
|
|
3
|
+
<tiny-form-item prop="username" label="用户名">
|
|
4
|
+
<tiny-input v-model="$Data.formData.username" placeholder="请输入用户名" size="large" clearable>
|
|
5
|
+
<template #prefix-icon>
|
|
6
|
+
<Icon name="User" :size="18" />
|
|
7
|
+
</template>
|
|
8
|
+
</tiny-input>
|
|
9
|
+
</tiny-form-item>
|
|
10
|
+
|
|
11
|
+
<tiny-form-item prop="email" label="邮箱">
|
|
12
|
+
<tiny-input v-model="$Data.formData.email" placeholder="请输入邮箱" size="large" clearable>
|
|
13
|
+
<template #prefix-icon>
|
|
14
|
+
<Icon name="Mail" :size="18" />
|
|
15
|
+
</template>
|
|
16
|
+
</tiny-input>
|
|
17
|
+
</tiny-form-item>
|
|
18
|
+
|
|
19
|
+
<tiny-form-item prop="password" label="密码">
|
|
20
|
+
<tiny-input v-model="$Data.formData.password" type="password" placeholder="请输入密码" size="large" clearable>
|
|
21
|
+
<template #prefix-icon>
|
|
22
|
+
<Icon name="Lock" :size="18" />
|
|
23
|
+
</template>
|
|
24
|
+
</tiny-input>
|
|
25
|
+
</tiny-form-item>
|
|
26
|
+
|
|
27
|
+
<tiny-form-item prop="nickname" label="昵称">
|
|
28
|
+
<tiny-input v-model="$Data.formData.nickname" placeholder="请输入昵称(选填)" size="large" clearable>
|
|
29
|
+
<template #prefix-icon>
|
|
30
|
+
<Icon name="Smile" :size="18" />
|
|
31
|
+
</template>
|
|
32
|
+
</tiny-input>
|
|
33
|
+
</tiny-form-item>
|
|
34
|
+
|
|
35
|
+
<tiny-button theme="primary" class="auth-btn" size="large" :loading="$Data.loading" @click="$Method.handleSubmit"> 注册 </tiny-button>
|
|
36
|
+
</tiny-form>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script setup>
|
|
40
|
+
const emit = defineEmits(['success']);
|
|
41
|
+
|
|
42
|
+
// 表单引用
|
|
43
|
+
const $From = $shallowRef({
|
|
44
|
+
form: null
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// 数据定义
|
|
48
|
+
const $Data = $ref({
|
|
49
|
+
loading: false,
|
|
50
|
+
formData: {
|
|
51
|
+
username: '',
|
|
52
|
+
email: '',
|
|
53
|
+
password: '',
|
|
54
|
+
nickname: ''
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const $Data2 = $shallowRef({
|
|
59
|
+
formRules: {
|
|
60
|
+
username: [
|
|
61
|
+
{ required: true, message: '请输入用户名', trigger: 'blur' },
|
|
62
|
+
{ min: 3, max: 20, message: '用户名长度为 3-20 个字符', trigger: 'blur' }
|
|
63
|
+
],
|
|
64
|
+
email: [
|
|
65
|
+
{ required: true, message: '请输入邮箱', trigger: 'blur' },
|
|
66
|
+
{ type: 'email', message: '请输入正确的邮箱格式', trigger: 'blur' }
|
|
67
|
+
],
|
|
68
|
+
password: [
|
|
69
|
+
{ required: true, message: '请输入密码', trigger: 'blur' },
|
|
70
|
+
{ min: 6, message: '密码长度至少 6 个字符', trigger: 'blur' }
|
|
71
|
+
]
|
|
72
|
+
// nickname 是选填项,不需要验证规则
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// 方法定义
|
|
77
|
+
const $Method = {
|
|
78
|
+
async handleSubmit() {
|
|
79
|
+
const valid = await $From.form.validate();
|
|
80
|
+
if (!valid) return;
|
|
81
|
+
|
|
82
|
+
$Data.loading = true;
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
await $Http('/core/register', $Data.formData);
|
|
86
|
+
MessagePlugin.success('注册成功,请登录');
|
|
87
|
+
|
|
88
|
+
// 清空表单
|
|
89
|
+
$Method.resetForm();
|
|
90
|
+
|
|
91
|
+
// 通知父组件注册成功,切换到登录模式
|
|
92
|
+
emit('success');
|
|
93
|
+
} catch (error) {
|
|
94
|
+
// 错误已经在 request 拦截器中处理
|
|
95
|
+
} finally {
|
|
96
|
+
$Data.loading = false;
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
// 清空表单
|
|
101
|
+
resetForm() {
|
|
102
|
+
$Data.formData.username = '';
|
|
103
|
+
$Data.formData.email = '';
|
|
104
|
+
$Data.formData.password = '';
|
|
105
|
+
$Data.formData.nickname = '';
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<style scoped lang="scss">
|
|
111
|
+
.login-form {
|
|
112
|
+
width: 100%;
|
|
113
|
+
max-width: 450px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.tiny-form-item {
|
|
117
|
+
width: 100%;
|
|
118
|
+
margin-bottom: 1.2rem;
|
|
119
|
+
|
|
120
|
+
:deep(.tiny-form__controls) {
|
|
121
|
+
width: 100%;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
:deep(.tiny-input) {
|
|
125
|
+
width: 100%;
|
|
126
|
+
background: #f8f9fa;
|
|
127
|
+
border: 1px solid #e0e0e0;
|
|
128
|
+
border-radius: 6px;
|
|
129
|
+
transition: all 0.3s;
|
|
130
|
+
|
|
131
|
+
&:hover {
|
|
132
|
+
border-color: #48b19f;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&:focus-within {
|
|
136
|
+
border-color: #48b19f;
|
|
137
|
+
background: #fff;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
input {
|
|
141
|
+
padding: 0.75rem 1rem;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.auth-btn {
|
|
147
|
+
width: 100% !important;
|
|
148
|
+
max-width: 100%;
|
|
149
|
+
height: 44px;
|
|
150
|
+
border-radius: 6px;
|
|
151
|
+
background: #48b19f;
|
|
152
|
+
border: none;
|
|
153
|
+
font-size: 0.95rem;
|
|
154
|
+
font-weight: 600;
|
|
155
|
+
margin-top: 0.5rem;
|
|
156
|
+
transition: all 0.3s;
|
|
157
|
+
|
|
158
|
+
&:hover {
|
|
159
|
+
background: #3a9d8f;
|
|
160
|
+
transform: translateY(-1px);
|
|
161
|
+
box-shadow: 0 3px 10px rgba(72, 177, 159, 0.3);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
:deep(.tiny-button__text) {
|
|
165
|
+
color: #fff;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
</style>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="panel-content" v-if="!isSignUp">
|
|
3
|
+
<h2>你好,朋友!</h2>
|
|
4
|
+
<p>填写个人信息,开始使用</p>
|
|
5
|
+
<button class="toggle-btn" @click="$emit('toggle')">注册账号</button>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="panel-content" v-else>
|
|
8
|
+
<h2>欢迎回来!</h2>
|
|
9
|
+
<p>使用您的账号登录</p>
|
|
10
|
+
<button class="toggle-btn" @click="$emit('toggle')">立即登录</button>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup>
|
|
15
|
+
const props = defineProps({
|
|
16
|
+
isSignUp: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: false
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
defineEmits(['toggle']);
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<style scoped lang="scss">
|
|
26
|
+
.panel-content {
|
|
27
|
+
text-align: center;
|
|
28
|
+
padding: 2rem;
|
|
29
|
+
max-width: 400px;
|
|
30
|
+
|
|
31
|
+
h2 {
|
|
32
|
+
font-size: 2rem;
|
|
33
|
+
font-weight: 600;
|
|
34
|
+
margin-bottom: 1rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
p {
|
|
38
|
+
font-size: 1rem;
|
|
39
|
+
line-height: 1.6;
|
|
40
|
+
margin-bottom: 2rem;
|
|
41
|
+
opacity: 0.9;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.toggle-btn {
|
|
45
|
+
padding: 0.8rem 3rem;
|
|
46
|
+
border: 2px solid #fff;
|
|
47
|
+
background: transparent;
|
|
48
|
+
color: #fff;
|
|
49
|
+
border-radius: 25px;
|
|
50
|
+
font-size: 0.9rem;
|
|
51
|
+
font-weight: 600;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
transition: all 0.3s;
|
|
54
|
+
|
|
55
|
+
&:hover {
|
|
56
|
+
background: #fff;
|
|
57
|
+
color: #48b19f;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
</style>
|