-
Notifications
You must be signed in to change notification settings - Fork 0
/
m_login.html
121 lines (118 loc) · 3.01 KB
/
m_login.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" type="text/css" href="lib/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/common.css">
<style>
#title{
text-align: center;
font-size: 25px;
margin-top: 180px;
}
#username , #options{
background-color: #EFEFEF;
border: none;
width: 80%;
height: 50px;
margin-top: 50px;
margin-left: 10%;
padding: 0 20px;
}
#options{
display: none;
}
.btn{
font-size: 22px;
width: 80%;
height: 50px;
margin-left: 10%;
margin-top: 30px;
background-color: #03C1FB;
}
input::-webkit-input-placeholder { text-align: center; }
</style>
</head>
<body>
<article class="content col-xs-12 col-md-4 col-md-offset-4" style="height:100%;">
<div id="title">输入你的名字</div>
<div class=>
<input id="username" type="text" placeholder="Your Name">
<select id="options" >
<option value="1">1000以下</option>
<option value="2">1000~3000</option>
<option value="3">3000~5000</option>
<option value="4">5000~8000</option>
<option value="5">8000以上</option>
</select>
</div>
<div class="button">
<input class="btn btn-info" id="submit" type="button" value="Next">
</div>
</article>
<script type="text/javascript" src="lib/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script>
exist = null;
$(function(){
$("#submit").click(function(e){
username = $("#username").val() ;
if( username ) {
registUser(username);
} else {
alert("请输入用户名");
}
});
});
function registUser( name ){
$.ajax({
type: "GET",
timeout: 3000,
url: target_url + "user_register",
async: "false",
data: { "name": name },
success: function (data, textStatus){
exist = data.target_vocabulary ;
console.log(data);
if ( exist ) {
//window.location = "m_preview.html?id="+2;
window.location = "m_index.html";
} else {
select = $("option:selected").val();
$(".button").unbind("click").click(function(){
sendUserData(select);
});
localStorage.vc_username = username;
$("#title").html("请选择词汇量");
$("#username").hide();
$("#options").show();
}
},
error: function (){
console.warn("获取数据失败");
}
});
}
function sendUserData(select){
console.log("send voc");
$.ajax({
type: "GET",
url: target_url + "receive_vocabulary_target",
async: "false",
data: { "vocabulary": select*1000 , "target": 1},
success: function (data, textStatus){
console.log(data);
console.log("选择词汇");
window.location = "m_preview.html?id="+2;
},
error: function (){
console.warn("获取数据失败");
}
});
}
</script>
</body>
</html>