提交 f04204de authored 作者: lihuihui's avatar lihuihui
...@@ -6,11 +6,10 @@ ...@@ -6,11 +6,10 @@
<van-icon name="arrow-down" /> <van-icon name="arrow-down" />
</template> </template>
<ul> <ul>
<li <li v-for="subItem in item.children" :key="subItem.id" @click="onClick(subItem)">
v-for="subItem in item.children" <div class="name">{{subItem.name}}</div>
:key="subItem.id" <div class="progress">{{subItem.video_progress | progressText}}</div>
@click="onClick(subItem)" </li>
>{{subItem.name}}</li>
</ul> </ul>
</van-collapse-item> </van-collapse-item>
</van-collapse> </van-collapse>
...@@ -35,6 +34,12 @@ export default { ...@@ -35,6 +34,12 @@ export default {
return this.$store.state.isWeapp return this.$store.state.isWeapp
} }
}, },
filters: {
progressText(value) {
value = parseInt(value)
return value === 100 ? '已学完' : `${value}%`
}
},
methods: { methods: {
onClick(data) { onClick(data) {
if (this.isWeapp) { if (this.isWeapp) {
...@@ -65,13 +70,21 @@ export default { ...@@ -65,13 +70,21 @@ export default {
display: none; display: none;
} }
li { li {
display: flex;
padding: 10px 0; padding: 10px 0;
font-size: 13px;
&:first-child { &:first-child {
padding-top: 0; padding-top: 0;
} }
&:last-child { &:last-child {
padding-bottom: 20px; padding-bottom: 20px;
} }
.name {
flex: 1;
font-size: 13px;
overflow: hidden;
}
.progress {
font-size: 12px;
}
} }
</style> </style>
<template> <template>
<div class="main-container"> <div class="main-container" v-show="loaded">
<course-item v-for="item in courseList" :data="item" :key="item.course_id"></course-item> <template v-if="list.length">
<course-item v-for="item in list" :data="item" :key="item.course_id" />
</template>
<van-empty description="暂无内容" v-else />
</div> </div>
</template> </template>
...@@ -16,14 +19,20 @@ export default { ...@@ -16,14 +19,20 @@ export default {
}, },
data() { data() {
return { return {
courseList: [] loaded: false,
list: []
} }
}, },
methods: { methods: {
getCourseList() { getCourseList() {
api.getCourseList().then(response => { api
this.courseList = response .getCourseList()
}) .then(response => {
this.list = response
})
.finally(() => {
this.loaded = true
})
} }
}, },
beforeMount() { beforeMount() {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<div class="inner"> <div class="inner">
<ul> <ul>
<li @click="toExamPage">去测试</li> <li @click="toExamPage">去测试</li>
<li @click="toExamPage" v-if="detail.has_video">相关视频</li> <li @click="toCourseVideo" v-if="detail.has_video">相关视频</li>
</ul> </ul>
<ul> <ul>
<li @click="getCourseTag(detail.last)" v-if="detail.last">上一点</li> <li @click="getCourseTag(detail.last)" v-if="detail.last">上一点</li>
...@@ -74,6 +74,16 @@ export default { ...@@ -74,6 +74,16 @@ export default {
} else { } else {
this.$router.push({ path }) this.$router.push({ path })
} }
},
// 去课程视频页面
toCourseVideo() {
if (this.isWeapp) {
wx.miniProgram.navigateTo({
url: `/pages/course/item?id=${this.detail.course_id}&chapter_id=${this.detail.section_id}`
})
} else {
window.alert('请在微信小程序中打开')
}
} }
}, },
beforeMount() { beforeMount() {
......
...@@ -89,7 +89,7 @@ export default { ...@@ -89,7 +89,7 @@ export default {
toCourseVideo() { toCourseVideo() {
if (this.isWeapp) { if (this.isWeapp) {
wx.miniProgram.navigateTo({ wx.miniProgram.navigateTo({
url: `/pages/course/item?id=${this.courseId}` url: `/pages/course/item?id=${this.data.course_id}&chapter_id=${this.data.section_id}`
}) })
} else { } else {
window.alert('请在微信小程序中打开') window.alert('请在微信小程序中打开')
......
<template> <template>
<div class="list"> <div class="main-container" v-show="loaded">
<alarm-item <template v-if="list.length">
v-for="item in list" <alarm-item
:data="item" v-for="item in list"
:key="item.id" :data="item"
@click-edit="onUpdate" :key="item.id"
@update="refersh" @click-edit="onUpdate"
></alarm-item> @update="refersh"
></alarm-item>
</template>
<van-empty description="暂无内容" v-else />
<div class="add-button"> <div class="add-button">
<div class="inner" @click="popupVisible = true"></div> <div class="inner" @click="popupVisible = true"></div>
</div> </div>
...@@ -41,6 +44,7 @@ export default { ...@@ -41,6 +44,7 @@ export default {
}, },
data() { data() {
return { return {
loaded: false,
list: [], list: [],
popupVisible: false, popupVisible: false,
isUpdate: false, isUpdate: false,
...@@ -57,9 +61,14 @@ export default { ...@@ -57,9 +61,14 @@ export default {
}, },
// 获取提醒列表 // 获取提醒列表
getAlarmList() { getAlarmList() {
api.getAlarmList().then(response => { api
this.list = response .getAlarmList()
}) .then(response => {
this.list = response
})
.finally(() => {
this.loaded = true
})
}, },
refersh() { refersh() {
this.getAlarmList() this.getAlarmList()
...@@ -86,9 +95,8 @@ export default { ...@@ -86,9 +95,8 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.list { .main-container {
padding: 20px 0; padding: 20px 0;
margin: 0 20px;
} }
.add-button { .add-button {
height: 64px; height: 64px;
......
<template> <template>
<div class="main-container"> <div class="main-container" v-show="loaded">
<ul> <ul v-if="list.length">
<li class="order-item" v-for="(item, index) in order" :key="index"> <li class="order-item" v-for="(item, index) in list" :key="index">
<div class="order-info"> <div class="order-info">
<div class="no-c"></div> <div class="no-c"></div>
<img :src="item.product_image" /> <img :src="item.product_image" />
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
</div> </div>
</li> </li>
</ul> </ul>
<van-empty description="暂无内容" v-else />
</div> </div>
</template> </template>
<script> <script>
...@@ -32,7 +33,8 @@ export default { ...@@ -32,7 +33,8 @@ export default {
}, },
data() { data() {
return { return {
order: [], loaded: false,
list: [],
orderTime: null, orderTime: null,
goFlag: true goFlag: true
} }
...@@ -72,11 +74,16 @@ export default { ...@@ -72,11 +74,16 @@ export default {
} }
}, },
getMyOrder() { getMyOrder() {
api.getMyOrder().then(res => { api
if (res.code === 0) { .getMyOrder()
this.order = res.data.orders .then(res => {
} if (res.code === 0) {
}) this.list = res.data.orders
}
})
.finally(() => {
this.loaded = true
})
}, },
goBuy(data) { goBuy(data) {
if (this.goFlag) { if (this.goFlag) {
...@@ -98,8 +105,8 @@ export default { ...@@ -98,8 +105,8 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.main-container { .main-container {
ul{ ul {
padding-top: .4rem; padding-top: 0.4rem;
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
} }
.order-item { .order-item {
...@@ -107,7 +114,7 @@ export default { ...@@ -107,7 +114,7 @@ export default {
} }
.order-info { .order-info {
position: relative; position: relative;
.no-c{ .no-c {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
...@@ -144,16 +151,16 @@ export default { ...@@ -144,16 +151,16 @@ export default {
margin-left: auto; margin-left: auto;
font-weight: bold; font-weight: bold;
} }
.invo{ .invo {
font-size: .3rem; font-size: 0.3rem;
margin-left: auto; margin-left: auto;
} }
.col { .col {
color: #ff6767; color: #ff6767;
font-size: 0.3rem; font-size: 0.3rem;
} }
.mar{ .mar {
margin-left: .3rem; margin-left: 0.3rem;
} }
} }
} }
......
...@@ -6,9 +6,7 @@ ...@@ -6,9 +6,7 @@
<div class="progress">{{item.video_progress | progressText}}</div> <div class="progress">{{item.video_progress | progressText}}</div>
</li> </li>
</ul> </ul>
<template v-else> <van-empty description="暂无内容" v-else />
<slot name="empty"></slot>
</template>
</div> </div>
</template> </template>
<script> <script>
...@@ -21,6 +19,11 @@ export default { ...@@ -21,6 +19,11 @@ export default {
list: [] list: []
} }
}, },
computed: {
isWeapp() {
return this.$store.state.isWeapp
}
},
filters: { filters: {
progressText(value) { progressText(value) {
value = parseInt(value) value = parseInt(value)
...@@ -29,10 +32,14 @@ export default { ...@@ -29,10 +32,14 @@ export default {
}, },
methods: { methods: {
getList() { getList() {
api.getCourseList().then(response => { api
this.loaded = true .getCourseList()
this.list = response .then(response => {
}) this.list = response
})
.finally(() => {
this.loaded = true
})
}, },
onClick(data) { onClick(data) {
if (this.isWeapp) { if (this.isWeapp) {
......
...@@ -9,9 +9,7 @@ ...@@ -9,9 +9,7 @@
<div class="progress">{{item.video_progress | progressText}}</div> <div class="progress">{{item.video_progress | progressText}}</div>
</li> </li>
</ul> </ul>
<template v-else> <van-empty description="暂无内容" v-else />
<slot name="empty"></slot>
</template>
</div> </div>
</template> </template>
<script> <script>
...@@ -24,6 +22,11 @@ export default { ...@@ -24,6 +22,11 @@ export default {
list: [] list: []
} }
}, },
computed: {
isWeapp() {
return this.$store.state.isWeapp
}
},
filters: { filters: {
progressText(value) { progressText(value) {
value = parseInt(value) value = parseInt(value)
...@@ -32,10 +35,14 @@ export default { ...@@ -32,10 +35,14 @@ export default {
}, },
methods: { methods: {
getList() { getList() {
api.getFreeCourseList().then(response => { api
this.loaded = true .getFreeCourseList()
this.list = response .then(response => {
}) this.list = response
})
.finally(() => {
this.loaded = true
})
}, },
onClick(data) { onClick(data) {
if (this.isWeapp) { if (this.isWeapp) {
......
...@@ -103,6 +103,7 @@ export default { ...@@ -103,6 +103,7 @@ export default {
font-size: 15px; font-size: 15px;
background-color: #2b7ce9; background-color: #2b7ce9;
border-radius: 6px; border-radius: 6px;
border: 0;
} }
} }
</style> </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论