Skip to content

Commit a758221

Browse files
authored
Merge pull request #2152 from Azir-11/dev2.8.8
优化仪表盘组件样式,调整各个子组件的布局和样式,提升视觉效果
2 parents 803c957 + 8cedb98 commit a758221

File tree

9 files changed

+124
-85
lines changed

9 files changed

+124
-85
lines changed

web/src/view/dashboard/components/card.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@
55

66
<template>
77
<div
8-
class="bg-white dark:bg-slate-900 text-gray-800 dark:text-gray-400 rounded shadow"
8+
class="rounded-xl border border-black/10 bg-white text-black/80 dark:border-white/10 dark:bg-black dark:text-white/80"
99
:class="[customClass || '', withoutPadding ? 'p-0' : 'p-4']"
1010
>
1111
<div v-if="title" class="flex justify-between items-center">
12-
<div class="text-base font-bold">
12+
<div class="text-sm font-semibold tracking-tight text-black dark:text-white">
1313
{{ title }}
1414
</div>
15-
<div v-if="showAction" class="text-sm text-active cursor-pointer">
15+
<div
16+
v-if="showAction"
17+
class="text-xs text-black/60 dark:text-white/60 hover:text-active cursor-pointer"
18+
>
1619
查看更多
1720
</div>
1821
</div>
19-
<div class="mt-2">
22+
<div :class="title ? 'mt-3' : ''">
2023
<slot />
2124
</div>
2225
</div>

web/src/view/dashboard/components/charts-content-numbers.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424
default: '128px'
2525
}
2626
})
27+
const axisTextColor = computed(() => {
28+
return appStore.isDark ? 'rgba(255,255,255,0.70)' : 'rgba(0,0,0,0.70)'
29+
})
2730
const dotColor = computed(() => {
28-
return appStore.isDark ? '#333' : '#E5E8EF'
31+
return appStore.isDark ? 'rgba(255,255,255,0.12)' : 'rgba(0,0,0,0.08)'
2932
})
3033
const graphicFactory = (side) => {
3134
return {
@@ -35,7 +38,7 @@
3538
style: {
3639
text: '',
3740
textAlign: 'center',
38-
fill: '#4E5969',
41+
fill: axisTextColor.value,
3942
fontSize: 12
4043
}
4144
}
@@ -69,7 +72,7 @@
6972
data: xAxis.value,
7073
boundaryGap: false,
7174
axisLabel: {
72-
color: '#4E5969',
75+
color: axisTextColor.value,
7376
formatter(value, idx) {
7477
if (idx === 0) return ''
7578
if (idx === xAxis.value.length - 1) return ''

web/src/view/dashboard/components/charts-people-numbers.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
style: {
3939
text: '',
4040
textAlign: 'center',
41-
fill: '#4E5969',
41+
fill: appStore.isDark ? '#FFFFFF' : '#000000',
4242
fontSize: 12
4343
}
4444
}

web/src/view/dashboard/components/charts.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
<template>
77
<div class="">
88
<div class="flex items-center justify-between mb-2">
9-
<div v-if="title" class="font-bold">
9+
<div v-if="title" class="text-sm font-semibold tracking-tight text-black dark:text-white">
1010
{{ title }}
1111
</div>
1212
<slot v-else name="title" />
1313
</div>
1414
<div class="w-full relative">
1515
<div v-if="type !== 4">
16-
<div class="mt-4 text-gray-600 text-3xl font-mono">
16+
<div class="mt-4 text-3xl font-mono text-black dark:text-white">
1717
<el-statistic :value="268500" />
1818
</div>
19-
<div class="mt-2 text-green-600 text-sm font-bold font-mono">
20-
+80% <el-icon><TopRight /></el-icon>
19+
<div class="mt-2 text-xs font-mono text-black/60 dark:text-white/60">
20+
+80% <el-icon class="align-middle"><TopRight /></el-icon>
2121
</div>
2222
</div>
2323
<div class="absolute top-0 right-2 w-[50%] h-20">

web/src/view/dashboard/components/notice.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
<div
99
v-for="(item, index) in notices"
1010
:key="index"
11-
class="flex items-center mb-1.5 gap-3"
11+
class="flex items-center gap-3 py-1"
1212
>
13-
<el-tag :type="item.type" size="small">
13+
<div
14+
class="shrink-0 rounded-full border border-black/10 px-2 py-0.5 text-[11px] leading-4 text-black/70 dark:border-white/10 dark:text-white/70"
15+
>
1416
{{ item.typeTitle }}
15-
</el-tag>
17+
</div>
1618
<el-tooltip effect="light" :content="item.title" placement="top">
17-
<div class="text-xs text-gray-700 dark:text-gray-300 line-clamp-1">
19+
<div class="min-w-0 text-xs text-black/70 dark:text-white/70 line-clamp-1">
1820
{{ item.title }}
1921
</div>
2022
</el-tooltip>

web/src/view/dashboard/components/pluginTable.vue

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
<el-table-column prop="ranking" label="排名" width="80" align="center" />
1010
<el-table-column prop="title" label="插件标题" show-overflow-tooltip>
1111
<template #default="{ row }">
12-
<a class="text-active" :href="row.link" target="_blank">{{
13-
row.title
14-
}}</a>
12+
<a
13+
class="text-black dark:text-white underline underline-offset-4 decoration-black/20 dark:decoration-white/20 hover:text-active"
14+
:href="row.link"
15+
target="_blank"
16+
>{{ row.title }}</a>
1517
</template>
1618
</el-table-column>
1719
<el-table-column prop="click_num" label="关注度" width="100" />
@@ -27,38 +29,45 @@
2729
title: '组织管理插件:更方便管理组织,分配资源权限。',
2830
click_num: 523,
2931
hot: 263,
30-
link: 'https://plugin.gin-vue-admin.com/#/layout/newPluginInfo?id=36'
32+
link: 'https://plugin.gin-vue-admin.com/details/36'
3133
},
3234
{
3335
ranking: 2,
3436
title:
3537
'Kubernetes容器管理:,Kubernetes 原生资源管理,提供炫酷的YAML 编辑,Pod 终端,方便运维兄弟管理k8s资源',
3638
click_num: 416,
3739
hot: 223,
38-
link: 'https://plugin.gin-vue-admin.com/#/layout/newPluginInfo?id=42'
40+
link: 'https://plugin.gin-vue-admin.com/details/42'
3941
},
4042
{
4143
ranking: 3,
4244
title:
4345
'定时任务配置化管理:本插件用于对系统内部的定时任务进行配置化管理,可以配置自定义的函数和HTTP,可以配置cron和remark等等',
4446
click_num: 337,
4547
hot: 176,
46-
link: 'https://plugin.gin-vue-admin.com/#/layout/newPluginInfo?id=67'
48+
link: 'https://plugin.gin-vue-admin.com/details/67'
4749
},
4850
{
4951
ranking: 4,
5052
title:
5153
'官网CMS系统:基于Gin-Vue-Admin 和 插件市场客户端开发基座开发的企业官网类(cms)系统',
5254
click_num: 292,
5355
hot: 145,
54-
link: 'https://plugin.gin-vue-admin.com/#/layout/newPluginInfo?id=69'
56+
link: 'https://plugin.gin-vue-admin.com/details/69'
5557
},
5658
{
5759
ranking: 5,
5860
title: '微信支付插件:提供扫码支付功能(需自行对接业务)',
5961
click_num: 173,
6062
hot: 110,
61-
link: 'https://plugin.gin-vue-admin.com/#/layout/newPluginInfo?id=28'
63+
link: 'https://plugin.gin-vue-admin.com/details/28'
64+
},
65+
{
66+
ranking: 6,
67+
title: '线上版本更新智能检测【自动版】',
68+
click_num: 236,
69+
hot: 132,
70+
link: 'https://plugin.gin-vue-admin.com/details/112'
6271
}
6372
]
6473
</script>

web/src/view/dashboard/components/quickLinks.vue

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,40 @@
33
@date: 2024/5/8
44
!-->
55
<template>
6-
<div class="mt-8 w-full">
7-
<div class="grid grid-cols-2 md:grid-cols-3 3xl:grid-cols-4">
6+
<div class="mt-4 w-full">
7+
<div class="text-xs tracking-wide text-black/60 dark:text-white/60">快捷入口</div>
8+
<div class="mt-3 grid grid-cols-3 gap-3 sm:grid-cols-4">
89
<div
910
v-for="(item, index) in shortcuts"
1011
:key="index"
11-
class="flex flex-col items-center mb-3 group cursor-pointer"
12+
class="flex flex-col items-center group cursor-pointer"
1213
@click="toPath(item)"
1314
>
1415
<div
15-
class="w-8 h-8 rounded bg-gray-200 dark:bg-slate-500 flex items-center justify-center group-hover:bg-blue-400 group-hover:text-white"
16+
class="w-10 h-10 rounded-lg border border-black/10 dark:border-white/10 flex items-center justify-center text-black/70 dark:text-white/70 group-hover:bg-black group-hover:text-white dark:group-hover:bg-white dark:group-hover:text-black transition-colors"
1617
>
1718
<el-icon><component :is="item.icon" /></el-icon>
1819
</div>
19-
<div class="text-xs mt-2 text-gray-700 dark:text-gray-300">
20+
<div class="mt-2 text-[11px] text-black/70 dark:text-white/70">
2021
{{ item.title }}
2122
</div>
2223
</div>
2324
</div>
24-
<div class="grid grid-cols-2 md:grid-cols-3 3xl:grid-cols-4 mt-8">
25+
26+
<div class="mt-6 text-xs tracking-wide text-black/60 dark:text-white/60">最近访问</div>
27+
<div class="mt-3 grid grid-cols-3 gap-3 sm:grid-cols-4">
2528
<div
2629
v-for="(item, index) in recentVisits"
2730
:key="index"
28-
class="flex flex-col items-center mb-3 group cursor-pointer"
31+
class="flex flex-col items-center group cursor-pointer"
2932
@click="openLink(item)"
3033
>
3134
<div
32-
class="w-8 h-8 rounded bg-gray-200 dark:bg-slate-500 flex items-center justify-center group-hover:bg-blue-400 group-hover:text-white"
35+
class="w-10 h-10 rounded-lg border border-black/10 dark:border-white/10 flex items-center justify-center text-black/70 dark:text-white/70 group-hover:bg-black group-hover:text-white dark:group-hover:bg-white dark:group-hover:text-black transition-colors"
3336
>
3437
<el-icon><component :is="item.icon" /></el-icon>
3538
</div>
36-
<div class="text-xs mt-2 text-gray-700 dark:text-gray-300">
39+
<div class="mt-2 text-[11px] text-black/70 dark:text-white/70">
3740
{{ item.title }}
3841
</div>
3942
</div>

web/src/view/dashboard/components/wiki.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
v-for="item in wikis"
1010
:key="item.url"
1111
:href="item.url"
12-
class="text-sm text-gray-700 dark:text-gray-300 no-underline hover:text-active"
12+
class="text-sm text-black/70 dark:text-white/70 no-underline hover:text-black dark:hover:text-white"
1313
target="_blank"
1414
>
1515
{{ item.title }}

web/src/view/dashboard/index.vue

Lines changed: 70 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,70 @@
11
<template>
22
<div
3-
class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-7 py-2 gap-4 md:gap-2 gva-container2"
3+
class="h-full gva-container2 overflow-auto bg-white text-black dark:bg-black dark:text-white"
44
>
5-
<gva-card custom-class="col-span-1 lg:col-span-2 ">
6-
<gva-chart :type="1" title="访问人数" />
7-
</gva-card>
8-
<gva-card custom-class="col-span-1 lg:col-span-2 ">
9-
<gva-chart :type="2" title="新增客户" />
10-
</gva-card>
11-
<gva-card custom-class="col-span-1 lg:col-span-2 ">
12-
<gva-chart :type="3" title="解决数量" />
13-
</gva-card>
14-
<gva-card
15-
title="快捷功能"
16-
show-action
17-
custom-class="col-start-1 md:col-start-3 lg:col-start-7 row-span-2 "
18-
>
19-
<gva-quick-link />
20-
</gva-card>
21-
<gva-card
22-
title="内容数据"
23-
custom-class="col-span-1 md:col-span-2 md:row-start-2 lg:col-span-6 col-start-1 row-span-2"
24-
>
25-
<gva-chart :type="4" />
26-
</gva-card>
27-
<gva-card
28-
title="文档"
29-
show-action
30-
custom-class="md:row-start-8 md:col-start-3 lg:row-start-3 lg:col-start-7"
31-
>
32-
<gva-wiki />
33-
</gva-card>
5+
<div class="p-4 lg:p-6">
6+
<div class="mb-5 flex flex-col gap-1 sm:flex-row sm:items-end sm:justify-between">
7+
<div>
8+
<div class="text-lg font-semibold tracking-tight">仪表盘</div>
9+
<div class="text-xs text-black/60 dark:text-white/60">概览 · {{ today }}</div>
10+
</div>
11+
</div>
3412

35-
<gva-card
36-
title="最新更新"
37-
custom-class="col-span-1 md:col-span-3 row-span-2"
38-
>
39-
<gva-table />
40-
</gva-card>
41-
<gva-card
42-
title="最新插件"
43-
custom-class="col-span-1 md:col-span-3 row-span-2"
44-
>
45-
<gva-plugin-table />
46-
</gva-card>
13+
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3">
14+
<gva-card>
15+
<gva-chart :type="1" title="访问人数" />
16+
</gva-card>
17+
<gva-card>
18+
<gva-chart :type="2" title="新增客户" />
19+
</gva-card>
20+
<gva-card>
21+
<gva-chart :type="3" title="解决数量" />
22+
</gva-card>
23+
</div>
4724

48-
<gva-card title="公告" show-action custom-class="col-span-1 lg:col-start-7">
49-
<gva-notice />
50-
</gva-card>
25+
<div class="mt-4 grid grid-cols-1 gap-4 xl:grid-cols-12 items-start">
26+
<div class="grid grid-cols-1 gap-4 xl:col-span-8 self-start content-start">
27+
<gva-card title="内容数据">
28+
<gva-chart :type="4" />
29+
</gva-card>
5130

52-
<gva-card
53-
without-padding
54-
custom-class="overflow-hidden lg:h-40 col-span-1 md:col-start-2 md:col-span-1 lg:col-start-7"
55-
>
56-
<gva-banner />
57-
</gva-card>
31+
<div class="grid grid-cols-1 gap-4">
32+
<gva-card title="最新插件">
33+
<gva-plugin-table />
34+
</gva-card>
35+
</div>
36+
37+
<div class="grid grid-cols-1 gap-4">
38+
<gva-card title="最新更新">
39+
<gva-table />
40+
</gva-card>
41+
</div>
42+
</div>
43+
44+
<div class="grid grid-cols-1 gap-4 xl:col-span-4 self-start content-start">
45+
<gva-card title="快捷功能" show-action>
46+
<gva-quick-link />
47+
</gva-card>
48+
<gva-card title="公告" show-action>
49+
<gva-notice />
50+
</gva-card>
51+
<gva-card title="文档" show-action>
52+
<gva-wiki />
53+
</gva-card>
54+
<gva-card
55+
without-padding
56+
custom-class="overflow-hidden h-44 sm:h-52 xl:h-56"
57+
>
58+
<gva-banner />
59+
</gva-card>
60+
</div>
61+
</div>
62+
</div>
5863
</div>
5964
</template>
6065

6166
<script setup>
67+
import { computed } from 'vue'
6268
import {
6369
GvaPluginTable,
6470
GvaTable,
@@ -69,6 +75,19 @@
6975
GvaCard,
7076
GvaBanner
7177
} from './components'
78+
79+
const today = computed(() => {
80+
try {
81+
const d = new Date()
82+
return d.toLocaleDateString('zh-CN', {
83+
year: 'numeric',
84+
month: '2-digit',
85+
day: '2-digit'
86+
})
87+
} catch (e) {
88+
return new Date().toISOString().slice(0, 10)
89+
}
90+
})
7291
defineOptions({
7392
name: 'Dashboard'
7493
})

0 commit comments

Comments
 (0)