提交 c86f6e66 authored 作者: lihuihui's avatar lihuihui
......@@ -19,14 +19,22 @@ export default {
computed: {
curriculum() {
return this.data.curriculum
},
isWeapp() {
return this.$store.state.isWeapp
}
},
methods: {
onClick(data) {
this.$router.push({
name: 'courseLearnItem',
params: { id: data.course_id }
})
if (this.isWeapp) {
const url = `/pages/web/index?src=${window.location.origin}/course/learn/${data.course_id}`
wx.miniProgram.navigateTo({ url })
} else {
this.$router.push({
name: 'courseLearnItem',
params: { id: data.course_id }
})
}
}
}
}
......
......@@ -7,7 +7,7 @@
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title>道路运输安全知识线上课</title>
<title></title>
<meta name="viewport" id="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no">
</head>
<body>
......
......@@ -48,6 +48,9 @@ export default {
return {
'has-more': this.hasMore && !this.showMore
}
},
isWeapp() {
return this.$store.state.isWeapp
}
},
methods: {
......
......@@ -38,6 +38,9 @@ import * as api from '@/api/course.js'
export default {
name: 'Index',
components: { SearchBar, Card, FreeCourseItem },
metaInfo: {
title: '道路运输安全知识线上课'
},
data() {
return {
courseList: [] // 免费课程列表
......
......@@ -144,7 +144,7 @@ export default {
},
checkWechatLogin() {
return !!(
Cookies.get('wechat_login_error') &&
Cookies.get('wechat_login_error') ||
Cookies.get('wechat_login_no_phone_error')
)
}
......
......@@ -38,6 +38,11 @@ export default {
}
}
},
computed: {
isWeapp() {
return this.$store.state.isWeapp
}
},
methods: {
getList() {
this.loaded = false
......@@ -51,7 +56,11 @@ export default {
this.getList()
},
onClick(data) {
this.$router.push({ name: 'courseLearnItem', params: { id: data.id } })
const url = data.free
? `/pages/free/item?id=${data.course_id}&chapter_id=${data.id}`
: `/pages/web/index?src=${window.location.origin}/course/learn/${data.id}`
wx.miniProgram.navigateTo({ url })
// this.$router.push({ name: 'courseLearnItem', params: { id: data.id } })
}
},
beforeMount() {
......
......@@ -51,7 +51,9 @@ export default {
this.getList()
},
onClick(data) {
this.$router.push({ name: 'courseTagItem', params: { id: data.id } })
const url = `/pages/web/index?src=${window.location.origin}/course/tag/${data.id}`
wx.miniProgram.navigateTo({ url })
// this.$router.push({ name: 'courseTagItem', params: { id: data.id } })
}
},
beforeMount() {
......
......@@ -64,13 +64,10 @@ export default {
this.getList()
},
onClick(data) {
if (this.isWeapp) {
wx.miniProgram.navigateTo({
url: `/pages/course/item?id=${data.course_id}&chapter_id=${data.id}`
})
} else {
window.alert('请在微信小程序中打开')
}
const url = data.free
? `/pages/free/item?id=${data.course_id}&chapter_id=${data.id}`
: `/pages/course/item?id=${data.course_id}&chapter_id=${data.id}`
wx.miniProgram.navigateTo({ url })
}
},
beforeMount() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论