提交 c03a2539 authored 作者: 王鹏飞's avatar 王鹏飞

feat:学习课程页面增加随机跳转购买页

上级 01dbd22f
......@@ -24,6 +24,7 @@
</template>
<script>
import { random } from 'lodash'
import CourseChapter from './components/courseChapter.vue'
import CourseTag from '../tag/index.vue'
import * as api from '@/api/course.js'
......@@ -45,6 +46,9 @@ export default {
computed: {
courseId() {
return this.$route.params.id
},
isVip() {
return this.$store.state.isVip
}
},
methods: {
......@@ -64,7 +68,16 @@ export default {
}
},
beforeMount() {
// 检测是否是付费用户
this.$store.dispatch('checkIsVip').then(isVip => {
if (!isVip) {
this.getCourse()
} else {
const routes = { 0: '/pay', 1: '/payPage' }
const path = routes[random(1)] || '/pay'
this.$router.replace(path)
}
})
}
}
</script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论