Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
mlaj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-12-10 11:32:31 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0d366a70daf986fdac90d8946376d3a2a2879c26
0d366a70
1 parent
0f1a0fb9
fix(teacher): 修复任务主页条件渲染和打卡类型处理
添加任务类型判断逻辑,修复日期和附件类型的条件渲染 防止打卡类型任务跳转作业记录页
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
src/views/teacher/taskHomePage.vue
src/views/teacher/taskHomePage.vue
View file @
0d366a7
<!--
* @Date: 2025-11-19 21:00:00
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-12-
05 22:31:03
* @LastEditTime: 2025-12-
10 11:32:08
* @FilePath: /mlaj/src/views/teacher/taskHomePage.vue
* @Description: 教师端作业主页(头部介绍、统计、日历与学生完成情况;数据Mock)
-->
...
...
@@ -19,9 +19,10 @@
<div class="details text-sm text-gray-600">
<div class="detailItem">周期:{{ task_details.cycle }}</div>
<div class="detailItem">频次:{{ task_details.frequency }}</div>
<div class="detailItem">开始时间:{{ task_details.begin_date }}</div>
<div class="detailItem">截止时间:{{ task_details.end_date }}</div>
<div class="detailItem">附件类型:{{ task_details.attachment_type }}</div>
<div v-if="task_details.begin_date" class="detailItem">开始时间:{{ task_details.begin_date }}</div>
<div v-if="task_details.end_date" class="detailItem">截止时间:{{ task_details.end_date }}</div>
<div v-if="task_details.attachment_type.length" class="detailItem">附件类型:{{ task_details.attachment_type }}</div>
<div v-if="task_type === 'checkin'" class="detailItem">类型:打卡签到</div>
</div>
</div>
...
...
@@ -90,7 +91,7 @@
<div class="text-base font-semibold text-gray-800">完成情况({{ completed_count }}/{{ user_list.length }})
</div>
<!-- <div class="text-xs text-gray-500">当前日期:{{ current_date_text }}</div> -->
<div class="text-xs text-gray-500">点击查看作业记录</div>
<div
v-if="task_type !== 'checkin'"
class="text-xs text-gray-500">点击查看作业记录</div>
</div>
<div class="grid grid-cols-5 gap-3 StudentsGrid">
<div v-for="(stu, idx) in students_status" :key="stu.id"
...
...
@@ -223,6 +224,7 @@ const upload_text = computed(() => `${upload_count.value}%`)
const today = new Date()
const selected_date = ref(format_date(today))
const user_list = ref([])
const task_type = ref('')
/**
* 获取作业详情和学生完成情况
...
...
@@ -237,6 +239,7 @@ async function fetchData() {
if (res.code) {
task_title.value = res.data.title
task_intro.value = res.data.note
task_type.value = res.data.task_type || ''
// 格式化周期显示
const cycleMap = {
...
...
@@ -265,8 +268,8 @@ async function fetchData() {
task_details.value = {
cycle: cycleText,
frequency: `每周期${res.data.frequency || 1}次`,
begin_date:
dayjs(res.data.begin_date).format('YYYY-MM-DD')
,
end_date:
dayjs(res.data.end_date).format('YYYY-MM-DD')
,
begin_date:
res.data.begin_date ? dayjs(res.data.begin_date).format('YYYY-MM-DD') : ''
,
end_date:
res.data.end_date ? dayjs(res.data.end_date).format('YYYY-MM-DD') : ''
,
// time_range: `${res.data.begin_date || '00:00'} ~ ${res.data.end_date || '23:59'}`, // 注意:API返回的begin_date/end_date可能是日期也可能是时间,这里暂且直接展示
attachment_type: attachmentText
}
...
...
@@ -375,6 +378,9 @@ const current_date_text = computed(() => selected_date.value)
* @returns {void}
*/
function go_student_record(stu) {
if (task_type.value === 'checkin') {
return
}
// 跳转到固定ID的作业记录页面,当前版本不使用传入ID
$router.push({ name: 'StudentRecord', query: { created_by: stu.id, date: selected_date.value } })
}
...
...
Please
register
or
login
to post a comment