From c2ef1cad8473163d602f3d45d3d0445f0624a0e8 Mon Sep 17 00:00:00 2001 From: zhouwentao Date: Fri, 2 Jan 2026 21:38:55 +0800 Subject: [PATCH] update --- .env.development | 2 +- docs/用户推荐专业列表API.md | 116 +++++++++++++++++ project_codebase.md | 42 ++----- project_doing.md | 71 ++--------- project_index.md | 2 + project_task.md | 41 +----- src/pages/simulate.vue | 242 ++++++++++++++++-------------------- src/service/api/major.ts | 61 +++++++++ task_detail.md | 74 ++--------- 9 files changed, 323 insertions(+), 328 deletions(-) create mode 100644 docs/用户推荐专业列表API.md create mode 100644 src/service/api/major.ts diff --git a/.env.development b/.env.development index 722ca9b..faa5b1f 100644 --- a/.env.development +++ b/.env.development @@ -4,7 +4,7 @@ VITE_API_BASE_URL=/api # Proxy Target (Where the /api requests are forwarded to) 改完后需要重启 -VITE_API_PROXY_TARGET=http://localhost:8080 +VITE_API_PROXY_TARGET=http://localhost:8081 # Other development-specific variables VITE_APP_TITLE=My App (Development) diff --git a/docs/用户推荐专业列表API.md b/docs/用户推荐专业列表API.md new file mode 100644 index 0000000..b60e3c0 --- /dev/null +++ b/docs/用户推荐专业列表API.md @@ -0,0 +1,116 @@ +--- +title: 艺考招生管理系统 API +language_tabs: + - shell: Shell + - http: HTTP + - javascript: JavaScript + - ruby: Ruby + - python: Python + - php: PHP + - java: Java + - go: Go +toc_footers: [] +includes: [] +search: true +code_clipboard: true +highlight_theme: darkula +headingLevel: 2 +generator: "@tarslib/widdershins v4.0.30" + +--- + +# 艺考招生管理系统 API + +提供用户认证、院校专业、历年招生、计算专业的管理接口 + +Base URLs: + +# Authentication + +# 用户专业 + +## GET 获取当前用户可检索列表 + +GET /user/major/list + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|page|query|integer| 否 |页码| +|size|query|integer| 否 |每页数量| +|batch|query|string| 否 |批次(本科提前批/本科A段/本科B段/本科/高职高专)| +|probability|query|string| 否 |录取概率类型(难录取/可冲击/较稳妥/可保底)| + +> 返回示例 + +> 200 Response + +``` +{"code":200,"message":"success","data":{"list":[{"schoolCode":"1495","schoolName":"哈尔滨工业大学","majorCode":"130508","majorName":"数字媒体艺术","majorType":"美术与设计类","majorTypeChild":"","planNum":2,"mainSubjects":"","limitation":"","chineseScoreLimitation":0,"englishScoreLimitation":0,"culturalScoreLimitation":0,"professionalScoreLimitation":0,"enrollmentCode":"02","tuition":"8000元/年","detail":"","category":"理科","batch":"提前批","rulesEnrollProbability":"专过文排","probabilityOperator":"文*1+专*0","rulesEnrollProbabilitySx":"专过文排","kslx":"","state":"1","historyMajorEnrollMap":{"2024":{"year":"2024","enrollmentCode":"03","enrollmentCount":0,"rulesEnrollProbability":"专过文排","probabilityOperator":"文*1+专*0","admissionLine":546.225,"controlLine":300}},"enrollProbability":64.5751,"studentScore":0}],"total":18,"page":1,"size":10}} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|Inline| + +### 返回数据结构 + +状态码 **200** + +|名称|类型|必选|约束|中文名|说明| +|---|---|---|---|---|---| +|» code|integer|true|none||none| +|» message|string|true|none||none| +|» data|object|true|none||none| +|»» list|[object]|true|none||none| +|»»» schoolCode|string|true|none|院校代码|none| +|»»» schoolName|string|true|none|院校名称|none| +|»»» majorCode|string|true|none||none| +|»»» majorName|string|true|none|专业名称|none| +|»»» majorType|string|true|none||none| +|»»» majorTypeChild|string|true|none||none| +|»»» planNum|integer|true|none|计划人数|none| +|»»» mainSubjects|string|true|none||none| +|»»» limitation|string|true|none||none| +|»»» chineseScoreLimitation|integer|true|none||none| +|»»» englishScoreLimitation|integer|true|none||none| +|»»» culturalScoreLimitation|integer|true|none||none| +|»»» professionalScoreLimitation|integer|true|none||none| +|»»» enrollmentCode|string|true|none|招录专业代码|none| +|»»» tuition|string|true|none|学费|none| +|»»» detail|string|true|none|详情|none| +|»»» category|string|true|none|文理分科|none| +|»»» batch|string|true|none|批次|none| +|»»» rulesEnrollProbability|string|true|none|录取方式|none| +|»»» probabilityOperator|string|true|none|计算规则|none| +|»»» rulesEnrollProbabilitySx|string|true|none|录取方式简写|none| +|»»» kslx|string|true|none||none| +|»»» state|string|true|none||none| +|»»» historyMajorEnrollMap|object|true|none|历年信息|none| +|»»»» 2024|object|true|none|年份|none| +|»»»»» year|string|true|none|年份|none| +|»»»»» enrollmentCode|string|true|none|招录专业代码|none| +|»»»»» enrollmentCount|integer|true|none|录取人数|none| +|»»»»» rulesEnrollProbability|string|true|none|录取方式|none| +|»»»»» probabilityOperator|string|true|none|计算规则|none| +|»»»»» admissionLine|number|true|none|录取线|none| +|»»»»» controlLine|integer|true|none|省控线|none| +|»»»» 2025|object|true|none||none| +|»»»»» year|string|true|none||none| +|»»»»» enrollmentCode|string|true|none||none| +|»»»»» enrollmentCount|integer|true|none||none| +|»»»»» rulesEnrollProbability|string|true|none||none| +|»»»»» probabilityOperator|string|true|none||none| +|»»»»» admissionLine|integer|true|none||none| +|»»»»» controlLine|number|true|none||none| +|»»» enrollProbability|number|true|none|通过率|none| +|»»» studentScore|integer|true|none|折合分|none| +|»» total|integer|true|none||none| +|»» page|integer|true|none||none| +|»» size|integer|true|none||none| + +# 数据模型 + diff --git a/project_codebase.md b/project_codebase.md index 96e4ed7..c464d45 100644 --- a/project_codebase.md +++ b/project_codebase.md @@ -1,39 +1,13 @@ -# Project Codebase - -## Function Overview - -### `src/utils/message.ts` -- **Purpose**: Provides a global interface for showing toast messages. -- **Methods**: `success(msg, duration, position)`, `error(msg, duration, position)`, `warning(msg, duration, position)`, `info(msg, duration, position)`. -- **Implementation**: Programmatically mounts `WMessage.vue`. -- **New Feature**: Supports `position` argument: `'top-center' | 'top-left' | 'top-right' | 'bottom-center' | 'bottom-left' | 'bottom-right'`. - -### `src/utils/loading.ts` -- **Purpose**: Provides a global interface for showing a full-screen blocking loading overlay. -- **Methods**: `show()`, `hide()`. -- **Implementation**: Programmatically mounts `WLoading.vue` with a reference counter to handle concurrent requests. - -### `src/service/request/index.ts` -- **Purpose**: Encapsulates Axios for API requests. -- **Features**: - - Request Interceptor: - - Adds `Authorization: Bearer `. - - Adds `X-App-Sign` and `X-App-Timestamp` headers. - - Starts `NProgress`. - - **New**: Shows blocking loading overlay if `config.showLoading` is true. - - Response Interceptor: Unwraps `data`; handles global errors (401, 403, 500); prioritizes backend error messages; stops `NProgress`. - - **New**: Hides blocking loading overlay if `config.showLoading` is true. - - Config: `showLoading`, `showError`. - -### `src/service/api/auth.ts` -- **Purpose**: API definitions for authentication. -- **Methods**: `login`, `logout`, `getUserInfo`. - ### `src/service/api/score.ts` - **Purpose**: API definitions for score management. - **Methods**: `getScore`, `saveScore`. - **Types**: `SaveScoreRequest`, `ScoreInfo`. +### `src/service/api/major.ts` +- **Purpose**: API definitions for user major recommendations. +- **Methods**: `getUserMajorList`. +- **Types**: `UserMajorListRequest`, `UserMajorListResponse`, `MajorItem`. + ### `src/stores/user.ts` - **Purpose**: Manages user session state. - **State**: `token`, `userInfo`. @@ -62,3 +36,9 @@ ### `src/pages/privacy-policy.vue` - **Purpose**: Displays the Privacy Policy. - **Features**: Static content detailing data collection, usage, and protection. Includes contact information. Responsive layout. + +### `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). diff --git a/project_doing.md b/project_doing.md index 8fe1b6e..ce20ada 100644 --- a/project_doing.md +++ b/project_doing.md @@ -1,63 +1,14 @@ -# Project Doing -## 2025-12-18 +## 2026-01-02 -### [Task 1] Global Message Component, API Encapsulation, and Login/Logout Integration -- **Time**: 2025-12-18 -- **Goal**: Implement global message, encapsulate axios, and integrate login. +### [Task 6] User Recommended Major List API Integration +- **Time**: 2026-01-02 +- **Goal**: Integrate the user recommended major list API into the simulation page. - **Scope**: - - `src/components/ui/WMessage.vue` (Review/Update) - - `package.json` (Add axios) - - `src/service/request/index.ts` (Create) - - `src/service/api/auth.ts` (Create) - - `src/stores/user.ts` (Update) - - `src/components/TheNavigation.vue` (Update) - -### [Task 2] Score API Encapsulation and Business Integration -- **Time**: 2025-12-18 -- **Goal**: Encapsulate Score API and integrate into components. -- **Scope**: - - `src/service/api/score.ts` (Create) - - `src/stores/score.ts` (Create) - - `src/components/TheNavigation.vue` (Update) - - `src/components/ScoreForm.vue` (Update) - - `project_task.md` (Update) - -### [Task 2] Verification and Documentation -- **Time**: 2025-12-18 -- **Goal**: Verify score integration and update documentation. -- **Scope**: - - `project_task.md` (Update status) - -### [Task 2] Fix Score Refresh Issue -- **Time**: 2025-12-18 -- **Goal**: Ensure score data is fetched when ScoreForm mounts if store is empty. -- **Scope**: - - `src/components/ScoreForm.vue` (Update onMounted) - -### [Task 3] Enhance WMessage Component -- **Time**: 2025-12-18 -- **Goal**: Add position configuration support (top/bottom/left/right/center). -- **Scope**: - - `src/utils/message.ts` (Update logic to support multiple containers) - - `src/components/ui/WMessage.vue` (No changes needed, styles handled by container) - -### [Task 4] Implement Fullscreen Loading -- **Time**: 2025-12-18 -- **Goal**: Add blocking loading overlay controlled by request config. -- **Scope**: - - `src/components/ui/WLoading.vue` (Create) - - `src/utils/loading.ts` (Create) - - `src/service/request/index.ts` (Update interceptors) - -## 2025-12-27 - -### [Task 5] Improve Sidebar and Add Legal Pages -- **Time**: 2025-12-27 -- **Goal**: Enhance user experience for non-logged-in users and ensure legal compliance. -- **Scope**: - - `src/pages/index.vue` (Redesign empty sidebar) - - `src/pages/agreement.vue` (Create user agreement page) - - `src/pages/privacy-policy.vue` (Create privacy policy page) - - `src/pages/agreement.vue` (Update company info) - - `src/pages/privacy-policy.vue` (Update company info and contact details) + - `src/service/api/major.ts` (Create) + - `src/pages/simulate.vue` (Update) +- **Result**: + - Created `src/service/api/major.ts` encapsulating `/user/major/list` API. + - Updated `src/pages/simulate.vue` to fetch and display data in Panel A using the new API. + - Implemented infinite scroll and filtering by probability. + - Mapped API response fields to the UI table. diff --git a/project_index.md b/project_index.md index 37be87a..0229e62 100644 --- a/project_index.md +++ b/project_index.md @@ -5,6 +5,7 @@ - `src/service/request/index.ts`: Axios wrapper. - `src/service/api/auth.ts`: Authentication API. - `src/service/api/score.ts`: Score API. +- `src/service/api/major.ts`: User major recommendation API. - `src/stores/user.ts`: User Pinia store. - `src/stores/score.ts`: Score Pinia store. - `src/components/ui/WMessage.vue`: Message component UI. @@ -14,3 +15,4 @@ - `src/pages/index.vue`: Home page with dashboard/welcome sidebar. - `src/pages/agreement.vue`: User agreement page. - `src/pages/privacy-policy.vue`: Privacy policy page. +- `src/pages/simulate.vue`: Simulation and volunteer filling page. diff --git a/project_task.md b/project_task.md index bdd85b8..28304c1 100644 --- a/project_task.md +++ b/project_task.md @@ -1,38 +1,5 @@ -# Project Tasks -- [x] [Task 1] Global Message Component, API Encapsulation, and Login/Logout Integration - - [x] Check/Implement Global Message Component - - [x] Install axios - - [x] Create `src/service/request/index.ts` - - [x] Create `src/service/api/auth.ts` - - [x] Update `src/stores/user.ts` (Pinia + Persistence) - - [x] Integrate Login/Logout in `TheNavigation.vue` - - [x] Install crypto-js and types - - [x] Configure API secret in environment variables - - [x] Update Axios request interceptor with signature logic - - [x] Fix CORS by updating VITE_API_BASE_URL - - [x] Refactor vite.config.ts to use loadEnv for dynamic proxy configuration - - [x] Update .env.development with VITE_API_PROXY_TARGET - - [x] Prioritize backend error message in Axios response interceptor - - [x] Check TheNavigation.vue for reactive user state usage - - [x] Update TheNavigation.vue template to toggle Login/User info based on store state - -- [x] [Task 2] Score API Encapsulation and Business Integration - - [x] Create `src/service/api/score.ts` with types - - [x] Create `src/stores/score.ts` - - [x] Integrate Get Score in `TheNavigation.vue` - - [x] Integrate Save Score in `ScoreForm.vue` - -- [x] [Task 3] Enhance WMessage Component - - [x] Add position support to `src/utils/message.ts` (top/bottom/left/right/center) - -- [x] [Task 4] Implement Fullscreen Loading - - [x] Create `src/components/ui/WLoading.vue` - - [x] Create `src/utils/loading.ts` logic - - [x] Update `src/service/request/index.ts` to handle `showLoading` parameter - -- [x] [Task 5] Improve Sidebar and Add Legal Pages - - [x] Improve empty sidebar layout in `src/pages/index.vue` - - [x] Create `src/pages/agreement.vue` with content - - [x] Create `src/pages/privacy-policy.vue` with content - - [x] Update legal pages with company info from `Task3.md` +- [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 diff --git a/src/pages/simulate.vue b/src/pages/simulate.vue index 1458940..8ccc7ae 100644 --- a/src/pages/simulate.vue +++ b/src/pages/simulate.vue @@ -1,6 +1,7 @@