<template>
	<view class="">
		
		
		<view class="rmkdwwer">
			<view class="fzctob inbddwddre">
				<image src="/static/index/ina1.png"
					style="width: 40rpx;height: 40rpx;min-width: 40rpx;margin-right: 12rpx;"></image>
				<input type="text" v-model="title" focus confirm-type="search" @confirm="getList" placeholder-style="color: #CCCCCC;font-size: 28rpx;"
					placeholder="搜索你感兴趣的内容" />
			</view>
		</view>
		
			
			
				
				<view class="zytlidde" style="padding: 0 30rpx;" @click="toDetail(item.id)" v-for="(item,index) in list" :key="index">
					<view class="zytyyrimg" style="overflow: hidden;">
                        <image :src="item.img" mode="aspectFill" style="width: 100%; height: 100%;"></image>
                    </view>
					<view class="zytyyopf">
						<view class="zytyotxta"><text>{{item.title}}</text></view>
						<view class="flztoa zytyotxtb">
							<text>{{item.lecturer_name}}</text>
							<image src="/static/zy/zyb3.png" style="width: 48rpx;height: 48rpx;" mode=""></image>
						</view>
						<view class="flztoa">
							<view class="fzctob zytyotxtc">
								<text>{{item.sales}}人观看</text>
							</view>
							<!-- 分钟 -->
							<text class="zytyotxtd">{{item.time}}</text>
						</view>
					</view>
				</view>
			
			
			
	</view>
</template>
<style>
	page {
		background: #FAFAFA;
	}
</style>
<script>
	export default {
		data() {
			return {
				list: [],
                info:null,
                page:1,
                num:20,
                title:'',
                total:0
			}
		},
        onLoad(e) {
            this.type_id = e.type_id || '-1'
            // this.getList()
        },
        onReachBottom() {
          if(this.list.length<this.total){
              this.page++
              this.getList()
          }  
        },
        methods:{
            getList(){
                this.$post({
                    data:{
                        do:'CourseList',
                        data:{
                            page:this.page,
                            num:this.num,
                            title:this.title,
                            user_id:uni.getStorageSync('id'),
                            type_id:'-1',
                        }
                    }
                }).then(res=>{
                    console.log(res,'llllll')
                    this.total = res.data.total
                    if(res.data.data.length){
                        this.list = this.page==1?res.data.data:[...this.list,...res.data.data]
                    }else{
                        this.total = 0
                        this.list = []
                    }
                }).catch(()=>{
                    this.total = 0
                    this.list = []
                })
            },
            toDetail(id){
                uni.navigateTo({
                    url: './kcxq-x?id=' + id
                })
            }
        }


	}
</script>

<style lang="scss" scoped>
	 
	 
</style>
