-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathNavigation.html
More file actions
397 lines (381 loc) · 16.5 KB
/
Copy pathNavigation.html
File metadata and controls
397 lines (381 loc) · 16.5 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
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
<!DOCTYPE html>
<html>
<head>
<title>学术会议管理平台</title>
<meta charset="utf-8">
<link rel="stylesheet" href="libs/css/bootstrap.min.css">
<script src="libs/js/jquery.min.js"></script>
<script src="libs/js/bootstrap.min.js"></script>
<style>
.center {
float: none;
margin-left: 26%;
}
</style>
</head>
<body onLoad="uname1()">
<!--Navigation导航栏部分-->
<div>
<nav class="navbar navbar-default" role="navigation">
<br/>
<div class="container-fluid">
<div class="navbar-header" style="margin-left: 15%">
<a class="navbar-brand" href="#">学术会议管理平台</a>
</div>
<div class="hidden-sm hidden-xs" style="margin-right: 10%">
<form class="navbar-form navbar-left" style="margin-left: 10%">
<div class="form-group">
<input type="text" class="form-control" placeholder="查找会议">
<button type="submit" class="btn btn-default">查找</button>
</div>
</form>
</div>
<div class="navbar-form navbar-left">
<button class="btn btn-default" onclick="createMeeting()">创建会议</button>
</div>
<div class="navbar-form navbar-left">
<button class="btn btn-default" onclick="administration()">管理员入口</button>
</div>
<div>
<div id="navbar">
<ul class="nav navbar-nav" style="margin-left: 10%">
<li class="dropdown">
<a href="#" id="uname" class="dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="drop">
<li><a id="LogIn" href="#" onclick="userLogin()">登录</a></li>
<li class="divider"></li>
<li><a id="SignIn" href="#" onclick="userRegister()">注册</a></li>
<li class="divider"></li>
<li><a id="LogOut"href="#" onclick="logout()">登出</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<br/>
</nav>
</div>
<!--Navigation导航栏结束-->
<!--注册部分-->
<div class="modal fade" id="userRegister" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content" style="margin-top:40%">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">注册</h4>
</div>
<div class="modal-body">
<div class="form-horizontal col-md-offset-0" id="login_form">
<div class="col-md-12">
<div class="form-group">
<label for="username1" class="control-label">昵称:</label>
<input class="form-control required" type="text" placeholder="Username" id="username" name="username" autofocus maxlength="20"/>
</div>
<div class="form-group">
<label for="useremail" class="control-label">邮箱:</label>
<input class="form-control required" type="email" placeholder="Email" id="useremail" name="useremail" autofocus maxlength="20"/>
</div>
<!--
<div class="form-group">
<label for="idnumber" class="control-label">身份证号:</label>
<input class="form-control required" type="text" placeholder="Idnumber" id="idnumber" name="idnumber" autofocus maxlength="20"/>
</div>-->
<div class="form-group">
<label for="password1" class="control-label">密码:</label>
<input class="form-control required" type="password" placeholder="Password" id="password1" name="password" autofocus maxlength="20"/>
</div>
<div class="form-group">
<label for="repassword" class="control-label">确认密码:</label>
<input class="form-control required" type="password" placeholder="Confirm Password" id="repassword" name="repassword" autofocus maxlength="20"/>
</div>
<div class="form-group" >
<font color="#999999">单位用户注册?</font><a href="institution/institution-register.html" color="#CCCC00">前往注册</a>
</div>
<div class="form-group col-md-offset-9">
<button id='btn' type="submit" class="btn btn-primary" name="submit" onclick="doPostRegister()">注册</button>
</div>
</div>
</div>
</div>
<div class="modal-footer"></div>
</div>
</div>
</div>
<!--注册部分结束-->
<!--用户登录部分-->
<div class="modal fade" id="userLogin" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content" style="margin-top:40%">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">登录</h4>
</div>
<div class="modal-body">
<div class="form-horizontal col-md-offset-0" id="login_form">
<div class="col-md-12">
<div class="btn-group center" id="option" data-toggle="buttons">
<label class="btn btn-default">
<input type="radio" class="toggle" value="user_option">个人用户登录
</label>
<label class="btn btn-default">
<input type="radio" class="toggle" value="institution_option">单位用户登录
</label>
</div>
<br>
<br>
<div class="form-group">
<label class="control-label">邮箱/用户名</label>
<input class="form-control required" type="text" placeholder="Email/Username" id="email_username" name="email" autofocus maxlength="50"/>
</div>
<div class="form-group">
<label class="control-label">密码</label>
<input class="form-control required" type="password" placeholder="Password" id="password" name="password" maxlength="20"/>
</div>
<div class="form-group col-md-offset-9">
<button id='btn' type="submit" class="btn btn-success" name="submit" onclick="doPostLogin()">登录</button>
</div>
</div>
</div>
</div>
<div class="modal-footer"></div>
</div>
</div>
</div>
<!--用户登录部分结束-->
</body>
<script type="text/javascript">
var url="http://154.8.211.55:8081";
function doPostRegister()
{
//alert("qqq");
var val1 = document.getElementById("username").value;
var val2 = document.getElementById("password1").value;
var val3 = document.getElementById("repassword").value;
var val4 = document.getElementById("useremail").value;
/*var val5 = document.getElementById("idnumber").value;*/
var user = {
"username":val1,
"password":val2,
"email":val4
};
user = JSON.stringify(user);
var settings = {
type: "POST",
url:url+"/personal_user",
data:user,
error: function(XHR,textStatus,errorThrown) {
alert("error!");
alert(errorThrown);
},
success: function(data,textStatus) {
if(data==false)
{
alert("该昵称已被注册!");
}
else
{
alert("注册成功!");
window.location.href='Navigation.html';
}
},
headers: {
"Content-Type":"application/json"
}
};
var isRightForm = true;
if(val1=="")
{
alert("昵称不能为空!");
isRightForm = false;
}
if(val2=="")
{
alert("密码不能为空!");
isRightForm = false;
}
if(val2!=val3)
{
alert("两次输入密码不相同!");
isRightForm = false;
}
if(val4=="")
{
alert("邮箱不能为空!");
isRightForm = false;
}
/*判断输入身份证号是否合法 */
/*简单判断是否为18位数字 */
/*
if(val5.length!=18){
isRightForm = false;
}
if(!isNumber(val5)){
isRightForm = false;
}
var reg1 = /^(\d{15}|\d{18})$/;
if(!reg1.test(val5)){
alert("身份证号输入错误!");
isRightForm = false;
}*/
/*判断邮箱是否格式正确 */
var reg2 = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$"); //正则表达式
if(!reg2.test(val4)){
alert("邮箱格式输入错误!");
isRightForm = false;
}
if(isRightForm){
$.ajax(settings);
}
}
function doPostLogin()
{
//alert("qqq");
var val1 = document.getElementById("email_username").value;
var val2 = document.getElementById("password").value;
var type = $('#option input:radio:checked').val();
document.cookie = "type="+type;
//alert(document.cookie);
if(type=="user_option"){
$.get(url+"/personal_user?email="+val1+"&password="+val2,function(data)
{
if(data==0)
{
alert("用户名或密码不正确!");
}
else
{
//alert(document.cookie);
document.cookie = "userId="+data;
alert("登录成功!");
window.location.href="Navigation.html";
}
});
}
else if(type=="institution_option"){
$.get(url+"/institution/login?username="+val1+"&password="+val2,function(data)
{
if(data==0)
{
alert("用户名或密码不正确!");
}
else
{
document.cookie = "userId="+data;
alert("登录成功!");
window.location.href="Navigation.html";
//window.location.href="createmeetings.html";
}
});
}
}
function logout()
{
setCookie("userId", "", -1);
setCookie("type","",-1)
location.reload();
}
function uname1()
{
//alert("uname1"+document.cookie);
var a=checkName();
$("#uname").append(a);
}
function getCookie(c_name)
{
//alert(c_name);
//alert(document.cookie);
let c_end;
if(document.cookie.length>0){
c_start=document.cookie.indexOf(c_name+"=");
if(c_start!=-1){
c_start=c_start+c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if(c_end==-1){
c_end=document.cookie.length;
}
}
return unescape(document.cookie.substring(c_start,c_end));
}
return "";
}
/*
function getCookie(cname)
{
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++)
{
var c = ca[i].trim();
if (c.indexOf(name)==0)
return c.substring(name.length,c.length);
}
return "";
}*/
function checkName()
{
var type = getCookie("type");
var userid = getCookie("userId");
//alert("userid"+userid+" type"+type);
if(userid=="")
{
var b="游客";
return b;
}
else if(userid!="")
{
if(type=="user_option"){
document.getElementById("SignIn").href="#";
document.getElementById("LogIn").onclick=null;
var c="";
$.ajaxSettings.async=false;
//url=url+"/personal_user";
$.get(url+"/personal_user/info?uid="+userid,function(data,status){
c=data['username'];
});
return c;
}
else if(type=="institution_option"){
document.getElementById("SignIn").href="#";
document.getElementById("LogIn").onclick=null;
var c="";
$.ajaxSettings.async=false;
//url=url+"/personal_user";
$.get(url+"/institution/info?institution_id="+userid,function(data,status){
c=data['institutionName'];
});
return c;
}
}
}
function setCookie(cname, cvalue, exdays)
{
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}
function userLogin()
{
$('#userLogin').modal();
}
function userRegister()
{
$('#userRegister').modal();
}
function createMeeting()
{
var type = getCookie("type");
var userid = getCookie("userId");
if(type=="institution_option"&&userid!=""){
window.location.href="createmeetings.html";
}
}
function administration()
{
window.location.href="Administration.html";
}
</script>
</html>