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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
| <template>
| <div>
| <el-row class="dataAnalysis" v-if="isMenuAuth === 'true'">
| <el-col class="dataAnalysisItem" v-for="(item,index) in chartData" :key="index"
| :span="item.span">
| <public-component :chartData="item">
| <template slot="content" slot-scope="scope">
| <component :chartData="scope.data" :is="item.type"></component>
| </template>
| </public-component>
| </el-col>
| </el-row>
| </div>
| </template>
|
| <script>
| import Cookie from 'js-cookie'
| import publicComponent from '@/views/dataAnalysis/commponents/publicComponent.vue'
| import installComponent from '@/views/dataAnalysis/commponents/installComponent.vue'
| import loginComponent from '@/views/dataAnalysis/commponents/loginComponent.vue'
| import registerComponent from '@/views/dataAnalysis/commponents/registerComponent.vue'
| import visitComponent from '@/views/dataAnalysis/commponents/visitComponent.vue'
| const zoom = {
| type: 'inside', // 图表下方的伸缩条
| realtime: true, // 拖动时,是否实时更新系列的视图
| start: 0, // 伸缩条开始位置(1-100),可以随时更改
| end: 100 // 伸缩条结束位置(1-100),可以随时更改
| }
| const label = { // 顶部上方显示数字
| show: true,
| position: 'top',
| color: '#C2A16C'
| }
| const yAxis = {
| type: 'value',
| minInterval: 1, // 只显示整数
| splitLine: {
| show: true,
| // 网格线设置为虚线
| lineStyle: {
| type: 'dashed',
| color: 'rgb(194,161,108,0.5)'
| }
| }
| }
| // 隐藏X轴刻度线
| const axisLineStyle = {
| axisLine: { show: false }, // x轴坐标线
| axisTick: { show: false } // x轴刻度线
| }
| // 柱状图边框设置
| const barItemStyle = {
| borderWidth: 1,
| borderColor: 'rgba(208,38,30,0.60)'
| }
| export default {
| components: { publicComponent, installComponent, registerComponent, visitComponent, loginComponent },
| data () {
| return {
| installData: [],
| isMenuAuth: false,
| chartData: [
| // {
| // id: '1',
| // name: '安装统计',
| // timeType: null,
| // time: [],
| // type: 'installComponent',
| // resData: [],
| // option: {
| // tooltip: {
| // trigger: 'item'
| // },
| // legend: {
| // orient: 'vertical',
| // left: '20%',
| // top: 'middle',
| // textStyle: {
| // color: ['#FBDC8E', 'rgba(208,38,30,0.40)', '#9FE6B8']
| // },
| // itemGap: 25, // 图例每项之间的间隔
| // itemWidth: 14, // 图例标记的图形宽度
| // itemHeight: 14 // 图例标记的图形高度
| // },
| // series: [
| // {
| // name: '安装统计',
| // type: 'pie',
| // radius: ['45%', '70%'],
| // color: ['#FBDC8E', 'rgba(208,38,30,0.40)', '#9FE6B8'],
| // data: [],
| // emphasis: {
| // itemStyle: {
| // shadowBlur: 10,
| // shadowOffsetX: 0,
| // shadowColor: 'rgba(0, 0, 0, 0.5)'
| // }
| // },
| // label: {
| // formatter: '{c}'
| // }
| // }
| // ]
| // },
| // tip: '1、根据用户(设备ID)下载app首次运行进行计数<br/>2、同一用户多次卸载/安装首次运行分别计数(如:A用户下载app首次运行计数为1,卸载从新安装后首次运行计数为2)<br/>3、系统默认展示最近7天的安装计数统计'
| // },
| {
| name: '注册数量',
| timeType: '1',
| time: null,
| span: 24,
| type: 'registerComponent',
| option: {
| tooltip: {
| trigger: 'axis'
| },
| grid: {
| x: 50,
| x2: 50,
| y: 35,
| y2: 35
| },
| xAxis: {
| type: 'category',
| data: [],
| ...axisLineStyle
| },
| yAxis,
| dataZoom: [
| zoom
| ],
| series: [{
| name: '注册数量',
| color: ['rgba(208,38,30,0.40)'],
| data: [],
| type: 'bar',
| label,
| itemStyle: barItemStyle
| }]
| },
| tip: '1、根据首次注册的用户手机号进行计数<br/>2、注册统计按天统计,同一天内同一用户注册后注销则不计数(如:A用户1号注册,注册计数为1,随即注销账号,注册计数为0)'
| },
| {
| name: '登录数量',
| timeType: '1',
| time: null,
| span: 12,
| type: 'loginComponent',
| option: {
| tooltip: {
| trigger: 'axis'
| },
| grid: {
| x: 50,
| x2: 50,
| y: 35,
| y2: 35
| },
| xAxis: {
| type: 'category',
| data: [],
| ...axisLineStyle
| },
| yAxis,
| dataZoom: [
| zoom
| ],
| series: [{
| name: '登录数量',
| data: [],
| type: 'bar',
| color: ['rgba(208,38,30,0.40)'],
| label,
| itemStyle: barItemStyle
| }]
| },
| tip: '1、根据用户手机号记录当日的登录次数<br/>2、同一用户多次退出登录分别计数(如:A用户登录后计数为1,退出后再次登录计数为2)'
| }, {
| name: '访问量',
| timeType: '1',
| time: null,
| span: 12,
| type: 'visitComponent',
| option: {
| tooltip: {
| trigger: 'axis'
| },
| grid: {
| x: 50,
| x2: 50,
| y: 35,
| y2: 35
| },
| xAxis: {
| type: 'category',
| data: [],
| ...axisLineStyle,
| boundaryGap: false
| },
| yAxis,
| dataZoom: [
| zoom
| ],
| series: [{
| name: '访问量',
| data: [],
| type: 'line',
| color: ['#D0261E'],
| smooth: true,
| showSymbol: false,
| // label,
| areaStyle: {
| opacity: 0.8,
| color: this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
| {
| offset: 0,
| color: 'rgba(208,38,30,0.56)'
| },
| {
| offset: 1,
| color: 'rgba(208,38,30,0.00)'
| }
| ])
| }
| }]
| },
| tip: '1、记录时间段内登录用户打开APP的访客人数量'
| }
| ]
| }
| },
| created () {
| this.isMenuAuth = Cookie.get('isMenuAuth')
|
| this.getData()
| },
| methods: {
| // 获取前七天的日期
| fun_date (num) {
| var date1 = new Date()
| // 前一天的时间
| var time1 = date1.getFullYear() + '-' + ((date1.getMonth() + 1) < 10 ? '0' + (date1.getMonth() + 1) : (date1.getMonth() + 1)) + '-' + (date1.getDate() - 1)
| var date2 = new Date(date1)
| date2.setDate(date1.getDate() + num)
| // num是正数表示之后的时间,num负数表示之前的时间,0表示今天
| var time2 = date2.getFullYear() + '-' + ((date2.getMonth() + 1) < 10 ? '0' + (date2.getMonth() + 1) : (date2.getMonth() + 1)) + '-' + date2.getDate()
| return [time2, time1]
| },
| // 获取数据
| getData () {
| this.chartData.forEach(item => {
| item.time = this.fun_date(-7)
| })
| }
|
| }
| }
| </script>
|
| <style lang='scss'>
| .dataAnalysis {
| // width: 1863px;
| .dataAnalysisItem {
| // width: 50%;
| // min-width: 557px;
| margin-bottom: 10px;
| }
| }
| </style>
|
|