@befly-addon/admin 1.0.36 → 1.0.38

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 (57) hide show
  1. package/apis/admin/del.ts +1 -5
  2. package/apis/admin/ins.ts +2 -6
  3. package/apis/admin/list.ts +5 -0
  4. package/apis/admin/roleDetail.ts +1 -5
  5. package/apis/admin/roleSave.ts +1 -5
  6. package/apis/admin/upd.ts +1 -6
  7. package/apis/api/all.ts +1 -6
  8. package/apis/auth/login.ts +1 -5
  9. package/apis/auth/logout.ts +1 -5
  10. package/apis/auth/register.ts +1 -5
  11. package/apis/auth/sendSmsCode.ts +1 -5
  12. package/apis/dashboard/changelog.ts +1 -5
  13. package/apis/dashboard/configStatus.ts +1 -5
  14. package/apis/dashboard/environmentInfo.ts +1 -5
  15. package/apis/dashboard/performanceMetrics.ts +1 -5
  16. package/apis/dashboard/permissionStats.ts +1 -5
  17. package/apis/dashboard/serviceStatus.ts +1 -5
  18. package/apis/dashboard/systemInfo.ts +1 -5
  19. package/apis/dashboard/systemOverview.ts +1 -5
  20. package/apis/dashboard/systemResources.ts +1 -5
  21. package/apis/dict/all.ts +0 -3
  22. package/apis/menu/del.ts +1 -5
  23. package/apis/role/all.ts +18 -0
  24. package/apis/role/apiDetail.ts +1 -5
  25. package/apis/role/apiSave.ts +1 -5
  26. package/apis/role/del.ts +1 -5
  27. package/apis/role/detail.ts +1 -5
  28. package/apis/role/ins.ts +0 -3
  29. package/apis/role/list.ts +5 -0
  30. package/apis/role/menuDetail.ts +1 -5
  31. package/apis/role/menuSave.ts +1 -5
  32. package/apis/role/save.ts +1 -5
  33. package/package.json +5 -3
  34. package/styles/variables.scss +87 -0
  35. package/tables/admin.json +2 -8
  36. package/views/403/index.vue +21 -30
  37. package/views/admin/components/edit.vue +73 -48
  38. package/views/admin/index.vue +128 -48
  39. package/views/dict/index.vue +0 -2
  40. package/views/index/components/addonList.vue +20 -14
  41. package/views/index/components/environmentInfo.vue +6 -6
  42. package/views/index/components/operationLogs.vue +9 -9
  43. package/views/index/components/performanceMetrics.vue +22 -32
  44. package/views/index/components/serviceStatus.vue +14 -14
  45. package/views/index/components/systemNotifications.vue +21 -21
  46. package/views/index/components/systemOverview.vue +24 -24
  47. package/views/index/components/systemResources.vue +4 -4
  48. package/views/index/components/userInfo.vue +7 -7
  49. package/views/index/index.vue +0 -2
  50. package/views/login/components/emailLoginForm.vue +47 -46
  51. package/views/login/index_1.vue +158 -121
  52. package/views/role/components/api.vue +11 -9
  53. package/views/role/components/edit.vue +13 -2
  54. package/views/role/index.vue +0 -2
  55. package/utils/scanBeflyAddonViews.js +0 -43
  56. package/views/admin/components/role.vue +0 -138
  57. /package/apis/admin/{info.ts → detail.ts} +0 -0
package/apis/admin/del.ts CHANGED
@@ -1,8 +1,4 @@
1
- /**
2
- * 删除管理员
3
- */
4
-
5
- import { Yes, No } from 'befly';
1
+ import { Yes, No } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '删除管理员',
package/apis/admin/ins.ts CHANGED
@@ -1,14 +1,10 @@
1
- /**
2
- * 添加管理员
3
- */
4
-
5
- import { Yes, No, Cipher } from 'befly';
1
+ import { Yes, No, Cipher } from 'befly';
6
2
  import adminTable from '../../tables/admin.json';
7
3
 
8
4
  export default {
9
5
  name: '添加管理员',
10
6
  fields: adminTable,
11
- required: ['username', 'email', 'password'],
7
+ required: ['username', 'email', 'password', 'roleId'],
12
8
  handler: async (befly, ctx) => {
13
9
  // 检查用户名是否已存在
14
10
  if (ctx.body.username) {
@@ -7,6 +7,11 @@ export default {
7
7
  table: 'addon_admin_admin',
8
8
  page: ctx.body.page || 1,
9
9
  limit: ctx.body.limit || 10,
10
+ where: {
11
+ roleCode: {
12
+ $ne: 'dev'
13
+ }
14
+ },
10
15
  orderBy: ['createdAt#DESC']
11
16
  });
12
17
 
@@ -1,8 +1,4 @@
1
- /**
2
- * 获取管理员的角色(单角色模式)
3
- */
4
-
5
- import { Yes, No } from 'befly';
1
+ import { Yes, No } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '获取管理员角色',
@@ -1,8 +1,4 @@
1
- /**
2
- * 保存管理员的角色(单角色模式)
3
- */
4
-
5
- import { Yes, No } from 'befly';
1
+ import { Yes, No } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '管理员角色保存',
package/apis/admin/upd.ts CHANGED
@@ -7,12 +7,7 @@ import adminTable from '../../tables/admin.json';
7
7
 
8
8
  export default {
9
9
  name: '更新管理员',
10
- fields: {
11
- name: adminTable.name,
12
- nickname: adminTable.nickname,
13
- email: adminTable.email,
14
- phone: adminTable.phone
15
- },
10
+ fields: adminTable,
16
11
  required: ['id'],
17
12
  handler: async (befly, ctx) => {
18
13
  const { id, ...updateData } = ctx.body;
package/apis/api/all.ts CHANGED
@@ -1,9 +1,4 @@
1
- /**
2
- * 获取所有接口列表
3
- * 说明:用于角色权限配置,返回所有接口信息
4
- */
5
-
6
- import { Yes, No } from 'befly';
1
+ import { Yes, No } from 'befly';
7
2
 
8
3
  export default {
9
4
  name: '获取所有接口',
@@ -1,8 +1,4 @@
1
- /**
2
- * 管理员登录接口
3
- */
4
-
5
- import { Yes, No, Cipher, Jwt } from 'befly';
1
+ import { Yes, No, Cipher, Jwt } from 'befly';
6
2
  import adminTable from '../../tables/admin.json';
7
3
 
8
4
  export default {
@@ -1,8 +1,4 @@
1
- /**
2
- * 退出登录接口
3
- */
4
-
5
- import { Yes } from 'befly';
1
+ import { Yes } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '退出登录',
@@ -1,8 +1,4 @@
1
- /**
2
- * 管理员注册接口
3
- */
4
-
5
- import { Yes, No, Cipher } from 'befly';
1
+ import { Yes, No, Cipher } from 'befly';
6
2
  import adminTable from '../../tables/admin.json';
7
3
 
8
4
  export default {
@@ -1,8 +1,4 @@
1
- /**
2
- * 发送短信验证码接口
3
- */
4
-
5
- import { Yes, Env } from 'befly';
1
+ import { Yes, Env } from 'befly';
6
2
  import adminTable from '../../tables/admin.json';
7
3
 
8
4
  export default {
@@ -1,8 +1,4 @@
1
- /**
2
- * 获取更新日志
3
- */
4
-
5
- import { Yes } from 'befly';
1
+ import { Yes } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '获取更新日志',
@@ -1,8 +1,4 @@
1
- /**
2
- * 获取系统配置状态
3
- */
4
-
5
- import { Yes } from 'befly';
1
+ import { Yes } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '获取配置状态',
@@ -1,8 +1,4 @@
1
- /**
2
- * 获取运行环境信息
3
- */
4
-
5
- import { Yes } from 'befly';
1
+ import { Yes } from 'befly';
6
2
  import os from 'node:os';
7
3
 
8
4
  export default {
@@ -1,8 +1,4 @@
1
- /**
2
- * 获取性能指标
3
- */
4
-
5
- import { Yes } from 'befly';
1
+ import { Yes } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '获取性能指标',
@@ -1,8 +1,4 @@
1
- /**
2
- * 获取权限统计信息
3
- */
4
-
5
- import { Yes } from 'befly';
1
+ import { Yes } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '获取权限统计',
@@ -1,8 +1,4 @@
1
- /**
2
- * 获取服务状态
3
- */
4
-
5
- import { Yes, Env } from 'befly';
1
+ import { Yes, Env } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '获取服务状态',
@@ -1,8 +1,4 @@
1
- /**
2
- * 获取系统信息
3
- */
4
-
5
- import { Yes, Env } from 'befly';
1
+ import { Yes, Env } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '获取系统信息',
@@ -1,8 +1,4 @@
1
- /**
2
- * 获取系统概览数据
3
- */
4
-
5
- import { Yes } from 'befly';
1
+ import { Yes } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '获取系统概览数据',
@@ -1,8 +1,4 @@
1
- /**
2
- * 获取系统资源使用情况
3
- */
4
-
5
- import os from 'node:os';
1
+ import os from 'node:os';
6
2
  import fs from 'node:fs';
7
3
  import { Yes } from 'befly';
8
4
  import { promisify } from 'node:util';
package/apis/dict/all.ts CHANGED
@@ -1,8 +1,5 @@
1
1
  import { Yes, No } from 'befly';
2
2
 
3
- /**
4
- * 获取所有字典(不分页)
5
- */
6
3
  export default {
7
4
  name: '获取所有字典',
8
5
  handler: async (befly, ctx) => {
package/apis/menu/del.ts CHANGED
@@ -1,8 +1,4 @@
1
- /**
2
- * 删除菜单
3
- */
4
-
5
- import { Yes, No } from 'befly';
1
+ import { Yes, No } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '删除菜单',
@@ -0,0 +1,18 @@
1
+ import { Yes } from 'befly';
2
+
3
+ export default {
4
+ name: '获取所有角色',
5
+ handler: async (befly, ctx) => {
6
+ const roles = await befly.db.getAll({
7
+ table: 'addon_admin_role',
8
+ where: {
9
+ code: {
10
+ $ne: 'dev'
11
+ }
12
+ },
13
+ orderBy: ['sort#ASC', 'id#ASC']
14
+ });
15
+
16
+ return Yes('操作成功', roles);
17
+ }
18
+ };
@@ -1,8 +1,4 @@
1
- /**
2
- * 获取角色的接口权限
3
- */
4
-
5
- import { Yes, No } from 'befly';
1
+ import { Yes, No } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '获取角色接口权限',
@@ -1,8 +1,4 @@
1
- /**
2
- * 保存角色的接口权限
3
- */
4
-
5
- import { Yes, No } from 'befly';
1
+ import { Yes, No } from 'befly';
6
2
  import adminRoleTable from '../../tables/role.json';
7
3
 
8
4
  export default {
package/apis/role/del.ts CHANGED
@@ -1,8 +1,4 @@
1
- /**
2
- * 删除角色
3
- */
4
-
5
- import { Yes, No } from 'befly';
1
+ import { Yes, No } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '删除角色',
@@ -1,8 +1,4 @@
1
- /**
2
- * 获取用户的角色(单角色模式)
3
- */
4
-
5
- import { Yes, No } from 'befly';
1
+ import { Yes, No } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '获取用户角色',
package/apis/role/ins.ts CHANGED
@@ -1,9 +1,6 @@
1
1
  import { Yes, No } from 'befly';
2
2
  import adminRoleTable from '../../tables/role.json';
3
3
 
4
- /**
5
- * 创建角色
6
- */
7
4
  export default {
8
5
  name: '创建角色',
9
6
  fields: adminRoleTable,
package/apis/role/list.ts CHANGED
@@ -6,6 +6,11 @@ export default {
6
6
  const roles = await befly.db.getList({
7
7
  limit: 30,
8
8
  table: 'addon_admin_role',
9
+ where: {
10
+ code: {
11
+ $ne: 'dev'
12
+ }
13
+ },
9
14
  orderBy: ['sort#ASC', 'id#ASC']
10
15
  });
11
16
 
@@ -1,8 +1,4 @@
1
- /**
2
- * 获取角色的菜单权限
3
- */
4
-
5
- import { Yes, No } from 'befly';
1
+ import { Yes, No } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '获取角色菜单权限',
@@ -1,8 +1,4 @@
1
- /**
2
- * 保存角色的菜单权限
3
- */
4
-
5
- import { Yes, No } from 'befly';
1
+ import { Yes, No } from 'befly';
6
2
  import adminRoleTable from '../../tables/role.json';
7
3
 
8
4
  export default {
package/apis/role/save.ts CHANGED
@@ -1,8 +1,4 @@
1
- /**
2
- * 保存用户的角色(单角色模式)
3
- */
4
-
5
- import { Yes, No } from 'befly';
1
+ import { Yes, No } from 'befly';
6
2
 
7
3
  export default {
8
4
  name: '角色保存',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@befly-addon/admin",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "description": "Befly - 管理后台功能组件",
5
5
  "type": "module",
6
6
  "private": false,
@@ -19,6 +19,7 @@
19
19
  "tables/",
20
20
  "views/",
21
21
  "utils/",
22
+ "styles/",
22
23
  "addon.config.json",
23
24
  "README.md",
24
25
  "package.json",
@@ -39,8 +40,9 @@
39
40
  "url": "https://github.com/chenbimo/befly.git",
40
41
  "directory": "packages/addon-admin"
41
42
  },
42
- "gitHead": "eca0bca31957e39e68a7553fc180d9665c216a58",
43
+ "gitHead": "afb329b2cce2ab5f5821d8515ae7dba4622a4f1f",
43
44
  "dependencies": {
44
- "befly": "3.8.12"
45
+ "befly": "3.8.13",
46
+ "befly-util": "0.1.1"
45
47
  }
46
48
  }
@@ -0,0 +1,87 @@
1
+ // CSS 原生变量(支持运行时动态修改)
2
+ :root {
3
+ // 主题色
4
+ --primary-color: #0052d9;
5
+ --success-color: #00a870;
6
+ --warning-color: #ed7b2f;
7
+ --error-color: #e34d59;
8
+ --info-color: #0052d9;
9
+
10
+ // 主题色 RGB 格式(用于 rgba)
11
+ --primary-color-rgb: 0, 82, 217;
12
+ --success-color-rgb: 0, 168, 112;
13
+ --warning-color-rgb: 237, 123, 47;
14
+ --error-color-rgb: 227, 77, 89;
15
+ --info-color-rgb: 0, 82, 217;
16
+
17
+ // 文本颜色
18
+ --text-primary: #1f2329;
19
+ --text-secondary: #646a73;
20
+ --text-placeholder: #8f959e;
21
+ --text-disabled: #c9cdd4;
22
+
23
+ // 背景色
24
+ --bg-color-page: #f5f7fa;
25
+ --bg-color-container: #ffffff;
26
+ --bg-color-overlay: rgba(0, 0, 0, 0.6);
27
+ --bg-color-hover: #f5f7fa;
28
+
29
+ // 边框
30
+ --border-color: #e8eaed;
31
+ --border-color-light: #f0f1f3;
32
+ --border-radius: 8px;
33
+ --border-radius-small: 4px;
34
+ --border-radius-large: 12px;
35
+
36
+ // 间距
37
+ --spacing-xs: 4px;
38
+ --spacing-sm: 8px;
39
+ --spacing-md: 16px;
40
+ --spacing-lg: 24px;
41
+ --spacing-xl: 32px;
42
+
43
+ // 阴影
44
+ --shadow-small: 0 2px 8px rgba(0, 0, 0, 0.04);
45
+ --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.08);
46
+ --shadow-large: 0 8px 24px rgba(0, 0, 0, 0.12);
47
+ --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04);
48
+
49
+ // 动画时间
50
+ --transition-fast: 0.15s;
51
+ --transition-normal: 0.3s;
52
+ --transition-slow: 0.5s;
53
+
54
+ // 字体大小
55
+ --font-size-xs: 12px;
56
+ --font-size-sm: 14px;
57
+ --font-size-md: 16px;
58
+ --font-size-lg: 18px;
59
+ --font-size-xl: 20px;
60
+
61
+ // 布局尺寸
62
+ --header-height: 64px;
63
+ --sidebar-width: 240px;
64
+ --footer-height: 48px;
65
+ --search-height: 56px;
66
+ --pagination-height: 56px;
67
+ --detail-width: 320px;
68
+ --transition-duration: 0.3s;
69
+
70
+ // 登录页配色
71
+ --login-bg: #f5f7fa;
72
+ --login-left-gradient-start: #f8f9fa;
73
+ --login-left-gradient-end: #e9ecef;
74
+ --login-circle-bg: rgba(0, 0, 0, 0.03);
75
+ --login-brand-title: #2c3e50;
76
+ --login-brand-subtitle: #6c757d;
77
+ --login-card-bg: #ffffff;
78
+ --login-card-border: #e9ecef;
79
+ --login-card-shadow: rgba(0, 0, 0, 0.08);
80
+ --login-title: #2c3e50;
81
+ --login-subtitle: #6c757d;
82
+ --login-link: #495057;
83
+ --login-link-hover: #2c3e50;
84
+ --login-btn-gradient-start: #495057;
85
+ --login-btn-gradient-end: #343a40;
86
+ --login-btn-shadow: rgba(52, 58, 64, 0.3);
87
+ }
package/tables/admin.json CHANGED
@@ -1,14 +1,8 @@
1
1
  {
2
- "name": {
3
- "name": "姓名",
4
- "type": "string",
5
- "min": 2,
6
- "max": 50
7
- },
8
2
  "nickname": {
9
3
  "name": "昵称",
10
4
  "type": "string",
11
- "min": 2,
5
+ "min": 1,
12
6
  "max": 50
13
7
  },
14
8
  "email": {
@@ -29,7 +23,7 @@
29
23
  "username": {
30
24
  "name": "用户名",
31
25
  "type": "string",
32
- "min": 3,
26
+ "min": 2,
33
27
  "max": 30,
34
28
  "regexp": "@alphanumeric_"
35
29
  },
@@ -13,6 +13,7 @@
13
13
  </template>
14
14
 
15
15
  <script setup>
16
+ import { useRouter } from 'vue-router';
16
17
  import { Button as TButton } from 'tdesign-vue-next';
17
18
 
18
19
  const router = useRouter();
@@ -30,39 +31,29 @@ const $Method = {
30
31
  <style scoped lang="scss">
31
32
  .error-page {
32
33
  display: flex;
34
+ flex-direction: column;
33
35
  align-items: center;
34
36
  justify-content: center;
35
37
  min-height: 100vh;
36
- background: $bg-color-page;
37
-
38
- .error-content {
39
- text-align: center;
40
-
41
- .error-code {
42
- font-size: 120px;
43
- font-weight: bold;
44
- color: #ff6b6b;
45
- margin-bottom: 20px;
46
- }
47
-
48
- .error-title {
49
- font-size: 24px;
50
- font-weight: 600;
51
- color: $text-primary;
52
- margin-bottom: 12px;
53
- }
54
-
55
- .error-description {
56
- font-size: 14px;
57
- color: $text-secondary;
58
- margin-bottom: 30px;
59
- }
38
+ background: var(--bg-color-page);
39
+
40
+ .error-code {
41
+ font-size: 120px;
42
+ font-weight: 700;
43
+ background: linear-gradient(135deg, var(--primary-color) 0%, #764ba2 100%);
44
+ -webkit-background-clip: text;
45
+ -webkit-text-fill-color: transparent;
46
+ background-clip: text;
47
+ margin: 0;
48
+ }
60
49
 
61
- .error-actions {
62
- display: flex;
63
- gap: 12px;
64
- justify-content: center;
65
- }
50
+ .error-message {
51
+ font-size: 24px;
52
+ color: var(--text-primary);
53
+ margin: 20px 0;
66
54
  }
67
- }
55
+
56
+ .error-description {
57
+ font-size: 16px;
58
+ color: var(--text-secondary);
68
59
  </style>