forked from Daddies-of-SE/ReedSailing-Web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.html
133 lines (126 loc) · 5.95 KB
/
signup.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
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
<meta charset="UTF-8">
<title>注册-一苇以航</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="./js/xadmin.js"></script>
<script src="./js/app.js"></script>
<!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="layui-fluid">
<div class="layui-row">
<form class="layui-form">
<div class="layui-form-item">
<label for="L_email" class="layui-form-label">
<span class="x-red">*</span>用户名</label>
<div class="layui-input-inline">
<input type="text" id="L_username" name="username" required="" lay-verify="username|required"
autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
<span class="x-red">*</span>将会成为您唯一的登入名
</div>
</div>
<div class="layui-form-item">
<label for="L_username" class="layui-form-label">
<span class="x-red">*</span>邮箱</label>
<div class="layui-input-inline">
<input type="text" id="L_email" name="email" required="" lay-verify="email" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="L_pass" class="layui-form-label">
<span class="x-red">*</span>密码</label>
<div class="layui-input-inline">
<input type="password" id="L_password" name="password" required="" lay-verify="pass"
autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">6到16个字符</div>
</div>
<div class="layui-form-item">
<label for="L_repass" class="layui-form-label">
<span class="x-red">*</span>确认密码</label>
<div class="layui-input-inline">
<input type="password" id="L_repass" required="" lay-verify="repass" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="L_repass" class="layui-form-label"></label>
<button class="layui-btn" lay-filter="add" lay-submit="">注册</button>
</div>
</form>
</div>
</div>
<script>
layui.use(['form', 'layer', 'jquery'],
function () {
$ = layui.jquery;
var form = layui.form,
layer = layui.layer;
//自定义验证规则
form.verify({
/*nikename: function(value) {
if (value.length < 5) {
return '昵称至少得5个字符啊';
}
},*/
pass: [/(.+){6,16}$/, '密码必须6到16位'],
repass: function (value) {
if ($('#L_password').val() != $('#L_repass').val()) {
return '两次密码不一致';
}
}
});
//监听提交
form.on('submit(add)',
function (data) {
console.log(data.field);
//发异步,把数据提交给php
var index = layer.open({ type: 3, icon: 1 });
$.ajax(server + 'register/', {
method: 'POST',
data: JSON.stringify(data.field)
}).done(function (data) {
console.log(data);
if (data.success === 'true') {
layer.alert("注册成功", {
icon: 6,
title: '提示'
}, function () {
//关闭当前frame
xadmin.close();
});
}
else {
if (data.mess === 'Name exist') {
layer.msg('用户名已被使用', { icon: 5 });
}
else {
layer.msg('邮箱已被使用', { icon: 5 });
}
}
}).fail(function (xhr, status) {
console.log(xhr.status)
layer.msg("当前未开启超级管理员注册功能", { icon: 2 });
}).always(function () {
layer.close(index);
});
return false;
});
});</script>
</body>
</html>