@befly-addon/admin 1.1.28 → 1.1.30
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/apis/admin/cacheRefresh.ts +1 -4
- package/apis/admin/del.ts +4 -4
- package/apis/admin/detail.ts +8 -40
- package/apis/admin/ins.ts +21 -14
- package/apis/admin/list.ts +3 -3
- package/apis/admin/upd.ts +43 -8
- package/apis/api/all.ts +7 -3
- package/apis/api/list.ts +8 -17
- package/apis/auth/login.ts +19 -16
- package/apis/dict/all.ts +21 -4
- package/apis/dict/del.ts +7 -15
- package/apis/dict/detail.ts +28 -14
- package/apis/dict/ins.ts +34 -16
- package/apis/dict/items.ts +27 -0
- package/apis/dict/list.ts +30 -5
- package/apis/dict/upd.ts +51 -17
- package/apis/dictType/all.ts +11 -0
- package/apis/dictType/del.ts +32 -0
- package/apis/dictType/detail.ts +17 -0
- package/apis/dictType/ins.ts +30 -0
- package/apis/dictType/list.ts +24 -0
- package/apis/dictType/upd.ts +42 -0
- package/apis/email/logList.ts +2 -2
- package/apis/loginLog/list.ts +2 -2
- package/apis/menu/all.ts +1 -2
- package/apis/menu/list.ts +0 -1
- package/apis/operateLog/list.ts +2 -2
- package/apis/role/apiSave.ts +4 -3
- package/apis/role/{apiDetail.ts → apis.ts} +8 -3
- package/apis/role/del.ts +18 -10
- package/apis/role/detail.ts +0 -1
- package/apis/role/menuSave.ts +4 -3
- package/apis/role/{menuDetail.ts → menus.ts} +8 -3
- package/apis/role/save.ts +2 -3
- package/apis/sysConfig/all.ts +0 -1
- package/apis/sysConfig/del.ts +1 -1
- package/apis/sysConfig/get.ts +1 -2
- package/apis/sysConfig/upd.ts +1 -1
- package/package.json +4 -4
- package/tables/admin.json +0 -6
- package/tables/dict.json +13 -19
- package/tables/dictType.json +28 -0
- package/views/config/dict/components/edit.vue +76 -122
- package/views/config/dict/index.vue +76 -54
- package/views/config/dict/meta.json +1 -1
- package/views/config/dictType/components/edit.vue +106 -0
- package/views/config/dictType/index.vue +206 -0
- package/views/config/dictType/meta.json +4 -0
- package/views/login_1/index.vue +184 -2
- package/views/people/admin/components/edit.vue +5 -5
- package/views/permission/role/components/api.vue +3 -3
- package/views/permission/role/components/menu.vue +4 -4
- package/apis/admin/roleDetail.ts +0 -29
- package/apis/admin/roleSave.ts +0 -39
- package/apis/auth/logout.ts +0 -17
- package/apis/auth/register.ts +0 -43
- package/apis/dashboard/changelog.ts +0 -31
- package/views/login_1/components/emailLoginForm.vue +0 -174
- package/views/login_1/components/registerForm.vue +0 -175
- package/views/login_1/components/welcomePanel.vue +0 -61
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<TForm :model="$Data.formData" :rules="$Data2.formRules" :ref="(el) => ($From.form = el)" class="login-form" :show-message="false" label-width="0">
|
|
3
|
-
<TFormItem prop="account">
|
|
4
|
-
<TInput v-model="$Data.formData.account" placeholder="用户名或邮箱" size="large" clearable @enter="$Method.apiLogin">
|
|
5
|
-
<template #prefix-icon>
|
|
6
|
-
<ILucideUser />
|
|
7
|
-
</template>
|
|
8
|
-
</TInput>
|
|
9
|
-
</TFormItem>
|
|
10
|
-
|
|
11
|
-
<TFormItem prop="password">
|
|
12
|
-
<TInput v-model="$Data.formData.password" type="password" placeholder="密码" size="large" clearable @enter="$Method.apiLogin">
|
|
13
|
-
<template #prefix-icon>
|
|
14
|
-
<ILucideLock />
|
|
15
|
-
</template>
|
|
16
|
-
</TInput>
|
|
17
|
-
</TFormItem>
|
|
18
|
-
|
|
19
|
-
<div class="form-options">
|
|
20
|
-
<TCheckbox v-model="$Data.rememberMe">记住我</TCheckbox>
|
|
21
|
-
<a href="#" class="link-text">忘记密码?</a>
|
|
22
|
-
</div>
|
|
23
|
-
|
|
24
|
-
<TButton theme="primary" class="login-btn" size="large" block :loading="$Data.loading" @click="$Method.apiLogin"> 登录 </TButton>
|
|
25
|
-
</TForm>
|
|
26
|
-
</template>
|
|
27
|
-
|
|
28
|
-
<script setup>
|
|
29
|
-
import { useRouter } from 'vue-router';
|
|
30
|
-
import { Form as TForm, FormItem as TFormItem, Input as TInput, Button as TButton, Checkbox as TCheckbox, MessagePlugin } from 'tdesign-vue-next';
|
|
31
|
-
import ILucideUser from '~icons/lucide/user';
|
|
32
|
-
import ILucideLock from '~icons/lucide/lock';
|
|
33
|
-
import { $Http } from '@/plugins/http';
|
|
34
|
-
import { $Storage } from '@/plugins/storage';
|
|
35
|
-
import { hashPassword } from 'befly-shared/hashPassword';
|
|
36
|
-
|
|
37
|
-
const router = useRouter();
|
|
38
|
-
|
|
39
|
-
// 表单引用
|
|
40
|
-
const $From = $shallowRef({
|
|
41
|
-
form: null
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// 数据定义
|
|
45
|
-
const $Data = $ref({
|
|
46
|
-
loading: false,
|
|
47
|
-
rememberMe: false,
|
|
48
|
-
formData: {
|
|
49
|
-
account: '',
|
|
50
|
-
password: ''
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const $Data2 = $shallowRef({
|
|
55
|
-
formRules: {
|
|
56
|
-
account: [{ required: true, message: '请输入用户名或邮箱', trigger: 'blur' }],
|
|
57
|
-
password: [{ required: true, message: '请输入密码', trigger: 'blur' }]
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
// 方法定义
|
|
62
|
-
const $Method = {
|
|
63
|
-
async apiLogin() {
|
|
64
|
-
try {
|
|
65
|
-
const valid = await $From.form.validate();
|
|
66
|
-
|
|
67
|
-
$Data.loading = true;
|
|
68
|
-
|
|
69
|
-
// 对密码进行 SHA-256 加密
|
|
70
|
-
const hashedPassword = await hashPassword($Data.formData.password);
|
|
71
|
-
|
|
72
|
-
const res = await $Http('/addon/admin/auth/login', {
|
|
73
|
-
account: $Data.formData.account,
|
|
74
|
-
password: hashedPassword
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// 先保存 token
|
|
78
|
-
$Storage.local.set('token', res.data.token);
|
|
79
|
-
|
|
80
|
-
// 如果返回用户信息,也可以存储
|
|
81
|
-
if (res.data.userInfo) {
|
|
82
|
-
$Storage.local.set('userInfo', res.data.userInfo);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
MessagePlugin.info({
|
|
86
|
-
message: '登录成功',
|
|
87
|
-
status: 'success'
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// 跳转到首页,路由守卫会自动加载菜单
|
|
91
|
-
await router.push('/');
|
|
92
|
-
} catch (error) {
|
|
93
|
-
console.log('🔥[ error ]-77', error);
|
|
94
|
-
} finally {
|
|
95
|
-
$Data.loading = false;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
</script>
|
|
100
|
-
|
|
101
|
-
<style scoped lang="scss">
|
|
102
|
-
.login-form {
|
|
103
|
-
width: 100%;
|
|
104
|
-
|
|
105
|
-
:deep(.t-form__item) {
|
|
106
|
-
margin-bottom: 1.25rem;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
:deep(.t-form__controls) {
|
|
110
|
-
width: 100%;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
:deep(.t-input) {
|
|
114
|
-
width: 100%;
|
|
115
|
-
border-radius: 8px;
|
|
116
|
-
transition: all 0.3s;
|
|
117
|
-
|
|
118
|
-
&:hover {
|
|
119
|
-
border-color: #667eea;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
&:focus-within {
|
|
123
|
-
border-color: #667eea;
|
|
124
|
-
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
:deep(.t-input__wrap) {
|
|
129
|
-
width: 100%;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.form-options {
|
|
134
|
-
display: flex;
|
|
135
|
-
justify-content: space-between;
|
|
136
|
-
align-items: center;
|
|
137
|
-
margin-bottom: 1.5rem;
|
|
138
|
-
font-size: 0.875rem;
|
|
139
|
-
|
|
140
|
-
.link-text {
|
|
141
|
-
color: var(--login-link);
|
|
142
|
-
text-decoration: none;
|
|
143
|
-
transition: color 0.3s;
|
|
144
|
-
|
|
145
|
-
&:hover {
|
|
146
|
-
color: var(--login-link-hover);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.login-btn {
|
|
152
|
-
width: 100%;
|
|
153
|
-
height: 48px;
|
|
154
|
-
border-radius: 8px;
|
|
155
|
-
font-size: 1rem;
|
|
156
|
-
font-weight: 600;
|
|
157
|
-
background: linear-gradient(135deg, var(--login-btn-gradient-start) 0%, var(--login-btn-gradient-end) 100%);
|
|
158
|
-
border: none;
|
|
159
|
-
transition: all 0.3s;
|
|
160
|
-
|
|
161
|
-
&:hover {
|
|
162
|
-
transform: translateY(-2px);
|
|
163
|
-
box-shadow: 0 8px 20px var(--login-btn-shadow);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
&:active {
|
|
167
|
-
transform: translateY(0);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
:deep(.t-button__text) {
|
|
171
|
-
color: #fff;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
</style>
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<TForm :model="$Data.formData" :rules="$Data2.formRules" :ref="(el) => ($From.form = el)" class="login-form" label-width="70px" label-position="left">
|
|
3
|
-
<TFormItem prop="username" label="用户名">
|
|
4
|
-
<TInput v-model="$Data.formData.username" placeholder="请输入用户名" size="large" clearable>
|
|
5
|
-
<template #prefix-icon>
|
|
6
|
-
<ILucideUser />
|
|
7
|
-
</template>
|
|
8
|
-
</TInput>
|
|
9
|
-
</TFormItem>
|
|
10
|
-
|
|
11
|
-
<TFormItem prop="email" label="邮箱">
|
|
12
|
-
<TInput v-model="$Data.formData.email" placeholder="请输入邮箱" size="large" clearable>
|
|
13
|
-
<template #prefix-icon>
|
|
14
|
-
<ILucideMail />
|
|
15
|
-
</template>
|
|
16
|
-
</TInput>
|
|
17
|
-
</TFormItem>
|
|
18
|
-
|
|
19
|
-
<TFormItem prop="password" label="密码">
|
|
20
|
-
<TInput v-model="$Data.formData.password" type="password" placeholder="请输入密码" size="large" clearable>
|
|
21
|
-
<template #prefix-icon>
|
|
22
|
-
<ILucideLock />
|
|
23
|
-
</template>
|
|
24
|
-
</TInput>
|
|
25
|
-
</TFormItem>
|
|
26
|
-
|
|
27
|
-
<TFormItem prop="nickname" label="昵称">
|
|
28
|
-
<TInput v-model="$Data.formData.nickname" placeholder="请输入昵称(选填)" size="large" clearable>
|
|
29
|
-
<template #prefix-icon>
|
|
30
|
-
<ILucideSmile />
|
|
31
|
-
</template>
|
|
32
|
-
</TInput>
|
|
33
|
-
</TFormItem>
|
|
34
|
-
|
|
35
|
-
<TButton theme="primary" class="auth-btn" size="large" :loading="$Data.loading" @click="$Method.handleSubmit"> 注册 </TButton>
|
|
36
|
-
</TForm>
|
|
37
|
-
</template>
|
|
38
|
-
|
|
39
|
-
<script setup>
|
|
40
|
-
import { Form as TForm, FormItem as TFormItem, Input as TInput, Button as TButton, MessagePlugin } from 'tdesign-vue-next';
|
|
41
|
-
import ILucideUser from '~icons/lucide/user';
|
|
42
|
-
import ILucideMail from '~icons/lucide/mail';
|
|
43
|
-
import ILucideLock from '~icons/lucide/lock';
|
|
44
|
-
import ILucideSmile from '~icons/lucide/smile';
|
|
45
|
-
import { $Http } from '@/plugins/http';
|
|
46
|
-
|
|
47
|
-
const emit = defineEmits(['success']);
|
|
48
|
-
|
|
49
|
-
// 表单引用
|
|
50
|
-
const $From = $shallowRef({
|
|
51
|
-
form: null
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// 数据定义
|
|
55
|
-
const $Data = $ref({
|
|
56
|
-
loading: false,
|
|
57
|
-
formData: {
|
|
58
|
-
username: '',
|
|
59
|
-
email: '',
|
|
60
|
-
password: '',
|
|
61
|
-
nickname: ''
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const $Data2 = $shallowRef({
|
|
66
|
-
formRules: {
|
|
67
|
-
username: [
|
|
68
|
-
{ required: true, message: '请输入用户名', trigger: 'blur' },
|
|
69
|
-
{ min: 3, max: 20, message: '用户名长度为 3-20 个字符', trigger: 'blur' }
|
|
70
|
-
],
|
|
71
|
-
email: [
|
|
72
|
-
{ required: true, message: '请输入邮箱', trigger: 'blur' },
|
|
73
|
-
{ type: 'email', message: '请输入正确的邮箱格式', trigger: 'blur' }
|
|
74
|
-
],
|
|
75
|
-
password: [
|
|
76
|
-
{ required: true, message: '请输入密码', trigger: 'blur' },
|
|
77
|
-
{ min: 6, message: '密码长度至少 6 个字符', trigger: 'blur' }
|
|
78
|
-
]
|
|
79
|
-
// nickname 是选填项,不需要验证规则
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// 方法定义
|
|
84
|
-
const $Method = {
|
|
85
|
-
async handleSubmit() {
|
|
86
|
-
const valid = await $From.form.validate();
|
|
87
|
-
if (!valid) return;
|
|
88
|
-
|
|
89
|
-
$Data.loading = true;
|
|
90
|
-
|
|
91
|
-
try {
|
|
92
|
-
await $Http('/addon/admin/register', $Data.formData);
|
|
93
|
-
MessagePlugin.success('注册成功,请登录');
|
|
94
|
-
|
|
95
|
-
// 清空表单
|
|
96
|
-
$Method.resetForm();
|
|
97
|
-
|
|
98
|
-
// 通知父组件注册成功,切换到登录模式
|
|
99
|
-
emit('success');
|
|
100
|
-
} catch (error) {
|
|
101
|
-
// 错误已经在 request 拦截器中处理
|
|
102
|
-
} finally {
|
|
103
|
-
$Data.loading = false;
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
// 清空表单
|
|
108
|
-
resetForm() {
|
|
109
|
-
$Data.formData.username = '';
|
|
110
|
-
$Data.formData.email = '';
|
|
111
|
-
$Data.formData.password = '';
|
|
112
|
-
$Data.formData.nickname = '';
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
</script>
|
|
116
|
-
|
|
117
|
-
<style scoped lang="scss">
|
|
118
|
-
.login-form {
|
|
119
|
-
width: 100%;
|
|
120
|
-
max-width: 450px;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.t-form__item {
|
|
124
|
-
width: 100%;
|
|
125
|
-
margin-bottom: 1.2rem;
|
|
126
|
-
|
|
127
|
-
:deep(.t-form__controls) {
|
|
128
|
-
width: 100%;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
:deep(.t-input) {
|
|
132
|
-
width: 100%;
|
|
133
|
-
background: #f8f9fa;
|
|
134
|
-
border: 1px solid #e0e0e0;
|
|
135
|
-
border-radius: 6px;
|
|
136
|
-
transition: all 0.3s;
|
|
137
|
-
|
|
138
|
-
&:hover {
|
|
139
|
-
border-color: #48b19f;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
&:focus-within {
|
|
143
|
-
border-color: #48b19f;
|
|
144
|
-
background: #fff;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
input {
|
|
148
|
-
padding: 0.75rem 1rem;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.auth-btn {
|
|
154
|
-
width: 100% !important;
|
|
155
|
-
max-width: 100%;
|
|
156
|
-
height: 44px;
|
|
157
|
-
border-radius: 6px;
|
|
158
|
-
background: #48b19f;
|
|
159
|
-
border: none;
|
|
160
|
-
font-size: 0.95rem;
|
|
161
|
-
font-weight: 600;
|
|
162
|
-
margin-top: 0.5rem;
|
|
163
|
-
transition: all 0.3s;
|
|
164
|
-
|
|
165
|
-
&:hover {
|
|
166
|
-
background: #3a9d8f;
|
|
167
|
-
transform: translateY(-1px);
|
|
168
|
-
box-shadow: 0 3px 10px rgba(72, 177, 159, 0.3);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
:deep(.t-button__text) {
|
|
172
|
-
color: #fff;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
</style>
|
|
@@ -1,61 +0,0 @@
|
|
|
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>
|