From eeeb48d0480444a90f584cd06c54d2e63cb0efae Mon Sep 17 00:00:00 2001
From: lbw <1192299468@qq.com>
Date: Wed, 17 Dec 2025 17:34:41 +0800
Subject: [PATCH] =?UTF-8?q?feat(student):=20=E6=B7=BB=E5=8A=A0=E5=AD=A6?=
=?UTF-8?q?=E7=94=9F=E8=AF=A6=E6=83=85=E9=A1=B5=E5=8F=8A=E7=9B=B8=E5=85=B3?=
=?UTF-8?q?=E8=B7=AF=E7=94=B1=E5=92=8C=E8=B7=B3=E8=BD=AC=E6=8C=89=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在 class.vue 中增加“详情”按钮,可跳转至对应学生详情页
- 使用 vue-router 的 useRouter 实现页面跳转功能
- 添加 /student/:id 路由,绑定学生详情组件 student.vue
- 新增 student.vue 组件,展示学生详细信息
- 精简 Header.vue, 移除多余导航链接,优化界面展示
---
enlish-vue/src/layouts/components/Header.vue | 12 -----
enlish-vue/src/pages/class.vue | 8 ++-
enlish-vue/src/pages/student.vue | 55 ++++++++++++++++++++
enlish-vue/src/router/index.js | 8 +++
4 files changed, 70 insertions(+), 13 deletions(-)
create mode 100644 enlish-vue/src/pages/student.vue
diff --git a/enlish-vue/src/layouts/components/Header.vue b/enlish-vue/src/layouts/components/Header.vue
index 7b7733d..27a7a44 100644
--- a/enlish-vue/src/layouts/components/Header.vue
+++ b/enlish-vue/src/layouts/components/Header.vue
@@ -51,18 +51,6 @@
学案
-
-
- Features
-
-
-
-
- Team
-
-
-
+
+ 详情
删除
@@ -167,6 +168,7 @@ import AddStudentDialog from '@/layouts/components/AddStudentDialog.vue'
import LessonPlanDialog from '@/layouts/components/LessonPlanDialog.vue'
import { getUnitList, deleteUnit } from '@/api/unit'
import AddUnitDialog from '@/layouts/components/AddUnitDialog.vue'
+import { useRouter } from 'vue-router'
const classes = ref([])
const pageNo = ref(1)
@@ -207,6 +209,7 @@ const unitTotalCount = ref(0)
const unitLoading = ref(false)
const unitTableRef = ref(null)
const showAddUnitDialog = ref(false)
+const router = useRouter()
async function fetchClasses() {
loading.value = true
@@ -289,6 +292,9 @@ function handleStudentSizeChange(s) {
function onStudentSelectionChange(rows) {
selectedStudentIds.value = rows.map(r => r.id)
}
+function onViewStudent(row) {
+ router.push(`/student/${row.id}`)
+}
function onClassRowClick(row) {
selectedClassId.value = row.id
selectedClassTitle.value = row.title
diff --git a/enlish-vue/src/pages/student.vue b/enlish-vue/src/pages/student.vue
new file mode 100644
index 0000000..72ce05d
--- /dev/null
+++ b/enlish-vue/src/pages/student.vue
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
学生详情
+
+
+ {{ detail.id }}
+ {{ detail.name }}
+ {{ detail.className }}
+ {{ detail.gradeName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/enlish-vue/src/router/index.js b/enlish-vue/src/router/index.js
index 1215653..6a39d5f 100644
--- a/enlish-vue/src/router/index.js
+++ b/enlish-vue/src/router/index.js
@@ -3,6 +3,7 @@ import Uploadpng from '@/pages/uploadpng.vue'
import LearningPlan from '@/pages/LearningPlan.vue'
import Class from '@/pages/class.vue'
import { createRouter, createWebHashHistory } from 'vue-router'
+import Student from '@/pages/student.vue'
// 统一在这里声明所有路由
const routes = [
@@ -26,6 +27,13 @@ const routes = [
meta: { // meta 信息
title: '学案' // 页面标题
}
+ },
+ {
+ path: '/student/:id', // 路由地址
+ component: Student, // 对应组件
+ meta: { // meta 信息
+ title: '学生详情' // 页面标题
+ }
}
]