feat(数据分析): 添加域名过滤功能并持久化存储

- 在评论、统计和访问分析页面添加域名过滤功能
- 使用localStorage持久化存储用户选择的域名过滤条件
- 新增30天访问趋势图表展示
- 优化API接口支持按域名过滤数据
- 添加每日访问统计记录功能
This commit is contained in:
anghunk
2026-01-21 22:35:59 +08:00
parent 73eaa975fe
commit 5d2cf49d96
7 changed files with 574 additions and 81 deletions

View File

@@ -251,7 +251,7 @@
</template>
<script setup lang="ts">
import { onMounted, ref, computed } from "vue";
import { onMounted, ref, computed, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
import {
CommentItem,
@@ -265,6 +265,8 @@ import {
blockEmail,
} from "../api/admin";
const DOMAIN_STORAGE_KEY = "cwd_admin_domain_filter";
const route = useRoute();
const router = useRouter();
@@ -273,7 +275,11 @@ const pagination = ref<{ page: number; total: number }>({ page: 1, total: 1 });
const loading = ref(false);
const error = ref("");
const statusFilter = ref("");
const domainFilter = ref("");
const storedDomain =
typeof window !== "undefined"
? window.localStorage.getItem(DOMAIN_STORAGE_KEY) || ""
: "";
const domainFilter = ref(storedDomain);
const jumpPageInput = ref("");
const editVisible = ref(false);
const editSaving = ref(false);
@@ -565,6 +571,15 @@ onMounted(() => {
loadComments(initialPage);
});
watch(
domainFilter,
(value) => {
if (typeof window !== "undefined") {
window.localStorage.setItem(DOMAIN_STORAGE_KEY, value || "");
}
}
);
</script>
<style scoped>