Browse Source

dashboard调整

main
piexlmax 3 years ago
parent
commit
0e6a5e6981
  1. 54
      web/src/components/dashbordTable/dashbordTable.vue
  2. 42
      web/src/view/dashboard/dashbordCharts/echartsLine.vue
  3. 112
      web/src/view/dashboard/dashbordTable/dashbordTable.vue
  4. 77
      web/src/view/dashboard/index.vue

54
web/src/components/dashbordTable/dashbordTable.vue

@ -1,54 +0,0 @@
<template>
<div class="commit-table">
<div class="commit-table-title">Gva 仓库commit 记录</div>
<el-table v-loading="loading" :data="dataTimeline" style="width: 100%">
<el-table-column prop="from" show-overflow-tooltip label="日期" width="180" />
<el-table-column prop="title" show-overflow-tooltip label="推送者" width="120" />
<el-table-column prop="message" show-overflow-tooltip label="commit 信息" />
</el-table>
</div>
</template>
<script>
import { Commits } from '@/api/github'
export default {
data() {
return {
loading: true,
dataTimeline: [],
}
},
created() {
this.loadCommits()
},
methods: {
loadCommits() {
Commits(0).then(({ data }) => {
this.loading = false
data.forEach((element, index) => {
if (element.commit.message && index < 6) {
this.dataTimeline.push({
from: new Date(element.commit.author.date),
title: element.commit.author.name,
showDayAndMonth: true,
message: element.commit.message,
})
}
})
})
},
}
}
</script>
<style lang="scss" scoped>
.commit-table{
padding: 20px;
background-color: #fff;
height: 400px;
&-title{
color: rgb(56,137,206);
font-size: 18px;
margin-bottom: 20px;
}
}
</style>

42
web/src/components/dashbordCharts/echartsLine.vue → web/src/view/dashboard/dashbordCharts/echartsLine.vue

@ -1,6 +1,8 @@
<template> <template>
<div class="dashbord-line-box"> <div class="dashbord-line-box">
<div class="dashbord-line-title">Gva 仓库commit 记录</div>
<div class="dashbord-line-title">
访问趋势
</div>
<div <div
ref="echart" ref="echart"
class="dashbord-line" class="dashbord-line"
@ -12,8 +14,8 @@ import echarts from 'echarts'
import 'echarts/theme/macarons' import 'echarts/theme/macarons'
var dataAxis = [] var dataAxis = []
for (var i = 1; i < 21; i++) {
dataAxis.push(`${i}`)
for (var i = 1; i < 13; i++) {
dataAxis.push(`${i}`)
} }
var data = [ var data = [
220, 220,
@ -28,14 +30,6 @@ var data = [
321, 321,
90, 90,
149, 149,
210,
122,
133,
334,
198,
123,
125,
220,
] ]
var yMax = 500 var yMax = 500
var dataShadow = [] var dataShadow = []
@ -71,6 +65,12 @@ export default {
}, },
setOptions() { setOptions() {
this.chart.setOption({ this.chart.setOption({
grid: {
left: '40',
right: '40',
top: '40',
bottom: '20',
},
xAxis: { xAxis: {
data: dataAxis, data: dataAxis,
axisTick: { axisTick: {
@ -102,21 +102,14 @@ export default {
series: [ series: [
{ {
type: 'bar', type: 'bar',
barWidth: 40,
itemStyle: { itemStyle: {
borderRadius: [5, 5, 0, 0], borderRadius: [5, 5, 0, 0],
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#83bff6' },
{ offset: 0.5, color: '#188df0' },
{ offset: 1, color: '#188df0' },
]),
color: '#188df0',
}, },
emphasis: { emphasis: {
itemStyle: { itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#2378f7' },
{ offset: 0.7, color: '#2378f7' },
{ offset: 1, color: '#83bff6' },
]),
color: '#188df0',
}, },
}, },
data: data, data: data,
@ -129,15 +122,14 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.dashbord-line-box { .dashbord-line-box {
padding: 20px;
.dashbord-line { .dashbord-line {
background-color: #fff; background-color: #fff;
height: 360px; height: 360px;
width: calc(100% - 40px);
width: 100%;
} }
.dashbord-line-title { .dashbord-line-title {
color: rgb(56, 137, 206);
font-size: 18px;
font-weight: 600;
margin-bottom: 12px;
} }
} }
</style> </style>

112
web/src/view/dashboard/dashbordTable/dashbordTable.vue

@ -0,0 +1,112 @@
<template>
<div class="commit-table">
<div class="commit-table-title">
更新日志
</div>
<div class="log">
<div v-for="(item,key) in dataTimeline" :key="key" class="log-item">
<div class="flex-1 flex"><span class="key" :class="key<3&&'top'">{{ key+1 }}</span></div>
<div class="flex-5 flex message">{{ item.message }}</div>
<div class="flex-3 flex form">{{ item.from }}</div>
</div>
</div>
<!-- <el-table v-loading="loading" :data="dataTimeline" style="width: 100%">
<el-table-column prop="from" show-overflow-tooltip label="日期" width="180" />
<el-table-column prop="title" show-overflow-tooltip label="推送者" width="120" />
<el-table-column prop="message" show-overflow-tooltip label="commit 信息" />
</el-table> -->
</div>
</template>
<script>
import { Commits } from '@/api/github'
import { formatTimeToStr } from '@/utils/date.js'
export default {
data() {
return {
loading: true,
dataTimeline: [],
}
},
created() {
this.loadCommits()
},
methods: {
loadCommits() {
Commits(0).then(({ data }) => {
this.loading = false
data.forEach((element, index) => {
if (element.commit.message && index < 10) {
this.dataTimeline.push({
from: formatTimeToStr(element.commit.author.date, 'yyyy-MM-dd'),
title: element.commit.author.name,
showDayAndMonth: true,
message: element.commit.message,
})
}
})
})
},
}
}
</script>
<style lang="scss" scoped>
.commit-table{
background-color: #fff;
height: 400px;
&-title{
font-weight: 600;
margin-bottom: 12px;
}
.log{
&-item{
display: flex;
justify-content: space-between;
margin-top: 14px;
.key{
&.top{
background: #314659;
color: #FFFFFF;;
}
display: inline-flex;
justify-content: center;
align-items: center;
width: 20px;
height: 20px;
border-radius: 50%;
background: #F0F2F5;
text-align: center;
color:rgba($color: #000000, $alpha: 0.65)
}
.message{
color: rgba(0, 0, 0, 0.65);
}
.form{
color: rgba(0, 0, 0, 0.65);
margin-left: 12px;
}
.flex{
line-height: 20px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.flex-1{
flex:1;
}
.flex-2{
flex:2;
}
.flex-3{
flex:3;
}
.flex-4{
flex:4;
}
.flex-5{
flex:5;
}
}
}
}
</style>

77
web/src/view/dashboard/index.vue

@ -1,6 +1,7 @@
<template> <template>
<div class="page"> <div class="page">
<div class="mycard dashbord1">
<div class="gva-card-box">
<div class="gva-card dashbord1">
<div class="dashbord1-left"> <div class="dashbord1-left">
<div class="dashbord1-left-title">早安管理员请开始一天的工作吧</div> <div class="dashbord1-left-title">早安管理员请开始一天的工作吧</div>
<div class="dashbord1-left-dot">今日晴0 - 10天气寒冷注意添加衣物</div> <div class="dashbord1-left-dot">今日晴0 - 10天气寒冷注意添加衣物</div>
@ -26,7 +27,9 @@
</div> </div>
<img src="@/assets/dashbord.png" class="dashbord1-right" alt> <img src="@/assets/dashbord.png" class="dashbord1-right" alt>
</div> </div>
<div class="mycard dashbord2">
</div>
<div class="gva-card-box">
<div class="gva-card dashbord2">
<div> <div>
<div class="dashbord2-item"> <div class="dashbord2-item">
使用教学 使用教学
@ -46,8 +49,9 @@
</div> </div>
</div> </div>
</div> </div>
<el-card class="mycard quick-entrance">
</div>
<div class="gva-card-box">
<el-card class="gva-card quick-entrance">
<template #header> <template #header>
<div class="card-header"> <div class="card-header">
<span>快捷入口</span> <span>快捷入口</span>
@ -72,22 +76,29 @@
</el-row> </el-row>
</el-card> </el-card>
<!-- <div class="quick-entrance-title"></div> --> <!-- <div class="quick-entrance-title"></div> -->
<div class="mycard">
<el-row :gutter="0">
<el-col :xs="24" :sm="16">
</div>
<div class="gva-card-box">
<div class="gva-card">
<div class="card-header">
<span>数据统计</span>
</div>
<div class="echart-box">
<el-row :gutter="20">
<el-col :xs="24" :sm="18">
<echarts-line /> <echarts-line />
</el-col> </el-col>
<el-col :xs="24" :sm="8">
<el-col :xs="24" :sm="6">
<dashbord-table /> <dashbord-table />
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
</div> </div>
</div>
</div>
</template> </template>
<script> <script>
import echartsLine from '@/components/dashbordCharts/echartsLine.vue'
import dashbordTable from '@/components/dashbordTable/dashbordTable.vue'
import echartsLine from '@/view/dashboard/dashbordCharts/echartsLine.vue'
import dashbordTable from '@/view/dashboard/dashbordTable/dashbordTable.vue'
export default { export default {
components: { components: {
echartsLine, echartsLine,
@ -157,33 +168,42 @@ export default {
.page { .page {
background: #f0f2f5; background: #f0f2f5;
padding: 0; padding: 0;
.mycard {
.gva-card-box{
padding: 12px;
&+.gva-card-box{
padding-top: 0px;
}
}
.gva-card {
box-sizing: border-box;
background-color: #fff; background-color: #fff;
border-radius: 10px;
border-radius: 2px;
height: auto; height: auto;
padding: 10px 30px;
padding: 26px 30px;
overflow: hidden; overflow: hidden;
margin-bottom: 15px;
box-shadow: 0 0 7px 1px rgba(0, 0, 0, 0.03); box-shadow: 0 0 7px 1px rgba(0, 0, 0, 0.03);
} }
.dashbord1 { .dashbord1 {
height: 120px;
height: 196px;
@include flex-center; @include flex-center;
justify-content: space-between; justify-content: space-between;
color: #777; color: #777;
&-left { &-left {
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
&-title { &-title {
margin-top: 15px;
font-size: 22px; font-size: 22px;
color: #000;
color: #343844;
} }
&-dot { &-dot {
font-size: 14px; font-size: 14px;
margin-top: 10px;
color: #6B7687;
} }
&-rows { &-rows {
// margin-top: 15px; // margin-top: 15px;
color: #6B7687;
width: 600px; width: 600px;
align-items: center; align-items: center;
} }
@ -194,11 +214,21 @@ export default {
margin-top: 28px; margin-top: 28px;
} }
} }
::v-deep(.el-card__header){
padding:0;
border-bottom: none;
}
.card-header{
padding-bottom: 20px;
border-bottom: 1px solid #e8e8e8;
}
.dashbord2 { .dashbord2 {
@include flex-center; @include flex-center;
justify-content: flex-start; justify-content: flex-start;
height: 60px;
&-item { &-item {
&+.dashbord2-item{
margin-top:24px;
}
line-height: 25px; line-height: 25px;
} }
} }
@ -234,6 +264,9 @@ export default {
} }
} }
} }
.echart-box{
padding: 14px;
}
} }
.icon { .icon {
font-size: 20px; font-size: 20px;
@ -249,7 +282,7 @@ export default {
// //
@media (max-width: 750px) { @media (max-width: 750px) {
.mycard {
.gva-card {
padding: 20px 10px !important; padding: 20px 10px !important;
.dashbord1 { .dashbord1 {
height: auto; height: auto;

Loading…
Cancel
Save