| | |
| | | ## app-full-stack-score-query |
| | | # 考试阅卷系统 |
| | | |
| | | 考务系统客观题批阅复核 |
| | | SQLite + FastAPI + React (Ant Design + Vite) |
| | | |
| | | ## 端口 |
| | | |
| | | - API:`8010`(仅后端) |
| | | - **前端生产(默认)**:`5174`(Node `vite preview` 托管 `dist`,`/api` 代理到 8010) |
| | | - 前端开发:`5175`(`./scripts/start.sh dev`,Vite HMR) |
| | | |
| | | ## 访问域名 |
| | | |
| | | 已默认允许 CORS 来源:`https://grader.gps120.com`、`http://grader.gps120.com`(及本地开发地址)。 |
| | | |
| | | 生产访问:将 `grader.gps120.com` 反代到本机 **`5174`**(或直连 `http://服务器:5174`),无需 Nginx 也可由 Node 提供页面。若需改 CORS: |
| | | |
| | | ```bash |
| | | export CORS_ORIGINS="https://grader.gps120.com,http://grader.gps120.com" |
| | | ``` |
| | | |
| | | Vite 开发已配置 `allowedHosts` 含 `grader.gps120.com`(经隧道/反代访问 dev 时)。 |
| | | |
| | | ## 服务启停(后台运行,关闭终端不退出) |
| | | |
| | | ```bash |
| | | # 首次安装后 |
| | | cd backend && python3 -m venv .venv && .venv/bin/pip install -r requirements.txt |
| | | cd ../frontend && npm install |
| | | |
| | | # 启动 / 停止 / 重启 / 状态 |
| | | ./scripts/start.sh # 生产:build + preview @5174 + 后端 8010 |
| | | ./scripts/start.sh dev # 开发:Vite dev @5175 + 后端 8010 |
| | | ./scripts/build-frontend.sh # 仅重新构建 dist(改代码后生产需 build 再 restart frontend) |
| | | ./scripts/stop.sh |
| | | ./scripts/restart.sh |
| | | ./scripts/status.sh |
| | | |
| | | # 日志:logs/backend.log logs/frontend.log(preview) logs/frontend-dev.log logs/frontend-build.log |
| | | # PID: run/backend.pid run/frontend.pid |
| | | ``` |
| | | |
| | | 单独控制:`./scripts/start.sh backend` | `frontend` |
| | | |
| | | ## 后端(手动调试) |
| | | |
| | | ```bash |
| | | cd backend |
| | | source .venv/bin/activate |
| | | python scripts/seed_admin.py |
| | | uvicorn app.main:app --host 127.0.0.1 --port 8010 |
| | | ``` |
| | | |
| | | 默认账号:`admin` / `admin123`(管理员),`grader` / `grader123`(阅卷员) |
| | | |
| | | ## 本地导入样例 |
| | | |
| | | ```bash |
| | | source backend/.venv/bin/activate |
| | | python backend/scripts/import_local.py "data/碳排放核查员" "碳排放核查员三级理论" |
| | | ``` |
| | | |
| | | ## 前端(手动调试) |
| | | |
| | | ```bash |
| | | cd frontend |
| | | npm run dev |
| | | ``` |
| | | |
| | | ## ZIP 格式 |
| | | |
| | | ZIP 内须包含 5 类 SQL:`examination_examinee`、`examination_exam_examinee`、`examination_paper_source`、`examination_paper_item`、`examination_examinee_exam_answer`。 |