|
|
@@ -15,39 +15,44 @@ $(document).ready(function () {
|
|
|
let account = $("#inputEmail").val();
|
|
|
let pw = $("#inputPassword").val();
|
|
|
|
|
|
- $.ajax({
|
|
|
- url: '/login',
|
|
|
- type: 'post',
|
|
|
- data: {"account": account, "pw": pw},
|
|
|
- success: function (response) {
|
|
|
- if (response.error === 0) {
|
|
|
- const url = response.last_page !== null && response.last_page !== undefined && response.last_page !== '' ?
|
|
|
- response.last_page : '/pm';
|
|
|
- if (response.login_ask === 0) {
|
|
|
- location.href = url;
|
|
|
- } else {
|
|
|
- response.compilation_list = response.compilation_list === undefined || response.compilation_list === '' ?
|
|
|
- null : JSON.parse(response.compilation_list);
|
|
|
- if (response.compilation_list === null || response.compilation_list.length <= 0) {
|
|
|
+ // 判断输入的邮箱/手机是否格式正确
|
|
|
+ if(/^1[3456789]\d{9}$/.test(account) || /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(account)) {
|
|
|
+ $.ajax({
|
|
|
+ url: '/login',
|
|
|
+ type: 'post',
|
|
|
+ data: {"account": account, "pw": pw},
|
|
|
+ success: function (response) {
|
|
|
+ if (response.error === 0) {
|
|
|
+ const url = response.last_page !== null && response.last_page !== undefined && response.last_page !== '' ?
|
|
|
+ response.last_page : '/pm';
|
|
|
+ if (response.login_ask === 0) {
|
|
|
location.href = url;
|
|
|
- return false;
|
|
|
+ } else {
|
|
|
+ response.compilation_list = response.compilation_list === undefined || response.compilation_list === '' ?
|
|
|
+ null : JSON.parse(response.compilation_list);
|
|
|
+ if (response.compilation_list === null || response.compilation_list.length <= 0) {
|
|
|
+ location.href = url;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ console.log(response.compilation_list);
|
|
|
+ setVersion(response.compilation_list);
|
|
|
+ $('#ver').modal('show');
|
|
|
}
|
|
|
- console.log(response.compilation_list);
|
|
|
- setVersion(response.compilation_list);
|
|
|
- $('#ver').modal('show');
|
|
|
+ } else if(response.error === 2) {
|
|
|
+ $('#check_ssoId').val(response.ssoId);
|
|
|
+ $('#phone').modal('show');
|
|
|
+ } else {
|
|
|
+ let msg = response.msg !== undefined ? response.msg : '未知错误';
|
|
|
+ showError(msg, $("input"));
|
|
|
}
|
|
|
- } else if(response.error === 2) {
|
|
|
- $('#check_ssoId').val(response.ssoId);
|
|
|
- $('#phone').modal('show');
|
|
|
- } else {
|
|
|
- let msg = response.msg !== undefined ? response.msg : '未知错误';
|
|
|
- showError(msg, $("input"));
|
|
|
+ },
|
|
|
+ error: function (result) {
|
|
|
+ showError('内部程序错误', null);
|
|
|
}
|
|
|
- },
|
|
|
- error: function (result) {
|
|
|
- showError('内部程序错误', null);
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ $('#emailHelp').text('您输入的 邮箱/手机 格式不对');
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
$("input").blur(function () {
|
|
|
@@ -224,7 +229,7 @@ function showError(msg, element) {
|
|
|
if (element !== null) {
|
|
|
element.parent().addClass('has-danger');
|
|
|
}
|
|
|
- $("#message").text(msg);
|
|
|
+ $("#message").html(msg);
|
|
|
$("#error-tips").show("fast");
|
|
|
}
|
|
|
|