hookehuyr

refactor(打卡): 优化打卡功能相关代码结构

- 恢复打卡管理和作业管理菜单项
- 移除打卡页面中未使用的按钮组
- 简化打卡详情页的提交按钮逻辑
- 注释掉未使用的打卡类型跳转方法
......@@ -130,9 +130,9 @@
</div>
<!-- 提交按钮 -->
<div v-if="!taskDetail.is_finish || route.query.status === 'edit'" class="submit-area">
<div v-if="!taskDetail.is_finish || isEditMode" class="submit-area">
<van-button type="primary" block size="large" :loading="uploading" @click="handleSubmit">
{{ route.query.status === 'edit' ? '保存修改' : '提交作业' }}
{{ isEditMode ? '保存修改' : '提交' }}
</van-button>
</div>
</div>
......@@ -439,7 +439,7 @@ const getTaskDetail = async (month) => {
}
// 处理编辑模式下的类型合并
if (route.query.status === 'edit' && Array.isArray(data.attachment_type)) {
if (isEditMode.value && Array.isArray(data.attachment_type)) {
const info = await getUploadTaskInfoAPI({ i: route.query.post_id });
if (info.code) {
data.attachment_type = [...new Set([...data.attachment_type, info.data.file_type])];
......
<!--
* @Date: 2025-05-29 15:34:17
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-12-11 10:32:47
* @LastEditTime: 2025-12-11 13:03:09
* @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue
* @Description: 文件描述
-->
......@@ -563,24 +563,27 @@ const getIconName = (type) => {
* 处理打卡类型点击事件
* @param {string} type - 打卡类型
*/
const handleCheckinTypeClick = (type) => {
switch (type) {
case 'text':
goToCheckinTextPage();
break;
case 'image':
goToCheckinImagePage();
break;
case 'video':
goToCheckinVideoPage();
break;
case 'audio':
goToCheckinAudioPage();
break;
default:
console.warn('未知的打卡类型:', type);
}
};
// const handleCheckinTypeClick = (type) => {
// switch (type) {
// case 'text':
// goToCheckinTextPage();
// break;
// case 'image':
// goToCheckinImagePage();
// break;
// case 'video':
// goToCheckinVideoPage();
// break;
// case 'audio':
// goToCheckinAudioPage();
// break;
// case 'count':
// goToCheckinCountPage();
// break;
// default:
// console.warn('未知的打卡类型:', type);
// }
// };
/**
* 跳转到打卡详情页面
......@@ -596,48 +599,49 @@ const goToCheckinDetailPage = () => {
date: current_date,
is_patch: isPatchCheckin.value ? '1' : '0',
type: taskDetail.value.task_type,
// type: 'count',
}
})
}
const goToCheckinTextPage = () => {
router.push({
path: '/checkin/text',
query: {
id: route.query.id,
type: 'text'
}
})
}
const goToCheckinImagePage = () => {
router.push({
path: '/checkin/image',
query: {
id: route.query.id,
type: 'image'
}
})
}
const goToCheckinVideoPage = (type) => {
router.push({
path: '/checkin/video',
query: {
id: route.query.id,
type: 'video',
}
})
}
const goToCheckinAudioPage = (type) => {
router.push({
path: '/checkin/audio',
query: {
id: route.query.id,
type: 'audio',
}
})
}
// const goToCheckinTextPage = () => {
// router.push({
// path: '/checkin/text',
// query: {
// id: route.query.id,
// type: 'text'
// }
// })
// }
// const goToCheckinImagePage = () => {
// router.push({
// path: '/checkin/image',
// query: {
// id: route.query.id,
// type: 'image'
// }
// })
// }
// const goToCheckinVideoPage = (type) => {
// router.push({
// path: '/checkin/video',
// query: {
// id: route.query.id,
// type: 'video',
// }
// })
// }
// const goToCheckinAudioPage = (type) => {
// router.push({
// path: '/checkin/audio',
// query: {
// id: route.query.id,
// type: 'audio',
// }
// })
// }
const handLike = async (post) => {
if (!post.is_liked) {
......
......@@ -318,21 +318,21 @@ const menuItems3 = ref([
]);
const menuItems4 = ref([
// {
// icon: "book",
// title: "打卡管理",
// path: "/teacher/checkin",
// },
{
icon: "book",
title: "打卡管理",
path: "/teacher/checkin",
},
{
icon: "user",
title: "我的班级",
path: "/teacher/myClass",
},
// {
// icon: "book",
// title: "作业管理",
// path: "/teacher/tasks",
// },
{
icon: "book",
title: "作业管理",
path: "/teacher/tasks",
},
]);
const handleCheckin = () => {
......
<!--
* @Date: 2025-05-29 15:34:17
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-11-10 10:43:07
* @LastEditTime: 2025-12-11 13:24:10
* @FilePath: /mlaj/src/views/teacher/checkinPage.vue
* @Description: 文件描述
-->
......@@ -25,7 +25,7 @@
@click-subtitle="onClickSubtitle">
</van-calendar>
<div style="padding: 0 1rem; margin-top: 1rem;">
<!-- <div style="padding: 0 1rem; margin-top: 1rem;">
<van-row gutter="15">
<van-col span="12">
<van-button type="primary" block icon="edit" @click="handleAdd('checkin')">安排打卡</van-button>
......@@ -34,7 +34,7 @@
<van-button type="primary" block icon="video" @click="handleAdd('homework')">设置作业</van-button>
</van-col>
</van-row>
</div>
</div> -->
<!--<div v-if="showProgress" class="text-wrapper">
<div class="text-header">打卡统计</div>
......