diff --git a/.cospec/plan/changes/fix-admin-multi-issues/proposal.md b/.cospec/plan/changes/fix-admin-multi-issues/proposal.md
new file mode 100644
index 0000000..8de233d
--- /dev/null
+++ b/.cospec/plan/changes/fix-admin-multi-issues/proposal.md
@@ -0,0 +1,59 @@
+# 变更:管理端多项功能修复与改版
+
+## 原因
+管理端存在多项问题需要修复:跨域配置导致API调用失败、导航栏各页面不一致、作业模块用途不符需求、考勤模块交互需改版、家长手机号需要权限控制。
+
+## 变更内容
+
+### 1. 跨域问题修复(确认)
+- 之前的 500 错误已通过添加 `PermissionChecker.get_user_class_id` 方法修复
+- CORS 中间件配置本身正确(`CORSMiddleware` 已注册且包含 OPTIONS 方法)
+- `AuthMiddleware` 虽已导入但未在 `main.py` 中注册为全局中间件,不影响当前功能(认证由路由层 `get_current_user` 处理)
+- 后端 `.env` 文件由服务器单独配置,不在版本控制中,无需添加默认值
+
+### 2. 统一导航栏
+- 创建 `frontend/includes/nav.php` 共享模板,所有 admin 页面统一引入
+- 导航项角色条件统一为:操行分管理=班主任/班长,作业管理=班主任/学习委员,考勤管理=班主任/考勤委员,科目管理=班主任/学习委员,管理员管理=班主任
+- 修复 `dashboard.php` 密码链接拼写错误 `passwork.php` → `password.php`
+- 接受参数:`$role`、`$current_page`(用于 active 状态)
+
+### 3. 作业管理改版(仅加减操行分)
+- 移除作业发布功能(创建作业、查看提交记录)
+- 改为类似操行分管理页面的交互:选择学生 + 选择扣分类型(未交作业/迟交作业等)+ 原因 + 提交扣分
+- 前端 `homework.php` 完全重写:学生列表表格 + 批量加减分模态框,扣分类型为作业相关(未交-2分、迟交-1分)
+- 后端保留 `add_conduct_points` 接口(已有),通过 `related_type="homework"` 关联
+- 角色权限不变:班主任 + 学习委员
+
+### 4. 考勤管理改版(学生方格扣分制)
+- 前端 `attendance.php` 重写UI:
+ - 顶部日期选择器
+ - 主体区域:学生方格网格(flex-wrap 布局,每行7个)
+ - 每个方格显示学生姓名,点击可选中(高亮变红表示缺勤扣分)
+ - 底部工具栏:全选/取消、批量选择状态(缺勤/迟到/请假)、提交按钮
+ - 下方保留历史记录表格
+- 后端考勤逻辑不变,新增批量提交支持(或前端循环调用现有单个添加接口)
+- 扣分规则不变:缺勤-5分、迟到-2分、请假-1分
+
+### 5. 家长手机号权限控制
+- `frontend/admin/students.php` 表格中 `家长手机号` 列仅 `班主任` 角色可见
+- 非班主任角色显示为 `***` 或隐藏该列
+- 新增/导入学生表单中的手机号字段保持不变(任何有学生管理权限的角色都能录入)
+
+### 6. 附带修复
+- 修复 `dashboard.php` 密码链接 `passwork.php` → `password.php`(如果导航模板方案未覆盖的话)
+- 统一所有角色判断为 `学习委员`(当前 homework.php 用 `科代表`)
+
+## 影响
+- **受影响的规范**:管理端导航、作业管理、考勤管理、学生管理
+- **受影响的代码**:
+ - `frontend/includes/nav.php`: 新建 - 统一导航栏模板
+ - `frontend/admin/dashboard.php`: 移除硬编码导航栏,引入 nav.php
+ - `frontend/admin/students.php`: 移除硬编码导航栏,引入 nav.php;手机号列增加角色判断
+ - `frontend/admin/conduct.php`: 移除硬编码导航栏,引入 nav.php
+ - `frontend/admin/homework.php`: 完全重写 - 改为加减操行分模式
+ - `frontend/admin/attendance.php`: 完全重写 - 改为学生方格扣分制
+ - `frontend/admin/history.php`: 移除硬编码导航栏,引入 nav.php
+ - `frontend/admin/subjects.php`: 移除硬编码导航栏,引入 nav.php
+ - `frontend/admin/admins.php`: 移除硬编码导航栏,引入 nav.php
+ - `frontend/admin/password.php`: 移除硬编码导航栏,引入 nav.php
+ - `frontend/assets/css/admin.css`: 新增学生方格网格样式
diff --git a/.cospec/plan/changes/fix-admin-multi-issues/task.md b/.cospec/plan/changes/fix-admin-multi-issues/task.md
new file mode 100644
index 0000000..5d05615
--- /dev/null
+++ b/.cospec/plan/changes/fix-admin-multi-issues/task.md
@@ -0,0 +1,156 @@
+## 实施
+
+### 阶段 1:统一导航栏
+
+- [x] 1.1 创建统一导航栏模板
+ 【目标对象】`frontend/includes/nav.php`(新建)
+ 【修改目的】将所有 admin 页面硬编码的导航栏抽取为共享模板,解决各页面导航不一致的问题;同时修复 dashboard.php 中密码链接 `passwork.php` 的拼写错误
+ 【修改方式】新建 PHP 文件,定义导航栏 HTML 结构,直接读取 `$role` 和 `$current_page` 变量(已由 `header.php` 第 17-19 行定义)来动态生成导航项和 active 状态
+ 【相关依赖】`frontend/includes/header.php`(第 17-19 行已定义 `$current_page`、`$user_type`、`$role` 变量,在 include nav.php 之前已可用)
+ 【修改内容】
+ - 直接使用 `$role` 和 `$current_page` 变量(无需参数传递,因为 header.php 在 nav.php 之前被 include)
+ - 导航项及角色条件统一为:
+ - 首页(dashboard):所有管理员可见
+ - 学生管理(students):所有管理员可见
+ - 操行分管理(conduct):$role==='班主任' || $role==='班长'
+ - 作业管理(homework):$role==='班主任' || $role==='学习委员'
+ - 考勤管理(attendance):$role==='班主任' || $role==='考勤委员'
+ - 科目管理(subjects):$role==='班主任' || $role==='学习委员'
+ - 管理员管理(admins):$role==='班主任'
+ - 历史记录(history):所有管理员可见
+ - 修改密码(password):所有管理员可见
+ - 根据 `$current_page`(值为不含 `.php` 后缀的文件名,如 `dashboard`、`students`)为当前页面对应的导航项添加 `active` class
+ - 密码链接统一写为 `password.php`(修复 dashboard 中 `passwork.php` 拼写错误)
+ - 导航栏外层容器沿用现有 `
` 结构
+
+- [x] 1.2 各 admin 页面引入统一导航模板
+ 【目标对象】所有 `frontend/admin/*.php` 页面
+ 【修改目的】移除各页面硬编码的 `
...
` 块,替换为 `include nav.php`,统一导航栏
+ 【修改方式】在以下每个页面中,找到 `
` 到对应的 `
` 之间的导航栏块,整块替换为 ``
+ 【相关依赖】`frontend/includes/nav.php`(任务 1.1 创建)
+ 【修改内容】
+ - `frontend/admin/dashboard.php`:替换第 25-43 行的 `
...
` 为 include nav.php
+ - `frontend/admin/students.php`:替换第 25-43 行的 `
...
` 为 include nav.php
+ - `frontend/admin/conduct.php`:替换第 31-47 行的 `
...
` 为 include nav.php
+ - `frontend/admin/homework.php`:替换第 31-47 行的 `
...
` 为 include nav.php(注意:此页面后续会在任务 2.2 完全重写,此处仅替换导航栏部分)
+ - `frontend/admin/attendance.php`:替换第 31-47 行的 `
...
` 为 include nav.php(注意:此页面后续会在任务 3.3 完全重写,此处仅替换导航栏部分)
+ - `frontend/admin/history.php`:替换第 25-43 行的 `
...
` 为 include nav.php
+ - `frontend/admin/subjects.php`:替换第 30-48 行的 `
...
` 为 include nav.php
+ - `frontend/admin/admins.php`:替换第 30-46 行的 `
...
` 为 include nav.php
+ - `frontend/admin/password.php`:替换第 25-43 行的 `
...
` 为 include nav.php
+ - 替换后需确认 include 语句位于 `include header.php;` 之后、页面主体内容之前
+
+### 阶段 2:作业管理改版
+
+- [x] 2.1 清理 `admin.js` 中废弃的作业管理函数
+ 【目标对象】`frontend/assets/js/admin.js`
+ 【修改目的】移除作业管理改版后不再使用的旧作业管理函数,避免全局函数污染和潜在冲突
+ 【修改方式】删除第 174-220 行的三个函数:`showAddAssignmentModal()`、`loadSubjectsForSelect()`、`submitAddAssignment()`
+ 【相关依赖】无(homework.php 将在任务 2.2 完全重写,不再依赖这些全局函数)
+ 【修改内容】
+ - 删除第 174-178 行的 `showAddAssignmentModal()` 函数
+ - 删除第 180-192 行的 `loadSubjectsForSelect()` 函数
+ - 删除第 194-220 行的 `submitAddAssignment()` 函数
+ - 注意:`admin.js` 中其他通用函数(如 `submitBatchPoints()`、`closeModal()`、`escapeHtml()`、`toggleSelectAll()`)保持不变,仍被 conduct.php 和 students.php 使用
+
+- [x] 2.2 重写作业管理前端页面
+ 【目标对象】`frontend/admin/homework.php`
+ 【修改目的】将作业发布/提交管理模式改为单纯的加减操行分模式,交互方式参照 `conduct.php`
+ 【修改方式】完全重写页面 HTML 内容和 `
-
\ No newline at end of file
+
diff --git a/frontend/admin/conduct.php b/frontend/admin/conduct.php
index 04c2550..f0d9b8e 100644
--- a/frontend/admin/conduct.php
+++ b/frontend/admin/conduct.php
@@ -28,23 +28,7 @@ if (!in_array($role, ['班主任', '班长'])) {
include __DIR__ . '/../includes/header.php';
?>
-
+
diff --git a/frontend/admin/dashboard.php b/frontend/admin/dashboard.php
index d2b85d0..89fab27 100644
--- a/frontend/admin/dashboard.php
+++ b/frontend/admin/dashboard.php
@@ -22,25 +22,7 @@ $role = $_SESSION['role'] ?? '';
include __DIR__ . '/../includes/header.php';
?>
-
+
diff --git a/frontend/admin/history.php b/frontend/admin/history.php
index 1e7dc7f..058215a 100644
--- a/frontend/admin/history.php
+++ b/frontend/admin/history.php
@@ -22,25 +22,7 @@ $role = $_SESSION['role'] ?? '';
include __DIR__ . '/../includes/header.php';
?>
-
+
diff --git a/frontend/admin/homework.php b/frontend/admin/homework.php
index 38f6f4f..d10e31c 100644
--- a/frontend/admin/homework.php
+++ b/frontend/admin/homework.php
@@ -20,7 +20,7 @@ if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'admin') {
$page_title = '作业管理';
$role = $_SESSION['role'] ?? '';
-if (!in_array($role, ['班主任', '科代表'])) {
+if (!in_array($role, ['班主任', '学习委员'])) {
header('Location: /admin/dashboard.php');
exit();
}
@@ -28,142 +28,152 @@ if (!in_array($role, ['班主任', '科代表'])) {
include __DIR__ . '/../includes/header.php';
?>
-
+
-
-
+
diff --git a/frontend/admin/password.php b/frontend/admin/password.php
index 6edf3e9..7e20c5d 100644
--- a/frontend/admin/password.php
+++ b/frontend/admin/password.php
@@ -22,25 +22,7 @@ $role = $_SESSION['role'] ?? '';
include __DIR__ . '/../includes/header.php';
?>
-
+
diff --git a/frontend/admin/students.php b/frontend/admin/students.php
index 2b72f80..73ede91 100644
--- a/frontend/admin/students.php
+++ b/frontend/admin/students.php
@@ -22,25 +22,7 @@ $role = $_SESSION['role'] ?? '';
include __DIR__ . '/../includes/header.php';
?>
-
+
@@ -65,7 +47,7 @@ include __DIR__ . '/../includes/header.php';
学号 |
姓名 |
操行分 |
- 家长手机号 |
+ 家长手机号 |
操作 |
@@ -129,6 +111,7 @@ include __DIR__ . '/../includes/header.php';
\ No newline at end of file
diff --git a/frontend/includes/nav.php b/frontend/includes/nav.php
new file mode 100644
index 0000000..dbe6169
--- /dev/null
+++ b/frontend/includes/nav.php
@@ -0,0 +1,21 @@
+