<template>
	<view>
		<view class="" style="padding: 20rpx 30rpx;">
			<u--input
			    placeholder="输入关键词查询"
			    border="surround"
			    v-model="value"
			    @change="change"
				@confirm="confirm"
				confirm-type="search"
				clearable
				shape="circle"
				prefixIcon="search"
					    prefixIconStyle="font-size: 22px;color: #909399"
			  ></u--input>
		</view>
	<!-- 	<u-tabs :current='current' :scrollable='false' lineColor='#A890FE' itemStyle="width: 125px;padding-bottom:10px" :activeStyle="{
		    color: '#303133',
		    fontWeight: 'bold',
		    transform: 'scale(1.05)'
		}" :list="list" @change="change1"></u-tabs> -->
		<view class="talkList">
			<view class="talkItem u-flex u-row-between" v-for="(item,index) in article" :key="index" @click="toinfo(item)">
				<image :src="item.show_image" mode=""></image>
				<view class="talkRight">
					<view class="talkTitle">
						{{item.subtitle}}
					</view>
					<view class="talkInfo u-flex  u-row-between">
						<!-- <text>小小小柚子</text> -->
						<text>{{item.create_at}}</text>
					
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title:'',
				article:[],
				value: '',
				current:0,
				page:1,
				list: [{
					name: '全部',
				}, {
					name: '推荐',
				}]
			}
		},
		onReachBottom() {
			this.page++
			this.getList()
		},
		onLoad() {
		this.getList()	
		},
		methods: {
			getList(){
				uni.$u.http.post('/api/Index/articlelist',{page:this.page,title:this.title}).then(res => {
				if(this.page==1){
					this.article=res.data.data
				}else{
					this.article=[...this.video,...res.data.data]
				}
				})
			},
			toinfo(item){
					uni.navigateTo({
						url:'./talkInfo?id='+item.id
					})
			},
			change1(e){
				if(this.current!=e.index){
					this.current=e.index
				}
			},
			confirm(e){
				this.page=1
				this.title=e
				this.getList()
			},
			 change(e) {
			          console.log('change', e);
			        }
		}
	}
</script>

<style lang="scss">
.talkList{
			box-sizing: border-box;
			margin: 18rpx auto 0;
			width: 690rpx;
			background: #FFFFFF;
			border-radius: 28rpx;
			padding: 0 20rpx;
			.talkItem{
				padding: 20rpx 0;
				border-bottom: 2rpx solid #F3F3F3;
				image{
					width: 220rpx;
					height: 148rpx;
					border-radius: 16rpx;
				}
				.talkRight{
					width: 402rpx;
					margin-left: 20rpx;
					.talkTitle{
						margin-bottom: 16rpx;
						color: #222222;
						font-size: 32rpx;
					}
					.talkInfo{
						overflow: hidden;
						white-space: nowrap;
						text-overflow: ellipsis;
						margin-top: 10rpx;
						color: #999999;
						font-size: 20rpx;
					}
				}
				
			}
		}
</style>
