martial-arts/pagesA/my-course/my-course.vue

92 lines
2.4 KiB
Vue
Raw Normal View History

2022-08-03 13:28:45 +00:00
<template>
<view>
<status-container titlet="我的课程" returnc="#FFFFFF">
<view slot="content" style="margin-top: -20rpx;">
2022-08-10 10:18:06 +00:00
<view class="pad-zy30 bacf pad-x30" v-if="total">
2022-08-03 13:28:45 +00:00
<view class="pad-sx30 disac fon24 bbot" v-for="(item,index) in dataList" :key="index">
2022-08-10 10:18:06 +00:00
<image class="flexs" :src="item.cover" mode="aspectFill" style="width: 228rpx;height: 160rpx;"></image>
2022-08-03 13:28:45 +00:00
<view class="disjbac fc width100 mar-z20" style="height: 160rpx;">
<view class="fon26 col26 width100">
2022-08-10 10:18:06 +00:00
<view class="clips2">{{item.name}}</view>
<view class="fon20 mar-s10" style="color: #7f7f7f;">{{item.created_at}}</view>
2022-08-03 13:28:45 +00:00
</view>
<view class="disjbac width100">
<view class="fon24">{{item.price}}</view>
2022-08-12 10:14:13 +00:00
<view @tap="$toolAll.tools.goPage(`/pagesB/course-detail/course-detail?id=${item.spu_id}`)" class="disjcac fon22 radius26" style="width: 144rpx;height: 52rpx;color: #f37717;border: 2rpx solid #f37717;">点击学习</view>
2022-08-03 13:28:45 +00:00
</view>
</view>
</view>
</view>
2022-08-16 10:06:46 +00:00
<view class="" v-if="loading">
<pitera :textStr="`${noMore && total > dataList.length?'上滑加载更多':'到底了'}~~`" textColor="#b0aaa9" paddingStr="40rpx 0 20rpx 0"></pitera>
2022-08-03 13:28:45 +00:00
</view>
</view>
</status-container>
</view>
</template>
<script>
import swiperTab from '@/components/swiper-tab/swiper-tab.vue';
import pitera from '@/components/nothing/pitera.vue';
export default {
components:{
swiperTab,
pitera
},
data() {
return {
2022-08-17 01:32:58 +00:00
dataList:[],
2022-08-10 10:18:06 +00:00
page:1,
size:20,
total:0,
noMore:false,
2022-08-16 10:06:46 +00:00
loading:false
2022-08-03 13:28:45 +00:00
}
},
2022-08-10 10:18:06 +00:00
onLoad() {
2022-08-05 03:08:36 +00:00
// 获取课程列表
this.getCouresList();
},
2022-08-10 10:18:06 +00:00
onReachBottom() {
2022-08-17 07:52:02 +00:00
if(this.total!=this.dataList.length){
2022-08-10 10:18:06 +00:00
this.page++;
this.getCouresList();
}
},
2022-08-03 13:28:45 +00:00
methods: {
2022-08-05 03:08:36 +00:00
// 获取课程列表
getCouresList(){
2022-08-16 10:06:46 +00:00
this.loading = false;
2022-08-17 01:32:58 +00:00
let params = {
page:this.page,
size:this.size
}
this.$requst.get('/api/user/course',params).then(res=>{
2022-08-10 10:18:06 +00:00
this.total = res.data.total;
if(this.page==1){this.dataList=[];}
this.dataList = [...this.dataList,...res.data.list];
if(this.total==this.dataList.length && this.page!=1){
this.noMore = true;
2022-08-05 03:08:36 +00:00
}
2022-08-16 10:06:46 +00:00
this.loading = true;
2022-08-05 03:08:36 +00:00
})
},
2022-08-03 13:28:45 +00:00
}
}
</script>
<style>
2022-08-05 03:08:36 +00:00
.used-item{
border-top: 2rpx solid ;
}
.noshow{
transform: rotate(-90deg);
transition: all .3s linear;
}
.isshow{
transform: rotate(90deg);
transition: all .3s linear;
}
2022-08-03 13:28:45 +00:00
</style>