仪表盘-访客数信息展示

This commit is contained in:
ronger 2022-03-14 13:49:36 +08:00
parent 81e304b122
commit c7c227af81
2 changed files with 87 additions and 5 deletions

View File

@ -204,9 +204,15 @@
<el-col class="mt-2rem"> <el-col class="mt-2rem">
<div id="lastThirtyDays" style="width: 100%;height: 500px;"></div> <div id="lastThirtyDays" style="width: 100%;height: 500px;"></div>
</el-col> </el-col>
<el-col class="mt-2rem">
<div id="lastThirtyDays2" style="width: 100%;height: 500px;"></div>
</el-col>
<el-col class="mt-2rem"> <el-col class="mt-2rem">
<div id="history" style="width: 100%;height: 500px;"></div> <div id="history" style="width: 100%;height: 500px;"></div>
</el-col> </el-col>
<el-col class="mt-2rem">
<div id="history2" style="width: 100%;height: 500px;"></div>
</el-col>
<el-col> <el-col>
<el-dialog :visible.sync="dialogVisible" title="发放新手奖励"> <el-dialog :visible.sync="dialogVisible" title="发放新手奖励">
<el-form label-width="180px"> <el-form label-width="180px">
@ -295,7 +301,7 @@ export default {
} }
}, },
legend: { legend: {
data: ["文章", "用户", "浏览量"] data: ["文章", "用户"]
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
@ -317,6 +323,44 @@ export default {
type: 'line', type: 'line',
smooth: true, smooth: true,
areaStyle: {} areaStyle: {}
}]
};
// 使
myChart.setOption(option);
let myChart2 = this.$echarts.init(document.getElementById('lastThirtyDays2'));
//
let option2 = {
title: {
text: '最近 30 天'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data: ["访客数", "浏览量"]
},
xAxis: {
type: 'category',
data: data.dates
},
yAxis: {
type: 'value'
},
series: [
{
name: '访客数',
data: data.visitIps,
type: 'line',
smooth: true,
areaStyle: {}
}, },
{ {
name: '浏览量', name: '浏览量',
@ -328,7 +372,7 @@ export default {
}; };
// 使 // 使
myChart.setOption(option); myChart2.setOption(option2);
}, },
initHistoryCharts(data) { initHistoryCharts(data) {
let myChart = this.$echarts.init(document.getElementById('history')); let myChart = this.$echarts.init(document.getElementById('history'));
@ -347,7 +391,7 @@ export default {
} }
}, },
legend: { legend: {
data: ["文章", "用户", "浏览量"] data: ["文章", "用户"]
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
@ -369,6 +413,43 @@ export default {
type: 'line', type: 'line',
smooth: true, smooth: true,
areaStyle: {} areaStyle: {}
}]
};
// 使
myChart.setOption(option);
let myChart2 = this.$echarts.init(document.getElementById('history2'));
//
let option2 = {
title: {
text: '历史'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data: ["访客数", "浏览量"]
},
xAxis: {
type: 'category',
data: data.dates
},
yAxis: {
type: 'value'
},
series: [{
name: '访客数',
data: data.visitIps,
type: 'line',
smooth: true,
areaStyle: {}
}, },
{ {
name: '浏览量', name: '浏览量',
@ -380,7 +461,7 @@ export default {
}; };
// 使 // 使
myChart.setOption(option); myChart2.setOption(option2);
}, },
getUserPath(nickname) { getUserPath(nickname) {
return `/user/${nickname}` return `/user/${nickname}`

View File

@ -11,7 +11,8 @@ const getDefaultLastThirtyDaysData = () => {
dates: [], dates: [],
articles: [], articles: [],
users: [], users: [],
visits: [] visits: [],
visitIps: []
} }
} }