提交 159c101d authored 作者: matian's avatar matian

推荐课程增加url跳转

上级 0e340cfa
...@@ -41,13 +41,18 @@ useInfiniteScroll( ...@@ -41,13 +41,18 @@ useInfiniteScroll(
onMounted(() => { onMounted(() => {
handleGetCourseList() handleGetCourseList()
}) })
const handleClickItem = (item: any) => {
if (item.url) {
location.href = item.url
}
}
</script> </script>
<template> <template>
<img src="https://webapp-pub.ezijing.com/project/prp-h5/course_banner.png" style="width: 100%" /> <img src="https://webapp-pub.ezijing.com/project/prp-h5/course_banner.png" style="width: 100%" />
<AppCard title="推荐课程"> <AppCard title="推荐课程">
<div ref="el"> <div ref="el">
<div class="list_item" v-for="(item, index) in courseList.list" :key="index"> <div class="list_item" v-for="(item, index) in courseList.list" :key="index" @click="handleClickItem(item)">
<img :src="item.cover" class="item_img" /> <img :src="item.cover" class="item_img" />
<div class="item_right"> <div class="item_right">
<div class="right_tit">{{ item.name }}</div> <div class="right_tit">{{ item.name }}</div>
......
...@@ -31,11 +31,15 @@ const docs = [ ...@@ -31,11 +31,15 @@ const docs = [
] ]
function handleViewDoc(data: any) { function handleViewDoc(data: any) {
// window.open(data.url) // window.open(data.url)
location.href = data.url if (data.url) {
} location.href = data.url
function showTips() { } else {
Notify({ type: 'primary', message: '尚未开放' }) Notify({ type: 'primary', message: '尚未开放' })
}
} }
// function showTips() {
// Notify({ type: 'primary', message: '尚未开放' })
// }
</script> </script>
<template> <template>
...@@ -45,12 +49,12 @@ function showTips() { ...@@ -45,12 +49,12 @@ function showTips() {
<div class="box box-test"> <div class="box box-test">
<h2>免费课程</h2> <h2>免费课程</h2>
<p class="t1">实战精华等你来看</p> <p class="t1">实战精华等你来看</p>
<p class="t2"><a @click="showTips">去看看 ></a></p> <p class="t2"><a href="https://fi.ezijing.com/shop/?activeIndex=2&type=free_course">去看看 ></a></p>
</div> </div>
<div class="box box-notice"> <div class="box box-notice">
<h2>系统小课</h2> <h2>系统小课</h2>
<p class="t1">专业思维 赢战未来</p> <p class="t1">专业思维 赢战未来</p>
<p class="t2"><a href="https://prp.ezijing.com/personal">去看看 ></a></p> <p class="t2"><a href="https://fi.ezijing.com/shop/?activeIndex=3&type=system_course">去看看 ></a></p>
</div> </div>
</div> </div>
<div class="admission-left"> <div class="admission-left">
......
...@@ -10,6 +10,11 @@ getRecommendCourse().then(res => { ...@@ -10,6 +10,11 @@ getRecommendCourse().then(res => {
courseList.value = res.data.slice(0, 3) courseList.value = res.data.slice(0, 3)
} }
}) })
const handleClickItem = (item: any) => {
if (item.url) {
location.href = item.url
}
}
</script> </script>
<template> <template>
...@@ -22,7 +27,7 @@ getRecommendCourse().then(res => { ...@@ -22,7 +27,7 @@ getRecommendCourse().then(res => {
</div> </div>
</template> </template>
<div class="course_list"> <div class="course_list">
<div class="list_item" v-for="(item, index) in courseList.list" :key="index"> <div class="list_item" v-for="(item, index) in courseList.list" :key="index" @click="handleClickItem(item)">
<img :src="item.cover" class="item_img" /> <img :src="item.cover" class="item_img" />
<div class="item_right"> <div class="item_right">
<div class="right_tit">{{ item.name }}</div> <div class="right_tit">{{ item.name }}</div>
......
...@@ -84,6 +84,7 @@ export interface IRecommendCourse { ...@@ -84,6 +84,7 @@ export interface IRecommendCourse {
name: string name: string
pv: string pv: string
weight: string weight: string
url: string
} }
export interface ITeacherList { export interface ITeacherList {
avatar: string avatar: string
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论