fix(HomePage): 添加打卡提交前的输入验证
在提交打卡内容前,添加了对打卡项目和打卡内容的验证。如果未选择打卡项目或未输入打卡内容,将显示相应的提示信息,避免用户提交无效数据。
Showing
1 changed file
with
10 additions
and
1 deletions
| ... | @@ -489,6 +489,8 @@ import SummerCampCard from '@/components/ui/SummerCampCard.vue' | ... | @@ -489,6 +489,8 @@ import SummerCampCard from '@/components/ui/SummerCampCard.vue' |
| 489 | import { courses, liveStreams, activities, checkInTypes, userRecommendations } from '@/utils/mockData' | 489 | import { courses, liveStreams, activities, checkInTypes, userRecommendations } from '@/utils/mockData' |
| 490 | import { useTitle } from '@vueuse/core' | 490 | import { useTitle } from '@vueuse/core' |
| 491 | import { useAuth } from '@/contexts/auth' | 491 | import { useAuth } from '@/contexts/auth' |
| 492 | +import { showToast } from 'vant' | ||
| 493 | +import 'vant/lib/toast/style' | ||
| 492 | 494 | ||
| 493 | const $route = useRoute() | 495 | const $route = useRoute() |
| 494 | const $router = useRouter() | 496 | const $router = useRouter() |
| ... | @@ -561,7 +563,14 @@ const handleCheckInSelect = (checkInType) => { | ... | @@ -561,7 +563,14 @@ const handleCheckInSelect = (checkInType) => { |
| 561 | 563 | ||
| 562 | // 处理打卡提交 | 564 | // 处理打卡提交 |
| 563 | const handleCheckInSubmit = () => { | 565 | const handleCheckInSubmit = () => { |
| 564 | - if (!checkInContent.value.trim()) return | 566 | + if (!selectedCheckIn.value) { |
| 567 | + showToast('请选择打卡项目') | ||
| 568 | + return | ||
| 569 | + } | ||
| 570 | + if (!checkInContent.value.trim()) { | ||
| 571 | + showToast('请输入打卡内容') | ||
| 572 | + return | ||
| 573 | + } | ||
| 565 | 574 | ||
| 566 | isCheckingIn.value = true | 575 | isCheckingIn.value = true |
| 567 | 576 | ... | ... |
-
Please register or login to post a comment