hookehuyr

fix: 修复视频播放器暂停功能并优化学生页面样式

修复视频播放器暂停功能的条件判断,确保player存在且pause是函数时才调用
调整学生页面标签大小和布局间距,增加卡片阴影效果
移除调试日志并优化音频暂停逻辑
...@@ -131,8 +131,8 @@ onBeforeUnmount(() => { ...@@ -131,8 +131,8 @@ onBeforeUnmount(() => {
131 131
132 defineExpose({ 132 defineExpose({
133 pause() { 133 pause() {
134 - if (player.value) { 134 + if (player && typeof player?.pause === 'function') {
135 - player.value?.pause(); 135 + player?.pause();
136 emit('onPause', player.value); 136 emit('onPause', player.value);
137 } 137 }
138 }, 138 },
......
...@@ -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 22:39:26 5 + * @LastEditTime: 2025-06-19 23:27:57
6 * @FilePath: /mlaj/src/views/teacher/studentPage.vue 6 * @FilePath: /mlaj/src/views/teacher/studentPage.vue
7 * @Description: 学生详情页面 7 * @Description: 学生详情页面
8 --> 8 -->
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
28 </div> 28 </div>
29 <!-- 标签 --> 29 <!-- 标签 -->
30 <div class="flex flex-wrap gap-2"> 30 <div class="flex flex-wrap gap-2">
31 - <van-tag v-for="tag in studentInfo.tags" :key="tag" type="success" size="small"> 31 + <van-tag v-for="tag in studentInfo.tags" :key="tag" type="success" size="large">
32 {{ tag }} 32 {{ tag }}
33 </van-tag> 33 </van-tag>
34 </div> 34 </div>
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
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="small"> 46 + <van-tag v-for="course in studentInfo.courses" :key="course" type="primary" size="large">
47 {{ course }} 47 {{ course }}
48 </van-tag> 48 </van-tag>
49 </div> 49 </div>
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
86 </div> 86 </div>
87 87
88 <!-- 功能按钮 --> 88 <!-- 功能按钮 -->
89 - <div class="mt-2 p-4"> 89 + <div class="mt-2 px-4">
90 <!-- 状态筛选 --> 90 <!-- 状态筛选 -->
91 <div class="flex items-center justify-end mb-4"> 91 <div class="flex items-center justify-end mb-4">
92 <div @click="showStatusPopup = true" class="flex items-center text-sm text-gray-600 cursor-pointer"> 92 <div @click="showStatusPopup = true" class="flex items-center text-sm text-gray-600 cursor-pointer">
...@@ -97,19 +97,19 @@ ...@@ -97,19 +97,19 @@
97 </div> 97 </div>
98 98
99 <!-- 使用van-sticky包裹van-tabs实现粘性布局 --> 99 <!-- 使用van-sticky包裹van-tabs实现粘性布局 -->
100 + <div class="bg-white" style="margin: 1rem;">
100 <van-sticky :offset-top="0"> 101 <van-sticky :offset-top="0">
101 - <div class="bg-white">
102 <van-tabs v-model:active="activeTab" color="#10b981" animated swipeable @change="handleTabChange"> 102 <van-tabs v-model:active="activeTab" color="#10b981" animated swipeable @change="handleTabChange">
103 <van-tab title="作业记录" name="homework"></van-tab> 103 <van-tab title="作业记录" name="homework"></van-tab>
104 <van-tab title="班主任点评" name="evaluation"></van-tab> 104 <van-tab title="班主任点评" name="evaluation"></van-tab>
105 <van-tab title="打卡统计" name="statistics"></van-tab> 105 <van-tab title="打卡统计" name="statistics"></van-tab>
106 </van-tabs> 106 </van-tabs>
107 - </div>
108 </van-sticky> 107 </van-sticky>
108 + </div>
109 109
110 <!-- 记录列表 --> 110 <!-- 记录列表 -->
111 <van-list v-show="activeTab === 'statistics'" v-model:loading="recordLoading" :finished="recordFinished" 111 <van-list v-show="activeTab === 'statistics'" v-model:loading="recordLoading" :finished="recordFinished"
112 - finished-text="没有更多了" @load="onRecordLoad"> 112 + finished-text="没有更多了" @load="onRecordLoad" class="px-4">
113 <div v-for="record in filteredRecords" :key="record.id" 113 <div v-for="record in filteredRecords" :key="record.id"
114 class="flex items-center justify-between py-4 border-b border-gray-100 last:border-b-0 bg-white px-4"> 114 class="flex items-center justify-between py-4 border-b border-gray-100 last:border-b-0 bg-white px-4">
115 <div class="flex items-center flex-1"> 115 <div class="flex items-center flex-1">
...@@ -138,8 +138,8 @@ ...@@ -138,8 +138,8 @@
138 138
139 <!--作业记录 --> 139 <!--作业记录 -->
140 <van-list v-show="activeTab === 'homework' && checkinDataList.length" v-model:loading="loading" 140 <van-list v-show="activeTab === 'homework' && checkinDataList.length" v-model:loading="loading"
141 - :finished="finished" finished-text="没有更多了" @load="onLoad" class="space-y-4"> 141 + :finished="finished" finished-text="没有更多了" @load="onLoad" class="space-y-4 px-4">
142 - <div class="post-card" v-for="post in checkinDataList" :key="post.id"> 142 + <div class="post-card shadow-md" v-for="post in checkinDataList" :key="post.id">
143 <div class="post-header"> 143 <div class="post-header">
144 <van-row> 144 <van-row>
145 <van-col span="4"> 145 <van-col span="4">
...@@ -410,7 +410,6 @@ const handleTabChange = (name) => { ...@@ -410,7 +410,6 @@ const handleTabChange = (name) => {
410 // 停止所有视频和音频播放 410 // 停止所有视频和音频播放
411 if (videoPlayers.value) { 411 if (videoPlayers.value) {
412 videoPlayers.value.forEach(player => { 412 videoPlayers.value.forEach(player => {
413 - console.warn(player);
414 if (player && typeof player?.pause === 'function') { 413 if (player && typeof player?.pause === 'function') {
415 player?.pause(); 414 player?.pause();
416 } 415 }
...@@ -546,7 +545,7 @@ const stopAllAudio = () => { ...@@ -546,7 +545,7 @@ const stopAllAudio = () => {
546 audioPlayers.value?.forEach(player => { 545 audioPlayers.value?.forEach(player => {
547 // 使用组件暴露的pause方法 546 // 使用组件暴露的pause方法
548 if (typeof player.pause === 'function') { 547 if (typeof player.pause === 'function') {
549 - player.pause(); 548 + player?.pause();
550 } 549 }
551 }); 550 });
552 // 更新所有帖子的播放状态 551 // 更新所有帖子的播放状态
......