hookehuyr

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

- 在学生页面添加课程单选功能
- 优化班级页面样式和交互细节
- 增加主题配置和搜索框样式调整
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
2 * @Author: hookehuyr hookehuyr@gmail.com 2 * @Author: hookehuyr hookehuyr@gmail.com
3 * @Date: 2025-01-20 10:00:00 3 * @Date: 2025-01-20 10:00:00
4 * @LastEditors: hookehuyr hookehuyr@gmail.com 4 * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2025-06-19 16:46:06 5 + * @LastEditTime: 2025-06-20 00:09:46
6 * @FilePath: /mlaj/src/views/teacher/myClassPage.vue 6 * @FilePath: /mlaj/src/views/teacher/myClassPage.vue
7 * @Description: 我的班级页面 7 * @Description: 我的班级页面
8 --> 8 -->
9 <template> 9 <template>
10 + <van-config-provider :theme-vars="themeVars">
10 <div class="bg-gradient-to-br from-green-50 via-green-100/30 to-blue-50/30 min-h-screen"> 11 <div class="bg-gradient-to-br from-green-50 via-green-100/30 to-blue-50/30 min-h-screen">
11 <!-- 用户信息卡片 --> 12 <!-- 用户信息卡片 -->
12 <div> 13 <div>
...@@ -37,6 +38,8 @@ ...@@ -37,6 +38,8 @@
37 </van-sticky> 38 </van-sticky>
38 </div> 39 </div>
39 40
41 + <div style="height: 0.5rem;"></div>
42 +
40 <!-- 统计数据 --> 43 <!-- 统计数据 -->
41 <div> 44 <div>
42 <van-row> 45 <van-row>
...@@ -45,7 +48,7 @@ ...@@ -45,7 +48,7 @@
45 <div class="bg-white p-4 text-center"> 48 <div class="bg-white p-4 text-center">
46 <div class="relative w-16 h-16 mx-auto mb-2"> 49 <div class="relative w-16 h-16 mx-auto mb-2">
47 <van-circle v-model:current-rate="attendanceRate" :rate="attendanceRate" :speed="100" 50 <van-circle v-model:current-rate="attendanceRate" :rate="attendanceRate" :speed="100"
48 - :text="attendanceRate + '%'" stroke-width="50" color="#10b981" size="64" /> 51 + :text="attendanceRate + '%'" stroke-width="70" color="#10b981" size="64" />
49 </div> 52 </div>
50 <div class="text-sm text-gray-600">出勤率</div> 53 <div class="text-sm text-gray-600">出勤率</div>
51 </div> 54 </div>
...@@ -55,7 +58,7 @@ ...@@ -55,7 +58,7 @@
55 <div class="bg-white p-4 text-center"> 58 <div class="bg-white p-4 text-center">
56 <div class="relative w-16 h-16 mx-auto mb-2"> 59 <div class="relative w-16 h-16 mx-auto mb-2">
57 <van-circle v-model:current-rate="taskCompletionRate" :rate="taskCompletionRate" :speed="100" 60 <van-circle v-model:current-rate="taskCompletionRate" :rate="taskCompletionRate" :speed="100"
58 - :text="taskCompletionRate + '%'" stroke-width="50" color="#3b82f6" size="64" /> 61 + :text="taskCompletionRate + '%'" stroke-width="70" color="#3b82f6" size="64" />
59 </div> 62 </div>
60 <div class="text-sm text-gray-600">任务完成</div> 63 <div class="text-sm text-gray-600">任务完成</div>
61 </div> 64 </div>
...@@ -65,7 +68,7 @@ ...@@ -65,7 +68,7 @@
65 <div class="bg-white p-4 text-center"> 68 <div class="bg-white p-4 text-center">
66 <div class="relative w-16 h-16 mx-auto mb-2"> 69 <div class="relative w-16 h-16 mx-auto mb-2">
67 <van-circle v-model:current-rate="learningProgress" :rate="learningProgress" :speed="100" 70 <van-circle v-model:current-rate="learningProgress" :rate="learningProgress" :speed="100"
68 - :text="learningProgress + '%'" stroke-width="50" color="#f59e0b" size="64" /> 71 + :text="learningProgress + '%'" stroke-width="70" color="#f59e0b" size="64" />
69 </div> 72 </div>
70 <div class="text-sm text-gray-600">学习进度</div> 73 <div class="text-sm text-gray-600">学习进度</div>
71 </div> 74 </div>
...@@ -85,7 +88,7 @@ ...@@ -85,7 +88,7 @@
85 <van-icon name="arrow-down" size="14" class="ml-1" /> 88 <van-icon name="arrow-down" size="14" class="ml-1" />
86 </div> 89 </div>
87 </div> 90 </div>
88 - <van-search v-model="searchKeyword" placeholder="请搜索" @search="handleSearch" @input="handleSearch" /> 91 + <van-search v-model="searchKeyword" placeholder="请搜索" shape="round" @search="handleSearch" @input="handleSearch" />
89 </div> 92 </div>
90 93
91 <!-- 学生列表 --> 94 <!-- 学生列表 -->
...@@ -145,14 +148,23 @@ ...@@ -145,14 +148,23 @@
145 </div> 148 </div>
146 </van-popup> 149 </van-popup>
147 </div> 150 </div>
151 + </van-config-provider>
148 </template> 152 </template>
149 153
150 <script setup> 154 <script setup>
151 import { ref, computed, onMounted } from 'vue' 155 import { ref, computed, onMounted } from 'vue'
152 import { useRouter } from 'vue-router' 156 import { useRouter } from 'vue-router'
153 import AppLayout from '@/layouts/AppLayout.vue' 157 import AppLayout from '@/layouts/AppLayout.vue'
158 +import { useTitle } from '@vueuse/core';
154 159
155 const router = useRouter() 160 const router = useRouter()
161 +const route = useRoute()
162 +useTitle(route.meta.title);
163 +
164 +const themeVars = ref({
165 + 'dropdownMenuShadow': '#fff',
166 + searchInputHeight: '2.5rem',
167 +})
156 168
157 // 用户信息 169 // 用户信息
158 const userInfo = ref({ 170 const userInfo = ref({
...@@ -238,6 +250,42 @@ const studentList = ref([ ...@@ -238,6 +250,42 @@ const studentList = ref([
238 phone: '13643214321', 250 phone: '13643214321',
239 lastActiveTime: '30分钟前活跃', 251 lastActiveTime: '30分钟前活跃',
240 avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' 252 avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg'
253 + },
254 + {
255 + id: 1,
256 + name: '张明',
257 + gender: 'male',
258 + className: '高一(3)班',
259 + phone: '13812345678',
260 + lastActiveTime: '5分钟前活跃',
261 + avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg'
262 + },
263 + {
264 + id: 2,
265 + name: '李华',
266 + gender: 'female',
267 + className: '高一(3)班',
268 + phone: '13987654321',
269 + lastActiveTime: '10分钟前活跃',
270 + avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg'
271 + },
272 + {
273 + id: 3,
274 + name: '王强',
275 + gender: 'male',
276 + className: '高一(2)班',
277 + phone: '13512349876',
278 + lastActiveTime: '15分钟前活跃',
279 + avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg'
280 + },
281 + {
282 + id: 4,
283 + name: '赵敏',
284 + gender: 'female',
285 + className: '高一(1)班',
286 + phone: '13643214321',
287 + lastActiveTime: '30分钟前活跃',
288 + avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg'
241 } 289 }
242 ]) 290 ])
243 291
...@@ -360,7 +408,7 @@ onMounted(() => { ...@@ -360,7 +408,7 @@ onMounted(() => {
360 }) 408 })
361 </script> 409 </script>
362 410
363 -<style scoped> 411 +<style lang="less">
364 /* 自定义样式 */ 412 /* 自定义样式 */
365 .van-dropdown-menu { 413 .van-dropdown-menu {
366 background-color: white; 414 background-color: white;
...@@ -374,8 +422,8 @@ onMounted(() => { ...@@ -374,8 +422,8 @@ onMounted(() => {
374 } 422 }
375 423
376 .van-search { 424 .van-search {
377 - background-color: #f9fafb; 425 + // background-color: #f9fafb;
378 - border-radius: 0.5rem; 426 + // border-radius: 0.5rem;
379 } 427 }
380 428
381 .van-list { 429 .van-list {
......
...@@ -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: '按状态' },
......