hookehuyr

fix(课程详情页): 修复课程审核状态检查逻辑并优化价格显示

添加课程审核状态检查逻辑,阻止用户访问未审核课程
根据pay_type优化课程价格显示逻辑
修复查看课程按钮的点击处理函数
......@@ -16,9 +16,14 @@
<h1 class="text-2xl text-white font-bold mb-1">{{ course?.title }}</h1>
<h2 class="text-lg text-white/90">{{ course?.subtitle }}</h2>
<div class="mt-4 flex justify-between items-center">
<div v-if="course?.price !== '0.00'" class="text-orange-300 font-bold text-2xl">¥{{ course?.price }}</div>
<div v-if="course?.pay_type !== 'DESIGNATE'">
<div v-if="course?.price !== '0.00'" class="text-orange-300 font-bold text-2xl">¥{{ course?.price }}</div>
<div v-else class="text-orange-300 text-sm">
免费
</div>
</div>
<div v-else class="text-orange-300 text-sm">
免费
指定学习
</div>
<div class="bg-orange-500/30 text-orange-100 text-xs px-3 py-1 rounded-full">
限时优惠
......@@ -245,7 +250,7 @@
color="linear-gradient(to right, #22c55e, #16a34a)" class="shadow-md">
{{ course?.price !== '0.00' ? '立即' : '免费' }}购买
</van-button>
<van-button v-else @click="router.push(`/profile/studyCourse/${course?.id}`)" round block
<van-button v-else @click="handleViewCourse" round block
color="linear-gradient(to right, #22c55e, #16a34a)" class="shadow-md">
查看课程
</van-button>
......@@ -534,7 +539,7 @@ onMounted(async () => {
}
// 进入页面时清理所有info_entry_completed_开头的localStorage标记
// TAG: 录入个人信息表单的标记, 进入页面时清理所有info_entry_completed_开头的localStorage标记
const keysToRemove = []
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i)
......@@ -564,6 +569,18 @@ const toggleSchedule = () => {
isScheduleExpanded.value = !isScheduleExpanded.value
}
/**
* 处理查看课程按钮点击
*/
const handleViewCourse = () => {
// 检查课程审核状态
if (course.value.is_approval_enable === false) {
showToast('购买的课程正在审核中,请稍后再试');
return;
}
router.push(`/profile/studyCourse/${course.value.id}`);
};
// 跳转课程大纲
const goToStudyDetail = (item) => {
console.warn(course.value);
......@@ -571,6 +588,11 @@ const goToStudyDetail = (item) => {
if (!course.value.is_buy) {
return;
}
// 检查课程审核状态
if (course.value.is_approval_enable === false) {
showToast('购买的课程正在审核中,请稍后再试');
return;
}
// 跳转详情
router.push(`/studyDetail/${item.id}`)
}
......@@ -632,6 +654,11 @@ const handleCheckInSubmit = async () => {
* 打开打卡弹窗
*/
const goToCheckin = () => {
// 检查课程审核状态
if (course.value.is_approval_enable === false) {
showToast('购买的课程正在审核中,请稍后再试');
return;
}
if(!default_list.value.length) {
showToast('暂无打卡任务');
return;
......