hookehuyr

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

在多个页面和组件中添加对感恩打卡次数(gratitude_count)和对象列表(gratitude_form_list)的数据处理
更新postCountModel组件以显示实际数据而非模拟数据
<!--
* @Date: 2025-12-11 17:26:25
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-12-16 11:22:13
* @LastEditTime: 2025-12-17 09:38:07
* @FilePath: /mlaj/src/components/count/postCountModel.vue
* @Description: 发布作业统计模型(包括感恩次数和感恩对象)
-->
<template>
<div class="post-count-model">
<div v-if="postData.gratitude_count || postData.gratitude_form_list.length" class="post-count-model">
<div class="flex justify-between items-center mb-2">
<div class="text-gray-500">感恩次数: </div>
<div class="font-bold">{{ countData.gratitude_count }} 次</div>
<div class="font-bold">{{ postData.gratitude_count }} 次</div>
</div>
<div class="flex justify-between items-center">
<div class="text-gray-500">感恩对象: </div>
<div class="font-bold">{{ countData.gratitude_people.map(item => item.name).join('、') }}</div>
<div class="font-bold">{{ postData.gratitude_form_list.map(item => item.name).join('、') }}</div>
</div>
</div>
</template>
......@@ -28,12 +28,6 @@ const props = defineProps({
default: () => ({})
}
})
// mock count data
const countData = ref({
gratitude_count: 3,
gratitude_people: [{id: 1, name: '张三'}, {id: 2, name: '李四'}, {id: 3, name: '王五'}]
})
</script>
<style lang="less">
......
......@@ -465,9 +465,10 @@ const handleSubmit = async () => {
subtask_id: selectedTaskValue.value.length > 0 ? selectedTaskValue.value[0] : ''
}
// 如果是计数打卡,添加选中的计数对象列表
// 如果是计数打卡,添加选中的计数对象列表, 并添加次数
if (taskType.value === 'count') {
extraData.gratitude_form_list = selectedTargets.value
extraData.gratitude_count = countValue.value
}
await onSubmit(extraData)
......
<!--
* @Date: 2025-05-29 15:34:17
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-12-16 13:54:46
* @LastEditTime: 2025-12-17 09:39:20
* @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue
* @Description: 文件描述
-->
......@@ -640,6 +640,8 @@ const formatData = (data) => {
file_type: item.file_type,
subtask_title: item.subtask_title,
subtask_id: item.subtask_id,
gratitude_count: item.gratitude_count,
gratitude_form_list: item.gratitude_form_list,
}
})
return formattedData;
......
<!--
* @Date: 2025-05-29 15:34:17
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-12-15 18:16:40
* @LastEditTime: 2025-12-17 09:40:49
* @FilePath: /mlaj/src/views/teacher/checkinPage.vue
* @Description: 文件描述
-->
......@@ -714,7 +714,9 @@ const formatData = (data) => {
is_audit: item.status === 5 ? true : false, // 5=审批通过,7=审批不通过
task_title: item.task_title || '',
subtask_title: item.subtask_title || '',
subtask_id: item.subtask_id,
subtask_id: item.subtask_id || '',
gratitude_count: item.gratitude_count || 0,
gratitude_form_list: item.gratitude_form_list || [],
}
})
return formattedData;
......
......@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2025-06-19 17:12:19
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-12-15 17:47:10
* @LastEditTime: 2025-12-17 09:40:12
* @FilePath: /mlaj/src/views/teacher/studentPage.vue
* @Description: 学生详情页面
-->
......@@ -879,6 +879,8 @@ const formatData = (data) => {
task_title: item.task_title || '',
subtask_title: item.subtask_title || '',
subtask_id: item.subtask_id || '',
gratitude_count: item.gratitude_count,
gratitude_form_list: item.gratitude_form_list,
}
})
return formattedData;
......
......@@ -312,6 +312,11 @@ function formatData(data) {
feedback_id: item.feedback_id || '',
feedback_score: item.feedback_score || 0,
comment: item.comment || null,
task_title: item.task_title || '',
subtask_title: item.subtask_title || '',
subtask_id: item.subtask_id || '',
gratitude_count: item.gratitude_count || 0,
gratitude_form_list: item.gratitude_form_list || [],
}
})
return formattedData
......