This commit is contained in:
chenyang
2022-07-03 16:02:18 +08:00
parent 12ee49e19a
commit e5a154ae8f
2 changed files with 17 additions and 25 deletions
+14 -22
View File
@@ -48,7 +48,7 @@
data: {'xx': 'xx'},
dataType: "json",
success: function (data) {
common_alert_(data.msg)
common_alert(data.msg)
setTimeout(function () {
location.reload();
}, 1000)
@@ -123,10 +123,10 @@
dataType: "json",
success: function (data) {
if (data.code === 0) {
primary_alert_(data.msg)
primary_alert(data.msg)
$('#' + card_id).remove()
} else {
common_alert_(data.msg)
common_alert(data.msg)
}
},
async: false
@@ -141,19 +141,12 @@
/**校验密码是否输入一致*/
validate_pw_eq: function (obj, inputPassword, inputPassword_) {
if (inputPassword !== inputPassword_) {
reg_alert('两次密码输入不一样,请确认!')
common_alert('两次密码输入不一样,请确认!')
return false
}
return true
},
/** 注册提示 */
reg_alert: function (text, class_str) {
common_alert_(text, class_str)
},
/** 登录提示 */
login_alert: function (text, class_str) {
common_alert_(text, class_str)
},
/** 设置窗口名称 */
set_modal_title: function (title) {
$('#exampleModal .modal-title').html(title);
@@ -197,7 +190,6 @@
me.set_modal_title('登录');
})
/** 注册按钮 */
$('#register_button').click(function () {
const userName = $('#userName').val();
@@ -205,12 +197,12 @@
const inputPassword_ = $('#inputPassword_').val();
if (!userName) {
me.reg_alert('请输入用户名')
common_alert('请输入用户名')
return
}
if (!inputPassword) {
me.reg_alert('请输入密码')
common_alert('请输入密码')
return
}
@@ -226,13 +218,13 @@
// 注册成功
if (data.code === 0) {
me.clear_reg_info()
me.reg_alert(data.msg, 'alert-primary')
common_alert(data.msg, 'alert-primary')
setTimeout(function () {
$('#p_login_a').click()
}, 1500)
} else {
// 注册失败
me.reg_alert(data.msg)
common_alert(data.msg)
}
},
async: false
@@ -246,7 +238,7 @@
const userName_login = $('#userName_login').val();
const inputPassword_login = $('#inputPassword_login').val();
if (!userName_login || !inputPassword_login) {
me.login_alert('请输入用户名和密码')
common_alert('请输入用户名和密码')
return
}
$.ajax({
@@ -258,14 +250,14 @@
success: function (data) {
// 登录成功
if (data.code === 0) {
me.login_alert(data.msg, 'alert-primary')
common_alert(data.msg, 'alert-primary')
$('#exampleModal').modal('hide')
setTimeout(function () {
location.reload();
}, 500)
} else {
// 登录失败
me.login_alert(data.msg)
common_alert(data.msg)
}
},
async: false
@@ -277,7 +269,7 @@
debugger
const mind_name = $('#mindName').val()
if (!mind_name) {
common_alert_('请输入导图名称')
common_alert('请输入导图名称')
return
}
@@ -298,7 +290,7 @@
window.open('detail?id=' + id)
}, 500)
} else {
common_alert_(resp.msg)
common_alert(resp.msg)
}
},
async: false
+3 -3
View File
@@ -1,4 +1,4 @@
function common_alert_(text, class_str) {
function common_alert(text, class_str) {
if (!class_str) {
class_str = 'alert-warning'
}
@@ -17,6 +17,6 @@ function common_alert_(text, class_str) {
}, 1500)
}
function primary_alert_(text) {
common_alert_(text, 'alert-primary')
function primary_alert(text) {
common_alert(text, 'alert-primary')
}