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.
 
 
 
 

256 lines
6.1 KiB

<template>
<view class="member-box">
<view class="search-box">
<view class="search-input-box acea-row row-middle">
<text class="iconfont icon-xiazai5"></text>
<input type="text" placeholder="请输入课程名称" v-model="keywords" @input="search">
</view>
</view>
<view class="tabs-box acea-row row-middle row-between">
<view class="tab-item" :class="active == 1 ? 'tab-item-active' : ''" @click="tabClick(1)">未完成</view>
<view class="tab-item" :class="active == 2 ? 'tab-item-active' : ''" @click="tabClick(2)">已完成</view>
</view>
<view class="course-list-box">
<view class="course-item acea-row-nowrap row-between"
v-for="(item,index) in courseList"
:key="index"
@click="toCourdeDetail(item.id)"
>
<view class="item-l">
<view class="name line2">{{item.course.courseName}}</view>
<!-- <view class="desc line2">{{item.shortIntroduce}}</view> -->
<view class="time">时间:{{(item.courseStartTime.split(' ')[0]).replace(/\-/g, '.')}} 至 {{(item.courseEndTime.split(' ')[0]).replace(/\-/g,'.')}}</view>
<view class="time">地点:{{item.coursePlace}}</view>
<view class="time">报名总人数:{{item.courseEnterPerson}}</view>
</view>
<view class="item-r acea-row row-column row-between">
<view class="img-box">
<image :src="item.course.coverImg" mode="aspectFill"></image>
</view>
<view class="state-box">
<view class="handle-btn default" v-if="item.courseStateSeller == 0">未开始</view>
<view class="handle-btn" v-if="item.courseStateSeller == 1">报名中</view>
<view class="handle-btn" v-if="item.courseStateSeller == 2">签到中</view>
<view class="handle-btn default" v-if="item.courseStateSeller == 3">已结束</view>
<view class="handle-btn default" v-if="item.courseStateSeller == 4">已取消</view>
</view>
</view>
</view>
<view class="nomore">{{loadState}}</view>
</view>
</view>
</template>
<script>
import { sellerCourses } from "@/api/serverTeacher"
import { debounce } from "@/utils/index"
export default{
data(){
return {
active: 1,
courseList:[],
page: 0,
size: 10,
loading: true,
loadState: '上拉加载更多...'
}
},
onLoad() {
this.getList();
},
onPullDownRefresh(){
this.courseList = []
this.page = 0
this.getList()
},
onReachBottom(){
this.page = this.page + 1
this.getList()
},
methods:{
search: debounce(function(){
this.page = 0;
this.courseList = []
uni.showLoading({
title: '正在加载中...'
})
sellerCourses({
type:this.active,
keywords: this.keywords,
page: this.page,
size: this.size,
}).then((res)=>{
this.courseList = this.courseList.concat(res.data.content)
if(res.data.content.length < this.size){
this.loading = false
this.loadState = '没有更多了...'
} else{
this.loading = true
this.loadState = '上拉加载更多...'
}
uni.hideLoading()
})
}),
getList(){
if(!this.loading) return
uni.showLoading({
title: '正在加载中...'
})
sellerCourses({type:this.active,page: this.page, size: this.size}).then((res)=>{
this.courseList = this.courseList.concat(res.data.content)
if(res.data.content.length < this.size){
this.loading = false
this.loadState = '没有更多了...'
} else{
this.loading = true
this.loadState = '上拉加载更多...'
}
uni.hideLoading()
uni.stopPullDownRefresh()
})
},
tabClick(idx){
this.loading = true
this.loading = '正在加载中...'
this.page = 0
this.courseList = []
this.active = idx;
this.getList();
},
toCourdeDetail(id){
this.$yrouter.push({
path: '/pages/serviceTeacher/courseDetail',
query:{
id: id
}
})
}
}
}
</script>
<style lang="less" scoped>
.nomore{
text-align: center;
font-size: 28rpx;
color: #B9B9B9;
margin-top: 30rpx;
}
.member-box{
width: 100%;
.search-box{
background: #fff;
width: 100%;
padding: 20rpx 30rpx;
.search-input-box{
width: 100%;
height: 70rpx;
background: #F2F2F2;
font-size: 28rpx;
color: #999999;
border-radius: 25px;
padding-left: 26rpx;
.iconfont{
margin-right: 12rpx;
}
input{
height: 100%;
}
}
}
.tabs-box{
border-top: 1px solid #d8d8d8;
width: 100%;
height: 90rpx;
padding: 0 122rpx;
background-color: #fff;
color: #999;
font-size: 32rpx;
.tab-item{
height: 100%;
line-height: 90rpx;
border-bottom: 6rpx solid #fff;
text-align: center;
}
.tab-item-active{
color: #222;
height: 100%;
line-height: 90rpx;
border-bottom: 4rpx solid #f4c076;
font-weight: bold;
}
// .tab-item-active::after{
// content: '';
// display: block;
// width: 124rpx;
// height: 6rpx;
// background: #F4C076;
// border-radius: 3rpx;
// position: absolute;
// bottom: 0;
// }
}
.course-list-box{
width: 100%;
padding: 20rpx;
.course-item{
width: 100%;
padding: 24rpx;
background: #fff;
border-radius: 10rpx;
margin-bottom: 22rpx;
.item-l{
width: 70%;
font-size: 28rpx;
color: #222;
.name{
font-size: 32rpx;
color: #333;
line-height: 44rpx;
font-weight: bold;
margin-bottom: 20rpx;
}
.desc{
color: #999;
line-height: 36rpx;
margin-top: 20rpx;
margin-bottom: 60rpx;
}
.time{
line-height: 34rpx;
margin-bottom: 4rpx;
}
}
.item-r{
image{
width: 180rpx;
height: 180rpx;
border-radius: 12rpx;
}
.tip{
width: 156rpx;
font-size: 24rpx;
color: #786133;
text-align: center;
margin: 20rpx 0 0;
}
.handle-btn{
width: 156rpx;
height: 60rpx;
background: #FEF2D9;
border-radius: 12rpx;
text-align: center;
line-height: 60rpx;
color: #786133;
font-size: 32rpx;
margin: 0rpx auto;
}
.default{
background: #F6F6F6;
color: #666;
}
}
}
}
}
</style>