<template>
	<view class="content">
		<pcNav></pcNav>
		<view style="height: 72rpx;"></view>
	
		
		<view class="gotop" @click="gotoTop">
			<image src="../../static/pcimg/btn_top@2x.png" mode="" class="gotopImg"></image>
		</view>
		
		<view class="main">
			<view class="searchTitle">搜索</view>
			<view class="searchBox">
				<view class="searchInputBox">
					<input class="searchInput" type="text" v-model="title" placeholder="请输入您想搜索到内容~" placeholder-style="color:#CCCCCC" @confirm="search"/>
				</view>
				<image src="../../static/pcimg/icon_sousuo@2x.png" mode="" class="searchBtn" @click="search"></image>
				
			</view>
			<view class="ssjg" v-if="sstype">为你找到“{{sstitle}}”相关结果共{{TotalSize}}条</view>
			<view class="cont2">
				
				<view class="contL">
					<view class="wxLine" v-for="(wz,wzindex) in list" @click="goDetail(wz)">
						<view class="wzLineLeft">
							<image :src="wz.LogoImg" class="wzLeftIMg"></image>
						</view>
						<view class="wzLineRight">
							<view class="wzTitle">{{wz.Name}}</view>
							<view class="wzComment">{{wz.Comment}}</view>
						</view>
					</view>
				</view>
				<view class="nodata" v-show="list.length==0&&sstype">
					<image src="../../static/pcimg/pic_empty_search@2x.png" mode="" class="nodataImg"></image>
					<view class="nodataTitle">暂无数据</view>
				</view>
			</view>
			
		</view>
		
		<!-- -->
		<view class="pageView" v-show="TotalSize">
			<page-pagination :pageSize="pageSize" :total="TotalSize" :numAround="true" @change="pageChange"></page-pagination>
		</view>
		<!-- <view>
			<a class="table-btn" href="http://phone.66km.cn:8088/marketing/training/940C4BF0A2E04542A1A1AD244EAFB6E2.xlsx" target='_blank'>下载入口</a>
		</view> -->
		
		
		
	</view>
</template>

<script>
	import pcNav from '../../components/pcNav/pcNav.vue'
	export default {
		components: {
			pcNav,
		},
		data() {
			return {
				list:[],
				title:'',
				page:1,
				sstype:false,
				TotalSize:0,
				pageSize:20,
				sstitle:'',
			}
		},
		onLoad(opt) {
          
		  // this.getcategoryPageData()
		},
		methods: {
			search(){
				var params={
					title:this.title,
					limit:this.pageSize,
					page:this.page,
				}
				uni.showLoading({
					title: '加载中'
				})
				this.$http('/trainingOpenApi/searchPageData', params, 'GET').then(res => {
					this.sstitle=this.title;
					this.sstype=true;
					uni.hideLoading();
					this.list=res.data.Items;
					this.TotalSize=res.data.TotalSize;
					
					
				})
			},
			goDetail(wz){
				// 1分类2文章
				if (wz.Type == 1) {
					uni.navigateTo({
						url:'groupingList?parentCode='+wz.Code+'&name='+wz.Name+'&title='+wz.Title+'&topName='
					})
				}else{
					uni.navigateTo({
						url:'detail?id='+wz.ID+'&topName=&twoName='
					})
				}
				//console.log(wz)
			},
			gotoTop(){
				uni.pageScrollTo({ 
				　　　scrollTop: 0, duration: 300 
				}); 
			},
			tabBtn(index,item){
				this.tabIndex=index;
				//console.log(item)
				this.parentCode=item.code;
				this.getcategoryPageData()
			},
			pageChange(e){
				console.log(e)
				this.page=e;
				this.getcategoryPageData()
				
			},
			getcategoryPageData(){
				var params={
					parentCode:this.parentCode,
					topCode:this.topCode,
					limit:this.pageSize,
					page:this.page,
				}
				uni.showLoading({
					title: '加载中'
				})
				this.$http('/trainingOpenApi/categoryPageData', params, 'GET').then(res => {
					uni.hideLoading();
					this.list=res.data.Items;
					this.TotalSize=res.data.TotalSize;
					var arr=[
						{
							'name':'全部','code':'',
						}	
					]
					this.dynamicCol=arr.concat(res.data.dynamicCol);
					
				})
			}
		}
	}
</script>

<style scoped>
	.searchTitle{
		font-size: 20rpx;
		font-weight: 500;
		color: #3C3C3C;
		padding-bottom: 30rpx;
	}
	.ssjg{
		font-size: 16rpx;
		color: #999999;
		padding-top: 20rpx;
	}
	.searchInput{
		width: 1060rpx;
		padding-left: 20rpx;
		line-height: 50rpx;
		border: 2rpx solid #EEEEEE;
		height: 50rpx;
		border-radius: 6rpx;
	}
	.searchBtn{
		width: 120rpx;
		height: 54rpx;
		margin-left: -2rpx;
	}
	.searchBox{
		display: flex;
	}
	*{
		padding: 0;
		margin: 0;
	}
	.gotopImg{
		width: 60rpx;
		height: 60rpx;
	}
	.gotop{
		position: fixed;
		right:15vh ;
		bottom: 100rpx;
		cursor: pointer;
	}
	.topName{
		text-align: center;
		font-size: 24rpx;
		font-weight: 500;
		color: #3C3C3C;
		line-height: 33rpx;
		padding-top: 30rpx;
	}
	.comment{
		text-align: center;
		font-size: 14rpx;
		font-weight: 400;
		color: #999999;
		line-height: 20rpx;
		width: 500rpx;
		padding-top: 10rpx;
		margin: 0 auto;
	}
	
	.main{
		width: 1200rpx;
		margin: 0 auto;
		padding-top: 30rpx;
	}
	.dynamicColLeft{
		display: flex;
	}
	.dynamicColLIne{
		padding-right: 44rpx;
		font-size: 16rpx;
		color: #3C3C3C;
		cursor: pointer;
	}
	.qhImg{
		width: 28rpx;
		height: 28rpx;
		margin-left: 8rpx;
		cursor: pointer;
	}
	.dynamicCol{
		display: flex;
		justify-content: space-between;
	}
	.activeTab{
		color: #FF4F00;
	}
	.mainwzImg{
		width: 276rpx;
		height: 184rpx;
	}
	.mainwzImgBox{
		border-radius: 15rpx;
	    overflow: hidden;
	}
	.contf{
		display: flex;
		flex-wrap: wrap;
	}
	.mainwzline{
		width: 276rpx;
		height: 260rpx;
		background: #FFFFFF;
		margin-right: 32rpx;	
		padding-top: 33rpx;
		cursor: pointer;
	}
	.mainwzlineR{
	  margin-right: 0rpx;	
	}
	.wztitle{
		width: 250rpx;
		font-size: 16rpx;
		color: #333333;
		line-height: 22rpx;
		height: 44rpx;
		text-overflow: -o-ellipsis-lastline;
		 overflow: hidden;
		 text-overflow: ellipsis;
		 display: -webkit-box;
		 -webkit-line-clamp: 2;
		 line-clamp: 2;
		 -webkit-box-orient: vertical;
		 padding-top: 16rpx;
		 padding:0 13rpx ;
	}
	.wzLeftIMg{
		width: 200rpx;
		height: 132rpx;
	}
	.wxLine{
		display: flex;
		padding: 20rpx 0;
		cursor: pointer;
		border-bottom: 1rpx solid #EEEEEE;
		
	}
	.wzLineLeft{
		border-radius: 10rpx;
		overflow: hidden;
		width: 200rpx;
		height: 132rpx;
	}
	.wzLineRight{
		padding-left: 16rpx;
		width: 900rpx;
	}
	.wzTitle{
		font-size: 16rpx;
		font-weight: 500;
		color: #3C3C3C;
	}
	.wzComment{
		font-size: 12rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #999999;
		line-height: 17rpx;
		padding-top: 10rpx;
		width: 960rpx;
		height: 100rpx;
		text-overflow: -o-ellipsis-lastline;
		 overflow: hidden;
		 text-overflow: ellipsis;
		 display: -webkit-box;
		 -webkit-line-clamp: 6;
		 line-clamp: 6;
		 -webkit-box-orient: vertical;
	}
	.pageView{
		margin-top: 20rpx;
		cursor: pointer;
		padding-bottom: 20rpx;
	}
	.nodataImg{
		width: 300rpx;
		height: 203rpx;
	}
	.nodata{
		text-align: center;
	}
	.nodataTitle{
		font-size: 16rpx;
		padding-top: 16rpx;
		font-weight: 400;
		color: #999999;
	}
	
</style>
