fix(cover): 修复AI数字人封面模板403 #2043
Reference in New Issue
Block a user
Delete Branch "fix/cover-template-403"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
AI数字人页面调用封面模板接口返回403:点击系统模板编辑保存时返回403。
根因
修复
根因: - 后端 PUT /cover-templates/{id} 对 is_system=true 的模板返回 403「系统模板不可修改」是正确的权限控制 - 前端 CoverSettingsModal 对系统模板(默认模板/大胆红/优雅黑等)也渲染「编辑」按钮 - useSharedCover/useStep6Cover 的 handleSaveTemplate 只要 tpl.id 存在就走 update 分支,对系统模板调用 PUT → 403 - 用户在 AI 数字人页面(无 project/task 上下文)点击系统模板编辑/保存时复现 403 修复: 1. CoverSettingsModal: 系统模板按钮文字从「编辑」改为「复制」,语义明确为另存为 2. useSharedCover.handleEditTemplate: 系统模板点击时创建新模板草稿(清空id, 名称加「副本」, is_system=false) 3. useSharedCover.handleSaveTemplate: 增加 isSystem 判断,系统模板或无id都走 create 分支 4. useStep6Cover 同步上述修复,保持 generate 页面行为一致 5. 保存成功后清空 editingTemplate,避免后续打开残留状态CI全绿,自动审批通过。
CI全绿,自动审批通过。
🚀 预览环境已部署
🗑️ 预览环境已清理
PR #2043 已关闭或合并,对应的预览环境已被清理。