Showing
1 changed file
with
10 additions
and
0 deletions
| ... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
| 19 | v-for="(banner, index) in bannerList" | 19 | v-for="(banner, index) in bannerList" |
| 20 | :key="index" | 20 | :key="index" |
| 21 | class="relative" | 21 | class="relative" |
| 22 | + @click="handleBannerClick(banner)" | ||
| 22 | > | 23 | > |
| 23 | <img | 24 | <img |
| 24 | :src="banner.banner || 'https://cdn.ipadbiz.cn/mlaj/images/featured-course.jpg'" | 25 | :src="banner.banner || 'https://cdn.ipadbiz.cn/mlaj/images/featured-course.jpg'" |
| ... | @@ -124,6 +125,15 @@ const $route = useRoute(); | ... | @@ -124,6 +125,15 @@ const $route = useRoute(); |
| 124 | const $router = useRouter(); | 125 | const $router = useRouter(); |
| 125 | useTitle($route.meta.title); | 126 | useTitle($route.meta.title); |
| 126 | 127 | ||
| 128 | +const handleBannerClick = (banner) => { | ||
| 129 | + if (!banner.post_link) return; | ||
| 130 | + if (banner.post_link.startsWith('http')) { | ||
| 131 | + window.location.href = banner.post_link; | ||
| 132 | + } else { | ||
| 133 | + $router.push(banner.post_link); | ||
| 134 | + } | ||
| 135 | +}; | ||
| 136 | + | ||
| 127 | // Current time for the countdown timer | 137 | // Current time for the countdown timer |
| 128 | const todayDate = new Date(); | 138 | const todayDate = new Date(); |
| 129 | const formattedTime = featuredCourse.liveTime.split(":"); | 139 | const formattedTime = featuredCourse.liveTime.split(":"); | ... | ... |
-
Please register or login to post a comment