<template>
	<view class="search">
		<view class="hd">
			<view class="l">
				<image class="icon-search" src="https://zhengxin.njrenzhou.cn/static/search.png"></image>
				<input type="text" v-model="filter.keyword" placeholder="支持姓名/公司/手机号/标签搜索"/>
				<image class="icon-del" @click="toSearch(1)" v-if="filter.keyword" src="https://zhengxin.njrenzhou.cn/static/icon-close.png"></image>
				<!-- <image class="icon-filter" @click="show = true" src="https://zhengxin.njrenzhou.cn/static/icon-filter.png"></image> -->
			</view>
			<view class="btn" @click="toSearch(2)">搜索</view>
		</view>
		<view class="content">
			<view class="l" v-if="info.length >0">查询信息</view>
			<view class="list" v-if="info.length >0">
				<view class="li" v-for="(a,i) in info" :key="i">
					<view class="a">姓名：{{a.main_realname}}</view>
					<view class="a" v-if="a.main_cardno">身份证号：{{a.main_cardno}}</view>
					<view class="a" v-if="a.main_phone">手机号：{{a.main_phone}}</view>
					<view class="a" v-if="a.main_qq">QQ号：{{a.main_qq}}</view>
					<view class="a" v-if="a.main_wechat">微信号：{{a.main_wechat}}</view>
					<view class="a" v-if="a.main_address">居住地址：{{a.main_address}}</view>
					<view class="a" v-if="a.main_jiguan">籍贯：{{a.main_jiguan}}</view>
					<view class="a" v-if="a.main_company">公司：{{a.main_company}}</view>
				</view>
			</view>
			<view class="l">数据列表</view>
			<view class="list" v-if="list && list.length > 0">
				<view class="li" v-for="(a,i) in list" :key="i" @click="openPage(a.id)">
					<view class="b">{{i+1}}、{{a.title}}</view>
					<view class="c" v-if="a.type_tag=='善'">善</view>
					<view class="c c-on" v-else>恶</view>
				</view>
			</view>
			<view class="empty" v-if="total == 0">
				<image src="https://zhengxin.njrenzhou.cn/static/empty.png"></image>
				<view class="txt">暂无数据 ~</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				overlayStyle: {
					'zIndex': 9
				},
				title: "",
				show: false,
				list: [],
				info: [],
				total: 1,
				filter: {
					content_type_id: "",
					main_realname: "",
					main_phone: "",
					main_cardno: "",
					main_qq: "",
					main_wechat: "",
					main_address: "",
					main_jiguan: "",
					main_company: "",
					keyword: ""
				}
			};
		},
		onLoad() {
			this.filter = uni.getStorageSync("filterInfo")
			this.filter.keyword = uni.getStorageSync("filterInfo").keyword?uni.getStorageSync("filterInfo").keyword:(uni.getStorageSync("filterInfo").main_realname?uni.getStorageSync("filterInfo").main_realname:"")
			this.getContentList();
		},
		methods: {
			openPage(id){
				uni.navigateTo({
					url: "/pages/release/detail?id="+id
				})
			},
			toSearch(index) {
				if(index == 1){
					this.filter.keyword = "";
				}
				this.getContentList();
			},
			async getContentList(){
				const { code, data } = await this.$api.getContentList({
					limit: 5000,
					offset: this.offset,
					token: uni.getStorageSync("token"),
					filter: JSON.stringify(this.filter)
				})
				if(code == 1){
					this.list = data.rows;
					this.info = data.showinfo;
					this.total = data.total;
				}
			},
		}
	}
</script>

<style scoped lang="scss">
.search{
	overflow: hidden;
		min-height: 100vh;
		background: #F3F7F8;
	.content{
		width: 100%;
		.l{
			padding: 25rpx 25rpx 0;
			font-weight: 500;
			font-size: 30rpx;
			color: #222222;
		}
		.list{
			padding: 0 25rpx 25rpx;
			.li{
				min-height: 100rpx;
				background: #FFFFFF;
				box-shadow: 0px 3rpx 10rpx 0px rgba(9,44,39,0.05);
				border-radius: 20rpx;
				padding: 20rpx 30rpx;
				box-sizing: border-box;
				margin-top: 20rpx;
				position: relative;
				overflow: hidden;
				display: flex;
				align-items: center;
				flex-wrap: wrap;
				.a{
					width: 100%;
					font-weight: 500;
					font-size: 28rpx;
					color: #666666;
					line-height: 50rpx;
				}
				.c{
					width: 80rpx;
					line-height: 56rpx;
					background: #00C6A9;
					border-radius: 0px 20rpx 0px 20rpx;
					font-weight: 400;
					font-size: 32rpx;
					text-align: center;
					color: #FFFFFF;
					position: absolute;
					right: 0;
					top: 0;
					z-index: 2;
					&-on{
						background: #333333;
					}
				}
			}
		}
	}
	.empty{
		margin-top: 139rpx;
		text-align: center;
		font-weight: 500;
		font-size: 32rpx;
		color: #222222;
		image{
			width: 460rpx;
			height: 400rpx;
			margin-bottom: 15rpx;
		}
	}
	.form{
		padding: 0 0 25rpx;
		background-color: #fff;
		overflow: hidden;
		.btns{
			padding: 40rpx 35rpx 20rpx 55rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.reset{
				width: 300rpx;
				line-height: 90rpx;
				background: #E3F4F1;
				border-radius: 90rpx;
				text-align: center;
				font-weight: 500;
				font-size: 28rpx;
				color: #00C6A9;
			}
			.sure{
				width: 300rpx;
				line-height: 90rpx;
				background: #00C6A9;
				border-radius: 90rpx;
				text-align: center;
				font-weight: 500;
				font-size: 28rpx;
				color: #fff;
			}
		}
		.l{
			padding: 0 25rpx;
			font-weight: 500;
			font-size: 30rpx;
			color: #222222;
		}
		.info{
			margin-top: 10rpx;
			padding: 0 25rpx 0 0;
			overflow: hidden;
			.item{
				margin-top: 20rpx;
				overflow: hidden;
				display: flex;
				align-items: center;
				.fl{
					font-weight: 500;
					font-size: 28rpx;
					color: #222222;
					width: 140rpx;
					text-align: right;
					margin-right: 20rpx;
					text{
						color: red;
					}
				}
				.fr{
					flex: 1;
					picker{
						width: 100%;
						line-height: 80rpx;
						height: 80rpx;
						background: #F6F6F6;
						padding: 0 20rpx;
						box-sizing: border-box;
						border-radius: 10rpx;
						font-weight: 500;
						.picker{
							width: 100%;
							font-size: 28rpx;
							color: #212121;
							display: flex;
							align-items: center;
							justify-content: space-between;
							image{
								width: 45rpx;
								height: 45rpx;
							}
						}
						
					}
					input{
						width: 100%;
						line-height: 80rpx;
						height: 80rpx;
						background: #F6F6F6;
						padding: 0 20rpx;
						box-sizing: border-box;
						border-radius: 10rpx;
						font-weight: 500;
						font-size: 28rpx;
						color: #212121;
					}
				}
			}
		}
	}
	.bd{
		background-color: #fff;
		overflow: hidden;
		
		.l{
			padding: 5rpx 25rpx;
			font-weight: 500;
			font-size: 30rpx;
			color: #333333;
			overflow: hidden;
			text{
				font-weight: 500;
				font-size: 24rpx;
				color: #999999;
				float: right;
			}
		}
		.info{
			padding: 0 25rpx 0 0;
			overflow: hidden;
			margin-bottom: 30rpx;
			.item{
				padding: 0 20rpx;
				line-height: 52rpx;
				background: #F6F6F6;
				border-radius: 52rpx;
				font-weight: 500;
				font-size: 24rpx;
				color: #666666;
				float: left;
				margin-top: 25rpx;
				margin-left: 25rpx;
			}
		}
	}
	.hd{
		background-color: #fff;
		padding: 30rpx 25rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		.l{
			flex: 1;
			width: 620rpx;
			line-height: 70rpx;
			height: 70rpx;
			background: #F6F6F6;
			border-radius: 70rpx;
			border: 1px solid #EAEAEA;
			padding: 15rpx 30rpx;
			overflow: hidden;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			.icon-search{
				width: 24rpx;
				height: 27rpx;
				margin-right: 15rpx;
			}
			.icon-filter{
				width: 35rpx;
				height: 33rpx;
				margin-left: 15rpx;
			}
			.icon-del{
				width: 50rpx;
				height: 50rpx;
				margin-left: 15rpx;
			}
			input{
				flex: 1;
				font-weight: 500;
				font-size: 24rpx;
				color: #212121;
			}
		}
		.btn{
			font-weight: 500;
			font-size: 30rpx;
			color: #222222;
			margin-left: 25rpx;
		}
	}
}
</style>
