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
+2
-14
@@ -40,11 +40,11 @@
|
||||
var isFollowing = result.data.is_following;
|
||||
updateFollowButton(btn, isFollowing, result.data.follower_count);
|
||||
} else {
|
||||
showToast(result.message || '操作失败', 'error');
|
||||
notyf(result.message || '操作失败', 'danger');
|
||||
}
|
||||
})
|
||||
.catch(function () {
|
||||
showToast('网络错误,请重试', 'error');
|
||||
notyf('网络错误,请重试', 'danger');
|
||||
})
|
||||
.finally(function () {
|
||||
btn.disabled = false;
|
||||
@@ -108,18 +108,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', initFollowButtons);
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user