([]);
const pagination = ref<{ page: number; total: number }>({ page: 1, total: 1 });
const loading = ref(false);
@@ -269,10 +273,16 @@ async function loadComments(page?: number) {
}
}
+function updateRoutePage(page: number) {
+ const query = { ...route.query, p: String(page) };
+ router.replace({ query });
+}
+
async function goPage(page: number) {
if (page < 1 || page > pagination.value.total) {
return;
}
+ updateRoutePage(page);
await loadComments(page);
}
@@ -286,6 +296,7 @@ function handleJumpPage() {
return;
}
jumpPageInput.value = "";
+ updateRoutePage(page);
loadComments(page);
}
@@ -341,7 +352,21 @@ async function handleBlockEmail(item: CommentItem) {
}
onMounted(() => {
- loadComments();
+ const p = route.query.p;
+ let initialPage = 1;
+ if (typeof p === "string") {
+ const value = Number(p);
+ if (Number.isFinite(value) && value >= 1) {
+ initialPage = Math.floor(value);
+ }
+ } else if (Array.isArray(p) && typeof p[0] === "string") {
+ const value = Number(p[0]);
+ if (Number.isFinite(value) && value >= 1) {
+ initialPage = Math.floor(value);
+ }
+ }
+ updateRoutePage(initialPage);
+ loadComments(initialPage);
});
diff --git a/cwd-admin/src/views/DataView.vue b/cwd-admin/src/views/DataView.vue
index 06cfdec..c8084fc 100644
--- a/cwd-admin/src/views/DataView.vue
+++ b/cwd-admin/src/views/DataView.vue
@@ -76,7 +76,7 @@
@@ -210,7 +210,7 @@ async function handleFileChange(event: Event) {
}
} catch (err: any) {
console.error(err);
- addLog(`导入失败: ${err.message || "未知错误"}`);
+ addLog(`导入失败:${err.message || "未知错误"}`);
showToast(err.message || "导入失败,文件格式错误", "error");
importing.value = false;
}
@@ -299,11 +299,11 @@ async function executeImport(comments: any[]) {
addLog("正在上传并导入数据库...");
try {
const res = await importComments(comments);
- addLog(`导入完成: ${res.message || "成功"}`);
+ addLog(`导入完成:${res.message || "成功"}`);
showToast(res.message || "导入成功", "success");
} catch (err: any) {
console.error(err);
- addLog(`导入失败: ${err.message || "未知错误"}`);
+ addLog(`导入失败:${err.message || "未知错误"}`);
showToast(err.message || "导入失败", "error");
} finally {
importing.value = false;
@@ -444,6 +444,7 @@ async function executeImport(comments: any[]) {
color: #ffffff;
font-size: 14px;
cursor: pointer;
+ min-width: 100px;
}
.card-button:disabled {
diff --git a/cwd-admin/src/views/LayoutView.vue b/cwd-admin/src/views/LayoutView.vue
index 8c5c67a..7b7cb48 100644
--- a/cwd-admin/src/views/LayoutView.vue
+++ b/cwd-admin/src/views/LayoutView.vue
@@ -327,7 +327,7 @@ function handleLogoutFromActions() {
left: 0;
right: 0;
bottom: 0;
- background-color: rgba(0, 0, 0, 0.3);
+ background-color: rgba(0, 0, 0, 0.6);
z-index: 900;
display: block;
}
diff --git a/cwd-admin/src/views/SettingsView.vue b/cwd-admin/src/views/SettingsView.vue
index d49f797..eafcf9c 100644
--- a/cwd-admin/src/views/SettingsView.vue
+++ b/cwd-admin/src/views/SettingsView.vue
@@ -701,6 +701,7 @@ onMounted(() => {
color: #ffffff;
font-size: 14px;
cursor: pointer;
+ min-width: 100px;
}
.card-button.secondary {