feat: 同步精简接口并统一表单校验

This commit is contained in:
GJ committed 2026-09-10 22:34:47 +08:00
1 parent 82d7bde631
commit 2eea0ea72e
66 files changed
+1611 -1100

No files matched your search

@@ -17,8 +17,7 @@ import type {
/** 单主体保存响应必须与提交时固定的正式 ID 一致。 */
function assertIdentity(value: SubjectIdentity, id: string) {
if (!value || value.subjectId !== id || value.images.some(image => image.identityId !== value.id))
throw new Error('后端未返回匹配的主体身份,请刷新核对。')
if (!value || value.subjectId !== id) throw new Error('后端未返回匹配的主体身份,请刷新核对。')
}
/** 主体目录、项目风格和当前身份分开查询,未创建 Identity 不误报为空图库错误。 */
@@ -256,7 +255,7 @@ export function useSubjectIdentity() {
!result ||
result.id !== imageId ||
result.identityId !== identityId ||
!result.enabled ||
!result.isAnchor ||
!canBeAnchor(result)
)
throw new Error('接口未确认身份母版切换,请刷新核对。')
@@ -282,10 +281,13 @@ export function useSubjectIdentity() {
const result = await subjectIdentityApi.confirmCasting(subjectId, imageId)
if (
!result ||
result.identity.id !== identityId ||
!result.identity.isLocked ||
result.identityId !== identityId ||
result.subjectId !== subjectId ||
!result.isLocked ||
result.anchor.id !== imageId ||
!result.anchor.enabled
!result.anchor.isAnchor ||
result.anchor.identityId !== identityId ||
!canBeAnchor(result.anchor)
)
throw new Error('接口未确认演员母版与身份锁定,请刷新核对。')
})