Authored by xuqi

zepto ajax

... ... @@ -16,12 +16,13 @@ $resend.on('touchstart', function(e) {
$.ajax({
url: $resend.data('url'),
type: 'GET'
}).then(function(data) {
if (data.code === 200) {
showErrTip(data.message);
} else {
showErrTip(data.message);
type: 'GET',
success: function(data) {
if (data.code === 200) {
showErrTip(data.message);
} else {
showErrTip(data.message);
}
}
});
});
\ No newline at end of file
... ...
... ... @@ -37,12 +37,13 @@ $btnSure.on('touchstart', function() {
type: 'POST',
data: {
email: email
}
}).then(function(data) {
if (data.code === 200) {
location.href = data.data;
} else {
showErrTip(data.message);
},
success: function(data) {
if (data.code === 200) {
location.href = data.data;
} else {
showErrTip(data.message);
}
}
});
} else {
... ...
... ... @@ -45,12 +45,13 @@ $btnNext.on('touchstart', function() {
data: {
area: country.split('+')[1],
mobile: pn
}
}).then(function(data) {
if (data.code === 200) {
location.href = '/passport/back/code';
} else {
showErrTip(data.message);
},
success: function(data) {
if (data.code === 200) {
location.href = '/passport/back/code';
} else {
showErrTip(data.message);
}
}
});
} else {
... ...
... ... @@ -37,17 +37,18 @@ $btnOk.on('touchstart', function() {
url: '/passport/back/update',
data: {
password: pwd
}
}).then(function(data) {
if (data.code === 200) {
showErrTip('密码修改成功');
//1000ms后跳转页面
setTimeout(function() {
location.href = '/';
}, 1000);
} else {
showErrTip(data.message);
},
success: function(data) {
if (data.code === 200) {
showErrTip('密码修改成功');
//1000ms后跳转页面
setTimeout(function() {
location.href = '/';
}, 1000);
} else {
showErrTip(data.message);
}
}
});
} else {
... ...
... ... @@ -50,15 +50,16 @@ module.exports = function(useInRegister) {
$.ajax({
type: 'POST',
url: '/passport/' + urlMid + '/sendPhone'
}).then(function (data) {
if (data.code === 200) {
$captchaTip.text('重发验证码 (60秒)').addClass('disable');
countDown();
} else {
url: '/passport/' + urlMid + '/sendPhone',
success: function(data) {
if (data.code === 200) {
$captchaTip.text('重发验证码 (60秒)').addClass('disable');
countDown();
} else {
//验证码不正确,显示提示
showErrTip(data.message);
//验证码不正确,显示提示
showErrTip(data.message);
}
}
});
});
... ... @@ -73,14 +74,15 @@ module.exports = function(useInRegister) {
url: '/passport/' + urlMid + '/verifycode',
data: {
verifyCode: trim($captcha.val())
}
}).then(function (data) {
if (data.code === 200) {
location.href = data.data;
} else {
},
success: function(data) {
if (data.code === 200) {
location.href = data.data;
} else {
//验证码不正确,显示提示
showErrTip(data.message);
//验证码不正确,显示提示
showErrTip(data.message);
}
}
});
});
... ...
... ... @@ -81,20 +81,22 @@ $loginBtn.on('touchstart', function() {
area: country.split('+')[1],
account: pn,
pwd: pwd
},
success: function(data) {
if (data.code === 200) {
showErrTip('登录成功');
//1000ms后跳转页面
setTimeout(function() {
location.href = data.data;
}, 1000);
} else {
showErrTip(data.message);
}
},
error: function() {
showErrTip('网络断开连接啦~');
}
}).then(function(data) {
if (data.code === 200) {
showErrTip('登录成功');
//1000ms后跳转页面
setTimeout(function() {
location.href = data.data;
}, 1000);
} else {
showErrTip(data.message);
}
}, function() {
showErrTip('网络断开连接啦~');
});
} else {
showErrTip('账号或密码有错误,请重新输入');
... ...
... ... @@ -84,20 +84,22 @@ $loginBtn.on('touchstart', function() {
data: {
account: acc,
pwd: pwd
},
success: function(data) {
if (data.code === 200) {
showErrTip('登录成功');
//1s后跳转页面
setTimeout(function() {
location.href = data.data;
}, 1000);
} else {
showErrTip(data.message);
}
},
error: function() {
showErrTip('网络断开连接啦~');
}
}).then(function(data) {
if (data.code === 200) {
showErrTip('登录成功');
//1s后跳转页面
setTimeout(function() {
location.href = data.data;
}, 1000);
} else {
showErrTip(data.message);
}
}, function() {
showErrTip('网络断开连接啦~');
});
} else {
showErrTip('账号或密码有错误,请重新输入');
... ...
... ... @@ -39,23 +39,24 @@ $btnSure.on('touchstart', function() {
url: '/passport/register/regmobile',
data: {
password: pwd
}
}).then(function(data) {
if (data.code === 200) {
showErrTip('注册成功');
//1000ms后跳转页面
setTimeout(function() {
location.href = data.data;
}, 1000);
} else {
if (data.code === 401 || data.code === 404 || data.code === 505) {
showErrTip(data.message);
} else {
showErrTip(data.message);
},
success: function(data) {
if (data.code === 200) {
showErrTip('注册成功');
//1000ms后跳转页面
setTimeout(function() {
location.href = data.data;
}, 1000);
} else {
if (data.code === 401 || data.code === 404 || data.code === 505) {
showErrTip(data.message);
} else {
showErrTip(data.message);
setTimeout(function() {
location.href = data.data;
}, 1000);
}
}
}
});
... ...
... ... @@ -45,12 +45,13 @@ $btnNext.on('touchstart', function() {
data: {
area: country.split('+')[1],
profile: pn
}
}).then(function(data) {
if (data.code === 200) {
location.href = '/passport/register/code';
} else {
showErrTip(data.message);
},
success: function(data) {
if (data.code === 200) {
location.href = '/passport/register/code';
} else {
showErrTip(data.message);
}
}
});
} else {
... ...