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.

257 lines
6.1 KiB

4 years ago
<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">
4 years ago
</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>
3 years ago
</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>
4 years ago
</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>
4 years ago
</view>
</view>
</view>
<view class="nomore">{{loadState}}</view>
4 years ago
</view>
</view>
4 years ago
</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: '上拉加载更多...'
3 years ago
}
},
onLoad() {
this.getList();
},
onPullDownRefresh(){
this.courseList = []
this.page = 0
this.getList()
3 years ago
},
onReachBottom(){
this.page = this.page + 1
this.getList()
3 years ago
},
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
}
})
3 years ago
}
}
}
</script>
3 years ago
<style lang="less" scoped>
.nomore{
3 years ago
text-align: center;
font-size: 28rpx;
color: #B9B9B9;
margin-top: 30rpx;
4 years ago
}
.member-box{
4 years ago
width: 100%;
.search-box{
4 years ago
background: #fff;
width: 100%;
padding: 20rpx 30rpx;
.search-input-box{
4 years ago
width: 100%;
height: 70rpx;
background: #F2F2F2;
font-size: 28rpx;
color: #999999;
border-radius: 25px;
padding-left: 26rpx;
.iconfont{
margin-right: 12rpx;
4 years ago
}
input{
height: 100%;
4 years ago
}
}
}
.tabs-box{
border-top: 1px solid #d8d8d8;
width: 100%;
height: 90rpx;
padding: 0 122rpx;
background-color: #fff;
4 years ago
color: #999;
font-size: 32rpx;
.tab-item{
height: 100%;
line-height: 90rpx;
border-bottom: 6rpx solid #fff;
text-align: center;
4 years ago
}
.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;
// }
4 years ago
}
.course-list-box{
4 years ago
width: 100%;
padding: 20rpx;
.course-item{
width: 100%;
padding: 24rpx;
background: #fff;
4 years ago
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;
}
3 years ago
}
.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;
}
3 years ago
}
4 years ago
}
}
}
4 years ago
</style>