hookehuyr

feat(teacher): 添加课程选择和样式优化

- 在学生页面添加课程单选功能
- 优化班级页面样式和交互细节
- 增加主题配置和搜索框样式调整
This diff is collapsed. Click to expand it.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 * @Author: hookehuyr hookehuyr@gmail.com 2 * @Author: hookehuyr hookehuyr@gmail.com
3 * @Date: 2025-06-19 17:12:19 3 * @Date: 2025-06-19 17:12:19
4 * @LastEditors: hookehuyr hookehuyr@gmail.com 4 * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2025-06-19 23:27:57 5 + * @LastEditTime: 2025-06-20 00:11:37
6 * @FilePath: /mlaj/src/views/teacher/studentPage.vue 6 * @FilePath: /mlaj/src/views/teacher/studentPage.vue
7 * @Description: 学生详情页面 7 * @Description: 学生详情页面
8 --> 8 -->
...@@ -43,7 +43,16 @@ ...@@ -43,7 +43,16 @@
43 <span class="text-sm font-medium text-gray-700">所学课程</span> 43 <span class="text-sm font-medium text-gray-700">所学课程</span>
44 </div> 44 </div>
45 <div class="flex flex-wrap gap-2"> 45 <div class="flex flex-wrap gap-2">
46 - <van-tag v-for="course in studentInfo.courses" :key="course" type="primary" size="large"> 46 + <van-tag
47 + v-for="course in studentInfo.courses"
48 + :key="course"
49 + :type="selectedCourses.includes(course) ? 'primary' : 'default'"
50 + :color="selectedCourses.includes(course) ? '#10b981' : '#f0f0f0'"
51 + :text-color="selectedCourses.includes(course) ? '#ffffff' : '#666666'"
52 + size="large"
53 + @click="toggleCourseSelection(course)"
54 + class="cursor-pointer transition-all duration-200 hover:opacity-80"
55 + >
47 {{ course }} 56 {{ course }}
48 </van-tag> 57 </van-tag>
49 </div> 58 </div>
...@@ -263,6 +272,9 @@ const studentInfo = ref({ ...@@ -263,6 +272,9 @@ const studentInfo = ref({
263 courses: ['讲师训2025', '亲子学堂课程'] 272 courses: ['讲师训2025', '亲子学堂课程']
264 }) 273 })
265 274
275 +// 选中的课程列表(默认选中第一个课程)
276 +const selectedCourses = ref([studentInfo.value.courses[0] || ''])
277 +
266 // 统计数据 278 // 统计数据
267 const studentStats = ref({ 279 const studentStats = ref({
268 attendanceRate: 92, 280 attendanceRate: 92,
...@@ -277,6 +289,23 @@ const activeTab = ref('homework') ...@@ -277,6 +289,23 @@ const activeTab = ref('homework')
277 const statusFilter = ref('按状态') 289 const statusFilter = ref('按状态')
278 const showStatusPopup = ref(false) 290 const showStatusPopup = ref(false)
279 291
292 +/**
293 + * 切换课程选中状态(单选模式)
294 + * @param {string} course - 课程名称
295 + */
296 +const toggleCourseSelection = (course) => {
297 + if (selectedCourses.value.includes(course)) {
298 + // 如果已选中,则取消选中
299 + selectedCourses.value = []
300 + } else {
301 + // 如果未选中,则设置为当前选中的课程(单选)
302 + selectedCourses.value = [course]
303 + }
304 +
305 + // 可以在这里添加其他业务逻辑,比如筛选相关数据
306 + console.log('当前选中的课程:', selectedCourses.value)
307 +}
308 +
280 // 状态选项 309 // 状态选项
281 const statusOptions = ref([ 310 const statusOptions = ref([
282 { text: '按状态', value: '按状态' }, 311 { text: '按状态', value: '按状态' },
......