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.
Files changed (35) hide show
  1. package/package.json +3 -3
  2. package/src/layouts/0.vue +2 -3
  3. package/src/layouts/2.vue +7 -4
  4. package/src/plugins/http.ts +2 -8
  5. package/src/plugins/router.ts +2 -1
  6. package/src/plugins/storage.ts +146 -0
  7. package/src/views/403/403.vue +39 -6
  8. package/src/views/admin/components/edit.vue +3 -3
  9. package/src/views/admin/components/role.vue +3 -3
  10. package/src/views/admin/index.vue +2 -2
  11. package/src/views/dict/components/edit.vue +3 -3
  12. package/src/views/dict/index.vue +2 -2
  13. package/src/views/index/components/{AddonList.vue → addonList.vue} +2 -2
  14. package/src/views/index/components/{EnvironmentInfo.vue → environmentInfo.vue} +1 -1
  15. package/src/views/index/components/{OperationLogs.vue → operationLogs.vue} +2 -2
  16. package/src/views/index/components/{PerformanceMetrics.vue → performanceMetrics.vue} +1 -1
  17. package/src/views/index/components/{QuickActions.vue → quickActions.vue} +3 -3
  18. package/src/views/index/components/{ServiceStatus.vue → serviceStatus.vue} +1 -1
  19. package/src/views/index/components/{SystemNotifications.vue → systemNotifications.vue} +1 -1
  20. package/src/views/index/components/{SystemOverview.vue → systemOverview.vue} +5 -5
  21. package/src/views/index/components/{SystemResources.vue → systemResources.vue} +4 -4
  22. package/src/views/index/components/{UserInfo.vue → userInfo.vue} +1 -1
  23. package/src/views/index/index.vue +7 -7
  24. package/src/views/login/components/emailLoginForm.vue +163 -0
  25. package/src/views/login/components/registerForm.vue +168 -0
  26. package/src/views/login/components/welcomePanel.vue +61 -0
  27. package/src/views/login/index_1.vue +16 -521
  28. package/src/views/menu/components/edit.vue +3 -3
  29. package/src/views/menu/index.vue +2 -2
  30. package/src/views/role/components/api.vue +3 -3
  31. package/src/views/role/components/menu.vue +10 -10
  32. package/src/views/role/index.vue +2 -2
  33. package/src/views/user/user.vue +8 -8
  34. package/src/api/auth.ts +0 -60
  35. package/temp/router.js +0 -71
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <tiny-dialog-box v-model:visible="$Data.visible" title="菜单权限" width="600px" :append-to-body="true" :show-footer="true" top="10vh" @close="$Method.onClose">
3
3
  <div class="comp-role-menu">
4
- <tiny-tree :data="$Data.menuTreeData" node-key="id" show-checkbox default-expand-all :props="{ label: 'name' }" :ref="(el) => ($Form.tree = el)" />
4
+ <tiny-tree :data="$Data.menuTreeData" node-key="id" show-checkbox default-expand-all :props="{ label: 'name' }" :ref="(el) => ($From.tree = el)" />
5
5
  </div>
6
6
  <template #footer>
7
7
  <tiny-button @click="$Method.onClose">取消</tiny-button>
@@ -27,7 +27,7 @@ const $Prop = defineProps({
27
27
  const $Emit = defineEmits(['update:modelValue', 'success']);
28
28
 
29
29
  // 表单引用
30
- const $Form = $shallowRef({
30
+ const $From = $shallowRef({
31
31
  tree: null
32
32
  });
33
33
 
@@ -60,7 +60,7 @@ const $Method = {
60
60
  // 加载菜单树(用于配置权限)
61
61
  async apiMenuAll() {
62
62
  try {
63
- const res = await $Http('/addon/admin/menuAll');
63
+ const res = await $Http('/core/menu/all');
64
64
  // menuAll 返回的 data 直接就是菜单数组
65
65
  const menuList = Array.isArray(res.data) ? res.data : [];
66
66
  $Data.menuTreeData = arrayToTree(menuList);
@@ -75,7 +75,7 @@ const $Method = {
75
75
  if (!$Prop.rowData.id) return;
76
76
 
77
77
  try {
78
- const res = await $Http('/addon/admin/roleMenuDetail', {
78
+ const res = await $Http('/core/role/menuDetail', {
79
79
  roleId: $Prop.rowData.id
80
80
  });
81
81
 
@@ -84,8 +84,8 @@ const $Method = {
84
84
 
85
85
  // 等待树渲染完成后设置选中状态
86
86
  nextTick(() => {
87
- if ($Form.tree && $Data.menuTreeCheckedKeys.length > 0) {
88
- $Form.tree.setCheckedKeys($Data.menuTreeCheckedKeys);
87
+ if ($From.tree && $Data.menuTreeCheckedKeys.length > 0) {
88
+ $From.tree.setCheckedKeys($Data.menuTreeCheckedKeys);
89
89
  }
90
90
  });
91
91
  } catch (error) {
@@ -96,17 +96,17 @@ const $Method = {
96
96
  // 提交表单
97
97
  async onSubmit() {
98
98
  try {
99
- if (!$Form.tree) {
99
+ if (!$From.tree) {
100
100
  Modal.message({ message: '菜单树未初始化', status: 'error' });
101
101
  return;
102
102
  }
103
103
 
104
104
  // 获取选中的节点(包括半选中的父节点)
105
- const checkedKeys = $Form.tree.getCheckedKeys();
106
- const halfCheckedKeys = $Form.tree.getHalfCheckedKeys();
105
+ const checkedKeys = $From.tree.getCheckedKeys();
106
+ const halfCheckedKeys = $From.tree.getHalfCheckedKeys();
107
107
  const menuIds = [...checkedKeys, ...halfCheckedKeys];
108
108
 
109
- const res = await $Http('/addon/admin/roleMenuSave', {
109
+ const res = await $Http('/core/role/menuSave', {
110
110
  roleId: $Prop.rowData.id,
111
111
  menuIds
112
112
  });
@@ -106,7 +106,7 @@ const $Method = {
106
106
  // 加载角色列表
107
107
  async apiRoleList() {
108
108
  try {
109
- const res = await $Http('/addon/admin/roleList', {
109
+ const res = await $Http('/core/role/list', {
110
110
  page: $Data.pagerConfig.currentPage,
111
111
  limit: $Data.pagerConfig.limit
112
112
  });
@@ -129,7 +129,7 @@ const $Method = {
129
129
  status: 'warning'
130
130
  }).then(async () => {
131
131
  try {
132
- const res = await $Http('/addon/admin/roleDel', { id: row.id });
132
+ const res = await $Http('/core/role/del', { id: row.id });
133
133
  if (res.code === 0) {
134
134
  Modal.message({ message: '删除成功', status: 'success' });
135
135
  $Method.apiRoleList();
@@ -34,9 +34,9 @@
34
34
  <div class="table-wrapper">
35
35
  <t-table :data="$Data.userList" :columns="$Data.columns" row-key="id" :loading="$Data.loading" bordered stripe hover max-height="100%">
36
36
  <template #state="{ row }">
37
- <t-tag v-if="row.state === 1" theme="success">正常</t-tag>
38
- <t-tag v-else-if="row.state === 2" theme="warning">禁用</t-tag>
39
- <t-tag v-else theme="danger">已删除</t-tag>
37
+ <tiny-tag v-if="row.state === 1" type="success">正常</tiny-tag>
38
+ <tiny-tag v-else-if="row.state === 2" type="warning">禁用</tiny-tag>
39
+ <tiny-tag v-else type="danger">已删除</tiny-tag>
40
40
  </template>
41
41
 
42
42
  <template #lastLoginTime="{ row }">
@@ -63,7 +63,7 @@
63
63
  <t-dialog v-model:visible="$Data.roleVisible" header="分配角色" width="600px" :on-confirm="$Method.handleRoleSubmit">
64
64
  <div class="role-dialog">
65
65
  <div class="user-info">
66
- <t-tag theme="primary">{{ $Data.currentUser.username }}</t-tag>
66
+ <tiny-tag type="primary">{{ $Data.currentUser.username }}</tiny-tag>
67
67
  <span class="user-email">{{ $Data.currentUser.email }}</span>
68
68
  </div>
69
69
  <t-divider />
@@ -111,7 +111,7 @@ const $Method = {
111
111
  async loadUserList() {
112
112
  $Data.loading = true;
113
113
  try {
114
- const res = await $Http('/addon/admin/adminList', {
114
+ const res = await $Http('/core/list', {
115
115
  page: $Data.pagination.current,
116
116
  limit: $Data.pagination.pageSize
117
117
  });
@@ -180,7 +180,7 @@ const $Method = {
180
180
  // 加载角色列表
181
181
  async loadRoleList() {
182
182
  try {
183
- const res = await $Http('/addon/admin/roleList', {});
183
+ const res = await $Http('/core/role/list', {});
184
184
  if (res.code === 0 && res.data) {
185
185
  // getList 返回分页对象
186
186
  const roleList = res.data.list || res.data || [];
@@ -207,7 +207,7 @@ const $Method = {
207
207
 
208
208
  // 加载该用户已有的角色
209
209
  try {
210
- const res = await $Http('/addon/admin/adminRoleDetail', { adminId: row.id });
210
+ const res = await $Http('/core/roleDetail', { adminId: row.id });
211
211
  if (res.code === 0 && res.data) {
212
212
  $Data.checkedRoleCode = res.data.roleCode || '';
213
213
  }
@@ -225,7 +225,7 @@ const $Method = {
225
225
  }
226
226
 
227
227
  try {
228
- const res = await $Http('/addon/admin/adminRoleSave', {
228
+ const res = await $Http('/core/roleSave', {
229
229
  adminId: $Data.currentUser.id,
230
230
  roleCode: $Data.checkedRoleCode
231
231
  });
package/src/api/auth.ts DELETED
@@ -1,60 +0,0 @@
1
- // 登录表单类型
2
- export interface LoginForm {
3
- email?: string;
4
- password?: string;
5
- phone?: string;
6
- code?: string;
7
- }
8
-
9
- // 注册表单类型
10
- export interface RegisterForm {
11
- name: string;
12
- email: string;
13
- password: string;
14
- }
15
-
16
- // 登录响应类型
17
- export interface LoginResponse {
18
- token: string;
19
- userInfo?: {
20
- id: number;
21
- name: string;
22
- email: string;
23
- [key: string]: any;
24
- };
25
- }
26
-
27
- /**
28
- * 用户登录
29
- */
30
- export const loginApi = (data: LoginForm) => {
31
- return $Http<LoginResponse>('/addon/admin/login', data);
32
- };
33
-
34
- /**
35
- * 用户注册
36
- */
37
- export const registerApi = (data: RegisterForm) => {
38
- return $Http('/addon/admin/register', data);
39
- };
40
-
41
- /**
42
- * 发送短信验证码
43
- */
44
- export const sendSmsCodeApi = (phone: string) => {
45
- return $Http('/addon/admin/sendSmsCode', { phone });
46
- };
47
-
48
- /**
49
- * 获取用户信息
50
- */
51
- export function getUserInfo() {
52
- return $Http('/addon/admin/adminInfo');
53
- }
54
-
55
- /**
56
- * 退出登录
57
- */
58
- export const logoutApi = () => {
59
- return $Http('/addon/admin/logout');
60
- };
package/temp/router.js DELETED
@@ -1,71 +0,0 @@
1
- export const yiteRouter = (options) => {
2
- let config = {};
3
- const virtualModuleId = `virtual:yite-router`;
4
- const resolvedVirtualModuleId = '\0' + virtualModuleId;
5
-
6
- return {
7
- name: 'yite-router',
8
- enforce: 'pre',
9
- options(options) {},
10
- buildStart(options) {},
11
- configResolved(resolvedConfig) {
12
- config = resolvedConfig;
13
- },
14
- resolveId(id) {
15
- if (id === virtualModuleId) {
16
- return resolvedVirtualModuleId;
17
- }
18
- },
19
- load(id) {
20
- if (id === resolvedVirtualModuleId) {
21
- return `
22
- const pageFiles = import.meta.glob('@/pages/**/*.vue');
23
- const layoutFiles = import.meta.glob('@/layouts/*.vue');
24
-
25
- const layouts = {};
26
- const routes = [];
27
-
28
-
29
-
30
- const getRouteData = (file) => {
31
- const path = file //
32
- .replace(/[\\\\\/]+/g, '/')
33
- .replace(/.*\\/pages\\//, '')
34
- .replace(/(\\!\\d)?\\.vue/, '')
35
- .replace(/#\\d+/g, '')
36
- .replace(/([a-z])([A-Z])/g, '$1-$2')
37
- .replace(/-$/g, '')
38
- .toLowerCase()
39
- .replace(/[\\s_-]+/g, '-');
40
- const index = file.indexOf('!');
41
- const layout = index !== -1 ? file.substring(index + 1, file.length - 4) : 1;
42
-
43
- return {
44
- path: path,
45
- layout: Number(layout)
46
- };
47
- };
48
-
49
- for (let file in pageFiles) {
50
- if (file.indexOf('components') !== -1) continue;
51
-
52
- const routeData = getRouteData(file);
53
- routes.push({
54
- path: routeData.path === 'index' ? '/' : '/' + routeData.path,
55
- component: layoutFiles['/src/layouts/' + routeData.layout + '.vue'],
56
- children: [
57
- {
58
- path: '',
59
- component: pageFiles[file]
60
- }
61
- ]
62
- });
63
- }
64
-
65
-
66
- export { routes };
67
- `;
68
- }
69
- }
70
- };
71
- };