From e6434e70f0c4f42659af8f11fc0eef5303b48dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=B6=E7=88=B8?= Date: Wed, 11 Dec 2019 18:03:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=9B=B4=E5=8F=8B=E5=A5=BD=E7=9A=84?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E6=9B=BF=E6=8D=A2alert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/static/main.js | 17 +++++++++++++++-- resource/template/page/home.html | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/resource/static/main.js b/resource/static/main.js index 30f3195..2c9a446 100644 --- a/resource/static/main.js +++ b/resource/static/main.js @@ -48,7 +48,13 @@ function showFormModal(modelSelector, formID, URL, getData) { $.post(URL, JSON.stringify(data)).done(function (resp) { if (resp.code == 200) { if (resp.message) { - alert(resp.message) + $.suiAlert({ + title: '操作成功', + type: 'success', + description: resp.message, + time: '3', + position: 'top-center', + }); } window.location.reload() } else { @@ -74,6 +80,7 @@ function logout(id) { $.suiAlert({ title: '注销成功', type: 'success', + description: '如需继续访问请使用 GitHub 再次登录', time: '3', position: 'top-center', }); @@ -88,6 +95,12 @@ function logout(id) { }); } }).fail(function (err) { - alert('网络错误:' + err.responseText) + $.suiAlert({ + title: '网络错误', + description: err.responseText, + type: 'error', + time: '3', + position: 'top-center', + }); }) } diff --git a/resource/template/page/home.html b/resource/template/page/home.html index 07c35ee..ae68a05 100644 --- a/resource/template/page/home.html +++ b/resource/template/page/home.html @@ -99,7 +99,7 @@ methods: { secondToDate(s) { 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 s = Math.floor((s % 60)); return result = d + "天" + h + "小时" + m + "分钟" + s + "秒";