use spinner instead of showing alert while logging&registering

This commit is contained in:
printempw 2016-03-26 23:09:59 +08:00
parent 79c050da98
commit 52eaaa932a
2 changed files with 7 additions and 7 deletions

View File

@ -2,7 +2,7 @@
* @Author: printempw
* @Date: 2016-01-21 13:55:44
* @Last Modified by: printempw
* @Last Modified time: 2016-03-19 10:08:46
* @Last Modified time: 2016-03-26 23:07:15
*/
'use strict';
@ -17,7 +17,7 @@ var login = function() {
dataType: "json",
data: { "uname": uname, "passwd": passwd },
beforeSend: function() {
showMsg('alert-info', '登录中。。');
$('#login-button').html('<i class="fa fa-spinner fa-spin"></i> 登录中').prop('disabled', 'disabled');
},
success: function(json) {
console.log(json);
@ -33,7 +33,7 @@ var login = function() {
window.setTimeout('window.location = "./user/index.php"', 1000);
} else {
showAlert(json.msg);
showMsg('hide', '');
$('#login-button').html('登录').prop('disabled', '');
}
},
error: function(json) {
@ -53,7 +53,7 @@ var register = function() {
dataType: "json",
data: {'uname':uname, 'passwd':passwd},
beforeSend: function() {
showMsg('alert-info', '注册中...');
$('#register-button').html('<i class="fa fa-spinner fa-spin"></i> 注册中').prop('disabled', 'disabled');
},
success: function(json) {
if (json.errno == 0) {
@ -67,7 +67,7 @@ var register = function() {
});
} else {
showAlert(json.msg);
showMsg('hide', "");
$('#register-button').html('注册').prop('disabled', '');
}
},
error: function(json) {

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-01-17 13:55:20
* @Last Modified by: printempw
* @Last Modified time: 2016-03-26 22:28:22
* @Last Modified time: 2016-03-26 23:09:06
*/
session_start();
$dir = dirname(__FILE__);
@ -28,6 +28,7 @@ if (isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
<link rel="shortcut icon" href="./assets/images/favicon.ico">
<link rel="stylesheet" href="./assets/libs/pure/pure-min.css">
<link rel="stylesheet" href="./assets/libs/pure/grids-responsive-min.css">
<link rel="stylesheet" href="../assets/libs/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="./assets/css/style.css">
<link rel="stylesheet" href="./assets/css/index.style.css">
<link rel="stylesheet" href="./assets/libs/remodal/remodal.css">
@ -102,7 +103,6 @@ if (isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
</label>
<button id="login-button" class="pure-button pure-button-primary">登录</button>
</div>
<div id="msg" class="alert"></div>
</div>
<?php if (Option::get('user_can_register') == 1): ?>
<div class="remodal" data-remodal-id="register-modal">