first working version

This commit is contained in:
howard
2025-10-22 20:14:31 +08:00
parent c9767b830b
commit 8dc869634e
118 changed files with 22518 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
# Angular Frontend Specification (Minimal)
## Purpose
Render exams from JSON, preserve progress with autosave, support resume, and submit to produce bundled output.
## Routes
- `/` → list of available exams (published finished)
- `/exam/:examId` → exam player (start or resume)
- `/done/:attemptId` → submission confirmation with output file reference
## Data Loading
- On `/exam/:examId`, call `GET /api/exams/:examId` to load exam
- Start/resume via `POST /api/exams/:examId}/attempt` (idempotent: returns existing in-progress attempt if any)
## State & Autosave
- Local reactive form/state per question
- Autosave every N seconds and on blur/change via `PUT /api/attempts/:attemptId`
- Show "Saved just now" status with debounce
## Timer & Submit
- Countdown from `durationMinutes`
- Auto-submit on expiry
- Manual submit → POST submit → redirect to `/done/:attemptId`
## Resume Behavior
- On load, hydrate answers from attempt JSON
- Scroll to last answered question; restore timer based on `startedAt` and `durationMinutes`
## Edge Cases
- Version drift: if exam JSON `metadata.version` differs from attempts `examVersion`, show non-blocking warning
- Connectivity loss: queue autosaves and replay when online
- Double tabs: server enforces single active attempt; UI warns
## Accessibility & UX (minimal)
- Keyboard-first navigation, ARIA roles
- Clear focus states and error messages
- Save status and timer announced politely