<template>
	<!--我的测评-->
	<view>
		<page-title :showBack="true">我的测评</page-title>
		<view class="top-content">
			<view>
				<u-search 
				:clearabled="true"
				@search="findList(true)"
				@clear="findList(true)"
				placeholder="搜索关键字" 
				v-model="keyword" 
				:showAction="false" 
				shape="square" 
				bgColor="#ffffff">
				</u-search>
			</view>
		</view>
		<view class="listbox">
			<view class="assess content" v-for="(item,idx) in testList" :key="idx" @click="myAssessdetail(item)">
				<view class="assess-info">
					<view class="assess-info-content">
						<img :src="coverFilter(item.cover)">
						<view class="assess-text">
							<view style="font-size: 32rpx; font-weight: bold;">{{item.title}}</view>
							<view style="font-size: 28rpx;">{{item.date}}</view>
						</view>
					</view>
				</view>
			</view>
			<view>
				<uni-load-more :status="loadStatus"></uni-load-more>
			</view>
		</view>

	</view>

	</view>
</template>

<script>
	// import apiBoeCourse from '@/api/modules/course.js';
	import apiBoeCourse from '@/api/boe/course.js';
	export default {
		data() {
			return {
				keyword: '',
				testList:'',
				total:0,
			    chaturl:'',
			    size:8,
				page:1,
				loadStatus: 'more',
				list:[]
			}
		},
		onPullDownRefresh() {
			this.onReachBottom();
		},
		onReachBottom() {
			this.loadStatus = 'loading'; //more,loading,noMore
			let $this = this;
			setTimeout(function() {
				$this.loadStatus = 'noMore';
			}, 1000);
		},
		onLoad(options) {
			this.findList();
		},
		methods:{
			// 测评跳转详情
			myAssessdetail(item){
				//console.log(item.id)
				console.log('编码前：'+item.url)
				let encodeUrl=encodeURIComponent(item.url);
				console.log('编码后：'+encodeUrl)
				uni.navigateTo({
					url: '/pages/my/myAssdetail?reurl='+encodeUrl
				});
			},
			
			findList(flag){
				uni.showLoading({ title: '加载中...' });
				let params={
					keyword:this.keyword,
					pagesize:this.page,
					size:this.size
				}
				 if (this.keyWord) {
					params.keyWord = this.keyWord;
				 }
			  apiBoeCourse.reportList(params).then(rs=>{
			      //console.log(rs.result.reportList);
			    
			    //this.total = rs.result.count
				  //   rs.result.reportList.forEach(item=>{
						// console.log(item.cover,'item.conver');
						
						// // if(item.cover && item.cover.length>0){
						// // 	item.cover=item.cover[0];
						// // 	console.log(item.cover,'item.conver');
						// // }
				  //   })
					this.testList = rs.result.reportList;
					setTimeout(function() {uni.hideLoading();}, 100);
			  })
			},
			coverFilter(url){
				return  url[0].url||url[0]
			}
		}
	}
</script>

<style lang="scss" scoped>
	// .big-box_top{
	//     height: 38px;
	//     display: flex;
	//     padding-top: 15upx;
	// }
	.top-content {
		padding: 28upx 20upx  10upx 20upx;
		margin-bottom: 20upx;

	}

	.assess {
		padding: 10px;
		margin-bottom: 10px;

		.assess-info {
			padding-top: 8px;
			display: flex;
			justify-content: space-between;

			.assess-info-content {
				display: flex;
				line-height: 40upx;

				img {
					width: 220upx;
					height: 150upx;
				}

				.assess-text {
					font-size: 35upx;
					color: #000000;
					margin-top: 5px;
					margin-left: 10px;

				}

				.assess-text :nth-child(2) {
                    font-size: 28upx;
					color: #909090;
					margin-top: 50upx;
				}

			}
		}

	}
</style>
