管理删除气泡
This commit is contained in:
1 parent
222c9b8f3c
commit
2a01e8ca3d
1 file changed
+9
-17
+9
-17
@@ -451,7 +451,7 @@ function renderAdminSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// 🎨 自定义 CSS(独立标签页)
|
// 🎨 自定义 CSS(独立标签页)- 已改用 Toast 提示
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
function renderAdminCustomCSS() {
|
function renderAdminCustomCSS() {
|
||||||
@@ -524,43 +524,37 @@ function renderAdminCustomCSS() {
|
|||||||
|
|
||||||
function handleCssFile(file) {
|
function handleCssFile(file) {
|
||||||
if (file.name !== 'style.css') {
|
if (file.name !== 'style.css') {
|
||||||
statusEl.textContent = '❌ 文件名必须是 style.css';
|
showToast('文件名必须是 style.css', 'error');
|
||||||
statusEl.style.color = '#ef4444';
|
|
||||||
selectedFile = null;
|
selectedFile = null;
|
||||||
fileInput.value = '';
|
fileInput.value = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!file.type.includes('text/css') && !file.name.endsWith('.css')) {
|
if (!file.type.includes('text/css') && !file.name.endsWith('.css')) {
|
||||||
statusEl.textContent = '❌ 请上传 CSS 文件';
|
showToast('请上传 CSS 文件', 'error');
|
||||||
statusEl.style.color = '#ef4444';
|
|
||||||
selectedFile = null;
|
selectedFile = null;
|
||||||
fileInput.value = '';
|
fileInput.value = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectedFile = file;
|
selectedFile = file;
|
||||||
statusEl.textContent = '✅ 已选择: ' + file.name + ' (' + (file.size / 1024).toFixed(1) + ' KB)';
|
showToast('已选择: ' + file.name + ' (' + (file.size / 1024).toFixed(1) + ' KB)', 'success');
|
||||||
statusEl.style.color = '#22c55e';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('customCssSaveBtn').addEventListener('click', function() {
|
document.getElementById('customCssSaveBtn').addEventListener('click', function() {
|
||||||
if (!selectedFile) {
|
if (!selectedFile) {
|
||||||
statusEl.textContent = '⚠️ 请先选择 style.css 文件';
|
showToast('请先选择 style.css 文件', 'warning');
|
||||||
statusEl.style.color = '#f59e0b';
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
showCustomCssWarningModal(async function() {
|
showCustomCssWarningModal(async function() {
|
||||||
try {
|
try {
|
||||||
await API.uploadCustomCSS(selectedFile);
|
await API.uploadCustomCSS(selectedFile);
|
||||||
statusEl.textContent = '✅ CSS 上传成功!刷新页面查看效果';
|
showToast('CSS 上传成功!刷新页面查看效果', 'success');
|
||||||
statusEl.style.color = '#22c55e';
|
|
||||||
selectedFile = null;
|
selectedFile = null;
|
||||||
fileInput.value = '';
|
fileInput.value = '';
|
||||||
dropText.textContent = '点击或拖拽上传 style.css';
|
dropText.textContent = '点击或拖拽上传 style.css';
|
||||||
loadCustomCSS();
|
loadCustomCSS();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
statusEl.textContent = '❌ 上传失败:' + err.message;
|
showToast('上传失败:' + err.message, 'error');
|
||||||
statusEl.style.color = '#ef4444';
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -569,13 +563,11 @@ function renderAdminCustomCSS() {
|
|||||||
if (!confirm('确定要删除自定义 CSS 吗?将恢复默认样式。')) return;
|
if (!confirm('确定要删除自定义 CSS 吗?将恢复默认样式。')) return;
|
||||||
try {
|
try {
|
||||||
await API.deleteCustomCSS();
|
await API.deleteCustomCSS();
|
||||||
statusEl.textContent = '✅ 已删除自定义 CSS';
|
showToast('已删除自定义 CSS', 'success');
|
||||||
statusEl.style.color = '#22c55e';
|
|
||||||
const link = document.getElementById('customCssLink');
|
const link = document.getElementById('customCssLink');
|
||||||
if (link) link.remove();
|
if (link) link.remove();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
statusEl.textContent = '❌ 删除失败:' + err.message;
|
showToast('删除失败:' + err.message, 'error');
|
||||||
statusEl.style.color = '#ef4444';
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user