refactor(frontend): replace toast system with zibll notyf
This commit is contained in:
1 parent
fb11a7ed0c
commit
86614c4905
33 files changed
+603
-802
No files matched your search
+3
-15
@@ -117,15 +117,15 @@
|
||||
.then(function (result) {
|
||||
overlay.remove();
|
||||
if (result.success) {
|
||||
showToast(result.message || '举报已提交');
|
||||
notyf(result.message || '举报已提交');
|
||||
} else {
|
||||
showToast(result.message || '提交失败', 'error');
|
||||
notyf(result.message || '提交失败', 'danger');
|
||||
}
|
||||
})
|
||||
.catch(function () {
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.textContent = '提交举报';
|
||||
showToast('网络错误,请重试', 'error');
|
||||
notyf('网络错误,请重试', 'danger');
|
||||
});
|
||||
};
|
||||
btnRow.appendChild(submitBtn);
|
||||
@@ -140,18 +140,6 @@
|
||||
reasonInput.focus();
|
||||
}
|
||||
|
||||
function showToast(msg, type) {
|
||||
var toast = document.createElement('div');
|
||||
toast.textContent = msg;
|
||||
toast.style.cssText = 'position:fixed;top:20px;left:50%;transform:translateX(-50%);padding:12px 24px;border-radius:6px;color:#fff;font-size:14px;z-index:10000;transition:opacity 0.3s;';
|
||||
toast.style.background = type === 'error' ? '#e74c3c' : '#27ae60';
|
||||
document.body.appendChild(toast);
|
||||
setTimeout(function () {
|
||||
toast.style.opacity = '0';
|
||||
setTimeout(function () { toast.remove(); }, 300);
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
function initReportButtons() {
|
||||
document.addEventListener('click', function (e) {
|
||||
var btn = e.target.closest('[data-aksrt-report]');
|
||||
|
||||
Reference in new issue
Block a user