-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
557 lines (516 loc) · 14.4 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
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
p,
blockquote,
dl,
dt,
dd,
ul,
ol,
li,
pre,
form,
fieldset,
legend,
button,
input,
textarea,
th,
td {
margin: 0;
padding: 0;
}
body,
button,
input,
select,
textarea {
font: 12px/1.5tahoma, arial, \5b8b\4f53;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-size: 100%;
}
address,
cite,
dfn,
em,
var {
font-style: normal;
}
code,
kbd,
pre,
samp {
font-family: couriernew, courier, monospace;
}
small {
font-size: 12px;
}
ul,
ol {
list-style: none;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
sup {
vertical-align: text-top;
}
sub {
vertical-align: text-bottom;
}
legend {
color: #000;
}
fieldset,
img {
border: 0;
}
button,
input,
select,
textarea {
font-size: 100%;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
.checkBox {
width: 560px;
}
/*自定义单复选框样式开始*/
.checkBox input {
display: none;
}
.diyCheckBox {
display: inline-block;
width: 14px;
height: 14px;
border: 1px solid #dddede;
position: relative;
top: 3px;
margin-right: 5px;
color: #595757;
}
.diyCheckBox b {
display: block;
width: 8px;
height: 8px;
margin: 3px;
background: #519bf4;
opacity: 0;
transition: opacity .3s;
}
input[type=radio]:checked +.diyCheckBox b,
input[type=checkBox]:checked +.diyCheckBox b {
opacity: 1;
transition: opacity .3s;
}
/*自定义单复选框样式结束*/
.ensure {
background: #519bf4;
color: white;
font-size: 12px;
padding: 7px 23px;
border: none;
outline: none;
}
.more,
.more:hover {
text-decoration: none;
color: #595757;
}
.checkBoxBottom label {
margin-right: 30px;
font-size: 12px;
}
.classify label {
margin-right: 20px;
font-size: 12px;
}
.checkBox h2 {
float: left;
line-height: 22px;
font-size: 12px;
color: #686767;
margin-right: 12px;
}
.field,
.way,
.formality {
padding: 14px 0;
border-top: 1px dotted #dedede;
}
.checkBox label i {
display: inline-block;
background: url("./sanjiao.jpg") no-repeat;
width: 7px;
height: 6px;
background-size: auto;
}
.checkBox label i.rotate {
transform: rotate(180deg);
transition: transform .5s;
}
.checkBoxTop h1 {
float: left;
font-size: 18px;
color: #595757;
margin-right: 54px;
}
.appendDomBox p {
color: #595757;
width: 78px;
height: 20px;
line-height: 20px;
text-align: center;
border: 1px solid #9dc7f9;
float: left;
margin-right: 12px;
font-size: 12px;
}
.appendDomBox p .checkClose {
color: #9dc7f9;
float: right;
margin-right: 5px;
}
.checkBoxTop::after {
content: "";
display: block;
width: 1px;
height: 1px;
clear: both;
}
.classifyDetaill {
display: none;
}
.moreDetail {
display: inline;
display: none;
}
.appendDomBox p {}
.appendDomBox span {}
</style>
</head>
<body>
<!--checkBox-->
<div class="checkBox" id="checkBox">
<form action="">
<!--更多数据盒子-->
<div class="checkBoxTop">
<h1>
更多数据
</h1>
<div class="appendDomBox" id="appendDomBox">
<p class=""><span id="data1">数据分类:</span><b class="checkClose" data-close="data1" data-tit="classifyCheck">X</b></p>
<p class=""><span id="data2">数据分类:</span><b class="checkClose" data-close="data2" data-tit="classifyDetaill">X</b></p>
<p class=""><span id="data3">相关领域:</span><b class="checkClose" data-close="data3" data-tit="wayCheck">X</b></p>
<p class=""><span id="data4">付费方式:</span><b class="checkClose" data-close="data4" data-tit="way">X</b></p>
<p class=""><span id="data5">数据形式:</span><b class="checkClose" data-close="data5" data-tit="formality">X</b></p>
</div>
</div>
<div class="checkBoxCenter">
<!--数据分类-->
<div class="classify">
<h2>数据分类:</h2>
<div class="classifyCheck" id="classifyCheck">
<label for="" data-title="数据分类1:">
<input type="radio" name="radioBox" value="不限">
<span class="diyCheckBox"><b></b></span> 不限
</label>
<label for="" data-title="数据分类1">
<input type="radio" name="radioBox" value="产品">
<span class="diyCheckBox"><b></b></span> 产品
<i></i>
</label>
<label for="" data-title="数据分类1">
<input type="radio" name="radioBox" value="入口">
<span class="diyCheckBox"><b></b></span> 入口
<i></i>
</label>
<label for="" data-title="数据分类1">
<input type="radio" name="radioBox" value="企业">
<span class="diyCheckBox"><b></b></span> 企业
<i></i>
</label>
<label for="" data-title="数据分类1">
<input type="radio" name="radioBox" value="行业">
<span class="diyCheckBox"><b></b></span> 行业
<i></i>
</label>
<label for="" data-title="数据分类1">
<input type="radio" name="radioBox" value="城市">
<span class="diyCheckBox"><b></b></span> 城市
<i></i>
</label>
</div>
</div>
<!--数据分类详情-->
<div class="classifyDetaill" id="classifyDetaill"></div>
</div>
<div class="checkBoxBottom">
<!--相关领域-->
<div class="field">
<h2>相关领域: </h2>
<div class="fieldCheck">
<label for="" data-title="相关领域">
<input type="checkBox" value="不限">
<span class="diyCheckBox"><b></b></span>不限
</label>
<label for="" data-title="相关领域">
<input type="checkBox" value="北京">
<span class="diyCheckBox"><b></b></span> 北京
</label>
<label data-title="相关领域">
<input type="checkBox" value="广州">
<span class="diyCheckBox"><b></b></span> 广州
</label>
<label for="" data-title="相关领域">
<input type="checkBox" value="无锡">
<span class="diyCheckBox"><b></b></span> 无锡
</label>
<label for="" data-title="相关领域">
<input type="checkBox" value="武汉">
<span class="diyCheckBox"><b></b></span> 武汉
</label>
<label for="" data-title="相关领域">
<input type="checkBox" value="青岛">
<span class="diyCheckBox"><b></b></span> 青岛
</label>
<div class="moreDetail" id="moreDetail">
<label for="" data-title="相关领域">
<input type="checkBox" value="青岛">
<span class="diyCheckBox"><b></b></span> 青岛
</label>
<label for="" data-title="相关领域">
<input type="checkBox" value="青岛">
<span class="diyCheckBox"><b></b></span> 青岛
</label>
<label for="" data-title="相关领域">
<input type="checkBox" value="青岛">
<span class="diyCheckBox"><b></b></span> 青岛
</label>
<label for="" data-title="相关领域">
<input type="checkBox" value="青岛">
<span class="diyCheckBox"><b></b></span> 青岛
</label>
<label for="" data-title="相关领域">
<input type="checkBox" value="青岛">
<span class="diyCheckBox"><b></b></span> 青岛
</label>
<label for="" data-title="相关领域">
<input type="checkBox" value="青岛">
<span class="diyCheckBox"><b></b></span> 青岛
</label>
<label for="" data-title="相关领域">
<input type="checkBox" value="青岛">
<span class="diyCheckBox"><b></b></span> 青岛
</label>
</div>
<a href="javascript:;" class="more" id="more">更多</a>
</div>
</div>
<!--付费方式-->
<div class="way" id="way">
<h2>付费方式:</h2>
<div class="wayCheck" id="wayCheck">
<label for="" data-title="付费方式">
<input type="checkBox" value="不限">
<span class="diyCheckBox"><b></b></span> 不限
</label>
<label for="" data-title="付费方式">
<input type="checkBox" value="免费">
<span class="diyCheckBox"><b></b></span> 免费
</label>
<label for="" data-title="付费方式">
<input type="checkBox" value="付费">
<span class="diyCheckBox"><b></b></span>付费
</label>
</div>
</div>
<!--数据形式-->
<div class="formality" id="formality">
<h2>数据形式:</h2>
<div class="formalityCheck">
<label for="" data-title="数据形式">
<input type="checkBox" value="不限">
<span class="diyCheckBox"><b></b></span> 不限
</label>
<label for="" data-title="数据形式">
<input type="checkBox" value="API">
<span class="diyCheckBox"><b></b></span> API
</label>
<label for="" data-title="数据形式">
<input type="checkBox" value="数据包">
<span class="diyCheckBox"><b></b></span> 数据包
</label>
</div>
</div>
</div>
<button type="button" class="ensure">确定</button>
</form>
</div>
<script src="./jquery.min.js"></script>
<script>
/*模拟的数据*/
var datajson = {
"不限": ["不限1", "不限2", "不限3", "不限4", "不限5", "不限6", "不限7", "不限8", "不限9"],
"产品": ["产品1", "产品2", "产品3", "产品4", "产品5", "产品6"],
"入口": ["入口1", "入口2", "入口3", "入口4", "入口5", "入口6", "入口7", "入口8"],
"企业": ["企业1", "企业2", "企业3", "企业4", "企业5", "企业6", "企业7", "企业8", "企业9", "企业10", "企业11", "企业12", ],
"行业": ["行业1", "行业2", "行业3", "行业4", "行业5", "行业6", "行业7"],
"城市": ["城市1", "城市2", "城市3", "城市4", "城市5", "城市6", "城市7", "城市8", "城市9", "城市", "城市10", "城市11", "城市12", "城市13", "城市14", "城市15", "城市16"]
};
var data1 = [],
data2 = [],
data3 = [],
data4 = [],
data5 = [];
/*时间代理,给所有的ipput绑定单击事件,并执行相关操作*/
$("#checkBox").on("click", "label", function () {
var $this_input = $(this).find("input"),
$this_ = $this_input.attr("type"),
$this_val = $this_input.val(),
nowDate = "data" + Date.parse(new Date()),
$this_i = $(this).find("i"),
$this_title = $(this).attr("data-title");
if ($this_ == "checkBox") {
if ($this_input.prop("checked") == true) {
$this_input.attr("checked", false);
removeDom($this_val, nowDate, $this_title);
} else {
$this_input.attr("checked", "true");
$this_input.attr("data-this", nowDate);
$this_input.attr("class", "");
$this_input.addClass(nowDate);
appendDom($this_val, nowDate, $this_title);
}
} else {
$("#classifyCheck").find("input").attr("checked", false);
$this_input.attr("checked", "true");
$("#classifyCheck").find("i").removeClass("rotate");
$this_i.addClass("rotate");
appendDom($this_val, nowDate, $this_title);
/*模拟数据接口,渲染数据*/
getMes($this_val);
}
})
/*单选按钮选中之后渲染数据逻辑*/
function getMes(val) {
var oHtml = "";
$.each(datajson, function (i) {
if (i == val) {
$.each(datajson[i], function (i, v) {
oHtml += "<label for='' data-title='数据分类'><input type='checkBox' value=" + v + " /><span class='diyCheckBox'><b></b></span> " + v + "</label>";
})
$("#classifyDetaill").html(oHtml);
$("#classifyDetaill").slideUp(0);
$("#classifyDetaill").slideDown(200);
}
})
}
function appendDom(dom, nowDate, this_title) {
if (this_title == "数据分类1") {
$("#data1").html("数据分类:" + dom);
} else if (this_title == "数据分类") {
data2.push(dom);
$("#data2").html("数据分类:" + data2.join(","));
} else if (this_title == "相关领域") {
data3.push(dom);
$("#data3").html("相关领域:" + data3.join(","));
} else if (this_title == "付费方式") {
data4.push(dom);
$("#data4").html("付费方式:" + data4.join(","));
} else if (this_title == "数据形式") {
data5.push(dom);
$("#data5").html("数据形式:" + data5.join(","));
}
}
/*删除选中的元素*/
function removeDom(dom, nowDate, this_title) {
if (this_title == "数据分类1") {
$("#data1").html("数据分类:" + dom);
} else if (this_title == "数据分类") {
data2.removeByValue(dom);
$("#data2").html("数据分类:" + data2.join(","));
} else if (this_title == "相关领域") {
data3.removeByValue(dom);
$("#data3").html("相关领域:" + data3.join(","));
} else if (this_title == "付费方式") {
data4.removeByValue(dom);
$("#data4").html("付费方式:" + data4.join(","));
} else if (this_title == "数据形式") {
data5.removeByValue(dom);
$("#data5").html("数据形式:" + data5.join(","));
}
}
/*数组删除特定的元素方法*/
Array.prototype.removeByValue = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) {
this.splice(i, 1);
break;
}
}
}
/*点击关闭按钮*/
$("#appendDomBox").on("click", ".checkClose", function () {
var $data_close = $(this).attr("data-close"),
$data_tit = $(this).attr("data-tit");
if ($data_close == "data1") {
$("#data1").html("数据分类:");
checkFalse($data_tit);
} else if ($data_close == "data2") {
$("#data2").html("数据分类:");
checkFalse($data_tit);
} else if ($data_close == "data3") {
$("#data3").html("相关领域:");
checkFalse($data_tit);
} else if ($data_close == "data4") {
$("#data4").html("付费方式:");
checkFalse($data_tit);
} else if ($data_close == "data5") {
$("#data5").html("数据形式:");
checkFalse($data_tit);
}
})
/*便利让所有的input框取消选中*/
function checkFalse(dom) {
$("#" + dom).find("input").attr("checked", false);
}
/*更多*/
$("#more").on("click", function () {
if (!$(this).hasClass("active")) {
$("#moreDetail").slideDown(350);
$(this).addClass("active");
$(this).html("收起");
} else {
$("#moreDetail").hide();
$(this).removeClass("active");
$(this).html("更多");
}
})
</script>
</body>
</html>