refactor(打卡): 优化打卡功能相关代码结构
- 恢复打卡管理和作业管理菜单项 - 移除打卡页面中未使用的按钮组 - 简化打卡详情页的提交按钮逻辑 - 注释掉未使用的打卡类型跳转方法
Showing
4 changed files
with
77 additions
and
73 deletions
| ... | @@ -130,9 +130,9 @@ | ... | @@ -130,9 +130,9 @@ |
| 130 | </div> | 130 | </div> |
| 131 | 131 | ||
| 132 | <!-- 提交按钮 --> | 132 | <!-- 提交按钮 --> |
| 133 | - <div v-if="!taskDetail.is_finish || route.query.status === 'edit'" class="submit-area"> | 133 | + <div v-if="!taskDetail.is_finish || isEditMode" class="submit-area"> |
| 134 | <van-button type="primary" block size="large" :loading="uploading" @click="handleSubmit"> | 134 | <van-button type="primary" block size="large" :loading="uploading" @click="handleSubmit"> |
| 135 | - {{ route.query.status === 'edit' ? '保存修改' : '提交作业' }} | 135 | + {{ isEditMode ? '保存修改' : '提交' }} |
| 136 | </van-button> | 136 | </van-button> |
| 137 | </div> | 137 | </div> |
| 138 | </div> | 138 | </div> |
| ... | @@ -439,7 +439,7 @@ const getTaskDetail = async (month) => { | ... | @@ -439,7 +439,7 @@ const getTaskDetail = async (month) => { |
| 439 | } | 439 | } |
| 440 | 440 | ||
| 441 | // 处理编辑模式下的类型合并 | 441 | // 处理编辑模式下的类型合并 |
| 442 | - if (route.query.status === 'edit' && Array.isArray(data.attachment_type)) { | 442 | + if (isEditMode.value && Array.isArray(data.attachment_type)) { |
| 443 | const info = await getUploadTaskInfoAPI({ i: route.query.post_id }); | 443 | const info = await getUploadTaskInfoAPI({ i: route.query.post_id }); |
| 444 | if (info.code) { | 444 | if (info.code) { |
| 445 | data.attachment_type = [...new Set([...data.attachment_type, info.data.file_type])]; | 445 | data.attachment_type = [...new Set([...data.attachment_type, info.data.file_type])]; | ... | ... |
| 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-11 10:32:47 | 4 | + * @LastEditTime: 2025-12-11 13:03:09 |
| 5 | * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue | 5 | * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -563,24 +563,27 @@ const getIconName = (type) => { | ... | @@ -563,24 +563,27 @@ const getIconName = (type) => { |
| 563 | * 处理打卡类型点击事件 | 563 | * 处理打卡类型点击事件 |
| 564 | * @param {string} type - 打卡类型 | 564 | * @param {string} type - 打卡类型 |
| 565 | */ | 565 | */ |
| 566 | -const handleCheckinTypeClick = (type) => { | 566 | +// const handleCheckinTypeClick = (type) => { |
| 567 | - switch (type) { | 567 | +// switch (type) { |
| 568 | - case 'text': | 568 | +// case 'text': |
| 569 | - goToCheckinTextPage(); | 569 | +// goToCheckinTextPage(); |
| 570 | - break; | 570 | +// break; |
| 571 | - case 'image': | 571 | +// case 'image': |
| 572 | - goToCheckinImagePage(); | 572 | +// goToCheckinImagePage(); |
| 573 | - break; | 573 | +// break; |
| 574 | - case 'video': | 574 | +// case 'video': |
| 575 | - goToCheckinVideoPage(); | 575 | +// goToCheckinVideoPage(); |
| 576 | - break; | 576 | +// break; |
| 577 | - case 'audio': | 577 | +// case 'audio': |
| 578 | - goToCheckinAudioPage(); | 578 | +// goToCheckinAudioPage(); |
| 579 | - break; | 579 | +// break; |
| 580 | - default: | 580 | +// case 'count': |
| 581 | - console.warn('未知的打卡类型:', type); | 581 | +// goToCheckinCountPage(); |
| 582 | - } | 582 | +// break; |
| 583 | -}; | 583 | +// default: |
| 584 | +// console.warn('未知的打卡类型:', type); | ||
| 585 | +// } | ||
| 586 | +// }; | ||
| 584 | 587 | ||
| 585 | /** | 588 | /** |
| 586 | * 跳转到打卡详情页面 | 589 | * 跳转到打卡详情页面 |
| ... | @@ -596,48 +599,49 @@ const goToCheckinDetailPage = () => { | ... | @@ -596,48 +599,49 @@ const goToCheckinDetailPage = () => { |
| 596 | date: current_date, | 599 | date: current_date, |
| 597 | is_patch: isPatchCheckin.value ? '1' : '0', | 600 | is_patch: isPatchCheckin.value ? '1' : '0', |
| 598 | type: taskDetail.value.task_type, | 601 | type: taskDetail.value.task_type, |
| 602 | + // type: 'count', | ||
| 599 | } | 603 | } |
| 600 | }) | 604 | }) |
| 601 | } | 605 | } |
| 602 | 606 | ||
| 603 | -const goToCheckinTextPage = () => { | 607 | +// const goToCheckinTextPage = () => { |
| 604 | - router.push({ | 608 | +// router.push({ |
| 605 | - path: '/checkin/text', | 609 | +// path: '/checkin/text', |
| 606 | - query: { | 610 | +// query: { |
| 607 | - id: route.query.id, | 611 | +// id: route.query.id, |
| 608 | - type: 'text' | 612 | +// type: 'text' |
| 609 | - } | 613 | +// } |
| 610 | - }) | 614 | +// }) |
| 611 | -} | 615 | +// } |
| 612 | - | 616 | + |
| 613 | -const goToCheckinImagePage = () => { | 617 | +// const goToCheckinImagePage = () => { |
| 614 | - router.push({ | 618 | +// router.push({ |
| 615 | - path: '/checkin/image', | 619 | +// path: '/checkin/image', |
| 616 | - query: { | 620 | +// query: { |
| 617 | - id: route.query.id, | 621 | +// id: route.query.id, |
| 618 | - type: 'image' | 622 | +// type: 'image' |
| 619 | - } | 623 | +// } |
| 620 | - }) | 624 | +// }) |
| 621 | -} | 625 | +// } |
| 622 | -const goToCheckinVideoPage = (type) => { | 626 | +// const goToCheckinVideoPage = (type) => { |
| 623 | - router.push({ | 627 | +// router.push({ |
| 624 | - path: '/checkin/video', | 628 | +// path: '/checkin/video', |
| 625 | - query: { | 629 | +// query: { |
| 626 | - id: route.query.id, | 630 | +// id: route.query.id, |
| 627 | - type: 'video', | 631 | +// type: 'video', |
| 628 | - } | 632 | +// } |
| 629 | - }) | 633 | +// }) |
| 630 | -} | 634 | +// } |
| 631 | - | 635 | + |
| 632 | -const goToCheckinAudioPage = (type) => { | 636 | +// const goToCheckinAudioPage = (type) => { |
| 633 | - router.push({ | 637 | +// router.push({ |
| 634 | - path: '/checkin/audio', | 638 | +// path: '/checkin/audio', |
| 635 | - query: { | 639 | +// query: { |
| 636 | - id: route.query.id, | 640 | +// id: route.query.id, |
| 637 | - type: 'audio', | 641 | +// type: 'audio', |
| 638 | - } | 642 | +// } |
| 639 | - }) | 643 | +// }) |
| 640 | -} | 644 | +// } |
| 641 | 645 | ||
| 642 | const handLike = async (post) => { | 646 | const handLike = async (post) => { |
| 643 | if (!post.is_liked) { | 647 | if (!post.is_liked) { | ... | ... |
| ... | @@ -318,21 +318,21 @@ const menuItems3 = ref([ | ... | @@ -318,21 +318,21 @@ const menuItems3 = ref([ |
| 318 | ]); | 318 | ]); |
| 319 | 319 | ||
| 320 | const menuItems4 = ref([ | 320 | const menuItems4 = ref([ |
| 321 | - // { | 321 | + { |
| 322 | - // icon: "book", | 322 | + icon: "book", |
| 323 | - // title: "打卡管理", | 323 | + title: "打卡管理", |
| 324 | - // path: "/teacher/checkin", | 324 | + path: "/teacher/checkin", |
| 325 | - // }, | 325 | + }, |
| 326 | { | 326 | { |
| 327 | icon: "user", | 327 | icon: "user", |
| 328 | title: "我的班级", | 328 | title: "我的班级", |
| 329 | path: "/teacher/myClass", | 329 | path: "/teacher/myClass", |
| 330 | }, | 330 | }, |
| 331 | - // { | 331 | + { |
| 332 | - // icon: "book", | 332 | + icon: "book", |
| 333 | - // title: "作业管理", | 333 | + title: "作业管理", |
| 334 | - // path: "/teacher/tasks", | 334 | + path: "/teacher/tasks", |
| 335 | - // }, | 335 | + }, |
| 336 | ]); | 336 | ]); |
| 337 | 337 | ||
| 338 | const handleCheckin = () => { | 338 | const handleCheckin = () => { | ... | ... |
| 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-11-10 10:43:07 | 4 | + * @LastEditTime: 2025-12-11 13:24:10 |
| 5 | * @FilePath: /mlaj/src/views/teacher/checkinPage.vue | 5 | * @FilePath: /mlaj/src/views/teacher/checkinPage.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -25,7 +25,7 @@ | ... | @@ -25,7 +25,7 @@ |
| 25 | @click-subtitle="onClickSubtitle"> | 25 | @click-subtitle="onClickSubtitle"> |
| 26 | </van-calendar> | 26 | </van-calendar> |
| 27 | 27 | ||
| 28 | - <div style="padding: 0 1rem; margin-top: 1rem;"> | 28 | + <!-- <div style="padding: 0 1rem; margin-top: 1rem;"> |
| 29 | <van-row gutter="15"> | 29 | <van-row gutter="15"> |
| 30 | <van-col span="12"> | 30 | <van-col span="12"> |
| 31 | <van-button type="primary" block icon="edit" @click="handleAdd('checkin')">安排打卡</van-button> | 31 | <van-button type="primary" block icon="edit" @click="handleAdd('checkin')">安排打卡</van-button> |
| ... | @@ -34,7 +34,7 @@ | ... | @@ -34,7 +34,7 @@ |
| 34 | <van-button type="primary" block icon="video" @click="handleAdd('homework')">设置作业</van-button> | 34 | <van-button type="primary" block icon="video" @click="handleAdd('homework')">设置作业</van-button> |
| 35 | </van-col> | 35 | </van-col> |
| 36 | </van-row> | 36 | </van-row> |
| 37 | - </div> | 37 | + </div> --> |
| 38 | 38 | ||
| 39 | <!--<div v-if="showProgress" class="text-wrapper"> | 39 | <!--<div v-if="showProgress" class="text-wrapper"> |
| 40 | <div class="text-header">打卡统计</div> | 40 | <div class="text-header">打卡统计</div> | ... | ... |
-
Please register or login to post a comment