WYB
2021-03-22 91b8cdad021ab052e4991f3d41834a6f0ddc36b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<template>
  <section>
    <el-scrollbar
      class="default-scrollbar"
      wrap-class="default-scrollbar__wrap"
      view-class="p20-scrollbar__view"
    >
      <el-row :gutter="20">
        <el-col :span="12" class="echarts-item">
          <div class="content-title">周访问柱状图 Top8</div>
          <ve-histogram
            :data="histogramChartDataWeek"
            :settings="histogramChartSettingsWeek"
            :mark-line="histogramChartMarkLine"
          ></ve-histogram>
        </el-col>
        <el-col :span="12" class="echarts-item">
          <div class="content-title">7天访问曲线图</div>
          <ve-line
            :data="lineChartData7Day"
            :extend="extend"
            :settings="lineChartSettings7Day"
            :mark-point="lineChartMarkPoint"
          ></ve-line>
        </el-col>
        <el-col :span="12" class="echarts-item">
          <div class="content-title">24小时访问图</div>
         <ve-line
            :data="lineChartData24Hour"
            :settings="lineChartSettings24Hour"
            :mark-point="lineChartMarkPoint"
          ></ve-line>
        </el-col>
        <el-col :span="12" class="echarts-item">
          <div class="content-title">环形图</div>
          <ve-ring :data="ringChartData" :settings="ringChartSettings"></ve-ring>
        </el-col>
      </el-row>
    </el-scrollbar>
  </section>
</template>
 
<script>
import Vue from "vue";
import VCharts from "v-charts";
Vue.use(VCharts);
import { getRequestApiinfoByWeek, getAccessApiByDate,getAccessApiByHour } from "../../api/api";
 
export default {
  name: "AdminDashboard",
  data() {
    return {
      histogramChartDataWeek: {
        columns: [],
        rows: []
      },
      extend: {
        series: {
          label: {
            normal: {
              show: true
            }
          }
        }
      },
      histogramChartSettingsWeek: {},
      histogramChartMarkLine: {
      },
      lineChartData7Day: {
        columns: [],
        rows: []
      },
      lineChartSettings7Day: {
        metrics: ["count"],
        dimension: ["date"]
      },
      lineChartData24Hour: {
        columns: [],
        rows: []
      },
      lineChartSettings24Hour: {
        metrics: ["count"],
        dimension: ["date"]
      },
      lineChartMarkPoint: {
        data: [
          {
            name: "最大值",
            type: "max"
          },
          {
            name: "最小值",
            type: "min"
          }
        ]
      },
      pieChartData: {
        columns: ["日期", "成本", "利润"],
        rows: [
          {
            日期: "1月1号",
            成本: 123,
            利润: 3
          },
          {
            日期: "1月2号",
            成本: 1223,
            利润: 6
          },
          {
            日期: "1月3号",
            成本: 2123,
            利润: 90
          },
          {
            日期: "1月4号",
            成本: 4123,
            利润: 12
          },
          {
            日期: "1月5号",
            成本: 3123,
            利润: 15
          },
          {
            日期: "1月6号",
            成本: 7123,
            利润: 20
          }
        ]
      },
      pieChartSettings: {
        dimension: "成本",
        metrics: "利润"
      },
      ringChartData: {
        columns: ["日期", "成本", "利润"],
        rows: [
          {
            日期: "1月1号",
            成本: 123,
            利润: 3
          },
          {
            日期: "1月2号",
            成本: 1223,
            利润: 6
          },
          {
            日期: "1月3号",
            成本: 2123,
            利润: 90
          },
          {
            日期: "1月4号",
            成本: 4123,
            利润: 12
          },
          {
            日期: "1月5号",
            成本: 3123,
            利润: 15
          },
          {
            日期: "1月6号",
            成本: 7123,
            利润: 20
          }
        ]
      },
      ringChartSettings: {
        dimension: "成本",
        metrics: "利润"
      }
    };
  },
  created: function() {},
  methods: {},
  mounted() {
      let para={};
 
    getRequestApiinfoByWeek(para).then(res => {
      this.histogramChartDataWeek.columns = res.data.response.columns;
      this.histogramChartDataWeek.rows =JSON.parse( res.data.response.rows);
    });
    getAccessApiByDate(para).then(res => {
      this.lineChartData7Day = res.data.response;
    });
    getAccessApiByHour(para).then(res => {
      this.lineChartData24Hour = res.data.response;
    });
  }
};
</script>
 
<style scoped>
.content-title {
  clear: both;
  font-weight: 400;
  line-height: 50px;
  padding: 10px 10px;
  font-size: 22px;
  color: #1f2f3d;
}
</style>