UXInteract / task_007 /instruction.md
DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
|
Raw History Blame Contribute Delete
2.46 kB

Practice-question administration dashboard

Extend the supplied index.html into a local practice-question dashboard with question, user and permission management. Deliver the root index.html for direct, offline browser use. Keep state in memory; do not add login or a backend.

Question and role management

An administrator can add a question from text, edit it, toggle it between published and unpublished, and delete it. Each action affects only its selected question, and status changes are visible. A regular user can browse but cannot change the question bank. Hide, remove or disable management controls in that role; if a control remains in the DOM, programmatic clicks must not allow mutations. Returning to the admin role restores management.

Edit through the main input, an accessible dialog with a text field and a Save button (保存、确认 or 确定 in Chinese), or a native prompt. Give Edit and Delete buttons recognizable accessible names. Use a native <select> for the role selector, distinguishing Administrator and Normal User in English or Chinese (管理员 / 普通用户).

User records and page hooks

Show local users with basic information and their own answer records. Expose window.__setUsers(users) to replace the list with entries shaped as {id, name, email, records: string[]} and refresh through the normal page renderer. Display the provided name and email on the corresponding card. An empty list shows no answer records; a no-records message is optional.

Use the following data-testid values, retaining the starter's existing hooks:

  • Sections: admin-dashboard, question-bank, user-management, permission-management.
  • Question and role controls: question-input, upload-question, question-item, edit-question, offline-question, delete-question, role-select.
  • User cards: user-card with the corresponding data-user-id; use answer-record on each actual record inside the card.

Acceptance Checklist

  • All dashboard sections render offline. Adding appends the supplied text; editing, unpublishing/republishing and deletion affect only the selected question.
  • Regular users cannot add, edit, change status or delete, including through programmatic clicks. Returning to admin restores those actions.
  • User management displays actual answer records. Replacing the list displays each supplied user and only their own records; empty lists show no answer-record entries.