feat(web): 07 创作者中心四个页面(我的作品 / 作品编辑 / 收费配置 / 数据看板)
为什么:07 的接口五批都做完了,但创作者在界面上一个都点不到 —— 只能靠 curl。 这批把创作者中心做进后台管理(沿用 AppUsersView 那套 api 封装 + composable + 视图 + 样式与 console.css), 创作者用自己的后台账号登录就能完成"建草稿 → 编辑分集传片 → 提交审核 → 配置收费 → 看数据"的闭环。 - WorkspaceView:主体状态 / 我的作品(含最近一次提交的审核进度)/ 通知列表;新建草稿、按状态给出可提交的动作、撤回 - DramaEditView:作品信息(封面、预告片)、分集增删与上移下移、分片上传(复用 /admin/media)+ 断点续传 (会话存 localStorage,中断后「继续上传」接着传)、产物挂载、提交记录与撤回;非草稿/已下线状态整页转只读 - PriceConfigView:整剧免费集数与解锁金币 + 逐集免费/收费/试看秒数;已上线只读(需先申请下线) - DashboardView:作品 / 播放 / 互动 / 解锁收入四组指标,取不到的显示「暂无数据源」+ notes 口径说明 - 时间列统一 yyyy-MM-dd HH:mm:ss;表格列与后端字段一一对应,不在前端编字段 - media.ts 补上传进度接口;uploader 补 resumeUpload(先查服务端进度再续传)
This commit is contained in:
1 parent
f037d243cd
commit
0a2e3e0b81
13 files changed
+2113
-1
No files matched your search
@@ -0,0 +1,87 @@
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { getCreatorDashboardApi } from '@/api/admin/creatorCenter'
|
||||
|
||||
/**
|
||||
* 指标展示配置:key 与后端 /admin/creator-center/dashboard 的字段一一对应,
|
||||
* 不在前端编字段;口径见后端 CreatorDashboardService 注释与 docs/api-phase1.md「2.10」。
|
||||
*/
|
||||
export const DASHBOARD_GROUPS = [
|
||||
{
|
||||
key: 'drama',
|
||||
title: '我的作品',
|
||||
metrics: [
|
||||
{ key: 'total', label: '作品总数' },
|
||||
{ key: 'draft', label: '草稿' },
|
||||
{ key: 'reviewing', label: '审核中' },
|
||||
{ key: 'approved', label: '待发布' },
|
||||
{ key: 'published', label: '已上线' },
|
||||
{ key: 'offline', label: '已下线' },
|
||||
{ key: 'episodeTotal', label: '分集总数' },
|
||||
{ key: 'episodeWithMedia', label: '有片源分集' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'playback',
|
||||
title: '播放',
|
||||
metrics: [
|
||||
{ key: 'viewTotal', label: '累计观看' },
|
||||
{ key: 'playTotal', label: '累计播放' },
|
||||
{ key: 'watchedDramas', label: '看过我的剧(用户×剧)' },
|
||||
{ key: 'finishedDramas', label: '其中标记完播' },
|
||||
{ key: 'finishRate', label: '完播率' },
|
||||
{ key: 'playEvents7d', label: '近 7 天播放流水' },
|
||||
{ key: 'playEventsTotal', label: '播放流水总量' },
|
||||
{ key: 'finishEvents', label: '完播事件' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'interaction',
|
||||
title: '互动',
|
||||
metrics: [
|
||||
{ key: 'favoriteTotal', label: '收藏' },
|
||||
{ key: 'commentTotal', label: '评论' },
|
||||
{ key: 'commentPending', label: '待审评论' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'revenue',
|
||||
title: '解锁收入',
|
||||
metrics: [
|
||||
{ key: 'unlockCount', label: '解锁笔数' },
|
||||
{ key: 'coinIncome', label: '金币收入' },
|
||||
{ key: 'coinIncome7d', label: '近 7 天金币收入' },
|
||||
{ key: 'paidOrderAmount', label: '法币收入金额' }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
export function useCreatorDashboard() {
|
||||
const loading = ref(false)
|
||||
const board = ref(null)
|
||||
const lastUpdated = ref('')
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
board.value = (await getCreatorDashboardApi()).data || null
|
||||
lastUpdated.value = new Date().toLocaleString()
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 取不到的指标后端给 null,这里显示「暂无数据源」而不是 0 */
|
||||
function display(value) {
|
||||
if (value === null || value === undefined) return '暂无数据源'
|
||||
if (typeof value === 'number' && !Number.isInteger(value)) return value.toFixed(3)
|
||||
return value
|
||||
}
|
||||
|
||||
function groupValue(groupKey, metricKey) {
|
||||
return board.value?.[groupKey]?.[metricKey]
|
||||
}
|
||||
|
||||
onMounted(load)
|
||||
|
||||
return { loading, board, lastUpdated, load, display, groupValue }
|
||||
}
|
||||
Reference in new issue
Block a user