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:
1 parent
0a2e3e0b81
commit
685c912313
19 files changed
+995
-658
No files matched your search
@@ -17,6 +17,7 @@ import {
|
||||
import { dateCell } from '@/utils/format'
|
||||
import { probeVideoDuration, resumeUpload, uploadFile } from '@/utils/uploader'
|
||||
import { submissionStatusMeta, submissionTypeText, submitOptions } from './useCreatorWorkspace'
|
||||
import { useCreatorAccess } from './useCreatorAccess'
|
||||
|
||||
/** 中断的上传会话按「作品 + 文件名 + 大小」记住,刷新后还能接着传 */
|
||||
const RESUME_KEY = 'creator-upload-sessions'
|
||||
@@ -37,6 +38,7 @@ function writeSession(key, value) {
|
||||
}
|
||||
|
||||
export function useDramaEdit() {
|
||||
const { ensureAccess, impersonating } = useCreatorAccess()
|
||||
const route = useRoute()
|
||||
const dramaId = Number(route.params.id)
|
||||
|
||||
@@ -56,10 +58,13 @@ export function useDramaEdit() {
|
||||
})
|
||||
|
||||
/** 只有草稿与已下线能改(与后端 requireEditable 一致),其余状态页面转只读 */
|
||||
const editable = computed(
|
||||
() => drama.value?.status === 'draft' || drama.value?.status === 'offline'
|
||||
)
|
||||
const editable = computed(() => {
|
||||
// 代看只读:整页禁用,与后端 requireWritable 的边界保持一致
|
||||
if (impersonating.value) return false
|
||||
return drama.value?.status === 'draft' || drama.value?.status === 'offline'
|
||||
})
|
||||
const readonlyReason = computed(() => {
|
||||
if (impersonating.value) return '代看模式只读:可以查看作品与分集,但不能编辑、上传或提交'
|
||||
switch (drama.value?.status) {
|
||||
case 'published':
|
||||
return '已上线的作品只读,要改内容请先提交「申请下线」'
|
||||
@@ -304,7 +309,10 @@ export function useDramaEdit() {
|
||||
await loadAll()
|
||||
}
|
||||
|
||||
onMounted(loadAll)
|
||||
onMounted(async () => {
|
||||
if (!(await ensureAccess())) return
|
||||
await loadAll()
|
||||
})
|
||||
|
||||
return {
|
||||
dramaId,
|
||||
|
||||
Reference in new issue
Block a user