|
|
@@ -4,79 +4,110 @@
|
|
|
<div slot="con"></div>
|
|
|
</main-top>
|
|
|
<div class="table-interface">
|
|
|
- <!-- <div class="top-body">
|
|
|
+ <div class="top-body">
|
|
|
<div class="info-top">
|
|
|
<div class="info-left">
|
|
|
- <span style="font-size:18px">统计分析</span>
|
|
|
+ <span style="font-size: 18px">统计分析</span>
|
|
|
</div>
|
|
|
<div class="info-right"></div>
|
|
|
</div>
|
|
|
<div class="analysis">
|
|
|
- <ul>
|
|
|
- <li class="analysis-con left">
|
|
|
- <div class="title">
|
|
|
- 流量统计
|
|
|
- </div>
|
|
|
- <ul class="content">
|
|
|
- <li>合计</li>
|
|
|
- <li>今日</li>
|
|
|
- <li>昨日</li>
|
|
|
- </ul>
|
|
|
- </li>
|
|
|
- <li class="analysis-con left" v-for="(item,i) in trafficStatistics" :key='i'>
|
|
|
- <div class="title">
|
|
|
- {{item.type === "web"?"官网访问量":item.type === "scene"?"线上史馆访问人数":item.type === "comment"? "留言人数":""}}
|
|
|
- </div>
|
|
|
- <ul class="content">
|
|
|
- <li>{{item.total}}</li>
|
|
|
- <li>{{item.today}}</li>
|
|
|
- <li>{{item.yesterday}}</li>
|
|
|
- </ul>
|
|
|
- </li>
|
|
|
-
|
|
|
- </ul>
|
|
|
+ <ul>
|
|
|
+ <li class="analysis-con left">
|
|
|
+ <div class="title">流量统计</div>
|
|
|
+ <ul class="content">
|
|
|
+ <li>合计</li>
|
|
|
+ <li>今日</li>
|
|
|
+ <li>昨日</li>
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
+ <li
|
|
|
+ class="analysis-con left"
|
|
|
+ v-for="(item, i) in trafficStatistics"
|
|
|
+ :key="i"
|
|
|
+ >
|
|
|
+ <div class="title">
|
|
|
+ {{
|
|
|
+ item.type === "web"
|
|
|
+ ? "官网访问量"
|
|
|
+ : item.type === "scene"
|
|
|
+ ? "线上史馆访问人数"
|
|
|
+ : item.type === "comment"
|
|
|
+ ? "留言人数"
|
|
|
+ : ""
|
|
|
+ }}
|
|
|
+ </div>
|
|
|
+ <ul class="content">
|
|
|
+ <li>{{ item.total }}</li>
|
|
|
+ <li>{{ item.today }}</li>
|
|
|
+ <li>{{ item.yesterday }}</li>
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
</div>
|
|
|
- </div> -->
|
|
|
+ </div>
|
|
|
|
|
|
<div class="bottom">
|
|
|
- <div class="bottom-left">
|
|
|
- <div class="head">
|
|
|
- <div class="head-txt">访问时间趋势</div>
|
|
|
- <div class="head-btn">
|
|
|
- <el-button type="success" size="mini">官网</el-button>
|
|
|
- <el-button type="default" size="mini">线上史馆</el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div class="bottom-left">
|
|
|
+ <div class="head">
|
|
|
+ <div class="head-txt">访问时间趋势</div>
|
|
|
+ <div class="head-btn">
|
|
|
+ <el-button type="success" size="mini">官网</el-button>
|
|
|
+ <el-button type="default" size="mini">线上史馆</el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div class="bottom-right" >
|
|
|
- <div class="head">
|
|
|
- <div class="head-txt">阅读量排行</div>
|
|
|
- <div class="head-btn">
|
|
|
- <el-button :type="readingVolumeType === 'news'?'success':'default'" size="mini" @click="readingVolumeTypeSwitch('news')">新闻</el-button>
|
|
|
- <el-button :type="readingVolumeType === 'activity'?'success':'default'" size="mini" @click="readingVolumeTypeSwitch('activity')">活动</el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="foot">
|
|
|
- <div class="foot-txt">标题</div>
|
|
|
- <div class="foot-btn">总阅读量</div>
|
|
|
+ <div class="mymain">66666666</div>
|
|
|
+ </div>
|
|
|
+ <div class="bottom-right">
|
|
|
+ <div class="head">
|
|
|
+ <div class="head-txt">阅读量排行</div>
|
|
|
+ <div class="head-btn">
|
|
|
+ <el-button
|
|
|
+ :type="readingVolumeType === 'news' ? 'success' : 'default'"
|
|
|
+ size="mini"
|
|
|
+ @click="readingVolumeTypeSwitch('news')"
|
|
|
+ >新闻</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ :type="readingVolumeType === 'activity' ? 'success' : 'default'"
|
|
|
+ size="mini"
|
|
|
+ @click="readingVolumeTypeSwitch('activity')"
|
|
|
+ >活动</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
- <ul class="list">
|
|
|
- <li class="list-con" v-for="(item,index) in readingVolumeRanking" :key="index">
|
|
|
- <div class="list-con-title">{{item.name}}</div>
|
|
|
- <div class="list-con-amount">{{item.visit}}</div>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
</div>
|
|
|
+ <div class="foot">
|
|
|
+ <div class="foot-txt">标题</div>
|
|
|
+ <div class="foot-btn">总阅读量</div>
|
|
|
+ </div>
|
|
|
+ <ul class="list" v-if="readingVolumeRanking.length">
|
|
|
+ <li
|
|
|
+ class="list-con"
|
|
|
+ v-for="(item, index) in readingVolumeRanking"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <div class="list-con-title">{{ item.name }}</div>
|
|
|
+ <div class="list-con-amount">{{ item.visit }}</div>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ <div class="empty" v-else>暂无数据</div>
|
|
|
+
|
|
|
+ </div>
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import MainTop from "@/components/main-top";
|
|
|
-import activityEdit from "@/pages/activity/activityEdit";
|
|
|
-import * as common from "@/util/commonfn.js";
|
|
|
+// import activityEdit from "@/pages/activity/activityEdit";
|
|
|
+// import * as common from "@/util/commonfn.js";
|
|
|
+import * as echarts from "echarts/core";
|
|
|
+import { GridComponent } from "echarts/components";
|
|
|
+import { LineChart } from "echarts/charts";
|
|
|
+import { UniversalTransition } from "echarts/features";
|
|
|
+import { CanvasRenderer } from "echarts/renderers";
|
|
|
+echarts.use([GridComponent, LineChart, CanvasRenderer, UniversalTransition]);
|
|
|
|
|
|
const crumbData = [
|
|
|
{
|
|
|
@@ -91,6 +122,8 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ // echarts图表发请求变量
|
|
|
+ val:'web',
|
|
|
crumbData,
|
|
|
tableData: [],
|
|
|
params: {
|
|
|
@@ -100,18 +133,52 @@ export default {
|
|
|
type: "",
|
|
|
},
|
|
|
total: 0,
|
|
|
- trafficStatistics:[],
|
|
|
- readingVolumeRanking:[],
|
|
|
- readingVolumeType:"news"
|
|
|
+ trafficStatistics: [],
|
|
|
+ readingVolumeRanking: [],
|
|
|
+ readingVolumeType: "news",
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
|
watch: {},
|
|
|
created() {
|
|
|
this.getTrafficStatistics();
|
|
|
- this.getReadingVolumeRanking('news')
|
|
|
+ this.getReadingVolumeRanking("news");
|
|
|
+ },
|
|
|
+ async mounted() {
|
|
|
+ // 时间趋势接口获取数据
|
|
|
+
|
|
|
+ let result = await this.$http({
|
|
|
+ method: "get",
|
|
|
+ url: `/manage/stats/trend/${this.val}`,
|
|
|
+ });
|
|
|
+ //-------------------echarts图表------------------------
|
|
|
+ var chartDom = document.querySelector(".mymain");
|
|
|
+ var myChart = echarts.init(chartDom);
|
|
|
+ var option;
|
|
|
+ option = {
|
|
|
+ xAxis: {
|
|
|
+ type: "category",
|
|
|
+
|
|
|
+ data: result.data.map(v=>v.time),
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: "value",
|
|
|
+ // scale: true,
|
|
|
+ // max: 400,
|
|
|
+ // min: 0,
|
|
|
+ // splitNumber: 5,
|
|
|
+ // boundaryGap: [0.2, 0.2],
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ data: result.data.map(v=>v.count),
|
|
|
+ type: "line",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ option && myChart.setOption(option);
|
|
|
+ // --------------------
|
|
|
},
|
|
|
- mounted() {},
|
|
|
|
|
|
methods: {
|
|
|
indexMethod(index) {
|
|
|
@@ -126,31 +193,30 @@ export default {
|
|
|
method: "get",
|
|
|
url: "/manage/stats/flow",
|
|
|
});
|
|
|
- console.log('result',result)
|
|
|
+ console.log("result", result);
|
|
|
if (result.code !== 0) {
|
|
|
return;
|
|
|
}
|
|
|
- this.trafficStatistics = result && result['data'] || []
|
|
|
- console.log('this.trafficStatistics',this.trafficStatistics)
|
|
|
+ this.trafficStatistics = (result && result["data"]) || [];
|
|
|
+ console.log("this.trafficStatistics", this.trafficStatistics);
|
|
|
},
|
|
|
- async getReadingVolumeRanking(type="news") {
|
|
|
-
|
|
|
+ async getReadingVolumeRanking(type = "news") {
|
|
|
let result = await this.$http({
|
|
|
method: "get",
|
|
|
url: `/manage/stats/news/${type}`,
|
|
|
});
|
|
|
- console.log('result',result)
|
|
|
+ console.log("result", result);
|
|
|
if (result.code !== 0) {
|
|
|
return;
|
|
|
}
|
|
|
- this.readingVolumeRanking = result && result['data'] || []
|
|
|
- console.log('this.readingVolumeRanking',this.readingVolumeRanking)
|
|
|
+ this.readingVolumeRanking = (result && result["data"]) || [];
|
|
|
+ console.log("this.readingVolumeRanking", this.readingVolumeRanking);
|
|
|
},
|
|
|
- readingVolumeTypeSwitch(type){
|
|
|
+ readingVolumeTypeSwitch(type) {
|
|
|
this.readingVolumeType = type;
|
|
|
- console.log('type',type)
|
|
|
- this.getReadingVolumeRanking(type)
|
|
|
- }
|
|
|
+ console.log("type", type);
|
|
|
+ this.getReadingVolumeRanking(type);
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
@@ -178,46 +244,98 @@ export default {
|
|
|
border-bottom: 0.0625rem #a5a5a5 solid;
|
|
|
}
|
|
|
.left {
|
|
|
- float: left;
|
|
|
+ float: left;
|
|
|
}
|
|
|
.analysis {
|
|
|
- padding:20px;height:10rem;
|
|
|
- .analysis-con {
|
|
|
- width:20%;heigth:auto;padding:0 5px;
|
|
|
- .title{ text-align:right;padding:0 10px;font-size:18px; }
|
|
|
- .content{ width:100%;height:100%;border-right:1px solid black;text-align:right;padding:0 10px; }
|
|
|
+ padding: 20px;
|
|
|
+ height: 10rem;
|
|
|
+ .analysis-con {
|
|
|
+ width: 20%;
|
|
|
+ heigth: auto;
|
|
|
+ padding: 0 5px;
|
|
|
+ .title {
|
|
|
+ text-align: right;
|
|
|
+ padding: 0 10px;
|
|
|
+ font-size: 18px;
|
|
|
+ }
|
|
|
+ .content {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ border-right: 1px solid black;
|
|
|
+ text-align: right;
|
|
|
+ padding: 0 10px;
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
.bottom {
|
|
|
- display:flex;justify-content: space-between;
|
|
|
- .bottom-left {
|
|
|
- line-height: 1.5;align-items: center;box-sizing: border-box;background: #fff;margin: 1rem 0;width:55%;height:29rem;padding:1.5rem;
|
|
|
- .head {
|
|
|
- display:flex;justify-content: space-between;
|
|
|
- .head-txt{}
|
|
|
- .head-btn{}
|
|
|
-
|
|
|
- }
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ .bottom-left {
|
|
|
+ line-height: 1.5;
|
|
|
+ align-items: center;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background: #fff;
|
|
|
+ margin: 1rem 0;
|
|
|
+ width: 55%;
|
|
|
+ height: 29rem;
|
|
|
+ padding: 1.5rem;
|
|
|
+ .head {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ .head-txt {
|
|
|
+ }
|
|
|
+ .head-btn {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .mymain {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
}
|
|
|
- .bottom-right {
|
|
|
- line-height: 1.5;align-items: center;box-sizing: border-box;background: #fff;margin: 1rem 0;width:43%;height:29rem;padding:1.5rem;
|
|
|
- .head{
|
|
|
- display:flex;justify-content: space-between;
|
|
|
- .head-txt{}
|
|
|
- .head-btn{}
|
|
|
- }
|
|
|
- .foot {
|
|
|
- margin:2rem 0 1rem 0;display:flex;justify-content: space-between;border-bottom:1px solid #333;padding-bottom:0.5rem;
|
|
|
- .foot-txt{}
|
|
|
- .foot-btn{}
|
|
|
- }
|
|
|
- .list {
|
|
|
- .list-con {
|
|
|
- display:flex;justify-content: space-between;padding:0.4rem 0;font-size: 13px;
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+ .bottom-right {
|
|
|
+ position: relative;
|
|
|
+ .empty {
|
|
|
+ position: absolute;
|
|
|
+ left: 50%;
|
|
|
+ top: 50%;
|
|
|
+ transform: translate(-50%,-50%);
|
|
|
+ }
|
|
|
+ line-height: 1.5;
|
|
|
+ align-items: center;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background: #fff;
|
|
|
+ margin: 1rem 0;
|
|
|
+ width: 43%;
|
|
|
+ height: 29rem;
|
|
|
+ padding: 1.5rem;
|
|
|
+ .head {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ .head-txt {
|
|
|
+ }
|
|
|
+ .head-btn {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .foot {
|
|
|
+ margin: 2rem 0 1rem 0;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ border-bottom: 1px solid #333;
|
|
|
+ padding-bottom: 0.5rem;
|
|
|
+ .foot-txt {
|
|
|
+ }
|
|
|
+ .foot-btn {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .list {
|
|
|
+ .list-con {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 0.4rem 0;
|
|
|
+ font-size: 13px;
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
</style>
|
|
|
|