用更友好的交互替换alert

This commit is contained in:
奶爸 2019-12-11 18:03:49 +08:00
parent 661fd6e534
commit e6434e70f0
2 changed files with 16 additions and 3 deletions

View File

@ -48,7 +48,13 @@ function showFormModal(modelSelector, formID, URL, getData) {
$.post(URL, JSON.stringify(data)).done(function (resp) { $.post(URL, JSON.stringify(data)).done(function (resp) {
if (resp.code == 200) { if (resp.code == 200) {
if (resp.message) { if (resp.message) {
alert(resp.message) $.suiAlert({
title: '操作成功',
type: 'success',
description: resp.message,
time: '3',
position: 'top-center',
});
} }
window.location.reload() window.location.reload()
} else { } else {
@ -74,6 +80,7 @@ function logout(id) {
$.suiAlert({ $.suiAlert({
title: '注销成功', title: '注销成功',
type: 'success', type: 'success',
description: '如需继续访问请使用 GitHub 再次登录',
time: '3', time: '3',
position: 'top-center', position: 'top-center',
}); });
@ -88,6 +95,12 @@ function logout(id) {
}); });
} }
}).fail(function (err) { }).fail(function (err) {
alert('网络错误:' + err.responseText) $.suiAlert({
title: '网络错误',
description: err.responseText,
type: 'error',
time: '3',
position: 'top-center',
});
}) })
} }

View File

@ -99,7 +99,7 @@
methods: { methods: {
secondToDate(s) { secondToDate(s) {
var d = Math.floor(s / 3600 / 24); var d = Math.floor(s / 3600 / 24);
var h = Math.floor(s / 3600); var h = Math.floor(s / 3600 % 24);
var m = Math.floor((s / 60 % 60)); var m = Math.floor((s / 60 % 60));
var s = Math.floor((s % 60)); var s = Math.floor((s % 60));
return result = d + "天" + h + "小时" + m + "分钟" + s + "秒"; return result = d + "天" + h + "小时" + m + "分钟" + s + "秒";