js新用户注册小案例(正则表达式)

本文是在学习javaScript中Web APIs板块为更加熟练掌握理解正则表达式的练习小案例

网页的业务模块分析

  1. 发送验证码模块
  2. 各个表单验证模块
  3. 勾选已经阅读同意模块
  4. 下一步验证模块,只要上面有一个input验证不通过就不同意提交

网页效果如下

完整代码实现以及包含的css代码如下,可按需取用

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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>newUser-registery</title>
<link rel="stylesheet" href="./css/common.css">
<link rel="stylesheet" href="./css/register.css">
<link rel="stylesheet" href="https://at.alicdn.com/t/font_2143783_iq6z4ey5vu.css">
</head>
<body>
<div class="xtx-wrapper">
<div class="container">
<!-- 卡片 -->
<div class="xtx-card">
<h3>新用户注册</h3>
<form class="xtx-form">
<div data-prop="username" class="xtx-form-item">
<span class="iconfont icon-zhanghao"></span>
<input name="username" type="text" placeholder="设置用户名称">
<span class="msg"></span>
</div>
<div data-prop="phone" class="xtx-form-item">
<span class="iconfont icon-shouji"></span>
<input name="phone" type="text" placeholder="输入手机号码 ">
<span class="msg"></span>
</div>
<div data-prop="code" class="xtx-form-item">
<span class="iconfont icon-zhibiaozhushibiaozhu"></span>
<input name="code" type="text" placeholder="短信验证码">
<span class="msg"></span>
<a class="code" href="javascript:;">发送验证码</a>
</div>
<div data-prop="password" class="xtx-form-item">
<span class="iconfont icon-suo"></span>
<input name="password" type="password" placeholder="设置6至20位字母、数字和符号组合">
<span class="msg"></span>
</div>
<div data-prop="confirm" class="xtx-form-item">
<span class="iconfont icon-suo"></span>
<input name="confirm" type="password" placeholder="请再次输入上面密码">
<span class="msg"></span>
</div>
<div class="xtx-form-item pl50">
<i class="iconfont icon-queren"></i>
已阅读并同意<i>《用户服务协议》</i>
</div>
<div class="xtx-form-item">
<button class="submit">下一步</button>
<!-- <a class="submit" href="javascript:;">下一步</a> -->
</div>
</form>
</div>
</div>
</div>
<script>
(function () {
// 1. 发送短信验证码模块
const code = document.querySelector('.code')
let flag = true // 通过一个变量来控制 节流阀
// 1.1 点击事件
code.addEventListener('click', function () {
if (flag) {
// 取反了,不能马上第二次点击
flag = false
let i = 5
// 点击完毕之后立马触发
code.innerHTML = `0${i}秒后重新获取`
// 开启定时器
let timerId = setInterval(function () {
i--
code.innerHTML = `0${i}秒后重新获取`
if (i === 0) {
// 清除定时器
clearInterval(timerId)
// 从新获取
code.innerHTML = `重新获取`
// 到时间了,可以开启 flag了
flag = true
}
}, 1000)
}
})
})();


// 2. 验证的是用户名
// 2.1 获取用户名表单
const username = document.querySelector('[name=username]')
// 2.2 使用change事件 值发生变化的时候
username.addEventListener('change', verifyName)
// 2.3 封装verifyName函数
function verifyName() {
// console.log(11)
const span = username.nextElementSibling
// 2.4 定规则 用户名
const reg = /^[a-zA-Z0-9-_]{6,10}$/
if (!reg.test(username.value)) {
// console.log(11)
span.innerText = '输入不合法,请输入6~10位'
return false
}
// 2.5 合法的 就清空span
span.innerText = ''
return true
}



// 3. 验证的是手机号
// 2.1 获取手机表单
const phone = document.querySelector('[name=phone]')
// 2.2 使用change事件 值发生变化的时候
phone.addEventListener('change', verifyPhone)
// 2.3 verifyPhone
function verifyPhone() {
// console.log(11)
const span = phone.nextElementSibling
// 2.4 定规则 用户名
const reg = /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/
if (!reg.test(phone.value)) {
// console.log(11)
span.innerText = '输入不合法,请输入正确的11位手机号码'
return false
}
// 2.5 合法的 就清空span
span.innerText = ''
return true
}


// 4. 验证的是验证码
// 4.1 获取验证码表单
const codeInput = document.querySelector('[name=code]')
//4.2 使用change事件 值发生变化的时候
codeInput.addEventListener('change', verifyCode)
// 4.3 verifyPhone
function verifyCode() {
// console.log(11)
const span = codeInput.nextElementSibling
// 4.4 定规则 验证码
const reg = /^\d{6}$/
if (!reg.test(codeInput.value)) {
// console.log(11)
span.innerText = '输入不合法,6 位数字'
return false
}
// 4.5 合法的 就清空span
span.innerText = ''
return true
}

// 5. 验证的是密码框
// 5.1 获取密码表单
const password = document.querySelector('[name=password]')
//5.2 使用change事件 值发生变化的时候
password.addEventListener('change', verifyPwd)
// 5.3 verifyPhone
function verifyPwd() {
// console.log(11)
const span = password.nextElementSibling
// 5.4 定规则 密码
const reg = /^[a-zA-Z0-9-_]{6,20}$/
if (!reg.test(password.value)) {
// console.log(11)
span.innerText = '输入不合法,6~20位数字字母符号组成'
return false
}
// 5.5 合法的 就清空span
span.innerText = ''
return true
}



// 6. 密码的再次验证
// 6.1 获取再次验证表单
const confirm = document.querySelector('[name=confirm]')
//6.2 使用change事件 值发生变化的时候
confirm.addEventListener('change', verifyConfirm)
// 6.3 verifyPhone
function verifyConfirm() {
// console.log(11)
const span = confirm.nextElementSibling
// 6.4 当前表单的值不等于 密码框的值就是错误的
if (confirm.value !== password.value) {
// console.log(11)
span.innerText = '两次密码输入不一致'
return false
}
// 6.5 合法的 就清空span
span.innerText = ''
return true
}

// 7. 我同意
const queren = document.querySelector('.icon-queren')
queren.addEventListener('click', function () {
// 切换类 原来有的就删掉,原来没有就添加
this.classList.toggle('icon-queren2')
})

// 8. 提交模块
const form = document.querySelector('form')
form.addEventListener('submit', function (e) {
// 判断是否勾选我同意模块 ,如果有 icon-queren2说明就勾选了,否则没勾选
if (!queren.classList.contains('icon-queren2')) {
alert('请勾选同意协议')
// 阻止提交
e.preventDefault()
}
// 依次判断上面的每个框框 是否通过,只要有一个没有通过的就阻止
// console.log(verifyName())
if (!verifyName()) e.preventDefault()
if (!verifyPhone()) e.preventDefault()
if (!verifyCode()) e.preventDefault()
if (!verifyPwd()) e.preventDefault()
if (!verifyConfirm()) e.preventDefault()
})
</script>
</body>
</html>

register.css

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
.xtx-wrapper {
background: #f5f5f5;
line-height: 1.4;
}

.xtx-wrapper .container {
width: 1240px;
margin: 0 auto;
padding: 50px 0;
}

.xtx-card {
width: 100%;
height: 800px;
background: #fff;
}

.xtx-card h3 {
font-size: 26px;
font-weight: normal;
color: #999999;
padding-left: 50px;
height: 180px;
line-height: 180px;
}

.xtx-form {
padding-left: 460px;
}

.xtx-form .xtx-form-item {
position: relative;
padding-bottom: 24px;
}

.xtx-form .xtx-form-item .msg {
color: #ff4d4f;
position: absolute;
left: 2px;
bottom: 2px;
}


.xtx-form .xtx-form-item.pl50 {
padding-left: 40px;
cursor: pointer;
}

.xtx-form .xtx-form-item span.iconfont {
position: absolute;
left: 15px;
top: 13px;
color: #666;
font-size: 18px;
}

.xtx-form .xtx-form-item i {
color: #27BA9B;
font-size: 14px;
}

.xtx-form .xtx-form-item input {
width: 300px;
height: 50px;
border: 1px solid #e4e4e4;
padding-left: 40px;
}

.xtx-form .xtx-form-item.error input {
border-color: #ff4d4f;
}

.xtx-form .xtx-form-item input::placeholder {
color: #cccccc !important;
}

.xtx-form .xtx-form-item .submit {
width: 300px;
height: 50px;
background: #27BA9B;
border-radius: 4px;
display: block;
font-size: 16px;
color: #fff;
text-align: center;
line-height: 50px;
cursor: pointer;
}

.xtx-form .xtx-form-item .code {
position: absolute;
left: 190px;
top: 16px;
width: 100px;
color: #27BA9B;
text-align: right;
}

.xtx-form .xtx-form-item .code.ing {
color: #cccccc;
}

.xtx-steps {
display: flex;
justify-content: space-between;
width: 720px;
height: 96px;
margin: 0 auto;
}

.xtx-steps .item {
position: relative;
width: 48px;
height: 48px;
}

.xtx-steps .item .text {
text-align: center;
width: 120px;
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 63px;
color: #999;
}

.xtx-steps .item .step {
border: 2px solid #e4e4e4;
color: #ccc;
background: #fff;
border-radius: 50%;
line-height: 46px;
text-align: center;
font-size: 28px;
z-index: 999;
display: block;
position: relative;
}

.xtx-steps .item::after, .xtx-steps .item::before {
content: "";
position: absolute;
top: 23px;
left: 24px;
height: 2px;
background: #e4e4e4;
width: 120px;
}

.xtx-steps .item::after {
transform: translateX(-100%);
}

.xtx-steps .item:first-child::after {
display: none;
}

.xtx-steps .item:last-child::before {
display: none;
}

.xtx-steps .item.active .text {
color: #27BA9B;
}

.xtx-steps .item.active .step {
background: #27BA9B;
color: #fff;
border-color: #27BA9B;
}

.xtx-steps .item.active::after, .xtx-steps .item.active::before {
content: "";
background: #27BA9B;
}

.xtx-form-label {
padding-left: 360px;
margin-top: 80px;
}

.xtx-form-label .xtx-form-item {
position: relative;
padding-bottom: 24px;
display: flex;
}

.xtx-form-label .xtx-form-item label {
width: 100px;
padding-right: 15px;
text-align: right;
font-size: 16px;
height: 50px;
line-height: 50px;
color: #999;
}

.xtx-form-label .xtx-form-item input {
width: 300px;
height: 50px;
border: 1px solid #e4e4e4;
padding-left: 10px;
}

.xtx-form-label .xtx-form-item input::placeholder {
color: #cccccc !important;
}

.xtx-form-label .xtx-form-item input:read-only {
background: #f5f5f5;
color: #999;
}

.xtx-form-label .xtx-form-item .submit {
width: 300px;
height: 50px;
background: #27BA9B;
border-radius: 4px;
display: block;
font-size: 16px;
color: #fff;
text-align: center;
line-height: 50px;
}

.xtx-form-label .xtx-form-item .captcha {
line-height: 50px;
height: 50px;
}

.xtx-form-label .xtx-form-item .captcha img {
width: 134px;
height: 50px;
}

.xtx-form-label .xtx-form-item .captcha a {
color: #27BA9B;
}

.xtx-form-label .xtx-form-item .code {
position: absolute;
left: 310px;
top: 16px;
color: #27BA9B;
}

.xtx-form-label .xtx-form-item .code.ing {
color: #cccccc;
}

.xtx-success-box {
padding-top: 250px;
text-align: center;
color: #999999;
}

.xtx-success-box .iconfont {
font-size: 80px;
color: #1DC779;
}

.xtx-success-box .tit {
font-size: 20px;
padding: 20px 0;
}

.xtx-success-box .desc {
font-size: 16px;
padding-bottom: 20px;
}

.xtx-success-box .btn {
width: 300px;
height: 50px;
background: #27BA9B;
border-radius: 4px;
display: block;
font-size: 16px;
color: #fff;
text-align: center;
line-height: 50px;
margin: 0 auto;
}

common.css

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
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
@charset "UTF-8";
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
html {
line-height: 1.15;
/* 1 */
-webkit-text-size-adjust: 100%;
/* 2 */
}

/* Sections
========================================================================== */
/**
* Remove the margin in all browsers.
*/
body {
margin: 0;
}

/**
* Render the `main` element consistently in IE.
*/
main {
display: block;
}

/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}

/* Grouping content
========================================================================== */
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box;
/* 1 */
height: 0;
/* 1 */
overflow: visible;
/* 2 */
}

/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace;
/* 1 */
font-size: 1em;
/* 2 */
}

/* Text-level semantics
========================================================================== */
/**
* Remove the gray background on active links in IE 10.
*/
a {
background-color: transparent;
}

/**
* 1. Remove the bottom border in Chrome 57-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none;
/* 1 */
text-decoration: underline;
/* 2 */
text-decoration: underline dotted;
/* 2 */
}

/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}

/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace, monospace;
/* 1 */
font-size: 1em;
/* 2 */
}

/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}

/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}

sub {
bottom: -0.25em;
}

sup {
top: -0.5em;
}

/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10.
*/
img {
border-style: none;
}

/* Forms
========================================================================== */
/**
* 1. Change the font styles in all browsers.
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit;
/* 1 */
font-size: 100%;
/* 1 */
line-height: 1.15;
/* 1 */
margin: 0;
/* 2 */
}

/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input {
/* 1 */
overflow: visible;
}

/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select {
/* 1 */
text-transform: none;
}

/**
* Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}

/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}

/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}

/**
* Correct the padding in Firefox.
*/
fieldset {
padding: 0.35em 0.75em 0.625em;
}

/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box;
/* 1 */
color: inherit;
/* 2 */
display: table;
/* 1 */
max-width: 100%;
/* 1 */
padding: 0;
/* 3 */
white-space: normal;
/* 1 */
}

/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}

/**
* Remove the default vertical scrollbar in IE 10+.
*/
textarea {
overflow: auto;
}

/**
* 1. Add the correct box sizing in IE 10.
* 2. Remove the padding in IE 10.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box;
/* 1 */
padding: 0;
/* 2 */
}

/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}

/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield;
/* 1 */
outline-offset: -2px;
/* 2 */
}

/**
* Remove the inner padding in Chrome and Safari on macOS.
*/
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}

/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button;
/* 1 */
font: inherit;
/* 2 */
}

/* Interactive
========================================================================== */
/*
* Add the correct display in Edge, IE 10+, and Firefox.
*/
details {
display: block;
}

/*
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}

/* Misc
========================================================================== */
/**
* Add the correct display in IE 10+.
*/
template {
display: none;
}

/**
* Add the correct display in IE 10.
*/
[hidden] {
display: none;
}

* {
box-sizing: border-box;
}

body {
color: #333;
font: 14px/1.4 "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei", "Hiragino Sans GB", "Heiti SC", "WenQuanYi Micro Hei", sans-serif;
}

ul, h1, h3, h4, p, dl, dd {
padding: 0;
margin: 0;
}

a {
text-decoration: none;
color: #333;
}

i {
font-style: normal;
}

input {
outline: none;
padding: 0;
border: none;
}

img {
max-width: 100%;
max-height: 100%;
vertical-align: middle;
}

ul {
list-style: none;
}

.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}

.clearfix:after {
clear: both;
}

.clearfix {
*zoom: 1;
}

.wrapper {
width: 1240px;
margin: 0 auto;
}

.sprites {
background-image: url(../images/sprites.png);
background-size: 400px 400px;
background-repeat: no-repeat;
}

.fl {
float: left;
}

.fr {
float: right;
}

.tc {
text-align: center;
}

.green {
color: #27BA9B;
}

.red {
color: #CF4444;
}

.mb10 {
margin-bottom: 10px;
}

.fz20 {
font-size: 20px;
}

.fz18 {
font-size: 18px;
}

.fz16 {
font-size: 16px;
}

.xtx-bread {
padding: 10px 0 25px 25px;
}

.xtx-bread a {
color: #999;
padding-right: 5px;
}

.xtx-bread a:hover {
color: #27BA9B;
}

.xtx-common-btn {
width: 180px;
height: 50px;
border-radius: 4px;
text-align: center;
line-height: 48px;
font-size: 16px;
color: #FFFFFF;
display: inline-block;
}

.xtx-common-btn[type="primary"] {
background: #27BA9B;
}

.xtx-common-btn[type="info"] {
background: #CCCCCC;
}

.xtx-check {
color: #999;
line-height: 30px;
cursor: pointer;
}

.xtx-check i {
vertical-align: middle;
}

.xtx-check i.icon-yixuanze {
color: #27BA9B;
display: none;
}

.xtx-check i.icon-weixuanze {
color: #999;
}

.xtx-check span {
vertical-align: middle;
}

.xtx-check input {
display: none;
}

.xtx-check input:checked ~ span {
color: #27BA9B;
}

.xtx-check input:checked ~ i.icon-yixuanze {
display: inline-block;
}

.xtx-check input:checked ~ i.icon-weixuanze {
display: none;
}

/** 顶部导航 **/
.xtx_topnav {
background-color: #333;
}

.xtx_topnav .xtx_navs {
height: 53px;
text-align: right;
line-height: 53px;
font-size: 0;
}

.xtx_topnav .xtx_navs li {
display: inline-block;
font-size: 14px;
}

.xtx_topnav .xtx_navs li:last-child a {
border-right: none;
}

.xtx_topnav .xtx_navs .mobile {
display: inline-block;
width: 20px;
height: 16px;
position: relative;
top: 3px;
background-position: -160px -70px;
}

.xtx_topnav .xtx_navs a {
display: inline-block;
line-height: 1;
padding: 0 15px;
border-right: 2px solid #666666;
color: #dcdcdc;
}

.xtx_topnav .xtx_navs a:hover {
color: #27BA9B;
}

/** 主导航及Logo **/
.xtx_header .wrapper {
display: flex;
align-items: center;
}

.xtx_header .xtx_logo {
width: 200px;
height: 132px;
text-indent: -999px;
background-image: url(../images/logo.png);
background-size: contain;
background-repeat: no-repeat;
background-position-x: center;
background-position-y: 20px;
}

.xtx_header .xtx_navs {
padding-left: 50px;
}

.xtx_header .xtx_navs li {
line-height: 1;
font-size: 16px;
margin-right: 50px;
position: relative;
float: left;
}

.xtx_header .xtx_navs li:after {
content: '';
display: none;
width: 30px;
height: 2px;
background-color: #27BA9B;
position: absolute;
left: 1px;
bottom: -7px;
}

.xtx_header .xtx_navs li:hover a, .xtx_header .xtx_navs li.active a {
color: #27BA9B;
}

.xtx_header .xtx_navs li:hover:after, .xtx_header .xtx_navs li.active:after {
display: block;
}

.xtx_header .xtx_search {
height: 38px;
padding-left: 20px;
}

.xtx_header .xtx_search_wrapper {
width: 175px;
height: 38px;
padding-left: 39px;
border-bottom: 1px solid #e7e7e7;
position: relative;
float: right;
}

.xtx_header .xtx_search_wrapper:before {
content: '';
display: block;
width: 17px;
height: 17px;
position: absolute;
left: 5px;
top: 10px;
background-image: url(../images/sprites.png);
background-size: 400px 400px;
background-position: -80px -70px;
}

.xtx_header .xtx_search_wrapper input {
width: 100%;
height: 100%;
font-size: 15px;
color: #999;
}

.xtx_header .xtx_search_wrapper input::-webkit-input-placeholder {
color: #ccc;
}

.xtx_header .xtx_search_cart {
display: block;
width: 22px;
height: 22px;
position: relative;
margin: 8px 12px 0 12px;
float: right;
background-position: -120px -70px;
}

.xtx_header .xtx_search_cart i {
position: absolute;
top: -5px;
left: 16px;
line-height: 1;
padding: 1px 6px;
font-style: normal;
font-size: 13px;
background-color: #E26237;
border-radius: 15px;
color: #fff;
}

/** 公共底部 **/
.xtx_footer .contact {
padding: 60px 0 40px 25px;
}

.xtx_footer .contact dl {
height: 190px;
text-align: center;
padding: 0 72px;
border-right: 1px solid #f2f2f2;
color: #999;
float: left;
}

.xtx_footer .contact dl:first-child {
padding-left: 0;
}

.xtx_footer .contact dl:last-child {
border-right: none;
padding-right: 0;
}

.xtx_footer .contact dt {
line-height: 1;
font-size: 18px;
}

.xtx_footer .contact dd {
margin: 36px 12px 0 0;
float: left;
}

.xtx_footer .contact dd:last-child {
margin-right: 0;
}

.xtx_footer .contact .chat, .xtx_footer .contact .feedback, .xtx_footer .contact .weixin, .xtx_footer .contact .weibo {
width: 92px;
height: 92px;
padding-top: 20px;
border: 1px solid #ededed;
}

.xtx_footer .contact .chat:before, .xtx_footer .contact .feedback:before, .xtx_footer .contact .weixin:before, .xtx_footer .contact .weibo:before {
content: '';
display: block;
width: 40px;
height: 30px;
margin: 0 auto 8px;
background-image: url(../images/sprites.png);
background-size: 400px 400px;
}

.xtx_footer .contact .chat:before {
background-position: -245px -70px;
}

.xtx_footer .contact .chat:hover:before {
background-position: -200px -70px;
}

.xtx_footer .contact .feedback:before {
background-position: -345px -70px;
}

.xtx_footer .contact .feedback:hover:before {
background-position: -295px -70px;
}

.xtx_footer .contact .weixin:before {
background-position: -247px -15px;
}

.xtx_footer .contact .weixin:hover:before {
background-position: -202px -15px;
}

.xtx_footer .contact .weibo:before {
background-position: -347px -15px;
}

.xtx_footer .contact .weibo:hover:before {
background-position: -297px -15px;
}

.xtx_footer .contact .qrcode {
width: 92px;
height: 92px;
padding: 7px;
border: 1px solid #ededed;
}

.xtx_footer .contact .download {
padding-top: 5px;
font-size: 14px;
}

.xtx_footer .contact .download span {
display: block;
}

.xtx_footer .contact .download a {
display: block;
line-height: 1;
padding: 10px 25px;
margin-top: 5px;
color: #fff;
border-radius: 2px;
background-color: #27BA9B;
}

.xtx_footer .contact .hotline {
padding-top: 20px;
font-size: 22px;
color: #666;
}

.xtx_footer .contact .hotline small {
display: block;
font-size: 15px;
color: #999;
}

.xtx_footer .extra {
background-color: #333;
}

.xtx_footer .slogan {
height: 178px;
line-height: 58px;
padding: 60px 100px;
border-bottom: 1px solid #434343;
text-align: justify;
}

.xtx_footer .slogan:after {
content: '';
display: inline-block;
width: 100%;
height: 0;
}

.xtx_footer .slogan a {
display: inline-block;
height: 58px;
line-height: 58px;
color: #fff;
font-size: 28px;
}

.xtx_footer .slogan a:before {
content: '';
width: 58px;
height: 58px;
margin-right: 10px;
float: left;
background-image: url(../images/sprites.png);
background-size: 400px 400px;
}

.xtx_footer .slogan .price:before {
background-position: 0 0;
}

.xtx_footer .slogan .express:before {
background-position: -65px 0;
}

.xtx_footer .slogan .quality:before {
background-position: -130px 0;
}

.xtx_footer .copyright {
height: 170px;
padding-top: 40px;
text-align: center;
color: #999;
font-size: 15px;
}

.xtx_footer .copyright p {
line-height: 1;
margin-bottom: 20px;
}

.xtx_footer .copyright a {
color: #999;
line-height: 1;
padding: 0 10px 0 6px;
border-right: 1px solid #999;
}

.xtx_footer .copyright a:last-child {
border-right: none;
}

button {
border: none;
padding: 0;
}