feat: prompt/confirm 替换为自定义弹窗

- shared/utils.js 新增 showConfirm()/showPrompt() 通用函数(inline CSS,无需额外样式)
- admin/common.js 移除重复 showConfirm(),统一使用 utils.js
- admin/posts.js: 3 处 confirm/prompt 替换(审核/退回/锁定)
- admin/comments.js: 1 处 confirm 替换
- settings/index.html: 4 处 confirm + 1 处 prompt 替换
- studio/posts.html + drafts.html: 3 处 confirm 替换
- post-view.js + login.js + post-favorite.js: 3 处 confirm 替换
This commit is contained in:
2026-06-02 20:11:48 +08:00
parent 2e6e7fc057
commit c73b131b83
10 changed files with 318 additions and 243 deletions

View File

@ -119,21 +119,23 @@
function removeFromFolder(folderId) {
if (loading) return;
if (!confirm('确定取消收藏吗?')) return;
loading = true;
api('DELETE', '/api/folders/' + folderId + '/posts/' + postId)
.then(function(d) {
loading = false;
if (d.success) {
currentFolderId = null;
updateBtn(false);
if (favCountEl) favCountEl.textContent = Math.max(0, (parseInt(favCountEl.textContent) || 0) - 1);
hideModal();
} else {
showConfirm('确认', '确定取消收藏吗?').then(function(ok) {
if (!ok) return;
loading = true;
api('DELETE', '/api/folders/' + folderId + '/posts/' + postId)
.then(function(d) {
loading = false;
if (d.success) {
currentFolderId = null;
updateBtn(false);
if (favCountEl) favCountEl.textContent = Math.max(0, (parseInt(favCountEl.textContent) || 0) - 1);
hideModal();
} else {
alert(d.message || '操作失败');
}
})
.catch(function() { loading = false; });
});
}
function createAndAdd(name) {