提交 1c14d0db authored 作者: lihuihui's avatar lihuihui
......@@ -3,7 +3,7 @@
<div class="course-tag-message-hd">
<div class="course-tag-message__title">{{data.name}}</div>
<div class="course-tag-message__more" @click="viewMore" v-if="hasMore">
<span>{{moreText}}</span>
<span>更多</span>
<van-icon name="arrow" />
</div>
</div>
......@@ -11,7 +11,7 @@
<ul class="message-tag-list" ref="content">
<template v-for="item in dataList">
<li class="course-tag-item" :key="item.id" @click="onClick(item)">
<p>{{item.title}}</p>
<p>{{item.title}}{{item.free? '(免费)': ''}}</p>
</li>
</template>
</ul>
......@@ -42,7 +42,8 @@ export default {
dataList() {
let list = this.data.tag || []
if (!this.isVip) {
list = list.filter(item => item.free)
// 免费的在前
list = [...list.filter(item => item.free), ...list.filter(item => !item.free)]
}
return list.slice(0, this.maxCount)
},
......@@ -58,6 +59,16 @@ export default {
},
methods: {
onClick(data) {
// 未开通
if (!data.free && !this.isVip) {
if (this.isWeapp) {
const url = `/pages/web/index?src=${window.location.origin}/pay`
wx.miniProgram.navigateTo({ url })
} else {
this.$router.push({ name: 'pay' })
}
return
}
if (this.isTest) {
// 知识点测试
const path = `/exam/courseNodeExam?tag_id=${data.id}`
......
......@@ -39,6 +39,12 @@ export default {
return { showMore: false, maxCount: 7 }
},
computed: {
isWeapp() {
return this.$store.state.isWeapp
},
isVip() {
return this.$store.state.isVip
},
hasMore() {
return this.data.length > this.maxCount
},
......@@ -47,13 +53,19 @@ export default {
return this.data.filter((item, index) => index < this.maxCount)
}
return this.data
},
isWeapp() {
return this.$store.state.isWeapp
}
},
methods: {
onClick(data) {
// 未开通
if (!data.free && !this.isVip) {
if (this.isWeapp) {
const url = `/pages/web/index?src=${window.location.origin}/pay`
wx.miniProgram.navigateTo({ url })
} else {
this.$router.push({ name: 'pay' })
}
}
if (this.isTest) {
// 知识点测试
const path = `/exam/courseNodeExam?tag_id=${data.id}`
......@@ -87,7 +99,7 @@ export default {
overflow: hidden;
.num {
display: inline-block;
min-width: 24px;
padding-right: 5px;
}
.text {
border-bottom: 1px solid #c62245;
......
......@@ -8,9 +8,9 @@
<ul class="tag-list">
<li class="tag-item" v-for="item in tagList" :key="item.id" @click="onClick(item)">
<div class="tag-item__title">
<span>{{item.title}}</span>
<span>{{item.title}}{{item.free? '(免费)': ''}}</span>
</div>
<div class="tag-item__free" v-if="item.free">(免费)</div>
<!-- <div class="tag-item__free" v-if="item.free">(免费)</div> -->
<div class="tag-item__arrow">
<van-icon name="arrow" />
</div>
......
......@@ -185,7 +185,7 @@ export default {
domain: '.ezijing.com'
})
// 打开地址
window.location.href = wechatUrl
window.location.replace(wechatUrl)
},
checkWechatLogin() {
return !!(Cookies.get('wechat_login_error') || Cookies.get('wechat_login_no_phone_error'))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论