login.html
4.8 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
<meta name="format-detection" content="telephone=no, email=no, date=no, address=no" />
<title>注册</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel="stylesheet" href="./style/base.css">
<link rel="stylesheet" href="./style/common.css">
<script src="./js/base.js"></script>
<style>
body {
background: #fff
}
</style>
</head>
<body>
<!-- 吐司 -->
<div class="toast">
<div class="toast_title">1234</div>
</div>
<!-- 顶部 -->
<div class="register_top">
<div class="register_img"></div>
</div>
<div class="register_box">
<div class="register_contant">
<div class="register_title">登录</div>
<div class="register_one layer_star register_one_padding">
<div class="register_one_left layer_star">
<div class="register_one_icon">
<img src="./image/sun_46.png" alt="">
</div>
<div class="register_one_title">
手机号
</div>
</div>
<div class="register_one_right">
<input type="text" placeholder="请输入手机号码" id="phone" maxlength="11">
</div>
</div>
<div class="register_one layer_star">
<div class="register_one_padding layer_star">
<div class="register_one_left layer_star">
<div class="register_one_icon">
<img src="./image/sun_47.png" alt="">
</div>
<div class="register_one_title">
密 码
</div>
</div>
<div class="register_one_right">
<input type="text" placeholder="请输入密码" id="password">
</div>
</div>
<div class="register_one_code" onclick="codeButton()" id="code">发送验证码</div>
</div>
<div class="register_btn">确认注册</div>
<div class="register_word">
注册即表示你已阅读并同意<a href="">《XX协议》</a>
</div>
</div>
</div>
<script src="js/jquery.js"></script>
<script type="text/javascript">
// 验证码
function codeButton() {
var phone = $("#phone").val();
var toast;
if (phone == "") {
toast = "手机号不能为空";
$(".toast").show();
$(".toast_title").text(toast)
setTimeout(function() {
hide()
}, 1500)
} else if (!(/^1[3456789]\d{9}$/.test(phone))) {
toast = "请输入正确的手机号码";
$(".toast").show();
$(".toast_title").text(toast)
setTimeout(function() {
hide()
}, 1500)
} else {
var code = $("#code");
code.attr("disabled", "disabled");
setTimeout(function() {
code.css("opacity", "0.8");
}, 1000);
var time = 60;
var set = setInterval(function() {
code.text("" + --time + "s");
}, 1000);
setTimeout(function() {
code.attr("disabled", false).text("重新获取");
clearInterval(set);
}, 60000);
}
};
// 确认注册
$(".register_btn").click(function() {
var phone = $("#phone").val();
var password = $("#password").val();
var toast;
if (phone == "") {
toast = "手机号不能为空";
$(".toast").show();
$(".toast_title").text(toast)
setTimeout(function() {
hide()
}, 1500)
} else if (!(/^1[3456789]\d{9}$/.test(phone))) {
toast = "请输入正确的手机号码";
$(".toast").show();
$(".toast_title").text(toast)
setTimeout(function() {
hide()
}, 1500)
} else if (password == '') {
toast = "密码不能为空";
$(".toast").show();
$(".toast_title").text(toast)
setTimeout(function() {
hide()
}, 1500)
} else if (password != '1234') {
toast = "密码不正确";
$(".toast").show();
$(".toast_title").text(toast)
setTimeout(function() {
hide()
}, 1500)
} else {
console.log("注册成功")
}
})
function hide() {
$(".toast").hide()
}
</script>
</body>
</html>