master
lion 3 months ago
parent 4c86be9616
commit 8e1e6dfa30

@ -1163,28 +1163,25 @@ function applyServerPayload(d: {
location_city?: string location_city?: string
oversea_country?: string oversea_country?: string
intro?: string intro?: string
recommend?: string | null
promise_signed_at?: string | null promise_signed_at?: string | null
promise_signature?: string | null promise_signature?: string | null
submitted_at?: string | null submitted_at?: string | null
files?: { id: number; kind: string; original_name: string; size: number; url: string }[] files?: { id: number; kind: string; original_name: string; size: number; url: string }[]
}) { } & Record<string, unknown>) {
applicationStatus.value = (d.status as 'draft' | 'submitted') || 'draft' applicationStatus.value = (d.status as 'draft' | 'submitted') || 'draft'
submittedAt.value = typeof d.submitted_at === 'string' ? d.submitted_at : '' submittedAt.value = typeof d.submitted_at === 'string' ? d.submitted_at : ''
participantMayEdit.value = d.participant_may_edit !== false participantMayEdit.value = d.participant_may_edit !== false
formModel.player_name = d.player_name || '' for (const f of schemaFields.value) {
formModel.school = d.school || '' if (f.type === 'file') continue
formModel.degree = d.degree || '' if (f.key === 'commitment_accepted' || f.key === 'promise_signature') continue
formModel.contact_email = d.contact_email || '' const raw = Object.prototype.hasOwnProperty.call(d, f.key) ? d[f.key] : undefined
formModel.contact_mobile = d.contact_mobile || '' if (f.type === 'checkbox') {
formModel.entry_group = d.entry_group || '' formModel[f.key] = raw ? '1' : ''
formModel.company_name = d.company_name || '' } else {
formModel.project_name = d.project_name || '' formModel[f.key] = raw != null ? String(raw) : ''
formModel.track = d.track || '' }
formModel.location_country = d.location_country || '' }
formModel.location_province = d.location_province || ''
formModel.location_city = d.location_city || ''
formModel.oversea_country = d.oversea_country || ''
formModel.intro = d.intro || ''
const hasSignaturePayload = Object.prototype.hasOwnProperty.call(d, 'promise_signature') const hasSignaturePayload = Object.prototype.hasOwnProperty.call(d, 'promise_signature')
const sig = hasSignaturePayload const sig = hasSignaturePayload
? typeof d.promise_signature === 'string' ? typeof d.promise_signature === 'string'

Loading…
Cancel
Save