feat(signing): 支持点击文中签名位就地采集签名
This commit is contained in:
@@ -275,16 +275,20 @@ function hydrateTaskDocuments(records: SigningTaskRecord[]): SigningTaskRecord[]
|
||||
next = { ...next, signatureDataUrl: DEMO_SIGNATURE_DATA_URL }
|
||||
}
|
||||
|
||||
if (next.documentContentHtml) {
|
||||
return next
|
||||
}
|
||||
|
||||
const template = templates.get(next.documentId)
|
||||
|
||||
if (!template?.contentHtml) {
|
||||
return next
|
||||
}
|
||||
|
||||
// 已经进入签署流程的任务保留当时固化的正文——那是留痕的一部分,不能事后被换掉。
|
||||
// 尚未开始签署的任务则跟着演示种子走:演示数据是持久化在 localStorage 里的,
|
||||
// 改了 mock-document-library 的种子却还渲染上一轮的正文,表现为「新加的内容看不见」,
|
||||
// 排查成本很高(本地文档库演示入口已随 documents 开关一起关掉了)。
|
||||
if (next.documentContentHtml && !isTaskContentRefreshable(next.status)) {
|
||||
return next
|
||||
}
|
||||
|
||||
return {
|
||||
...next,
|
||||
templateVersionId: next.templateVersionId || template.versionId,
|
||||
@@ -293,6 +297,11 @@ function hydrateTaskDocuments(records: SigningTaskRecord[]): SigningTaskRecord[]
|
||||
})
|
||||
}
|
||||
|
||||
/** 正文可跟随演示种子刷新的状态:还没真正开始签署,正文只是待签的快照 */
|
||||
function isTaskContentRefreshable(status: SigningTaskStatus): boolean {
|
||||
return status === 'pending' || status === 'expired'
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示任务记录:优先用本地保存的,刷新后仍保留(任务固化的文书 HTML、签名图都在里面)。
|
||||
* 所有写操作都要调用 persistMockRecords 落盘,否则刷新会回到切换前的状态。
|
||||
|
||||
Reference in New Issue
Block a user