hookehuyr

feat(打卡): 添加感恩打卡次数和对象的数据处理

在多个页面和组件中添加对感恩打卡次数(gratitude_count)和对象列表(gratitude_form_list)的数据处理
更新postCountModel组件以显示实际数据而非模拟数据
1 <!-- 1 <!--
2 * @Date: 2025-12-11 17:26:25 2 * @Date: 2025-12-11 17:26:25
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-12-16 11:22:13 4 + * @LastEditTime: 2025-12-17 09:38:07
5 * @FilePath: /mlaj/src/components/count/postCountModel.vue 5 * @FilePath: /mlaj/src/components/count/postCountModel.vue
6 * @Description: 发布作业统计模型(包括感恩次数和感恩对象) 6 * @Description: 发布作业统计模型(包括感恩次数和感恩对象)
7 --> 7 -->
8 <template> 8 <template>
9 - <div class="post-count-model"> 9 + <div v-if="postData.gratitude_count || postData.gratitude_form_list.length" class="post-count-model">
10 <div class="flex justify-between items-center mb-2"> 10 <div class="flex justify-between items-center mb-2">
11 <div class="text-gray-500">感恩次数: </div> 11 <div class="text-gray-500">感恩次数: </div>
12 - <div class="font-bold">{{ countData.gratitude_count }} 次</div> 12 + <div class="font-bold">{{ postData.gratitude_count }} 次</div>
13 </div> 13 </div>
14 <div class="flex justify-between items-center"> 14 <div class="flex justify-between items-center">
15 <div class="text-gray-500">感恩对象: </div> 15 <div class="text-gray-500">感恩对象: </div>
16 - <div class="font-bold">{{ countData.gratitude_people.map(item => item.name).join('、') }}</div> 16 + <div class="font-bold">{{ postData.gratitude_form_list.map(item => item.name).join('、') }}</div>
17 </div> 17 </div>
18 </div> 18 </div>
19 </template> 19 </template>
...@@ -28,12 +28,6 @@ const props = defineProps({ ...@@ -28,12 +28,6 @@ const props = defineProps({
28 default: () => ({}) 28 default: () => ({})
29 } 29 }
30 }) 30 })
31 -
32 -// mock count data
33 -const countData = ref({
34 - gratitude_count: 3,
35 - gratitude_people: [{id: 1, name: '张三'}, {id: 2, name: '李四'}, {id: 3, name: '王五'}]
36 -})
37 </script> 31 </script>
38 32
39 <style lang="less"> 33 <style lang="less">
......
...@@ -465,9 +465,10 @@ const handleSubmit = async () => { ...@@ -465,9 +465,10 @@ const handleSubmit = async () => {
465 subtask_id: selectedTaskValue.value.length > 0 ? selectedTaskValue.value[0] : '' 465 subtask_id: selectedTaskValue.value.length > 0 ? selectedTaskValue.value[0] : ''
466 } 466 }
467 467
468 - // 如果是计数打卡,添加选中的计数对象列表 468 + // 如果是计数打卡,添加选中的计数对象列表, 并添加次数
469 if (taskType.value === 'count') { 469 if (taskType.value === 'count') {
470 extraData.gratitude_form_list = selectedTargets.value 470 extraData.gratitude_form_list = selectedTargets.value
471 + extraData.gratitude_count = countValue.value
471 } 472 }
472 473
473 await onSubmit(extraData) 474 await onSubmit(extraData)
......
1 <!-- 1 <!--
2 * @Date: 2025-05-29 15:34:17 2 * @Date: 2025-05-29 15:34:17
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-12-16 13:54:46 4 + * @LastEditTime: 2025-12-17 09:39:20
5 * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue 5 * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -640,6 +640,8 @@ const formatData = (data) => { ...@@ -640,6 +640,8 @@ const formatData = (data) => {
640 file_type: item.file_type, 640 file_type: item.file_type,
641 subtask_title: item.subtask_title, 641 subtask_title: item.subtask_title,
642 subtask_id: item.subtask_id, 642 subtask_id: item.subtask_id,
643 + gratitude_count: item.gratitude_count,
644 + gratitude_form_list: item.gratitude_form_list,
643 } 645 }
644 }) 646 })
645 return formattedData; 647 return formattedData;
......
1 <!-- 1 <!--
2 * @Date: 2025-05-29 15:34:17 2 * @Date: 2025-05-29 15:34:17
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-12-15 18:16:40 4 + * @LastEditTime: 2025-12-17 09:40:49
5 * @FilePath: /mlaj/src/views/teacher/checkinPage.vue 5 * @FilePath: /mlaj/src/views/teacher/checkinPage.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -714,7 +714,9 @@ const formatData = (data) => { ...@@ -714,7 +714,9 @@ const formatData = (data) => {
714 is_audit: item.status === 5 ? true : false, // 5=审批通过,7=审批不通过 714 is_audit: item.status === 5 ? true : false, // 5=审批通过,7=审批不通过
715 task_title: item.task_title || '', 715 task_title: item.task_title || '',
716 subtask_title: item.subtask_title || '', 716 subtask_title: item.subtask_title || '',
717 - subtask_id: item.subtask_id, 717 + subtask_id: item.subtask_id || '',
718 + gratitude_count: item.gratitude_count || 0,
719 + gratitude_form_list: item.gratitude_form_list || [],
718 } 720 }
719 }) 721 })
720 return formattedData; 722 return formattedData;
......
...@@ -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-12-15 17:47:10 5 + * @LastEditTime: 2025-12-17 09:40:12
6 * @FilePath: /mlaj/src/views/teacher/studentPage.vue 6 * @FilePath: /mlaj/src/views/teacher/studentPage.vue
7 * @Description: 学生详情页面 7 * @Description: 学生详情页面
8 --> 8 -->
...@@ -879,6 +879,8 @@ const formatData = (data) => { ...@@ -879,6 +879,8 @@ const formatData = (data) => {
879 task_title: item.task_title || '', 879 task_title: item.task_title || '',
880 subtask_title: item.subtask_title || '', 880 subtask_title: item.subtask_title || '',
881 subtask_id: item.subtask_id || '', 881 subtask_id: item.subtask_id || '',
882 + gratitude_count: item.gratitude_count,
883 + gratitude_form_list: item.gratitude_form_list,
882 } 884 }
883 }) 885 })
884 return formattedData; 886 return formattedData;
......
...@@ -312,6 +312,11 @@ function formatData(data) { ...@@ -312,6 +312,11 @@ function formatData(data) {
312 feedback_id: item.feedback_id || '', 312 feedback_id: item.feedback_id || '',
313 feedback_score: item.feedback_score || 0, 313 feedback_score: item.feedback_score || 0,
314 comment: item.comment || null, 314 comment: item.comment || null,
315 + task_title: item.task_title || '',
316 + subtask_title: item.subtask_title || '',
317 + subtask_id: item.subtask_id || '',
318 + gratitude_count: item.gratitude_count || 0,
319 + gratitude_form_list: item.gratitude_form_list || [],
315 } 320 }
316 }) 321 })
317 return formattedData 322 return formattedData
......