You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

163 lines
3.4 KiB

<template>
<view class="container">
<image class="cbg" :src="base.imgHost('common_bg.png')"></image>
<view class="wrap">
<topBanner :banner_list="banner_list"></topBanner>
<view class="list">
<view>
<view class="list-title">进行中</view>
<view v-if="list.length>0">
<view class="list-item" @click="toUrl(item.id)" v-for="item in list">
<view class="list-item-name">{{item.name}}</view>
<view class="list-item-buttom">
<view>
<image :src="base.imgHost('mycourse-share.png')"></image>
<text>分享</text>
</view>
<view class="list-item-btn" @click="toUrl(item.id)">
进入
</view>
</view>
</view>
</view>
</view>
<view v-if="historyList.length>0">
<view class="list-title">历史课程</view>
<view v-if="historyList.length>0">
<view class="list-item" @click="toUrl(item.id)" v-for="item in historyList">
<view class="list-item-name list-item-hisname">{{item.name}}</view>
<view class="list-item-buttom">
<view>
<image :src="base.imgHost('mycourse-share.png')"></image>
<text>分享</text>
</view>
<view class="list-item-btn" @click="toUrl(item.id)">
进入
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import topBanner from '@/components/topBanner.vue'
export default {
components: {
topBanner
},
data() {
return {
banner_list:[],
list:[],
historyList:[]
}
},
onLoad() {
console.log("selectOptions",this.selectOptions)
this.getMyCourse()
this.getBannerList()
},
methods:{
async getMyCourse(){
const res = await this.$u.api.courseMy()
res.list.data.map(item=>{
if(item.date_status==='课程已结束'){
this.historyList.push(item)
}else{
this.list.push(item)
}
})
},
toUrl(id){
uni.navigateTo({
url:'/packages/mycourse/detail?id='+id
})
},
async getBannerList(){
const res = await this.$u.api.otherBanner({
position:1
})
this.banner_list = res
},
}
}
</script>
<style scoped lang="scss">
.container{
padding: 30rpx;
width:100%;
height:100vh;
.cbg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100vh;
}
.wrap{
position: relative;
height:100%;
overflow-x: hidden;
overflow-y: scroll;
.list{
margin-top:50rpx;
&-title{
margin-bottom:30rpx;
color:#333;
font-size: 42rpx;
}
&-item{
background-color: #fff;
padding:30rpx;
margin-bottom: 30rpx;
border-radius: 20rpx;
border-bottom: 2px solid #b79373;
&-name{
height:80rpx;
border-bottom: 1px solid #f5f5f5;
padding-bottom:20rpx;
}
&-hisname{
color:#888888
}
&-buttom{
display: flex;
justify-content: space-between;
align-items: center;
color:#b79373;
margin-top:20rpx;
&>view:first-child{
display: flex;
align-items: center;
image{
width:26rpx;
height:26rpx;
margin:0 10rpx;
}
}
}
&-btn{
background: linear-gradient(to right,#5e5fbc,#0d0398);
border-radius: 30rpx;
color:#fff;
text-align: center;
padding:10rpx 20rpx;
width:140rpx;
}
}
}
}
}
</style>