feat(web): 创作者中心「当前创作者」代看下拉 + 未绑定引导页

为什么:超管点进创作者中心原本是一片"未绑定创作者主体"的报错,既没说明原因也没有出路。
这批把两件事做出来:超管能在顶部选一个创作者只读代看;没有创作者身份的账号看到明确的引导页而不是白屏。

- 新增 useCreatorAccess(身份三态:granted / need-target / unbound)+ ImpersonationBar + CreatorAccessGuide,
  四个页面用 CreatorCenterPage 统一套壳;身份不满足时不打业务接口,避免一串无意义的报错提示
- 代看目标存 localStorage,由 axios.request 统一给 /admin/creator-center 的请求加 X-Creator-Id 头
  (不做查询参数;后端只对具备 impersonate 权限的账号认这个头)
- axios 支持 silent 请求:业务码非 0 时不弹全局提示、把 Result 交给调用方判断(引导页据此分流)
- 代看只读体验:代看态下「新建作品 / 编辑 / 提交审核 / 撤回」不渲染,编辑页整页禁用并提示原因
- 顶部下拉只在有 impersonate 权限时显示;无权限账号看不到、也不会请求 targets 接口
This commit is contained in:
Vicky committed 2026-10-15 15:25:53 +08:00
1 parent 0a2e3e0b81
commit 685c912313
19 files changed
+995 -658

No files matched your search

@@ -1,5 +1,6 @@
import { onMounted, ref } from 'vue'
import { getCreatorDashboardApi } from '@/api/admin/creatorCenter'
import { useCreatorAccess } from './useCreatorAccess'
/**
* 指标展示配置:key 与后端 /admin/creator-center/dashboard 的字段一一对应,
@@ -56,6 +57,7 @@ export const DASHBOARD_GROUPS = [
]
export function useCreatorDashboard() {
const { ensureAccess } = useCreatorAccess()
const loading = ref(false)
const board = ref(null)
const lastUpdated = ref('')
@@ -81,7 +83,10 @@ export function useCreatorDashboard() {
return board.value?.[groupKey]?.[metricKey]
}
onMounted(load)
onMounted(async () => {
if (!(await ensureAccess())) return
await load()
})
return { loading, board, lastUpdated, load, display, groupValue }
}