|
@@ -1,7 +1,19 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<main-top>
|
|
|
- <div slot="con"></div>
|
|
|
+ <div slot="con">
|
|
|
+ <!-- 导出 -->
|
|
|
+ <download-excel
|
|
|
+ :before-generate="derive"
|
|
|
+ class="export-excel-wrapper"
|
|
|
+ :data="json_data"
|
|
|
+ :fields="json_fields"
|
|
|
+ name="数据统计.xls"
|
|
|
+ >
|
|
|
+ <!-- 上面可以自定义自己的样式,还可以引用其他组件button -->
|
|
|
+ <el-button type="primary">导出</el-button>
|
|
|
+ </download-excel>
|
|
|
+ </div>
|
|
|
</main-top>
|
|
|
<div class="tablecon">
|
|
|
<div class="tablebody">
|
|
@@ -10,7 +22,7 @@
|
|
|
<div>
|
|
|
<div>
|
|
|
<span>累计访问量</span>
|
|
|
- <p>{{totalVisit}}</p>
|
|
|
+ <p>{{ totalVisit }}</p>
|
|
|
</div>
|
|
|
<i class="el-icon-s-data"></i>
|
|
|
</div>
|
|
@@ -18,18 +30,17 @@
|
|
|
<div>
|
|
|
<div>
|
|
|
<span>今日访问量</span>
|
|
|
- <p>{{todayVisit}}</p>
|
|
|
+ <p>{{ todayVisit }}</p>
|
|
|
</div>
|
|
|
<i class="el-icon-view"></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="ttr">
|
|
|
- <PowerBar class="n-i" :data='visitData' />
|
|
|
+ <PowerBar class="n-i" :data="visitData" />
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="tbottom">
|
|
|
- <FocusBang v-if="focus.length>0" :data="focus" />
|
|
|
-
|
|
|
+ <FocusBang v-if="focus.length > 0" :data="focus" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -40,53 +51,77 @@
|
|
|
import MainTop from "@/components/main-top";
|
|
|
import { mapGetters } from "vuex";
|
|
|
import { getReportDetail } from "@/configue/api";
|
|
|
-import PowerBar from '@/components/power-bar'
|
|
|
-
|
|
|
-import FocusBang from '@/components/focus-bang'
|
|
|
+import PowerBar from "@/components/power-bar";
|
|
|
|
|
|
+import FocusBang from "@/components/focus-bang";
|
|
|
|
|
|
export default {
|
|
|
+ name: "Derive",
|
|
|
data() {
|
|
|
return {
|
|
|
focus: [],
|
|
|
todayVisit: 0,
|
|
|
totalVisit: 0,
|
|
|
- visitData: { list: [], all: 0 }
|
|
|
-
|
|
|
+ visitData: { list: [], all: 0 },
|
|
|
+ // 关于导出的数据
|
|
|
+ json_fields: {
|
|
|
+ 排行名次: "index",
|
|
|
+ 展馆名称: "name",
|
|
|
+ 访问量: "visit",
|
|
|
+ },
|
|
|
+ json_data: [],
|
|
|
+ json_meta: [
|
|
|
+ [
|
|
|
+ {
|
|
|
+ " key ": " charset ",
|
|
|
+ " value ": " utf- 8 ",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ ],
|
|
|
};
|
|
|
},
|
|
|
components: {
|
|
|
MainTop,
|
|
|
FocusBang,
|
|
|
- PowerBar
|
|
|
+ PowerBar,
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 点击导出
|
|
|
+ async derive() {
|
|
|
+ this.visitData.list.forEach((v, i) => {
|
|
|
+ this.json_data.push({
|
|
|
+ index: i + 1,
|
|
|
+ name: v.name,
|
|
|
+ visit: v.visit,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
getReport() {
|
|
|
- getReportDetail(data => {
|
|
|
+ getReportDetail((data) => {
|
|
|
this.focus = data.data.ranking.map((item, i) => {
|
|
|
return {
|
|
|
num: i + 1,
|
|
|
zan: item.visit,
|
|
|
name: item.exhibitionName,
|
|
|
- img: item.thumb
|
|
|
- }
|
|
|
- })
|
|
|
+ img: item.thumb,
|
|
|
+ };
|
|
|
+ });
|
|
|
|
|
|
- let all = 0
|
|
|
+ let all = 0;
|
|
|
|
|
|
this.visitData.list = data.data.exhibitionVisit.map((item) => {
|
|
|
- all += item.visit
|
|
|
+ all += item.visit;
|
|
|
return {
|
|
|
visit: item.visit,
|
|
|
name: item.exhibitionName,
|
|
|
- img: item.thumb
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- this.visitData.all = all
|
|
|
- this.todayVisit = data.data.todayVisit
|
|
|
- this.totalVisit = data.data.totalVisit
|
|
|
- })
|
|
|
+ img: item.thumb,
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+ this.visitData.all = all;
|
|
|
+ this.todayVisit = data.data.todayVisit;
|
|
|
+ this.totalVisit = data.data.totalVisit;
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
computed: {
|
|
@@ -111,7 +146,7 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.getReport()
|
|
|
+ this.getReport();
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -138,7 +173,7 @@ export default {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
|
|
|
- >div {
|
|
|
+ > div {
|
|
|
height: 100%;
|
|
|
width: 49%;
|
|
|
border-radius: 8px;
|
|
@@ -147,28 +182,27 @@ export default {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
|
|
|
- >div {
|
|
|
+ > div {
|
|
|
margin-left: 10%;
|
|
|
text-align: center;
|
|
|
|
|
|
- >span {
|
|
|
+ > span {
|
|
|
color: #999;
|
|
|
font-size: 32px;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- >p {
|
|
|
+ > p {
|
|
|
font-size: 40px;
|
|
|
margin-top: 20px;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- >i {
|
|
|
+ > i {
|
|
|
position: absolute;
|
|
|
top: 50%;
|
|
|
right: 10%;
|
|
|
font-size: 60px;
|
|
|
- color: #B63C25;
|
|
|
+ color: #b63c25;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -179,7 +213,6 @@ export default {
|
|
|
box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
|
|
|
border-radius: 8px;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
.tbottom {
|