feat: 重构评估流程为内存状态管理并接入真实提交与报告接口
本次重构将评估草稿改为内存状态管理,移除本地存储草稿,新增评估流程内存状态模块;接入真实的账户资料获取、头像上传接口,新增账户缓存清理逻辑;重构评估提交逻辑,接入真实提交接口并返回评估ID;新增分析页和报告页的真实状态查询、报告获取功能;更新README文档,记录开发进度和接口状态。
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
// 仅供当前填写页与确认页传递数据,不写本机存储、不发起云端保存。
|
||||
let currentToken = ''
|
||||
let currentInput: UTSJSONObject | null = null
|
||||
let submissionFingerprint = ''
|
||||
let submissionKey = ''
|
||||
|
||||
export function clearAssessmentFlow(): void { currentToken = ''; currentInput = null; submissionFingerprint = ''; submissionKey = '' }
|
||||
// 只在本次流程内复用幂等键:网络超时可安全重试,修改提交内容时生成新键。
|
||||
export function assessmentRequestKey(token: string, fingerprint: string): string {
|
||||
const signature = token + ':' + fingerprint
|
||||
if (submissionFingerprint != signature || submissionKey.length == 0) {
|
||||
submissionFingerprint = signature
|
||||
submissionKey = 'assessment_' + Date.now().toString() + '_' + Math.random().toString(36).substring(2, 14)
|
||||
}
|
||||
return submissionKey
|
||||
}
|
||||
export function readAssessmentFlow(token: string): UTSJSONObject | null {
|
||||
if (token.length == 0 || token != currentToken) { clearAssessmentFlow(); return null }
|
||||
return currentInput
|
||||
}
|
||||
export function writeAssessmentFlow(token: string, input: UTSJSONObject): void {
|
||||
if (token.length == 0) { clearAssessmentFlow(); return }
|
||||
currentToken = token; currentInput = input
|
||||
}
|
||||
Reference in New Issue
Block a user