fix: 管理会话自动恢复与访问来源统计优化
- 新增 AdminSessionRecover:后台离线/后端重启时自动重试恢复会话,明确失效才回跳登录 - 认证 cookie 契约调整(SameSite=Lax 与刷新轮转适配),路由与守卫适配 - 访问来源统计查询优化与测试、管理端 analytics sources 页面适配 - 移动端布局修正:覆盖 body min-h-screen 避免内容区高度异常
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { AdminChartCard, NamedBarChart, NamedPieChart } from "@/components/admin/charts";
|
||||
import { apiStatsSources, type VisitSources } from "@/lib/api";
|
||||
import { RangeSegmented, StatsState, TableEmpty, refKindLabel } from "../ui";
|
||||
import { RangeSegmented, StatsState, TableEmpty, formatInt, refKindLabel } from "../ui";
|
||||
|
||||
/** 来源按日表:固定展示四类主要来源列 */
|
||||
const TREND_KINDS = ["direct", "search", "social", "external"] as const;
|
||||
@@ -49,11 +49,25 @@ export default function SourcesPage() {
|
||||
</AdminChartCard>
|
||||
|
||||
<div className="grid gap-4 lg:grid-cols-2">
|
||||
<AdminChartCard title="搜索引擎明细" hint="来自搜索结果页的浏览 Top 10">
|
||||
{data.search_hosts.length ? (
|
||||
<NamedBarChart data={data.search_hosts.map((h) => ({ label: h.key, count: h.count }))} />
|
||||
<AdminChartCard title="站内搜索词 Top 10" hint="搜索结果页(/?q=)浏览量 Top 10">
|
||||
{data.search_terms.length ? (
|
||||
<ul className="flex flex-col divide-y max-h-[360px] overflow-y-auto" style={{ borderColor: "var(--line)" }}>
|
||||
{data.search_terms.map((t, i) => (
|
||||
<li key={`${i}-${t.key}`} className="py-2 flex items-center gap-3 text-[13px]">
|
||||
<span className="w-5 text-right tabular-nums shrink-0" style={{ color: "var(--ink-3)" }}>
|
||||
{i + 1}
|
||||
</span>
|
||||
<span className="flex-1 min-w-0 truncate" style={{ color: "var(--ink)" }} title={t.key}>
|
||||
{t.key}
|
||||
</span>
|
||||
<span className="tabular-nums shrink-0" style={{ color: "var(--ink-2)" }}>
|
||||
{formatInt(t.count)}
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<TableEmpty text="暂无搜索引擎来源" />
|
||||
<TableEmpty text="暂无站内搜索" />
|
||||
)}
|
||||
</AdminChartCard>
|
||||
<AdminChartCard title="外部链接明细" hint="其他站点跳转来源 Top 10">
|
||||
|
||||
Reference in New Issue
Block a user