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.
208 lines
4.8 KiB
208 lines
4.8 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" v-for="item in list">
|
|
<view class="list-item-name">{{item.name}}</view>
|
|
<view class="list-item-buttom">
|
|
|
|
<view>
|
|
<u-button size="mini" :custom-style="{'color':'#b79373',
|
|
'border-color':'transparent','font-size': '26rpx',
|
|
'padding': 0}" :hair-line="false" @click="clickShareId(item)" shape="circle" open-type="share">
|
|
<image :src="base.imgHost('mycourse-share.png')"></image>
|
|
<text>分享</text>
|
|
</u-button>
|
|
</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" v-for="item in historyList">
|
|
<view class="list-item-name list-item-hisname">{{item.name}}</view>
|
|
<view class="list-item-buttom">
|
|
<view>
|
|
<u-button size="mini" :custom-style="{'color':'#b79373',
|
|
'border-color':'transparent','font-size': '26rpx',
|
|
'padding': 0}" :hair-line="false" @click="clickShareId(item)" shape="circle" open-type="share">
|
|
<image :src="base.imgHost('mycourse-share.png')"></image>
|
|
<text>分享</text>
|
|
</u-button>
|
|
</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: [],
|
|
shareObj: {}
|
|
}
|
|
},
|
|
onShareAppMessage(res) {
|
|
console.log("res", res)
|
|
console.log("this.shareObj", this.shareObj)
|
|
if (res.from === 'button') {
|
|
return {
|
|
path: "/packages/course/detail?id=" + this.shareObj.id, //这是为了传参 onload(data){let id=data.id;}
|
|
title: this.shareObj.name,
|
|
imageUrl: '/static/share.jpg'
|
|
}
|
|
}
|
|
return this.base.shareInfo
|
|
},
|
|
//发送到朋友圈
|
|
onShareTimeline(res) {
|
|
if (res.from === 'button') {
|
|
return {
|
|
path: "/packages/course/detail?id=" + this.shareObj.id, //这是为了传参 onload(data){let id=data.id;}
|
|
title: this.shareObj.name,
|
|
imageUrl: '/static/share.jpg'
|
|
}
|
|
}
|
|
return this.base.shareInfo
|
|
},
|
|
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)
|
|
}
|
|
})
|
|
},
|
|
clickShareId(item) {
|
|
this.shareObj = 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> |