-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.html
134 lines (130 loc) · 5.09 KB
/
data.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="x-dns-prefetch-control" content="on">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>上传个人基本信息</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="css/Font-Awesome-3.2.1/css/font-awesome.min.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/toastr.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/toastr.min.js"></script>
</head>
<body>
<div class="wrap">
<div class="data">
<img src="img/backgr.jpg" width="100%" height="100%">
<div class="data_s">
<img class="bianhua" src="img/ren.png" width="65%" />
<img class="bianhua1" src="img/ziliao.png" width="88%"/>
<div class="data_h1">
<h3>填写个人信息</h3>
</div>
<div class="data_inputs">
<input id="name" type="text" class="form-control" placeholder="请输入姓名">
<select class="form-control" id="sex">
<option value="-1" selected>请输选择性别</option>
<option value="1">男</option>
<option value="0">女</option>
</select>
<input id="phone" type="text" class="form-control" placeholder="请输入手机号码">
<input id="password" type="text" class="form-control" placeholder="请输入测试数字密码">
<input id="birthday" type="date" class="form-control" placeholder="请出生日期">
</div>
<button type="button" class="data_buttom bansf btn btn-primary btn-lg btn-block" id="start_btn" >开始答题</button>
</div>
</div>
</div>
<script type="text/javascript">
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-bottom-center",
"preventDuplicates": false,
"onclick": function () {
console.log(this);
},
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "2000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
}
$(function () {
$("#start_btn").on('click',function () {
//开始验证
var name = $("#name").val();
if(name==undefined || name ==''){
toastr.error('请输入姓名');
return;
}
if(name.length>4){
toastr.error('姓名不可超过4个字符');
return;
}
var sex = $("#sex").val();
if(sex==-1){
toastr.error('请选择性别');
return;
}
var phone = $("#phone").val();
if(!checkMobile(phone)){
toastr.error('请输入正确的手机号码');
return;
}
var pass = $("#password").val();
if(pass==undefined || pass ==''){
toastr.error('请输入密码');
return;
}
if(pass.length>16){
toastr.error('密码不可超过16个字符');
return;
}
var birthday = $("#birthday").val();
if(birthday==undefined || birthday ==''){
toastr.error('请选择出生日期');
return;
}
var params = {
type:'add_user',
name:name,
sex:sex,
phone:phone,
pass:pass,
birthday:birthday
}
//提交到数据库
$.ajax({
type : "POST", //提交方式
url : "ajax.php",//路径
data : params,//数据,这里使用的是Json格式进行传输
success : function(result) {//返回数据根据结果进行相应的处理
// toastr.success('开始答题了');
location.href='dati.php?user_id='+result+'&gender='+sex;
}
});
})
})
function checkMobile(phone){
var reg = /^1[3|4|5|7|8][0-9]{9}$/;
if(!(reg.test(phone))){
return false;
}
return true;
}
</script>
</body>
</html>