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

bug fixes

上级 9f017995
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div class="progress">{{item.video_progress | progressText}}</div> <div class="progress">{{item.video_progress | progressText}}</div>
</li> </li>
</ul> </ul>
<van-empty description="暂无内容" v-else /> <van-empty description="您还没有学习课程,快快开始学习吧!" v-else />
</div> </div>
</template> </template>
<script> <script>
......
...@@ -3,7 +3,23 @@ ...@@ -3,7 +3,23 @@
<div class="learn-choose"> <div class="learn-choose">
<van-cell title="选择已学课程:" :value="selectedItem.name" is-link @click="popupVisible = true" /> <van-cell title="选择已学课程:" :value="selectedItem.name" is-link @click="popupVisible = true" />
</div> </div>
<buy-course-list v-if="selectedItem.type === 1" /> <!-- 已学课程 -->
<template v-if="selectedItem.type === 1">
<buy-course-list v-if="isVip" />
<template v-else>
<van-empty
image="https://zws-imgs-pub.ezijing.com/transport/weapp/empty.png"
description="快去开启课程学习,一起加油考证吧!"
class="custom-empty"
/>
<div class="fixed-box">
<div class="fixed-inner">
<div class="fixed-button" @click="toCourse">学更多课程</div>
</div>
</div>
</template>
</template>
<!-- 试题课程 -->
<free-course-list v-else /> <free-course-list v-else />
<van-popup <van-popup
v-model="popupVisible" v-model="popupVisible"
...@@ -44,6 +60,14 @@ export default { ...@@ -44,6 +60,14 @@ export default {
selectedItem: { type: 1, name: '课程学习' } selectedItem: { type: 1, name: '课程学习' }
} }
}, },
computed: {
isWeapp() {
return this.$store.state.isWeapp
},
isVip() {
return this.$store.state.isVip
}
},
methods: { methods: {
popupOpen() { popupOpen() {
this.changeSelected(this.selectedItem) this.changeSelected(this.selectedItem)
...@@ -59,8 +83,20 @@ export default { ...@@ -59,8 +83,20 @@ export default {
const found = this.chooseList.find(item => item.selected) const found = this.chooseList.find(item => item.selected)
this.selectedItem = found this.selectedItem = found
this.popupVisible = false this.popupVisible = false
},
toCourse(data) {
if (this.isWeapp) {
const url = `/pages/web/index?src=${window.location.origin}/course/learn`
wx.miniProgram.navigateTo({ url })
} else {
this.$router.push({ name: 'courseLearn' })
} }
} }
},
beforeMount() {
// 检测是否是付费用户
this.$store.dispatch('checkIsVip')
}
} }
</script> </script>
......
...@@ -6,11 +6,11 @@ import { getUser, logout, getIsVip } from '@/api/account' ...@@ -6,11 +6,11 @@ import { getUser, logout, getIsVip } from '@/api/account'
Vue.use(Vuex) Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
isWeapp: /miniProgram/.test(navigator.userAgent),
isLogin: false,
token: '',
user: {}, user: {},
isVip: false token: '',
isVip: false,
isLogin: false,
isWeapp: /miniProgram/.test(navigator.userAgent)
}, },
mutations: { mutations: {
setToken(state, token) { setToken(state, token) {
...@@ -62,14 +62,13 @@ export default new Vuex.Store({ ...@@ -62,14 +62,13 @@ export default new Vuex.Store({
return response return response
}) })
}, },
async checkIsVip({ commit }) { async checkIsVip({ commit, state }) {
if (state.isVip) {
return state.isVip
}
const isVip = await getIsVip() const isVip = await getIsVip()
.then(response => { .then(response => response.is_vip)
return response.is_vip .catch(() => false)
})
.catch(() => {
return false
})
commit('setIsVip', isVip) commit('setIsVip', isVip)
return isVip return isVip
} }
......
...@@ -85,9 +85,8 @@ body { ...@@ -85,9 +85,8 @@ body {
font-size: 14px; font-size: 14px;
line-height: 1.4; line-height: 1.4;
color: #222; color: #222;
font-family: 'PingFang SC', 'Source Han Sans CN', -apple-system, font-family: 'PingFang SC', 'Source Han Sans CN', -apple-system, 'Microsoft YaHei', 'Helvetica', 'Arial', Verdana,
'Microsoft YaHei', 'Helvetica', 'Arial', Verdana, 'Hiragino Sans GB', 'Hiragino Sans GB', 'Wenquanyi Micro Hei', sans-serif;
'Wenquanyi Micro Hei', sans-serif;
background-color: #f7f7f7; background-color: #f7f7f7;
} }
.main-container { .main-container {
...@@ -138,3 +137,36 @@ body { ...@@ -138,3 +137,36 @@ body {
.van-swipe .van-swipe__indicators { .van-swipe .van-swipe__indicators {
bottom: 5px; bottom: 5px;
} }
.fixed-box {
height: 55px;
box-sizing: content-box;
padding-bottom: env(safe-area-inset-bottom);
}
.fixed-inner {
position: fixed;
left: 0;
right: 0;
bottom: 0;
max-width: 750px;
margin: 0 auto;
padding-bottom: env(safe-area-inset-bottom);
}
.fixed-button {
margin: 10px 20px;
height: 35px;
font-size: 15px;
line-height: 35px;
text-align: center;
color: #fff;
background: #c62245;
border-radius: 6px;
}
.custom-empty .van-empty__image {
width: 250px;
height: 205px;
}
.custom-empty .van-empty__description {
padding: 0 20px;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论