befly-admin 3.4.5 → 3.4.7
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/.gitignore +2 -0
- package/bunfig.toml +1 -8
- package/index.html +2 -2
- package/package.json +12 -8
- package/src/config/index.ts +20 -0
- package/src/layouts/{internal/0.vue → default.vue} +51 -21
- package/src/main.ts +3 -5
- package/src/plugins/global.ts +17 -0
- package/src/plugins/{internal/http.ts → http.ts} +1 -1
- package/src/router/index.ts +55 -0
- package/src/styles/{internal/index.scss → global.scss} +29 -29
- package/src/types/auto-imports.d.ts +176 -637
- package/src/types/components.d.ts +28 -19
- package/src/types/typed-router.d.ts +32 -0
- package/src/utils/index.ts +21 -9
- package/src/views/index.vue +27 -0
- package/src/views/internal/login.vue +73 -0
- package/src/views/test.vue +60 -0
- package/tsconfig.json +4 -4
- package/vite.config.ts +134 -60
- package/src/components/internal/Icon.vue +0 -41
- package/src/components/internal/README.md +0 -27
- package/src/layouts/4.vue +0 -17
- package/src/layouts/internal/1.vue +0 -22
- package/src/layouts/internal/2.vue +0 -169
- package/src/layouts/internal/README.md +0 -27
- package/src/plugins/internal/README.md +0 -36
- package/src/plugins/internal/router.ts +0 -48
- package/src/plugins/internal/store.ts +0 -19
- package/src/styles/internal/README.md +0 -27
- package/src/styles/internal/mixins.scss +0 -98
- package/src/types/env.d.ts +0 -23
- package/src/utils/README.md +0 -37
- package/src/utils/internal/README.md +0 -21
- package/src/utils/internal/index.ts +0 -30
- package/src/views/internal/403/403.vue +0 -66
- package/src/views/internal/README.md +0 -27
- package/src/views/internal/admin/components/edit.vue +0 -147
- package/src/views/internal/admin/components/role.vue +0 -135
- package/src/views/internal/admin/index.vue +0 -169
- package/src/views/internal/dict/components/edit.vue +0 -156
- package/src/views/internal/dict/index.vue +0 -159
- package/src/views/internal/index/components/addonList.vue +0 -125
- package/src/views/internal/index/components/environmentInfo.vue +0 -97
- package/src/views/internal/index/components/operationLogs.vue +0 -112
- package/src/views/internal/index/components/performanceMetrics.vue +0 -148
- package/src/views/internal/index/components/quickActions.vue +0 -27
- package/src/views/internal/index/components/serviceStatus.vue +0 -193
- package/src/views/internal/index/components/systemNotifications.vue +0 -136
- package/src/views/internal/index/components/systemOverview.vue +0 -188
- package/src/views/internal/index/components/systemResources.vue +0 -104
- package/src/views/internal/index/components/userInfo.vue +0 -202
- package/src/views/internal/index/index.vue +0 -62
- package/src/views/internal/login/components/emailLoginForm.vue +0 -163
- package/src/views/internal/login/components/registerForm.vue +0 -168
- package/src/views/internal/login/components/welcomePanel.vue +0 -61
- package/src/views/internal/login/index_1.vue +0 -189
- package/src/views/internal/menu/components/edit.vue +0 -150
- package/src/views/internal/menu/index.vue +0 -168
- package/src/views/internal/news/detail/detail_2.vue +0 -26
- package/src/views/internal/news/detail/index.vue +0 -26
- package/src/views/internal/news/news.vue +0 -26
- package/src/views/internal/role/components/api.vue +0 -280
- package/src/views/internal/role/components/edit.vue +0 -129
- package/src/views/internal/role/components/menu.vue +0 -143
- package/src/views/internal/role/index.vue +0 -179
- package/src/views/internal/user/user.vue +0 -320
- /package/src/plugins/{internal/storage.ts → storage.ts} +0 -0
- /package/src/styles/{internal/variables.scss → variables.scss} +0 -0
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="section-block">
|
|
3
|
-
<div class="section-header">
|
|
4
|
-
<Icon name="Settings" :size="20" />
|
|
5
|
-
<h2>服务状态</h2>
|
|
6
|
-
</div>
|
|
7
|
-
<div class="section-content">
|
|
8
|
-
<div class="config-grid">
|
|
9
|
-
<div v-for="service in services" :key="service.name" class="config-card" :class="`config-${service.status}`">
|
|
10
|
-
<div class="config-icon">
|
|
11
|
-
<Icon :name="getServiceIcon(service.name)" :size="20" />
|
|
12
|
-
</div>
|
|
13
|
-
<div class="config-info">
|
|
14
|
-
<div class="config-name">{{ service.name }}</div>
|
|
15
|
-
<div class="config-status">
|
|
16
|
-
{{ getStatusText(service.status) }}
|
|
17
|
-
<span v-if="service.responseTime && service.responseTime !== '-'" class="latency">{{ service.responseTime }}</span>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
<div class="config-badge">
|
|
21
|
-
<Icon :name="getStatusIcon(service.status)" :size="32" />
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script setup>
|
|
30
|
-
// 组件内部数据
|
|
31
|
-
const services = $ref([]);
|
|
32
|
-
|
|
33
|
-
// 获取数据
|
|
34
|
-
const fetchData = async () => {
|
|
35
|
-
try {
|
|
36
|
-
const { data } = await $Http('/addon/admin/dashboard/serviceStatus');
|
|
37
|
-
services.splice(0, services.length, ...data.services);
|
|
38
|
-
} catch (error) {
|
|
39
|
-
console.error('获取服务状态失败:', error);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
fetchData();
|
|
44
|
-
|
|
45
|
-
// 工具函数
|
|
46
|
-
const getStatusColor = (status) => {
|
|
47
|
-
const colors = {
|
|
48
|
-
running: 'success',
|
|
49
|
-
stopped: 'error',
|
|
50
|
-
unconfigured: 'warning'
|
|
51
|
-
};
|
|
52
|
-
return colors[status] || 'default';
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const getStatusText = (status) => {
|
|
56
|
-
const texts = {
|
|
57
|
-
running: '正常',
|
|
58
|
-
stopped: '停止',
|
|
59
|
-
unconfigured: '未配置'
|
|
60
|
-
};
|
|
61
|
-
return texts[status] || status;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const getServiceIcon = (name) => {
|
|
65
|
-
const icons = {
|
|
66
|
-
数据库: 'Database',
|
|
67
|
-
Redis: 'Zap',
|
|
68
|
-
文件系统: 'HardDrive',
|
|
69
|
-
邮件服务: 'Mail',
|
|
70
|
-
OSS存储: 'Cloud'
|
|
71
|
-
};
|
|
72
|
-
return icons[name] || 'Circle';
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const getStatusIcon = (status) => {
|
|
76
|
-
const icons = {
|
|
77
|
-
running: 'CheckCircle',
|
|
78
|
-
stopped: 'XCircle',
|
|
79
|
-
unconfigured: 'AlertCircle'
|
|
80
|
-
};
|
|
81
|
-
return icons[status] || 'Circle';
|
|
82
|
-
};
|
|
83
|
-
</script>
|
|
84
|
-
|
|
85
|
-
<style scoped lang="scss">
|
|
86
|
-
.config-grid {
|
|
87
|
-
display: grid;
|
|
88
|
-
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
89
|
-
gap: 10px;
|
|
90
|
-
|
|
91
|
-
.config-card {
|
|
92
|
-
background: rgba($primary-color, 0.02);
|
|
93
|
-
border: 1px solid $border-color;
|
|
94
|
-
border-radius: 6px;
|
|
95
|
-
padding: 12px;
|
|
96
|
-
display: flex;
|
|
97
|
-
align-items: center;
|
|
98
|
-
gap: 10px;
|
|
99
|
-
position: relative;
|
|
100
|
-
overflow: hidden;
|
|
101
|
-
transition: all 0.3s;
|
|
102
|
-
|
|
103
|
-
&:hover {
|
|
104
|
-
background: rgba($primary-color, 0.05);
|
|
105
|
-
border-color: $primary-color;
|
|
106
|
-
transform: translateY(-2px);
|
|
107
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.config-icon {
|
|
111
|
-
width: 40px;
|
|
112
|
-
height: 40px;
|
|
113
|
-
display: flex;
|
|
114
|
-
align-items: center;
|
|
115
|
-
justify-content: center;
|
|
116
|
-
border-radius: 6px;
|
|
117
|
-
flex-shrink: 0;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.config-info {
|
|
121
|
-
flex: 1;
|
|
122
|
-
min-width: 0;
|
|
123
|
-
|
|
124
|
-
.config-name {
|
|
125
|
-
font-size: 14px;
|
|
126
|
-
font-weight: 600;
|
|
127
|
-
margin-bottom: 2px;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.config-status {
|
|
131
|
-
font-size: 14px;
|
|
132
|
-
display: flex;
|
|
133
|
-
align-items: center;
|
|
134
|
-
gap: 4px;
|
|
135
|
-
|
|
136
|
-
.latency {
|
|
137
|
-
margin-left: 4px;
|
|
138
|
-
color: $text-placeholder;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.config-badge {
|
|
144
|
-
position: absolute;
|
|
145
|
-
top: 6px;
|
|
146
|
-
right: 6px;
|
|
147
|
-
opacity: 0.2;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
&.config-running {
|
|
151
|
-
border-color: $success-color;
|
|
152
|
-
background: linear-gradient(135deg, rgba(82, 196, 26, 0.05), white);
|
|
153
|
-
|
|
154
|
-
.config-icon {
|
|
155
|
-
background: rgba(82, 196, 26, 0.1);
|
|
156
|
-
color: $success-color;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.config-name {
|
|
160
|
-
color: $success-color;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
&.config-unconfigured {
|
|
165
|
-
border-color: $warning-color;
|
|
166
|
-
background: linear-gradient(135deg, rgba(250, 173, 20, 0.05), white);
|
|
167
|
-
|
|
168
|
-
.config-icon {
|
|
169
|
-
background: rgba(250, 173, 20, 0.1);
|
|
170
|
-
color: $warning-color;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.config-name {
|
|
174
|
-
color: $warning-color;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
&.config-stopped {
|
|
179
|
-
border-color: $error-color;
|
|
180
|
-
background: linear-gradient(135deg, rgba(255, 77, 79, 0.05), white);
|
|
181
|
-
|
|
182
|
-
.config-icon {
|
|
183
|
-
background: rgba(255, 77, 79, 0.1);
|
|
184
|
-
color: $error-color;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.config-name {
|
|
188
|
-
color: $error-color;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
</style>
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="section-block">
|
|
3
|
-
<div class="section-header">
|
|
4
|
-
<Icon name="Bell" :size="20" />
|
|
5
|
-
<h2>系统通知</h2>
|
|
6
|
-
</div>
|
|
7
|
-
<div class="section-content">
|
|
8
|
-
<div class="notification-compact-list">
|
|
9
|
-
<div v-for="notification in notifications" :key="notification.id" class="notification-compact-item">
|
|
10
|
-
<div class="notification-icon" :class="`type-${notification.type}`">
|
|
11
|
-
<Icon :name="getNotificationIcon(notification.type)" :size="16" />
|
|
12
|
-
</div>
|
|
13
|
-
<div class="notification-content">
|
|
14
|
-
<span class="notification-title">{{ notification.title }}</span>
|
|
15
|
-
<span class="notification-time">{{ formatTime(notification.createdAt) }}</span>
|
|
16
|
-
</div>
|
|
17
|
-
<tiny-tag v-if="!notification.isRead" type="primary" size="small">新</tiny-tag>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script setup>
|
|
25
|
-
// 组件内部数据
|
|
26
|
-
const notifications = $ref([
|
|
27
|
-
{ id: 1, type: 'warning', title: '系统更新提醒 - v1.1.0 版本已发布', isRead: false, createdAt: Date.now() - 3600000 },
|
|
28
|
-
{ id: 2, type: 'info', title: '数据备份完成 - 今日凌晨自动备份成功', isRead: true, createdAt: Date.now() - 21600000 },
|
|
29
|
-
{ id: 3, type: 'error', title: 'SSL证书即将过期 - 请及时更新证书', isRead: false, createdAt: Date.now() - 86400000 },
|
|
30
|
-
{ id: 4, type: 'success', title: '性能优化完成 - 响应速度提升30%', isRead: true, createdAt: Date.now() - 172800000 }
|
|
31
|
-
]);
|
|
32
|
-
|
|
33
|
-
const getNotificationIcon = (type) => {
|
|
34
|
-
const iconMap = {
|
|
35
|
-
info: 'Info',
|
|
36
|
-
success: 'CheckCircle',
|
|
37
|
-
warning: 'AlertTriangle',
|
|
38
|
-
error: 'XCircle'
|
|
39
|
-
};
|
|
40
|
-
return iconMap[type] || 'Bell';
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const formatTime = (timestamp) => {
|
|
44
|
-
const date = new Date(timestamp);
|
|
45
|
-
const now = Date.now();
|
|
46
|
-
const diff = now - timestamp;
|
|
47
|
-
|
|
48
|
-
if (diff < 3600000) {
|
|
49
|
-
return `${Math.floor(diff / 60000)}分钟前`;
|
|
50
|
-
} else if (diff < 86400000) {
|
|
51
|
-
return `${Math.floor(diff / 3600000)}小时前`;
|
|
52
|
-
} else {
|
|
53
|
-
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
54
|
-
const day = String(date.getDate()).padStart(2, '0');
|
|
55
|
-
return `${month}-${day}`;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
</script>
|
|
59
|
-
|
|
60
|
-
<style scoped lang="scss">
|
|
61
|
-
.notification-compact-list {
|
|
62
|
-
display: flex;
|
|
63
|
-
flex-direction: column;
|
|
64
|
-
gap: $spacing-xs;
|
|
65
|
-
|
|
66
|
-
.notification-compact-item {
|
|
67
|
-
display: flex;
|
|
68
|
-
align-items: center;
|
|
69
|
-
gap: $spacing-sm;
|
|
70
|
-
padding: $spacing-sm $spacing-md;
|
|
71
|
-
background: rgba($primary-color, 0.02);
|
|
72
|
-
border-radius: $border-radius-small;
|
|
73
|
-
border: 1px solid $border-color;
|
|
74
|
-
transition: all 0.2s ease;
|
|
75
|
-
|
|
76
|
-
&:hover {
|
|
77
|
-
background: rgba($primary-color, 0.05);
|
|
78
|
-
border-color: $primary-color;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.notification-icon {
|
|
82
|
-
display: flex;
|
|
83
|
-
align-items: center;
|
|
84
|
-
justify-content: center;
|
|
85
|
-
width: 32px;
|
|
86
|
-
height: 32px;
|
|
87
|
-
border-radius: $border-radius-small;
|
|
88
|
-
flex-shrink: 0;
|
|
89
|
-
|
|
90
|
-
&.type-info {
|
|
91
|
-
background: rgba($primary-color, 0.1);
|
|
92
|
-
color: $primary-color;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
&.type-success {
|
|
96
|
-
background: rgba($success-color, 0.1);
|
|
97
|
-
color: $success-color;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
&.type-warning {
|
|
101
|
-
background: rgba($warning-color, 0.1);
|
|
102
|
-
color: $warning-color;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
&.type-error {
|
|
106
|
-
background: rgba($error-color, 0.1);
|
|
107
|
-
color: $error-color;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.notification-content {
|
|
112
|
-
display: flex;
|
|
113
|
-
align-items: center;
|
|
114
|
-
gap: $spacing-sm;
|
|
115
|
-
flex: 1;
|
|
116
|
-
min-width: 0;
|
|
117
|
-
|
|
118
|
-
.notification-title {
|
|
119
|
-
font-size: 14px;
|
|
120
|
-
color: $text-primary;
|
|
121
|
-
font-weight: 500;
|
|
122
|
-
overflow: hidden;
|
|
123
|
-
text-overflow: ellipsis;
|
|
124
|
-
white-space: nowrap;
|
|
125
|
-
flex: 1;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.notification-time {
|
|
129
|
-
font-size: 14px;
|
|
130
|
-
color: $text-placeholder;
|
|
131
|
-
flex-shrink: 0;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
</style>
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="section-block">
|
|
3
|
-
<div class="section-header">
|
|
4
|
-
<Icon name="Info" :size="20" />
|
|
5
|
-
<h2>系统概览</h2>
|
|
6
|
-
</div>
|
|
7
|
-
<div class="section-content">
|
|
8
|
-
<tiny-row :flex="true" :gap="12">
|
|
9
|
-
<tiny-col :xs="24" :sm="12" :md="12" :lg="12">
|
|
10
|
-
<div class="info-block">
|
|
11
|
-
<div class="stats-grid">
|
|
12
|
-
<div class="stat-box stat-primary">
|
|
13
|
-
<Icon name="Menu" :size="24" />
|
|
14
|
-
<div class="stat-content">
|
|
15
|
-
<div class="stat-value">{{ permissionStats.menuCount }}</div>
|
|
16
|
-
<div class="stat-label">菜单总数</div>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
<div class="stat-box stat-success">
|
|
20
|
-
<Icon name="Webhook" :size="24" />
|
|
21
|
-
<div class="stat-content">
|
|
22
|
-
<div class="stat-value">{{ permissionStats.apiCount }}</div>
|
|
23
|
-
<div class="stat-label">接口总数</div>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
<div class="stat-box stat-warning">
|
|
27
|
-
<Icon name="Users" :size="24" />
|
|
28
|
-
<div class="stat-content">
|
|
29
|
-
<div class="stat-value">{{ permissionStats.roleCount }}</div>
|
|
30
|
-
<div class="stat-label">角色总数</div>
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
</tiny-col>
|
|
36
|
-
</tiny-row>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</template>
|
|
40
|
-
|
|
41
|
-
<script setup>
|
|
42
|
-
// 组件内部数据
|
|
43
|
-
const permissionStats = $ref({
|
|
44
|
-
menuCount: 0,
|
|
45
|
-
apiCount: 0,
|
|
46
|
-
roleCount: 0
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// 获取数据
|
|
50
|
-
const fetchData = async () => {
|
|
51
|
-
try {
|
|
52
|
-
const { data } = await $Http('/addon/admin/dashboard/systemOverview');
|
|
53
|
-
Object.assign(permissionStats, data);
|
|
54
|
-
} catch (error) {
|
|
55
|
-
console.error('获取系统概览失败:', error);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
fetchData();
|
|
60
|
-
</script>
|
|
61
|
-
|
|
62
|
-
<style scoped lang="scss">
|
|
63
|
-
.info-block {
|
|
64
|
-
background: transparent;
|
|
65
|
-
border: none;
|
|
66
|
-
padding: 0;
|
|
67
|
-
height: 100%;
|
|
68
|
-
|
|
69
|
-
.info-header {
|
|
70
|
-
display: flex;
|
|
71
|
-
align-items: center;
|
|
72
|
-
gap: 6px;
|
|
73
|
-
padding-bottom: 8px;
|
|
74
|
-
margin-bottom: 12px;
|
|
75
|
-
border-bottom: 2px solid $primary-color;
|
|
76
|
-
|
|
77
|
-
.info-title {
|
|
78
|
-
font-size: 14px;
|
|
79
|
-
font-weight: 600;
|
|
80
|
-
color: $text-primary;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.info-grid-compact {
|
|
85
|
-
display: grid;
|
|
86
|
-
grid-template-columns: repeat(3, 1fr);
|
|
87
|
-
gap: 10px;
|
|
88
|
-
|
|
89
|
-
.info-grid-item {
|
|
90
|
-
display: flex;
|
|
91
|
-
justify-content: space-between;
|
|
92
|
-
align-items: center;
|
|
93
|
-
padding: 10px 12px;
|
|
94
|
-
background: rgba($primary-color, 0.02);
|
|
95
|
-
border-radius: $border-radius-small;
|
|
96
|
-
border: 1px solid $border-color;
|
|
97
|
-
transition: all 0.2s ease;
|
|
98
|
-
|
|
99
|
-
&:hover {
|
|
100
|
-
background: rgba($primary-color, 0.05);
|
|
101
|
-
border-color: $primary-color;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.label {
|
|
105
|
-
font-size: 14px;
|
|
106
|
-
color: $text-secondary;
|
|
107
|
-
font-weight: 500;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.value {
|
|
111
|
-
font-size: 14px;
|
|
112
|
-
color: $text-primary;
|
|
113
|
-
font-weight: 600;
|
|
114
|
-
|
|
115
|
-
&.highlight {
|
|
116
|
-
color: $primary-color;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.stats-grid {
|
|
124
|
-
display: grid;
|
|
125
|
-
grid-template-columns: repeat(3, 1fr);
|
|
126
|
-
gap: 10px;
|
|
127
|
-
|
|
128
|
-
.stat-box {
|
|
129
|
-
background: rgba($primary-color, 0.02);
|
|
130
|
-
border: 1px solid $border-color;
|
|
131
|
-
border-radius: 6px;
|
|
132
|
-
padding: 12px;
|
|
133
|
-
display: flex;
|
|
134
|
-
align-items: center;
|
|
135
|
-
gap: 10px;
|
|
136
|
-
transition: all 0.3s;
|
|
137
|
-
|
|
138
|
-
&:hover {
|
|
139
|
-
background: rgba($primary-color, 0.05);
|
|
140
|
-
border-color: $primary-color;
|
|
141
|
-
transform: translateY(-2px);
|
|
142
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.stat-content {
|
|
146
|
-
flex: 1;
|
|
147
|
-
|
|
148
|
-
.stat-value {
|
|
149
|
-
font-size: 20px;
|
|
150
|
-
font-weight: 700;
|
|
151
|
-
margin-bottom: 2px;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.stat-label {
|
|
155
|
-
font-size: 14px;
|
|
156
|
-
color: $text-secondary;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
&.stat-primary {
|
|
161
|
-
border-color: $primary-color;
|
|
162
|
-
background: linear-gradient(135deg, rgba(0, 82, 217, 0.05), white);
|
|
163
|
-
|
|
164
|
-
.stat-value {
|
|
165
|
-
color: $primary-color;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
&.stat-success {
|
|
170
|
-
border-color: $success-color;
|
|
171
|
-
background: linear-gradient(135deg, rgba(82, 196, 26, 0.05), white);
|
|
172
|
-
|
|
173
|
-
.stat-value {
|
|
174
|
-
color: $success-color;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
&.stat-warning {
|
|
179
|
-
border-color: $warning-color;
|
|
180
|
-
background: linear-gradient(135deg, rgba(250, 173, 20, 0.05), white);
|
|
181
|
-
|
|
182
|
-
.stat-value {
|
|
183
|
-
color: $warning-color;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
</style>
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="section-block">
|
|
3
|
-
<div class="section-header">
|
|
4
|
-
<Icon name="Activity" :size="20" />
|
|
5
|
-
<h2>系统资源</h2>
|
|
6
|
-
</div>
|
|
7
|
-
<div class="section-content">
|
|
8
|
-
<div class="resource-compact-list">
|
|
9
|
-
<div class="resource-compact-item">
|
|
10
|
-
<div class="resource-compact-header">
|
|
11
|
-
<Icon name="Cpu" :size="16" />
|
|
12
|
-
<span class="resource-label">CPU</span>
|
|
13
|
-
<span class="resource-value">{{ systemResources.cpu.usage }}%</span>
|
|
14
|
-
<span class="resource-desc">{{ systemResources.cpu.cores }}核心</span>
|
|
15
|
-
</div>
|
|
16
|
-
<tiny-progress :percentage="systemResources.cpu.usage" :status="getProgressColor(systemResources.cpu.usage)" />
|
|
17
|
-
</div>
|
|
18
|
-
<div class="resource-compact-item">
|
|
19
|
-
<div class="resource-compact-header">
|
|
20
|
-
<Icon name="HardDrive" :size="16" />
|
|
21
|
-
<span class="resource-label">内存</span>
|
|
22
|
-
<span class="resource-value">{{ systemResources.memory.percentage }}%</span>
|
|
23
|
-
<span class="resource-desc">{{ systemResources.memory.used }}GB / {{ systemResources.memory.total }}GB</span>
|
|
24
|
-
</div>
|
|
25
|
-
<tiny-progress :percentage="systemResources.memory.percentage" :status="getProgressColor(systemResources.memory.percentage)" />
|
|
26
|
-
</div>
|
|
27
|
-
<div class="resource-compact-item">
|
|
28
|
-
<div class="resource-compact-header">
|
|
29
|
-
<Icon name="Disc" :size="16" />
|
|
30
|
-
<span class="resource-label">磁盘</span>
|
|
31
|
-
<span class="resource-value">{{ systemResources.disk.percentage }}%</span>
|
|
32
|
-
<span class="resource-desc">{{ systemResources.disk.used }}GB / {{ systemResources.disk.total }}GB</span>
|
|
33
|
-
</div>
|
|
34
|
-
<tiny-progress :percentage="systemResources.disk.percentage" :status="getProgressColor(systemResources.disk.percentage)" />
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</template>
|
|
40
|
-
|
|
41
|
-
<script setup>
|
|
42
|
-
// 组件内部数据
|
|
43
|
-
const systemResources = $ref({
|
|
44
|
-
cpu: { usage: 0, cores: 0 },
|
|
45
|
-
memory: { used: 0, total: 0, percentage: 0 },
|
|
46
|
-
disk: { used: 0, total: 0, percentage: 0 }
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// 获取数据
|
|
50
|
-
const fetchData = async () => {
|
|
51
|
-
try {
|
|
52
|
-
const { data } = await $Http('/addon/admin/dashboard/systemResources');
|
|
53
|
-
Object.assign(systemResources, data);
|
|
54
|
-
} catch (error) {
|
|
55
|
-
console.error('获取系统资源失败:', error);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
fetchData();
|
|
60
|
-
|
|
61
|
-
// 工具函数
|
|
62
|
-
const getProgressColor = (percentage) => {
|
|
63
|
-
if (percentage < 50) return 'success';
|
|
64
|
-
if (percentage < 80) return 'warning';
|
|
65
|
-
return 'danger';
|
|
66
|
-
};
|
|
67
|
-
</script>
|
|
68
|
-
|
|
69
|
-
<style scoped lang="scss">
|
|
70
|
-
.resource-compact-list {
|
|
71
|
-
display: grid;
|
|
72
|
-
grid-template-columns: repeat(3, 1fr);
|
|
73
|
-
gap: $spacing-md;
|
|
74
|
-
|
|
75
|
-
.resource-compact-item {
|
|
76
|
-
.resource-compact-header {
|
|
77
|
-
display: flex;
|
|
78
|
-
align-items: center;
|
|
79
|
-
gap: 10px;
|
|
80
|
-
margin-bottom: 8px;
|
|
81
|
-
|
|
82
|
-
.resource-label {
|
|
83
|
-
font-size: 14px;
|
|
84
|
-
font-weight: 600;
|
|
85
|
-
color: $text-secondary;
|
|
86
|
-
min-width: 50px;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.resource-value {
|
|
90
|
-
font-size: 16px;
|
|
91
|
-
font-weight: 700;
|
|
92
|
-
color: $primary-color;
|
|
93
|
-
min-width: 60px;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.resource-desc {
|
|
97
|
-
font-size: 14px;
|
|
98
|
-
color: $text-placeholder;
|
|
99
|
-
flex: 1;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
</style>
|