-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.html
95 lines (92 loc) · 2.87 KB
/
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
<!DOCTYPE html>
<html class="ui-page-login">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>登录</title>
<link href="css/mui.min.css" rel="stylesheet" />
<link href="css/app.css" rel="stylesheet" />
<script src="js/mui.min.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/app.js"></script>
</head>
<body>
<header id="header" class="mui-bar mui-bar-nav">
<h1 class="mui-title">登录</h1>
</header>
<div class="mui-content">
<form id='form' action="login" class="mui-input-group" method="post">
<div class="mui-input-row">
<label>手机号</label> <input id='phone' value="15800418543" name="phone" type="text" class="mui-input-clear mui-input" placeholder="请输入账号">
</div>
<div class="mui-input-row">
<label>密码</label> <input type="password" name="password" id="password" value="123456" class="mui-input-password" placeholder="请输入密码">
</div>
</form>
<div class="mui-content-padded">
<button id='login' data-loading-text="提交中..." class="mui-btn mui-btn-block mui-btn-primary">登录</button>
<div class="link-area">
<a href="reg.html">注册账号</a> <span class="spliter">|</span>
<a href="forgetpwd.html">忘记密码</a>
<!-- <br>
<a href="html/beecloud.html">忘记密码</a>
<br>
<a href="zhifu.html">支付</a>-->
</div>
</div>
<div class="mui-content-padded oauth-area"></div>
</div>
<script>
mui.init({
statusBarBackground: '#f7f7f7'
});
mui.ready(function() {
//重写返回按钮
var backButtonPress = 0;
mui.back = function(event) {
backButtonPress++;
if(backButtonPress > 1) {
plus.runtime.quit();
} else {
plus.nativeUI.toast('再按一次退出应用');
}
setTimeout(function() {
backButtonPress = 0;
}, 1000);
return false;
};
//登录
document.getElementById("login").addEventListener("tap", function() {
if($("#phone").val() == "" || !/1[1-9]\d{9}/.test($("#phone").val())) {
mui.toast("请输入有效手机号!");
return false;
}
if($("#password").val() == "") {
mui.toast("请输入密码!");
return false;
}
mui("#login").button("loading");
$.ajax({
dataType: "json",
type: "post",
url: basePath + "ajaxLogin",
data: $("#form").serialize(),
success: function(result) {
if(result.success) {
myLocalStorage.setItem("member", result.data);
location.href = "index.html";
} else {
mui.toast(result.message)
}
mui("#login").button("reset");
},
error: function(result) {
mui.toast("请求遇到问题!")
mui("#login").button("reset");
}
});
})
})
</script>
</body>
</html>