feat(任务管理): 统一日期显示格式并使用dayjs格式化
在任务管理和主页页面中,将日期显示从原始格式改为使用dayjs统一格式化为'YYYY-MM-DD'格式
Showing
2 changed files
with
11 additions
and
5 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-11-19 21:00:00 | 2 | * @Date: 2025-11-19 21:00:00 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-12-02 22:28:25 | 4 | + * @LastEditTime: 2025-12-05 22:31:03 |
| 5 | * @FilePath: /mlaj/src/views/teacher/taskHomePage.vue | 5 | * @FilePath: /mlaj/src/views/teacher/taskHomePage.vue |
| 6 | * @Description: 教师端作业主页(头部介绍、统计、日历与学生完成情况;数据Mock) | 6 | * @Description: 教师端作业主页(头部介绍、统计、日历与学生完成情况;数据Mock) |
| 7 | --> | 7 | --> |
| ... | @@ -19,7 +19,8 @@ | ... | @@ -19,7 +19,8 @@ |
| 19 | <div class="details text-sm text-gray-600"> | 19 | <div class="details text-sm text-gray-600"> |
| 20 | <div class="detailItem">周期:{{ task_details.cycle }}</div> | 20 | <div class="detailItem">周期:{{ task_details.cycle }}</div> |
| 21 | <div class="detailItem">频次:{{ task_details.frequency }}</div> | 21 | <div class="detailItem">频次:{{ task_details.frequency }}</div> |
| 22 | - <div class="detailItem">时间段:{{ task_details.time_range }}</div> | 22 | + <div class="detailItem">开始时间:{{ task_details.begin_date }}</div> |
| 23 | + <div class="detailItem">截止时间:{{ task_details.end_date }}</div> | ||
| 23 | <div class="detailItem">附件类型:{{ task_details.attachment_type }}</div> | 24 | <div class="detailItem">附件类型:{{ task_details.attachment_type }}</div> |
| 24 | </div> | 25 | </div> |
| 25 | </div> | 26 | </div> |
| ... | @@ -111,6 +112,7 @@ import { useRoute, useRouter } from 'vue-router' | ... | @@ -111,6 +112,7 @@ import { useRoute, useRouter } from 'vue-router' |
| 111 | import { useTitle } from '@vueuse/core' | 112 | import { useTitle } from '@vueuse/core' |
| 112 | import checkCorner from '@/assets/images/dui.png' | 113 | import checkCorner from '@/assets/images/dui.png' |
| 113 | import { getTeacherTaskDetailAPI } from '@/api/teacher' | 114 | import { getTeacherTaskDetailAPI } from '@/api/teacher' |
| 115 | +import dayjs from 'dayjs' | ||
| 114 | 116 | ||
| 115 | const $route = useRoute() | 117 | const $route = useRoute() |
| 116 | const $router = useRouter() | 118 | const $router = useRouter() |
| ... | @@ -263,7 +265,9 @@ async function fetchData() { | ... | @@ -263,7 +265,9 @@ async function fetchData() { |
| 263 | task_details.value = { | 265 | task_details.value = { |
| 264 | cycle: cycleText, | 266 | cycle: cycleText, |
| 265 | frequency: `每周期${res.data.frequency || 1}次`, | 267 | frequency: `每周期${res.data.frequency || 1}次`, |
| 266 | - time_range: `${res.data.begin_date || '00:00'} ~ ${res.data.end_date || '23:59'}`, // 注意:API返回的begin_date/end_date可能是日期也可能是时间,这里暂且直接展示 | 268 | + begin_date: dayjs(res.data.begin_date).format('YYYY-MM-DD'), |
| 269 | + end_date: dayjs(res.data.end_date).format('YYYY-MM-DD'), | ||
| 270 | + // time_range: `${res.data.begin_date || '00:00'} ~ ${res.data.end_date || '23:59'}`, // 注意:API返回的begin_date/end_date可能是日期也可能是时间,这里暂且直接展示 | ||
| 267 | attachment_type: attachmentText | 271 | attachment_type: attachmentText |
| 268 | } | 272 | } |
| 269 | 273 | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-11-19 10:18:00 | 2 | * @Date: 2025-11-19 10:18:00 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-12-01 14:30:47 | 4 | + * @LastEditTime: 2025-12-05 22:15:53 |
| 5 | * @FilePath: /mlaj/src/views/teacher/taskManagePage.vue | 5 | * @FilePath: /mlaj/src/views/teacher/taskManagePage.vue |
| 6 | * @Description: 教师端作业管理页面 | 6 | * @Description: 教师端作业管理页面 |
| 7 | --> | 7 | --> |
| ... | @@ -24,7 +24,8 @@ | ... | @@ -24,7 +24,8 @@ |
| 24 | <!-- 中间内容:占据剩余空间 --> | 24 | <!-- 中间内容:占据剩余空间 --> |
| 25 | <div class="left flex-1"> | 25 | <div class="left flex-1"> |
| 26 | <div class="taskTitle text-sm font-semibold text-gray-800">{{ task.title }}</div> | 26 | <div class="taskTitle text-sm font-semibold text-gray-800">{{ task.title }}</div> |
| 27 | - <div class="taskDates text-xs text-gray-600 mt-1">{{ format_date_range(task.begin_date, task.end_date) }}</div> | 27 | + <div class="taskDates text-xs text-gray-600 mt-1">开始时间:{{ dayjs(task.begin_date).format('YYYY-MM-DD') }}</div> |
| 28 | + <div v-if="task.end_date" class="taskDates text-xs text-gray-600 mt-1">截止时间:{{ dayjs(task.end_date).format('YYYY-MM-DD') }}</div> | ||
| 28 | </div> | 29 | </div> |
| 29 | <!-- 右侧按钮:占用较小空间,右对齐 --> | 30 | <!-- 右侧按钮:占用较小空间,右对齐 --> |
| 30 | <div class="right flex items-center justify-end w-20 ml-3"> | 31 | <div class="right flex items-center justify-end w-20 ml-3"> |
| ... | @@ -42,6 +43,7 @@ import { ref } from 'vue' | ... | @@ -42,6 +43,7 @@ import { ref } from 'vue' |
| 42 | import { useRoute, useRouter } from 'vue-router' | 43 | import { useRoute, useRouter } from 'vue-router' |
| 43 | import { useTitle } from '@vueuse/core' | 44 | import { useTitle } from '@vueuse/core' |
| 44 | import { getTeacherTaskListAPI } from '@/api/teacher' | 45 | import { getTeacherTaskListAPI } from '@/api/teacher' |
| 46 | +import dayjs from 'dayjs' | ||
| 45 | 47 | ||
| 46 | const $route = useRoute() | 48 | const $route = useRoute() |
| 47 | const $router = useRouter() | 49 | const $router = useRouter() | ... | ... |
-
Please register or login to post a comment