diff --git a/project_codebase.md b/project_codebase.md index c464d45..dcaa279 100644 --- a/project_codebase.md +++ b/project_codebase.md @@ -37,8 +37,15 @@ - **Purpose**: Displays the Privacy Policy. - **Features**: Static content detailing data collection, usage, and protection. Includes contact information. Responsive layout. +### `src/service/api/volunteer.ts` +- **Purpose**: API definitions for volunteer filling management. +- **Methods**: `saveVolunteer`, `getVolunteerDetail`. +- **Types**: `VolunteerInfo`, `VolunteerItem`, `VolunteerDetailResponse`. + ### `src/pages/simulate.vue` -- **Purpose**: Volunteer simulation page. -- **Features**: - - Panel A: Displays recommended majors list fetched from API (`/user/major/list`). Supports infinite scroll and filtering by probability. - - Panel B: Displays user's selected volunteers (Mock data for now). +- **Updated**: + - Integrated `getVolunteerDetail` and `saveVolunteer`. + - Implemented `isModified` state for unsaved changes detection. + - Added route leave protection and panel switch protection. + - Updated Panel B template to dynamic matching backend data structure. + diff --git a/project_doing.md b/project_doing.md index 40af199..9cb92a6 100644 --- a/project_doing.md +++ b/project_doing.md @@ -16,12 +16,27 @@ - [Result]: - Updated `UserMajorListResponse` to support `{ list: { items: [], probCount: {} } }` structure. - Added 'stable' (较稳妥) tab to `simulate.vue`. - - Implemented dynamic update of tab counts using `probCount` from API response. - ## 2026-01-23 ### [Task 8] Fix TypeScript type error in `simulate.vue` - **Time**: 2026-01-23 - **Goal**: Fix type error `Argument of type '"stable"' is not assignable to parameter of type 'TabKey'`. - **Scope**: `src/pages/simulate.vue` -- **Preparing**: Update `TabKey` definition to include `'stable'` and remove unused `'all'`. +- **Result**: Updated `TabKey` definition to include `'stable'` and remove unused `'all'`. + +## 2026-01-24 + +### [Task 9] Volunteer Filling Logic Perfection +- **Time**: 2026-01-24 +- **Goal**: Implement real API integration for saving and fetching volunteers, with modification detection. +- **Scope**: + - `src/service/api/volunteer.ts` (New) + - `src/pages/simulate.vue` (Update) +- **Result**: + - Created `volunteer.ts` with `saveVolunteer` and `getVolunteerDetail`. + - Integrated these into `simulate.vue`. + - Added `isModified` logic for reordering and deletion. + - Added `onBeforeRouteLeave` and `watch(activePanel)` protection for unsaved changes. + - Updated Panel B template to use real API data structure. + + diff --git a/project_index.md b/project_index.md index 0229e62..5e48ef5 100644 --- a/project_index.md +++ b/project_index.md @@ -16,3 +16,4 @@ - `src/pages/agreement.vue`: User agreement page. - `src/pages/privacy-policy.vue`: Privacy policy page. - `src/pages/simulate.vue`: Simulation and volunteer filling page. +- `src/service/api/volunteer.ts`: Volunteer management API. diff --git a/project_task.md b/project_task.md index 7e13fd2..ae3e81a 100644 --- a/project_task.md +++ b/project_task.md @@ -1,8 +1,6 @@ - - [x] [Task 6] User Recommended Major List API Integration - - [x] Create `src/service/api/major.ts` with types and API method - - [x] Integrate API in `src/pages/simulate.vue` (Panel A) - - [x] Update template to display real data -- [ ] [Task 8] Fix TypeScript type error in `simulate.vue` - - [ ] Add `'stable'` to `TabKey` type definition - - [ ] Cleanup unused `'all'` type if necessary +- [x] [Task 8] Fix TypeScript type error in `simulate.vue` +- [x] [Task 9] Volunteer Filling Logic Perfection + - [x] Encapsulate volunteer APIs (`src/service/api/volunteer.ts`) + - [x] Integrate save/detail logic in `simulate.vue` + - [x] Implement modification detection and leave protection diff --git a/src/pages/simulate.vue b/src/pages/simulate.vue index fee7c29..fc7f661 100644 --- a/src/pages/simulate.vue +++ b/src/pages/simulate.vue @@ -1,7 +1,9 @@