<template>
	<view class="container">
		<view class="tui-searchbox">
			<view class="tui-search-input">
				<input @confirm="searchResult" confirm-type="search" :placeholder="'大家都在搜：'" :focus="true" auto-focus placeholder-class="tui-input-plholder"
				 class="tui-input" v-model.trim="key" />
				<icon type="clear" :size='16' color='#6D6D6D' @tap="cleanKey" v-show="key"></icon>
			</view>
			<view class="tui-cancle" @tap="searchResult">确定</view>
		</view>
		<view class="search_list">
			<view class="s-list-item" v-for="(item,index) in dataList" :key="index">
				<view class="item-left">
					<image :src="'https://xyb.wlkjwl.cn/'+item.head" mode="aspectFill"></image>
					<view>
						<view class="name">{{item.name}}</view>
						<view class="text">{{item.much}}</view>
					</view>
				</view>
				<view @tap="navToMeth(item)" class="support">去支持</view>
			</view>
		</view>
	</view>

</template>

<script>
	import tuiIcon from "@/components/icon/icon"
	export default {
		components: {
			tuiIcon
		},
		data() {
			return {
				key: "",
				dataList:''
			}
		},
		onLoad:function(){
			
		},
		methods: {
			searchResult(){
				this.getSearchList()
			},
			getSearchList(){
				this.request({
					url:this.path+'/api/xyb/banner/monthRankingList',
					data:{
						name:this.key,
						typeId:1
					},
					success:(res)=>{
						let d = res.data;
						console.log(d)
						this.dataList = d.rows;
					}
				})
			},
			cleanKey: function() {
				this.key = ''
			},
			navToMeth(item){
				uni.navigateTo({
				    url: '/pages/support/support?id='+item.id
				});
			}
		}
	}
</script>

<style>
	page {
		color: #333;
		background: #fff;
	}

	.container {
		padding: 0 30upx 30upx 30upx;
		box-sizing: border-box;
	}
	
	.search_list{
		padding: 30rpx;
	}
	
	.s-list-item{
		display: flex;
		align-items: center;
		justify-content:space-between;
		padding: 10rpx 0;
	}
	
	.s-list-item:not(:last-child){
		border-bottom: 1px solid #F2F2F2;
	}
	
	.item-left{
		display: flex;
		font-size: 30rpx;
		align-items: center;
	}
	.support{
		padding: 10rpx 15rpx;
		background-color: #4A67D6;
		color: #FFFFFF;
		font-size: 28rpx;
		width: 100rpx;
		text-align: center;
		border-radius: 8rpx;
	}
	.name{
		font-size: 36rpx;
		font-weight: 700;
		font-family: "宋体";
	}
	.text{
		font-size: 30rpx;
		color: grey;
	}
	.s-list-item image{
		width: 90rpx;
		height: 90rpx;
		border-radius: 50%;
		margin-right: 30rpx;
	}
	
	.tui-searchbox {
		padding: 30upx 0;
		box-sizing: border-box;
		display: flex;
		align-items: center;
	}

	.tui-search-input {
		width: 100%;
		height: 66upx;
		border-radius: 35upx;
		padding: 0 30upx;
		box-sizing: border-box;
		background: #f2f2f2;
		display: flex;
		align-items: center;
		flex-wrap: nowrap;
	}

	.tui-input {
		flex: 1;
		color: #333;
		padding: 0 16upx;
		font-size: 28upx;
	}

	.tui-input-plholder {
		font-size: 28upx;
		color: #b2b2b2;
	}

	.tui-cancle {
		color: #888;
		font-size: 28upx;
		padding-left: 30upx;
		flex-shrink: 0;
	}

	.tui-history-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 30upx 0;
	}

	.tui-icon-delete {
		padding: 10upx;
	}

	.tui-search-title {
		font-size: 28upx;
		font-weight: bold;
	}

	.tui-hot-header {
		padding: 30upx 0;
	}

	.tui-tag-class {
		display: inline-block;
		margin-bottom: 20upx;
		margin-right: 20upx;
		font-size: 26upx !important;
	}
</style>