fix(课程详情页): 修复课程审核状态检查逻辑并优化价格显示
添加课程审核状态检查逻辑,阻止用户访问未审核课程 根据pay_type优化课程价格显示逻辑 修复查看课程按钮的点击处理函数
Showing
1 changed file
with
31 additions
and
4 deletions
| ... | @@ -16,9 +16,14 @@ | ... | @@ -16,9 +16,14 @@ |
| 16 | <h1 class="text-2xl text-white font-bold mb-1">{{ course?.title }}</h1> | 16 | <h1 class="text-2xl text-white font-bold mb-1">{{ course?.title }}</h1> |
| 17 | <h2 class="text-lg text-white/90">{{ course?.subtitle }}</h2> | 17 | <h2 class="text-lg text-white/90">{{ course?.subtitle }}</h2> |
| 18 | <div class="mt-4 flex justify-between items-center"> | 18 | <div class="mt-4 flex justify-between items-center"> |
| 19 | - <div v-if="course?.price !== '0.00'" class="text-orange-300 font-bold text-2xl">¥{{ course?.price }}</div> | 19 | + <div v-if="course?.pay_type !== 'DESIGNATE'"> |
| 20 | + <div v-if="course?.price !== '0.00'" class="text-orange-300 font-bold text-2xl">¥{{ course?.price }}</div> | ||
| 21 | + <div v-else class="text-orange-300 text-sm"> | ||
| 22 | + 免费 | ||
| 23 | + </div> | ||
| 24 | + </div> | ||
| 20 | <div v-else class="text-orange-300 text-sm"> | 25 | <div v-else class="text-orange-300 text-sm"> |
| 21 | - 免费 | 26 | + 指定学习 |
| 22 | </div> | 27 | </div> |
| 23 | <div class="bg-orange-500/30 text-orange-100 text-xs px-3 py-1 rounded-full"> | 28 | <div class="bg-orange-500/30 text-orange-100 text-xs px-3 py-1 rounded-full"> |
| 24 | 限时优惠 | 29 | 限时优惠 |
| ... | @@ -245,7 +250,7 @@ | ... | @@ -245,7 +250,7 @@ |
| 245 | color="linear-gradient(to right, #22c55e, #16a34a)" class="shadow-md"> | 250 | color="linear-gradient(to right, #22c55e, #16a34a)" class="shadow-md"> |
| 246 | {{ course?.price !== '0.00' ? '立即' : '免费' }}购买 | 251 | {{ course?.price !== '0.00' ? '立即' : '免费' }}购买 |
| 247 | </van-button> | 252 | </van-button> |
| 248 | - <van-button v-else @click="router.push(`/profile/studyCourse/${course?.id}`)" round block | 253 | + <van-button v-else @click="handleViewCourse" round block |
| 249 | color="linear-gradient(to right, #22c55e, #16a34a)" class="shadow-md"> | 254 | color="linear-gradient(to right, #22c55e, #16a34a)" class="shadow-md"> |
| 250 | 查看课程 | 255 | 查看课程 |
| 251 | </van-button> | 256 | </van-button> |
| ... | @@ -534,7 +539,7 @@ onMounted(async () => { | ... | @@ -534,7 +539,7 @@ onMounted(async () => { |
| 534 | } | 539 | } |
| 535 | 540 | ||
| 536 | 541 | ||
| 537 | - // 进入页面时清理所有info_entry_completed_开头的localStorage标记 | 542 | + // TAG: 录入个人信息表单的标记, 进入页面时清理所有info_entry_completed_开头的localStorage标记 |
| 538 | const keysToRemove = [] | 543 | const keysToRemove = [] |
| 539 | for (let i = 0; i < localStorage.length; i++) { | 544 | for (let i = 0; i < localStorage.length; i++) { |
| 540 | const key = localStorage.key(i) | 545 | const key = localStorage.key(i) |
| ... | @@ -564,6 +569,18 @@ const toggleSchedule = () => { | ... | @@ -564,6 +569,18 @@ const toggleSchedule = () => { |
| 564 | isScheduleExpanded.value = !isScheduleExpanded.value | 569 | isScheduleExpanded.value = !isScheduleExpanded.value |
| 565 | } | 570 | } |
| 566 | 571 | ||
| 572 | +/** | ||
| 573 | + * 处理查看课程按钮点击 | ||
| 574 | + */ | ||
| 575 | +const handleViewCourse = () => { | ||
| 576 | + // 检查课程审核状态 | ||
| 577 | + if (course.value.is_approval_enable === false) { | ||
| 578 | + showToast('购买的课程正在审核中,请稍后再试'); | ||
| 579 | + return; | ||
| 580 | + } | ||
| 581 | + router.push(`/profile/studyCourse/${course.value.id}`); | ||
| 582 | +}; | ||
| 583 | + | ||
| 567 | // 跳转课程大纲 | 584 | // 跳转课程大纲 |
| 568 | const goToStudyDetail = (item) => { | 585 | const goToStudyDetail = (item) => { |
| 569 | console.warn(course.value); | 586 | console.warn(course.value); |
| ... | @@ -571,6 +588,11 @@ const goToStudyDetail = (item) => { | ... | @@ -571,6 +588,11 @@ const goToStudyDetail = (item) => { |
| 571 | if (!course.value.is_buy) { | 588 | if (!course.value.is_buy) { |
| 572 | return; | 589 | return; |
| 573 | } | 590 | } |
| 591 | + // 检查课程审核状态 | ||
| 592 | + if (course.value.is_approval_enable === false) { | ||
| 593 | + showToast('购买的课程正在审核中,请稍后再试'); | ||
| 594 | + return; | ||
| 595 | + } | ||
| 574 | // 跳转详情 | 596 | // 跳转详情 |
| 575 | router.push(`/studyDetail/${item.id}`) | 597 | router.push(`/studyDetail/${item.id}`) |
| 576 | } | 598 | } |
| ... | @@ -632,6 +654,11 @@ const handleCheckInSubmit = async () => { | ... | @@ -632,6 +654,11 @@ const handleCheckInSubmit = async () => { |
| 632 | * 打开打卡弹窗 | 654 | * 打开打卡弹窗 |
| 633 | */ | 655 | */ |
| 634 | const goToCheckin = () => { | 656 | const goToCheckin = () => { |
| 657 | + // 检查课程审核状态 | ||
| 658 | + if (course.value.is_approval_enable === false) { | ||
| 659 | + showToast('购买的课程正在审核中,请稍后再试'); | ||
| 660 | + return; | ||
| 661 | + } | ||
| 635 | if(!default_list.value.length) { | 662 | if(!default_list.value.length) { |
| 636 | showToast('暂无打卡任务'); | 663 | showToast('暂无打卡任务'); |
| 637 | return; | 664 | return; | ... | ... |
-
Please register or login to post a comment