fix(web): 适配后端 ID 字符串化(雪花 id 不能过 Number)

后端 J1 起所有 Long id 以字符串下发,审计出 4 处把 id 当数字用的地方:

- utils/creatorImpersonation.ts:代看创作者 id 曾 Number(raw) 存 localStorage,
  19 位 id 会被四舍五入导致 X-Creator-Id 头带错 id;改为全程字符串
- contentManagement/EpisodeManagementView.vue:Number(route.query.drama) 与 item.id 比较,
  从短剧管理带 ?drama= 跳过来会选不中;改为字符串比较
- creator-center/composables/useDramaEdit.js:Number(route.params.id) 同上,作品编辑打不开
- permission/composables/useMenuManagement.js:顶级菜单哨兵 0 与接口的 "0" 类型不一致,
  下拉回显会变裸 0;统一成字符串 '0'

核过不需要改:分页 total 后端保持数字;role.id === selectedRoleId 等两侧都来自接口;
formatCount 内部 Number() 吃字符串;全局无 id 算术/下标/a.id-b.id。
This commit is contained in:
Vicky committed 2026-10-16 16:44:19 +08:00
1 parent db313f4aa6
commit 3ec9ea6717
4 files changed
+22 -13

No files matched your search

@@ -42,7 +42,8 @@ function writeSession(key, value) {
export function useDramaEdit() {
const { ensureAccess, impersonating } = useCreatorAccess()
const route = useRoute()
const dramaId = Number(route.params.id)
// 作品 id 是字符串(雪花 id 过 Number 会被四舍五入),按字符串比对
const dramaId = route.params.id ? String(route.params.id) : ''
const loading = ref(false)
const drama = ref(null)