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.

186 lines
4.1 KiB

<template>
<view class="container">
<image class="cbg" src="../../static/common_bg.png"></image>
<view class="list" v-if="hasData">
<scroll-view :scroll-y="true" @scrolltolower="scrollGet" style="height:100%">
<view class="list-item" v-for="item in course_list" @click="toDetail(item.id)">
<view class="list-item-wrap">
<view class="list-item-wrap-time">
<view>八月</view>
<view class="bigFont">06</view>
<view>2024 </view>
<!-- 开课日期:{{item.start_date}}至{{item.end_date}} -->
</view>
<view class="list-item-wrap-status">
<block v-for="cs in course_status">
<u-tag v-if="item.date_status===cs.value" :type="cs.type" :closeable="false"
:text="item.date_status" mode="dark" />
</block>
<view>{{item.name}}</view>
<view>
<text></text>报名{{item.sign_date_status}}
</view>
</view>
</view>
<view class="list-item-btn">
<view @click="toDetail(item.id)">我要报名</view>
</view>
</view>
</scroll-view>
<!-- <u-loadmore v-if="load_status" :status="load_status" /> -->
</view>
<view class="nodata" v-else>
<u-empty mode="data"></u-empty>
</view>
<tabbar :currentPage="1"></tabbar>
</view>
</template>
<script>
import tabbar from '@/components/tabbar/tabbar.vue';
export default {
components: {
tabbar
},
data() {
return {
hasMobile: false,
hasData: true,
current_page: 1,
total_page: 0,
load_status: '',
course_list: [],
course_status: [{
type: 'primary',
value: '未开始'
}, {
type: 'warning',
value: '进行中'
}, {
type: 'info',
value: '已结束'
}]
}
},
onLoad() {
this.getCourseList()
},
onReachBottom() {
// console.log("this.onReachBottom", this.current_page, this.total_page)
},
methods: {
scrollGet(){
console.log("123")
this.current_page = this.current_page + 1
if (this.current_page > this.total_page) {
this.base.toast('没有更多了')
return
}
this.getCourseList()
},
async getCourseList() {
this.load_status = 'loading'
const res = await this.$u.api.courseIndex({
page: this.current_page,
page_size: 10
})
this.total_page = res.last_page
if (res.data.length === 0 && this.current_page === 1) {
this.hasData = false
}
this.course_list.push(...res.data)
},
toDetail(id) {
uni.navigateTo({
url: '/packages/course/detail?id=' + id
})
}
}
}
</script>
<style scoped lang="scss">
.container {
width: 100%;
height: 100vh;
overflow: hidden;
.cbg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100vh;
}
.nodata {
position: relative;
top: 0;
left: 0;
height: 100vh;
}
.list {
// height:100vh;
// background: url("../../static/common_bg.png") no-repeat;
// background-size: 100% 100%;
height: 100vh;
// overflow: scroll;
padding-bottom: 200rpx;
position: relative;
top: 0;
left: 0;
&-item {
margin: 30rpx;
background-color: #fff;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 -1rpx 20rpx #bed2ec;
border-radius: 10rpx;
&-wrap{
width:calc(100% - 150rpx);
display: flex;
&-time{
padding: 30rpx;
background:linear-gradient(to right,#5e5fbc,#0d0398);
border-radius: 10rpx 0 0 10rpx;
color:#fff;
width:120rpx;
text-align: center;
font-size: 24rpx;
.bigFont{
font-size: 50rpx;
border-bottom:1rpx solid #ddd;
}
}
&-status{
margin:20rpx;
border-right:1px solid #ddd;
width:calc(100% - 120rpx);
margin-right: 0;
padding-right: 20rpx;
}
}
&-btn{
width:150rpx;
font-size: 24rpx;
background:linear-gradient(to right,#5e5fbc,#0d0398);
color:#fff;
padding:10rpx 20rpx;
border-radius: 30rpx;
margin:30rpx;
}
}
}
}
</style>