diff --git a/cwd-comments-admin/src/views/CommentsView.vue b/cwd-comments-admin/src/views/CommentsView.vue
index 8695790..86428e0 100644
--- a/cwd-comments-admin/src/views/CommentsView.vue
+++ b/cwd-comments-admin/src/views/CommentsView.vue
@@ -100,9 +100,49 @@
>
上一页
-
+ 1
+
+
+
+
+
+
@@ -130,6 +183,7 @@ const pagination = ref<{ page: number; total: number }>({ page: 1, total: 1 });
const loading = ref(false);
const error = ref("");
const statusFilter = ref("");
+const jumpPageInput = ref("");
const filteredComments = computed(() => {
if (!statusFilter.value) {
@@ -138,6 +192,29 @@ const filteredComments = computed(() => {
return comments.value.filter((item) => item.status === statusFilter.value);
});
+const visiblePages = computed(() => {
+ const total = pagination.value.total;
+ const current = pagination.value.page;
+ const maxVisible = 5;
+ if (total <= maxVisible) {
+ return Array.from({ length: total }, (_, index) => index + 1);
+ }
+ let start = current - Math.floor(maxVisible / 2);
+ let end = current + Math.floor(maxVisible / 2);
+ if (start < 1) {
+ start = 1;
+ end = maxVisible;
+ } else if (end > total) {
+ end = total;
+ start = total - maxVisible + 1;
+ }
+ const pages: number[] = [];
+ for (let i = start; i <= end; i += 1) {
+ pages.push(i);
+ }
+ return pages;
+});
+
function formatDate(value: number) {
const d = new Date(value);
if (Number.isNaN(d.getTime())) {
@@ -181,6 +258,19 @@ async function goPage(page: number) {
await loadComments(page);
}
+function handleJumpPage() {
+ const value = Number(jumpPageInput.value);
+ if (!Number.isFinite(value)) {
+ return;
+ }
+ const page = Math.floor(value);
+ if (page < 1 || page > pagination.value.total) {
+ return;
+ }
+ jumpPageInput.value = "";
+ loadComments(page);
+}
+
async function changeStatus(item: CommentItem, status: string) {
try {
await updateCommentStatus(item.id, status);
@@ -269,12 +359,12 @@ onMounted(() => {
border: 1px solid #d0d7de;
border-radius: 6px;
overflow: hidden;
+ overflow-x: auto;
}
.table-header {
display: flex;
background-color: #f6f8fa;
- border-bottom: 1px solid #d0d7de;
}
.table-row {
@@ -347,6 +437,8 @@ onMounted(() => {
font-weight: 500;
color: #57606a;
align-items: center;
+ background-color: #f6f8fa;
+ border-bottom: 1px solid #d0d7de;
}
.cell-id {
@@ -474,7 +566,7 @@ onMounted(() => {
}
.pagination {
- margin-top: 20px;
+ margin-top: 30px;
display: flex;
align-items: center;
gap: 8px;
@@ -494,8 +586,33 @@ onMounted(() => {
cursor: not-allowed;
}
-.pagination-info {
- font-size: 13px;
+.pagination-button-active {
+ background-color: #0969da;
+ color: #ffffff;
+ border-color: #0969da;
+}
+
+.pagination-ellipsis {
+ padding: 0 2px;
+ font-size: 12px;
color: #57606a;
}
+
+.pagination-jump {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ font-size: 12px;
+ color: #57606a;
+}
+
+.pagination-input {
+ width: 60px;
+ height: 24px;
+ box-sizing: border-box;
+ padding: 2px 4px;
+ border-radius: 4px;
+ border: 1px solid #d0d7de;
+ font-size: 12px;
+}
diff --git a/cwd-comments-admin/src/views/LayoutView.vue b/cwd-comments-admin/src/views/LayoutView.vue
index 20ae48e..297dd41 100644
--- a/cwd-comments-admin/src/views/LayoutView.vue
+++ b/cwd-comments-admin/src/views/LayoutView.vue
@@ -1,27 +1,61 @@
-