feat(teacher): 添加学生点评删除功能并更新班级页面
- 在学生详情页添加删除点评功能,包括确认对话框 - 更新班级页面学生信息展示,使用真实数据字段 - 移除多余的排序选项并调整头像尺寸
Showing
2 changed files
with
106 additions
and
47 deletions
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 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-25 16:12:36 | 5 | + * @LastEditTime: 2025-06-25 17:22:37 |
| 6 | * @FilePath: /mlaj/src/views/teacher/myClassPage.vue | 6 | * @FilePath: /mlaj/src/views/teacher/myClassPage.vue |
| 7 | * @Description: 我的班级页面 | 7 | * @Description: 我的班级页面 |
| 8 | --> | 8 | --> |
| ... | @@ -13,10 +13,10 @@ | ... | @@ -13,10 +13,10 @@ |
| 13 | <div> | 13 | <div> |
| 14 | <div class="bg-white p-4"> | 14 | <div class="bg-white p-4"> |
| 15 | <div class="flex items-center mb-4"> | 15 | <div class="flex items-center mb-4"> |
| 16 | - <van-image round width="3rem" height="3rem" | 16 | + <van-image round width="4rem" height="4rem" |
| 17 | - :src="userInfo.avatar || 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg'" fit="cover" class="mr-3" /> | 17 | + :src="currentUser.avatar || 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg'" fit="cover" class="mr-3" /> |
| 18 | <div class="flex-1"> | 18 | <div class="flex-1"> |
| 19 | - <h2 class="text-lg font-bold text-gray-800">{{ userInfo.name }}</h2> | 19 | + <h2 class="text-lg font-bold text-gray-800">{{ currentUser.name }}</h2> |
| 20 | <div class="flex items-center mt-1"> | 20 | <div class="flex items-center mt-1"> |
| 21 | <van-icon name="clock-o" size="22" color="#10b981" class="mr-1" /> | 21 | <van-icon name="clock-o" size="22" color="#10b981" class="mr-1" /> |
| 22 | <van-icon name="chat-o" size="22" color="#10b981" class="mr-1" /> | 22 | <van-icon name="chat-o" size="22" color="#10b981" class="mr-1" /> |
| ... | @@ -106,15 +106,17 @@ | ... | @@ -106,15 +106,17 @@ |
| 106 | <font-awesome-icon v-if="student.gender === 'male'" icon="venus" color="#3b82f6" class="mr-2" style="font-size: 0.85rem;" /> | 106 | <font-awesome-icon v-if="student.gender === 'male'" icon="venus" color="#3b82f6" class="mr-2" style="font-size: 0.85rem;" /> |
| 107 | <font-awesome-icon v-else icon="mars" color="#ec4899" class="mr-2" style="font-size: 0.85rem;" /> | 107 | <font-awesome-icon v-else icon="mars" color="#ec4899" class="mr-2" style="font-size: 0.85rem;" /> |
| 108 | </div> | 108 | </div> |
| 109 | - <div class="text-sm text-gray-500" style="text-align: left;">{{ student.className }}</div> | 109 | + <div class="text-sm text-gray-500" style="text-align: left;"> |
| 110 | + <span v-for="(item, index) in student.class_list" :key="index" class="mr-2">{{ item }}</span> | ||
| 111 | + </div> | ||
| 110 | </div> | 112 | </div> |
| 111 | </div> | 113 | </div> |
| 112 | <div class="text-right"> | 114 | <div class="text-right"> |
| 113 | <div class="flex items-center text-sm text-gray-500 mb-1"> | 115 | <div class="flex items-center text-sm text-gray-500 mb-1"> |
| 114 | <van-icon name="phone-o" size="12" class="mr-1" /> | 116 | <van-icon name="phone-o" size="12" class="mr-1" /> |
| 115 | - <span>{{ formatPhone(student.phone) }}</span> | 117 | + <span>{{ formatPhone(student.mobile) }}</span> |
| 116 | </div> | 118 | </div> |
| 117 | - <div class="text-xs text-gray-400">{{ student.lastActiveTime }}</div> | 119 | + <div class="text-xs text-gray-400">{{ student.last_checkin_time }}</div> |
| 118 | </div> | 120 | </div> |
| 119 | <van-icon name="arrow" color="#d1d5db" size="16" class="ml-2" /> | 121 | <van-icon name="arrow" color="#d1d5db" size="16" class="ml-2" /> |
| 120 | </div> | 122 | </div> |
| ... | @@ -156,6 +158,7 @@ import { ref, computed, onMounted } from 'vue' | ... | @@ -156,6 +158,7 @@ import { ref, computed, onMounted } from 'vue' |
| 156 | import { useRouter } from 'vue-router' | 158 | import { useRouter } from 'vue-router' |
| 157 | import AppLayout from '@/layouts/AppLayout.vue' | 159 | import AppLayout from '@/layouts/AppLayout.vue' |
| 158 | import { useTitle } from '@vueuse/core'; | 160 | import { useTitle } from '@vueuse/core'; |
| 161 | +import { useAuth } from '@/contexts/auth' | ||
| 159 | 162 | ||
| 160 | import { getTeacherGradeClassListAPI } from "@/api/teacher"; | 163 | import { getTeacherGradeClassListAPI } from "@/api/teacher"; |
| 161 | 164 | ||
| ... | @@ -168,11 +171,8 @@ const themeVars = ref({ | ... | @@ -168,11 +171,8 @@ const themeVars = ref({ |
| 168 | searchInputHeight: '2.5rem', | 171 | searchInputHeight: '2.5rem', |
| 169 | }) | 172 | }) |
| 170 | 173 | ||
| 171 | -// 用户信息 | 174 | +// 获取用户认证状态 |
| 172 | -const userInfo = ref({ | 175 | +const { currentUser } = useAuth() |
| 173 | - name: '我的班级', | ||
| 174 | - avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' | ||
| 175 | -}) | ||
| 176 | 176 | ||
| 177 | // 筛选器数据 | 177 | // 筛选器数据 |
| 178 | const selectGradeValue = ref(null); | 178 | const selectGradeValue = ref(null); |
| ... | @@ -189,8 +189,6 @@ const showSortPopup = ref(false) | ... | @@ -189,8 +189,6 @@ const showSortPopup = ref(false) |
| 189 | // 筛选器选项 | 189 | // 筛选器选项 |
| 190 | const sortOptions = ref([ | 190 | const sortOptions = ref([ |
| 191 | { text: '按活跃度', value: '按活跃度' }, | 191 | { text: '按活跃度', value: '按活跃度' }, |
| 192 | - { text: '按姓名', value: '按姓名' }, | ||
| 193 | - { text: '按成绩', value: '按成绩' } | ||
| 194 | ]) | 192 | ]) |
| 195 | 193 | ||
| 196 | // 统计数据 | 194 | // 统计数据 |
| ... | @@ -204,72 +202,72 @@ const studentList = ref([ | ... | @@ -204,72 +202,72 @@ const studentList = ref([ |
| 204 | id: 1, | 202 | id: 1, |
| 205 | name: '张明', | 203 | name: '张明', |
| 206 | gender: 'male', | 204 | gender: 'male', |
| 207 | - className: '高一(3)班', | 205 | + class_list: ['高一(3)班', '高二(1)班', '高二(2)班'], |
| 208 | - phone: '13812345678', | 206 | + mobile: '13812345678', |
| 209 | - lastActiveTime: '5分钟前活跃', | 207 | + last_checkin_time: '5分钟前活跃', |
| 210 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' | 208 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' |
| 211 | }, | 209 | }, |
| 212 | { | 210 | { |
| 213 | id: 2, | 211 | id: 2, |
| 214 | name: '李华', | 212 | name: '李华', |
| 215 | gender: 'female', | 213 | gender: 'female', |
| 216 | - className: '高一(3)班', | 214 | + class_list: ['高一(3)班', '高二(1)班', '高二(2)班'], |
| 217 | - phone: '13987654321', | 215 | + mobile: '13987654321', |
| 218 | - lastActiveTime: '10分钟前活跃', | 216 | + last_checkin_time: '10分钟前活跃', |
| 219 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' | 217 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' |
| 220 | }, | 218 | }, |
| 221 | { | 219 | { |
| 222 | id: 3, | 220 | id: 3, |
| 223 | name: '王强', | 221 | name: '王强', |
| 224 | gender: 'male', | 222 | gender: 'male', |
| 225 | - className: '高一(2)班', | 223 | + class_list: ['高一(2)班', '高二(1)班', '高二(2)班'], |
| 226 | - phone: '13512349876', | 224 | + mobile: '13512349876', |
| 227 | - lastActiveTime: '15分钟前活跃', | 225 | + last_checkin_time: '15分钟前活跃', |
| 228 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' | 226 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' |
| 229 | }, | 227 | }, |
| 230 | { | 228 | { |
| 231 | id: 4, | 229 | id: 4, |
| 232 | name: '赵敏', | 230 | name: '赵敏', |
| 233 | gender: 'female', | 231 | gender: 'female', |
| 234 | - className: '高一(1)班', | 232 | + class_list: ['高一(1)班', '高二(1)班', '高二(2)班'], |
| 235 | - phone: '13643214321', | 233 | + mobile: '13643214321', |
| 236 | - lastActiveTime: '30分钟前活跃', | 234 | + last_checkin_time: '30分钟前活跃', |
| 237 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' | 235 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' |
| 238 | }, | 236 | }, |
| 239 | { | 237 | { |
| 240 | id: 1, | 238 | id: 1, |
| 241 | name: '张明', | 239 | name: '张明', |
| 242 | gender: 'male', | 240 | gender: 'male', |
| 243 | - className: '高一(3)班', | 241 | + class_list: ['高一(3)班', '高二(1)班', '高二(2)班'], |
| 244 | - phone: '13812345678', | 242 | + mobile: '13812345678', |
| 245 | - lastActiveTime: '5分钟前活跃', | 243 | + last_checkin_time: '5分钟前活跃', |
| 246 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' | 244 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' |
| 247 | }, | 245 | }, |
| 248 | { | 246 | { |
| 249 | id: 2, | 247 | id: 2, |
| 250 | name: '李华', | 248 | name: '李华', |
| 251 | gender: 'female', | 249 | gender: 'female', |
| 252 | - className: '高一(3)班', | 250 | + class_list: ['高一(3)班'], |
| 253 | - phone: '13987654321', | 251 | + mobile: '13987654321', |
| 254 | - lastActiveTime: '10分钟前活跃', | 252 | + last_checkin_time: '10分钟前活跃', |
| 255 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' | 253 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' |
| 256 | }, | 254 | }, |
| 257 | { | 255 | { |
| 258 | id: 3, | 256 | id: 3, |
| 259 | name: '王强', | 257 | name: '王强', |
| 260 | gender: 'male', | 258 | gender: 'male', |
| 261 | - className: '高一(2)班', | 259 | + class_list: ['高一(2)班'], |
| 262 | - phone: '13512349876', | 260 | + mobile: '13512349876', |
| 263 | - lastActiveTime: '15分钟前活跃', | 261 | + last_checkin_time: '15分钟前活跃', |
| 264 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' | 262 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' |
| 265 | }, | 263 | }, |
| 266 | { | 264 | { |
| 267 | id: 4, | 265 | id: 4, |
| 268 | name: '赵敏', | 266 | name: '赵敏', |
| 269 | gender: 'female', | 267 | gender: 'female', |
| 270 | - className: '高一(1)班', | 268 | + class_list: ['高一(1)班'], |
| 271 | - phone: '13643214321', | 269 | + mobile: '13643214321', |
| 272 | - lastActiveTime: '30分钟前活跃', | 270 | + last_checkin_time: '30分钟前活跃', |
| 273 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' | 271 | avatar: 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' |
| 274 | } | 272 | } |
| 275 | ]) | 273 | ]) | ... | ... |
| ... | @@ -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-24 17:23:46 | 5 | + * @LastEditTime: 2025-06-25 17:47:34 |
| 6 | * @FilePath: /mlaj/src/views/teacher/studentPage.vue | 6 | * @FilePath: /mlaj/src/views/teacher/studentPage.vue |
| 7 | * @Description: 学生详情页面 | 7 | * @Description: 学生详情页面 |
| 8 | --> | 8 | --> |
| ... | @@ -149,10 +149,19 @@ | ... | @@ -149,10 +149,19 @@ |
| 149 | finished-text="没有更多了" @load="onEvaluationLoad" class="px-4"> | 149 | finished-text="没有更多了" @load="onEvaluationLoad" class="px-4"> |
| 150 | <div v-for="evaluation in evaluationList" :key="evaluation.id" | 150 | <div v-for="evaluation in evaluationList" :key="evaluation.id" |
| 151 | class="bg-white rounded-lg shadow-sm p-4 mb-3 border border-gray-100"> | 151 | class="bg-white rounded-lg shadow-sm p-4 mb-3 border border-gray-100"> |
| 152 | - <!-- 第一行:时间 + 日历图标 --> | 152 | + <!-- 第一行:时间 + 日历图标 + 删除按钮 --> |
| 153 | - <div class="flex items-center mb-3"> | 153 | + <div class="flex items-center justify-between mb-3"> |
| 154 | - <van-icon name="calendar-o" size="16" color="#10b981" class="mr-2" /> | 154 | + <div class="flex items-center"> |
| 155 | - <span class="text-sm text-gray-600">{{ evaluation.date }}</span> | 155 | + <van-icon name="calendar-o" size="16" color="#10b981" class="mr-2" /> |
| 156 | + <span class="text-sm text-gray-600">{{ evaluation.date }}</span> | ||
| 157 | + </div> | ||
| 158 | + <van-icon | ||
| 159 | + name="delete-o" | ||
| 160 | + size="16" | ||
| 161 | + color="#ef4444" | ||
| 162 | + class="cursor-pointer hover:opacity-70" | ||
| 163 | + @click="deleteEvaluation(evaluation.id)" | ||
| 164 | + /> | ||
| 156 | </div> | 165 | </div> |
| 157 | 166 | ||
| 158 | <!-- 第二行:点评内容 + 图标 --> | 167 | <!-- 第二行:点评内容 + 图标 --> |
| ... | @@ -168,7 +177,6 @@ | ... | @@ -168,7 +177,6 @@ |
| 168 | <van-icon name="star-o" size="16" color="#f59e0b" class="mr-2" /> | 177 | <van-icon name="star-o" size="16" color="#f59e0b" class="mr-2" /> |
| 169 | <span class="text-sm text-gray-600 mr-3">评分:</span> | 178 | <span class="text-sm text-gray-600 mr-3">评分:</span> |
| 170 | <van-rate v-model="evaluation.score" :size="16" color="#ffd21e" void-color="#eee" readonly /> | 179 | <van-rate v-model="evaluation.score" :size="16" color="#ffd21e" void-color="#eee" readonly /> |
| 171 | - <!-- <span class="text-sm text-gray-500 ml-2">({{ evaluation.score }}/5)</span> --> | ||
| 172 | </div> | 180 | </div> |
| 173 | </div> | 181 | </div> |
| 174 | </van-list> | 182 | </van-list> |
| ... | @@ -330,6 +338,23 @@ | ... | @@ -330,6 +338,23 @@ |
| 330 | </div> | 338 | </div> |
| 331 | </div> | 339 | </div> |
| 332 | </van-popup> | 340 | </van-popup> |
| 341 | + | ||
| 342 | + <!-- 删除确认对话框 --> | ||
| 343 | + <van-dialog | ||
| 344 | + v-model:show="showDeleteDialog" | ||
| 345 | + title="温馨提示" | ||
| 346 | + :show-cancel-button="true" | ||
| 347 | + :show-confirm-button="true" | ||
| 348 | + confirm-button-text="确定删除" | ||
| 349 | + cancel-button-text="取消" | ||
| 350 | + confirm-button-color="#ef4444" | ||
| 351 | + @confirm="confirmDelete" | ||
| 352 | + @cancel="cancelDelete" | ||
| 353 | + > | ||
| 354 | + <div class="p-4"> | ||
| 355 | + <p class="text-gray-700 text-center">确定要删除这条点评吗?</p> | ||
| 356 | + </div> | ||
| 357 | + </van-dialog> | ||
| 333 | </div> | 358 | </div> |
| 334 | </van-config-provider> | 359 | </van-config-provider> |
| 335 | </template> | 360 | </template> |
| ... | @@ -343,7 +368,7 @@ import AudioPlayer from "@/components/ui/AudioPlayer.vue"; | ... | @@ -343,7 +368,7 @@ import AudioPlayer from "@/components/ui/AudioPlayer.vue"; |
| 343 | import { useTitle } from '@vueuse/core'; | 368 | import { useTitle } from '@vueuse/core'; |
| 344 | import dayjs from 'dayjs'; | 369 | import dayjs from 'dayjs'; |
| 345 | 370 | ||
| 346 | -import { getTaskDetailAPI, getUploadTaskListAPI, delUploadTaskInfoAPI, likeUploadTaskInfoAPI, dislikeUploadTaskInfoAPI } from "@/api/checkin"; | 371 | +import { getCheckinTeacherListAPI, delUploadTaskInfoAPI, likeUploadTaskInfoAPI, dislikeUploadTaskInfoAPI } from "@/api/checkin"; |
| 347 | 372 | ||
| 348 | 373 | ||
| 349 | const router = useRouter() | 374 | const router = useRouter() |
| ... | @@ -529,6 +554,10 @@ const records = ref([ | ... | @@ -529,6 +554,10 @@ const records = ref([ |
| 529 | const recordLoading = ref(false) | 554 | const recordLoading = ref(false) |
| 530 | const recordFinished = ref(false) | 555 | const recordFinished = ref(false) |
| 531 | 556 | ||
| 557 | +// 删除对话框相关状态 | ||
| 558 | +const showDeleteDialog = ref(false) | ||
| 559 | +const currentDeleteId = ref(null) | ||
| 560 | + | ||
| 532 | // 班主任点评列表数据 | 561 | // 班主任点评列表数据 |
| 533 | const evaluationList = ref([ | 562 | const evaluationList = ref([ |
| 534 | { | 563 | { |
| ... | @@ -621,6 +650,38 @@ const onEvaluationLoad = () => { | ... | @@ -621,6 +650,38 @@ const onEvaluationLoad = () => { |
| 621 | } | 650 | } |
| 622 | 651 | ||
| 623 | /** | 652 | /** |
| 653 | + * 删除点评 | ||
| 654 | + * @param {number} evaluationId - 点评ID | ||
| 655 | + */ | ||
| 656 | +const deleteEvaluation = (evaluationId) => { | ||
| 657 | + currentDeleteId.value = evaluationId | ||
| 658 | + showDeleteDialog.value = true | ||
| 659 | +} | ||
| 660 | + | ||
| 661 | +/** | ||
| 662 | + * 确认删除操作 | ||
| 663 | + */ | ||
| 664 | +const confirmDelete = () => { | ||
| 665 | + // 这里应该调用API删除点评,暂时模拟删除操作 | ||
| 666 | + const index = evaluationList.value.findIndex(item => item.id === currentDeleteId.value) | ||
| 667 | + if (index !== -1) { | ||
| 668 | + evaluationList.value.splice(index, 1) | ||
| 669 | + showSuccessToast('删除成功') | ||
| 670 | + } | ||
| 671 | + showDeleteDialog.value = false | ||
| 672 | + currentDeleteId.value = null | ||
| 673 | +} | ||
| 674 | + | ||
| 675 | +/** | ||
| 676 | + * 取消删除操作 | ||
| 677 | + */ | ||
| 678 | +const cancelDelete = () => { | ||
| 679 | + showDeleteDialog.value = false | ||
| 680 | + currentDeleteId.value = null | ||
| 681 | + console.log('用户取消删除操作') | ||
| 682 | +} | ||
| 683 | + | ||
| 684 | +/** | ||
| 624 | * 组件挂载时初始化数据 | 685 | * 组件挂载时初始化数据 |
| 625 | */ | 686 | */ |
| 626 | const checkinDataList = ref([]); | 687 | const checkinDataList = ref([]); |
| ... | @@ -863,7 +924,7 @@ const onLoad = async (date) => { | ... | @@ -863,7 +924,7 @@ const onLoad = async (date) => { |
| 863 | const nextPage = page.value; | 924 | const nextPage = page.value; |
| 864 | const current_date = date || route.query.date || dayjs().format('YYYY-MM-DD'); | 925 | const current_date = date || route.query.date || dayjs().format('YYYY-MM-DD'); |
| 865 | // | 926 | // |
| 866 | - const res = await getUploadTaskListAPI({ | 927 | + const res = await getCheckinTeacherListAPI({ |
| 867 | limit: limit.value, | 928 | limit: limit.value, |
| 868 | page: nextPage, | 929 | page: nextPage, |
| 869 | task_id: route.query.id, | 930 | task_id: route.query.id, |
| ... | @@ -932,7 +993,7 @@ const formatData = (data) => { | ... | @@ -932,7 +993,7 @@ const formatData = (data) => { |
| 932 | } | 993 | } |
| 933 | </script> | 994 | </script> |
| 934 | 995 | ||
| 935 | -<style lang="less"> | 996 | +<style lang="less" scoped> |
| 936 | .van-back-top { | 997 | .van-back-top { |
| 937 | background-color: #4caf50; | 998 | background-color: #4caf50; |
| 938 | } | 999 | } | ... | ... |
-
Please register or login to post a comment