-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
392 lines (363 loc) · 13.9 KB
/
index.html
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="./css/base.css">
<link rel="stylesheet" href="./css/index.css">
<link rel="stylesheet" href="./font/iconfont.css">
</head>
<body>
<div class="tianqing">
<div class="banxing">
<header>
<div class="header-left">
<div class="logo">LOGO</div>
</div>
<div class="header-right">
<span class="iconfont icon-shezhi"></span>
<span class="iconfont icon-xiaoxi"></span>
<span class="logoOut">LOG OUT</span>
</div>
</header>
<main>
<!-- 标题 -->
<div class="mainTitle">
<div class="big">Audience Overview</div>
<div class="small">Roseville,CA</div>
</div>
<!-- 导航栏 -->
<div class="mainTab">
<ul>
<li class="cur">DASHBOAES</li>
<li >PROJECTS</li>
<li>CALNSAR</li>
<li>MAILBOX</li>
<li>ETTINGS</li>
</ul>
</div>
<!-- 轮播图 -->
<div class="lubotu" id="lubotu">
<div class="inner" id="inner">
<ul class="imglist" id="imglist">
<li><img alt="" src="https://via.placeholder.com/539x267/0000FF"></li>
<li><img alt="" src="https://via.placeholder.com/539x267/0000FF"></li>
<li><img alt="" src="https://via.placeholder.com/539x267/FF0000"></li>
<li><img alt="" src="https://via.placeholder.com/539x267/FFFF00"></li>
<li><img alt="" src="https://via.placeholder.com/539x267/000000"></li>
<li><img alt="" src="https://via.placeholder.com/539x267/0000FF"></li>
</ul>
<!-- 轮播图底下按钮 -->
<div class="list">
<i class="current"></i>
<i></i>
<i></i>
<i></i>
<i></i>
</div>
<!-- 轮播图左右箭头 -->
<div class="arrow">
<span class="arrow-left"><</span>
<span class="arrow-right">></span>
</div>
</div>
</div>
<!-- Support Requests -->
<div class="Support">
<div class="SupportTop">
<div class="Requests">Support Requets</div>
<div class="view">View All</div>
</div>
<div class="userMessage">
<table>
<tr>
<th>TIME</th>
<th>USER NAME</th>
<th>STATUS</th>
</tr>
<tr>
<td>9:45pm</td>
<td>[email protected]</td>
<td>
Solved
</td>
</tr>
<tr>
<td>9:45pm</td>
<td>[email protected]</td>
<td>
Solved
</td>
</tr>
</table>
</div>
</div>
<!-- 折线图echarts -->
<div id="monthzhe" style="width: 1140px;height:349px"></div>
<!-- 饼图的echarts -->
<div id="weekbing" style="width: 560px;height:377px;display: inline-block;"></div>
<!-- 柱形的echarts -->
<div id="weekzhu" style="width: 560px;height:377px;display: inline-block;"></div>
</div>
</main>
<footer>
<div id="haha">爆炸了</div>
<div class="haha">起飞了</div>
</footer>
</div>
</div>
</body>
</html>
<script src="./js/jquery-1.12.4.js"></script>
<script src="./js/animate.js"></script>
<script src="./js/echarts.min.js"></script>
<script>
// 导航栏
var $liCurrent=$('.mainTab ul li')
$liCurrent.mouseenter(function(){
$(this).addClass('cur').siblings().removeClass('cur')
})
$liCurrent.click(function(){
$(this).addClass('enter').siblings().removeClass('enter')
})
// 轮播图
// 获取元素
var $box = $("#lubotu");
var $inner = $("#inner");
var $imglist = $inner.children('#imglist');
var $list = $inner.children('.list').children();
var $arrow = $inner.children('.arrow');
var $leftBtn = $arrow.children('.arrow-left');
var $rightBtn = $arrow.children('.arrow-right');
// 图片宽度
var imgWidth = $inner.width();
// 鼠标移入圆点,切换图片
$list.mouseenter(function () {
var index = $(this).index();
$list.eq(index).addClass('current').siblings().removeClass('current');
var target = index * imgWidth * -1;
$imglist.stop().animate({ left: target })
});
// 左右按钮
function moveRight() {
// 到达最后一张,切换到第一张
if (currentIndex === $imglist.children().length - 1) {
// 切换到最开始,同步索引
$imglist.css({ left: 0 });
currentIndex = 0;
}
// 图片索引自增
currentIndex++;
// 计算位置,重新设置
var target = currentIndex * imgWidth * -1;
$imglist.stop().animate({ left: target })
// 排他的设置圆点的样式
$list.siblings().removeClass('current');
// 如果是到达最后一张的时候,用户认为是第一张,直接设置第一个圆点的样式
if (currentIndex == $imglist.children().length - 1) {
$list.eq(0).addClass('current')
} else {
$list.eq(currentIndex).addClass('current');
}
}
var currentIndex = 0;
$rightBtn.click(moveRight);
$leftBtn.click(moveLeft);
function moveLeft() {
if (currentIndex === 0) {
currentIndex = $imglist.children().length - 1;
var pos = currentIndex * imgWidth * -1;
$imglist.css({ left: pos })
}
currentIndex--;
var target = currentIndex * imgWidth * -1;
$imglist.stop().animate({ left: target });
//排他的设置圆点
$list.eq(currentIndex).addClass('current').siblings().removeClass('current');
}
// 自动轮播
var autoPlayTime = 2000;
var timer = setInterval(moveRight, autoPlayTime);
// 鼠标悬停,停止自动轮播,鼠标移除恢复自动轮播 -- 最好给大盒子
$box.hover(function () {
// 停止自动轮播
clearInterval(timer);
}, function () {
// 恢复自动轮播
timer = setInterval(moveRight, autoPlayTime);
});
//折线图月数据ajax请求
$.ajax({
type: 'GET',
url: "https://edu.telking.com/api/",
data: { type: 'month' },
dataType: 'json',
success: function (monthData) {
if (monthData.code === 200) {
let { series, xAxis } = monthData.data
// 折线 echarts
var zheChart = echarts.init(document.getElementById('monthzhe'));
option = {
title: {
text: '曲线图数据展示',
left: 'center'
},
xAxis: {
type: 'category',
data: xAxis,
boundaryGap: ['20%','0%'],
axisTick: { show: false },
axisLine: {
show: false
},
},
yAxis: {
type: 'value',
splitLine: {
show: true,
lineStyle: {
type: 'dashed'
}
},
axisLine: {
show: false
},
axisLabel: {
formatter: function (val) {
// return (val - base) * 100 + '%';
if(val<2000){
return '0人'
}else if(val<4000){
return '2,000人'
}else if(val<6000){
return '4,000人'
}else if(val<8000){
return '6,000人'
}else if(val<10000){
return '8,000人'
}else{
return '10,000人'
}
}
},
},
series: [
{
areaStyle: {
normal: {
color: '#f3f6fe'
}
},
itemStyle: {
normal: {
color: '#4587ef',
lineStyle: {
color: '#4587ef'
}
}
},
label: {
normal: {
show: true,
position: 'top',
color: '#4587ef'
}
},
data: series,
type: 'line',
smooth: true
}]
};
zheChart.setOption(option);
}
}
})
// 周数据的ajax请求
$.ajax({
type: "GET",
url: "https://edu.telking.com/api/",
data: { type: 'week' },
dataType: "json",
success: function (weekData) {
if (weekData.code == 200) {
console.log(weekData)
// 将获取的周数据存到data数组对象中
let { series, xAxis } = weekData.data
var data = []
for (var i = 0; i < series.length; i++) {
var j = {}
j.value = series[i]
data.push(j)
}
for (var i = 0; i < xAxis.length; i++) {
data[i].name = xAxis[i]
}
// 扇形的echartApi
var shanChart = echarts.init(document.getElementById('weekbing'));
option = {
title: {
text: '饼状图数据展示',
left: 'center'
},
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
series: [
{
type: 'pie',
radius: '65%',
center: ['50%', '50%'],
selectedMode: 'single',
data,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
shanChart.setOption(option);
// 柱状图的echarts api
var zhuChart = echarts.init(document.getElementById('weekzhu'));
option = {
color: ['#3398DB'],
title: {
text: '柱状图数据展示',
left: 'center'
},
xAxis: {
type: 'category',
data: xAxis,
axisTick: { show: false },
axisLine: {
show: false
},
},
yAxis: {
type: 'value',
name: '商品数',
axisTick: { show: false },
axisLine: {
show: false
},
},
axisTick: {
show: false
},
series: [{
data: series,
type: 'bar',
barWidth: '16px'
}]
};
zhuChart.setOption(option)
}
}
});
</script>