-
Notifications
You must be signed in to change notification settings - Fork 43
/
register.html
executable file
·142 lines (140 loc) · 7 KB
/
register.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
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<title>融云客服-web sdk demo</title>
<meta name="keywords"
content="融云,即时通讯,即时通讯云,即时通信云,移动 IM,开源 IM,IM 云服务,即时聊天软件,VOIP,移动客服,在线客服,免费,App 开发者服务,融云 Demo ,Web Demo,即时通讯 Demo"/>
<meta name="description" content="融云 Web Demo 下载体验!"/>
<link href="static/css/main.css" rel="stylesheet">
<script src="static/js/CommonUtil.js"></script>
<script src='http://rongcloud-web.qiniudn.com/js_jquery-1.11.1.min.js'></script>
<script>
$(function () {
var input = $("input");
input.blur(function () {
var that = $(this), index = that.index("input"), val = that.val().trim();
switch (index) {
case 0:
if (/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/.test(val)) {
var xhr = Util.XHR();
xhr.open("get", "/email_exists?email=" + val, false);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var result = Util.JSONParse(xhr.responseText);
if (result.code == 200 && !result.result) {
that.next().addClass("hidden");
return;
}
}
that.val("").next().removeClass("hidden").end().focus();
};
xhr.send(null);
return;
}
break;
case 1:
if (/\d{11}/.test(val)) {
var xhr = Util.XHR();
xhr.open("get", "/mobile_exists?mobile=" + val, false);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var result = Util.JSONParse(xhr.responseText);
if (result.code == 200 && !result.result) {
that.next().addClass("hidden");
return;
}
}
that.val("").next().removeClass("hidden").end().focus();
};
xhr.send(null);
return;
}
break;
case 2:
if (/\S{1,10}$/.test(val)) {
that.next().addClass("hidden");
return;
}
break;
case 3:
if (/[\@A-Za-z0-9\!\#\$\%\^\&\*\.\~]{6,18}$/.test(val)) {
that.next().addClass("hidden");
return;
}
break;
case 4:
if (/[\@A-Za-z0-9\!\#\$\%\^\&\*\.\~]{6,18}$/.test(val) && val == input.eq(3).val().trim()) {
that.next().addClass("hidden");
return;
}
break;
}
that.val("").next().removeClass("hidden");
});
$("#register").click(function () {
var empty = input.filter(function (s, i) {
return i.value == ""
});
if (empty.length == 0) {
var xhr = Util.XHR();
xhr.open("POST", "/reg", false);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
switch (xhr.status) {
case 200:
var val = Util.JSONParse(xhr.responseText);
if (val.code == 200) {
location.href = "login.html";
return;
} else {
alert("注册失败")
}
default :
input.val("")[0].focus();
break;
}
}
};
xhr.send("email=" + input[0].value + "&mobile=" + input[1].value + "&username=" + input[2].value + "&password=" + input[3].value);
} else {
empty.first().blur();
}
});
});
</script>
</head>
<body class="login-container">
<div class="login-wrap">
<div class="login-header">
<div class="login-logo"><img src="static/images/logo_login.png"></div>
<div class="phone-login-logo"><img src="static/images/phone_logo_login.png"></div>
<div class="login-title">注 册</div>
</div>
<div class="login-content">
<span class="mail">注册邮箱</span>
<span><input type="text" id="user_email" maxlength="30" autofocus=""/><label class="mail_error error hidden">邮箱格式不正确或已经注册</label></span>
<span class="name">手机号</span>
<span><input type="text" id="phone" maxlength="11" autofocus=""/><label class="mail_error error hidden">手机号码格式不正确或已被注册</label></span>
<span class="name">您的昵称</span>
<span><input type="text" id="user_name" maxlength="10"/><label
class="name_error error hidden">昵称格式不正确</label></span>
<span class="pass">密码</span>
<span><input type="password" maxlength="18" id="user_pass"/><label
class="pass_error error hidden">密码格式不正确</label></span>
<span class="pass">再次确认密码</span>
<span><input type="password" maxlength="18" id="user_repass"/><label
class="repass_error error hidden">密码不一致</label></span>
<span class="btn"><button id="register">注 册</button></span>
</div>
<div class="login-foot">
<a href="login.html">已注册帐号? 立刻登录</a>
</div>
</div>
<div class="login-footer">© 2014 Rong Cloud. V 0.9.0</div>
</body>
<script type="text/javascript">
</script>
</html>