Commit bfbc4d19 by 胡悦

修复bug

1 parent b9dd55ed
......@@ -3,19 +3,19 @@ import Vue from 'vue'
export default new Vue({
methods: {
warningTips(message) {
this.$notify({
this.$message({
type: 'warning',
title: message
})
},
okTips(message) {
this.$notify({
this.$message({
type: 'success',
title: message || '操作成功'
})
},
errorTips(message) {
this.$notify({
this.$message({
type: 'error',
title: message || '操作失败'
})
......
......@@ -18,6 +18,7 @@
<div class="echarts">
<el-row>
<el-col :span="24">
<div class="nodata" v-if="noDevice">暂无数据</div>
<div
id="deviceTrends"
style="width: 100%; height: 400px;"
......@@ -26,6 +27,7 @@
</el-row>
<el-row>
<el-col :span="24">
<div class="nodata" v-if="noUser">暂无数据</div>
<div
id="userTrends"
style="width: 100%; height: 400px;"
......@@ -34,6 +36,7 @@
</el-row>
<el-row>
<el-col :span="24">
<div class="nodata" v-if="noApp">暂无数据</div>
<div
id="appTrends"
style="width: 100%; height: 400px;"
......@@ -64,7 +67,10 @@ export default {
userECharts: '',
userOptions: {},
appECharts: '',
appOptions: {}
appOptions: {},
noDevice: false,
noUser: false,
noApp: false
}
},
......@@ -74,9 +80,9 @@ export default {
this.userECharts = this.$echarts.init(document.getElementById('userTrends'), 'walden')
this.appECharts = this.$echarts.init(document.getElementById('appTrends'), 'walden')
this.getTotal()
this.drawLine(getDeviceStatistic, this.deviceOptions, this.deviceECharts, '设备激活趋势')
this.drawLine(getUserStatistic, this.userOptions, this.userECharts, '用户活跃趋势')
this.drawLine(getAppStatistic, this.appOptions, this.appECharts, 'APP下载趋势')
this.drawLine(getDeviceStatistic, this.deviceOptions, this.deviceECharts, '设备激活趋势', 'noDevice')
this.drawLine(getUserStatistic, this.userOptions, this.userECharts, '用户活跃趋势' , 'noUser')
this.drawLine(getAppStatistic, this.appOptions, this.appECharts, 'APP下载趋势', 'noApp')
},
methods: {
......@@ -85,11 +91,12 @@ export default {
this.totalNum = res
})
},
drawLine(api, options, charts, title) {
drawLine(api, options, charts, title, nodata) {
api(this.params).then(res => {
if (res) {
let x = []
let y = []
this[nodata] = !res.length
console.log(this[nodata])
let x
let y
res.map(item => {
x.push(item.time)
y.push(item.count)
......@@ -100,11 +107,6 @@ export default {
yAxisData: y
})
charts.setOption(options)
} else {
var html = '<div style="color:#868686; font-size: 16px;text-align:center;line-height:380px;">暂无数据</div>'
charts.innerHTML = html
charts.removeAttribute('_echarts_instance_')
}
})
}
}
......@@ -134,4 +136,14 @@ li {
font-size: 24px;
margin-bottom: 10px;
}
.nodata {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
/* width: 100%; */
/* height: 400px; */
/* margin: 0 auto;
text-align: center; */
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!