<template>

	<view class="wrapper">
		<!-- 输入框 -->
		<view class="searchBox">
			<input bindconfirm="bindconfirm" bindinput="bindinput" placeholder="搜索您感兴趣内容" type='text'>
			</input>
			<!-- <image class="searchImg" src="../../assets/search-icon.png"></image> -->
		</view>


		<!-- <view class="content"> -->
		<view class="centerBox" data-id="list[0].dataId" data-format="list[0].format" data-index="list[0].dataTypeId"
			bindtap="nextUrl">
			<image :src="list[2].titlePicture"></image>
			<view class="sectionBox">
				<view class="title">
					<!-- style="color:{{list[0].fontcolor}};border:{{list[0].bordercolor}}" -->
					<text> {{list[0].dataTypeName}}</text>
					<text>{{list[0].title}}</text>
				</view>
				<view>
					<text> {{list[0].value}} </text>
				</view>
				<view class="timer">
					<text>{{list[0].issueTime}}</text>
					<view>
						<!-- <image src="../../assets/ydl.png"></image> -->
						<text>{{list[0].watchNumber}}</text>
					</view>
				</view>
			</view>
		</view>

		<view class="lastBox">
			<view class="last-sec-box">
				<view data-id="item.dataId" data-index="item.dataTypeId" data-format="item.format" bindtap="nextUrl"
					v-for="(item,index) in list1" :key="index" class="table-col">
					<!-- 左 -->
					<view class="leftBox">
						<image :src="item.titlePicture"></image>
					</view>
					<!-- 右 -->
					<view class="rightBox">
						<view class="right-Box-top">
							<!-- style="color:{{item.fontcolor}};border:{{item.bordercolor}}" -->
							<text>{{item.dataTypeName}}</text>
							<view>{{item.title}}</view>
						</view>
						<view class="right-Box-bom">
							<text>{{item.issueTime}} </text>
							<view>
								<!-- <image src="../../assets/ydl.png"></image> -->
								<text>{{item.watchNumber}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- </view> -->

	</view>


</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello',
				list: [],
				list1: [],
				inputKey: '',
				dataTypeId: 3
			}
		},
		onLoad() {
			this.getlistData()
		},
		methods: {
			getlistData() {
				let that = this;
				uni.request({
					url: 'https://gjcx.zhoubianjun.com/keji/policynews/getPolicyNewsList',
					data: {
						key: this.inputKey,
						dataTypeId: this.dataTypeId
					},
					method: 'GET',
					success: (res) => {
						let resulte = res.data;
						resulte.forEach(it => {
							if (it.dataTypeName == '新闻') {
								it.fontcolor = '#FF3C1C'
								it.bordercolor = '1rpx solid #FF3C1C'
							} else {
								it.fontcolor = '#4DA4FF'
								it.bordercolor = '1rpx solid #4DA4FF'
							}
							if (it.content) {
								let text = it.content.split('\n');
								it.value = text[1]
							}
						})
						// this.list.push(resulte);
						// this.list1.push(resulte.slice(1))
						resulte.forEach(it => {
							this.list.push(it)
						})
						let demo = resulte.slice(1);
						demo.forEach(it => {
							this.list1.push(it)
						})

						console.log(this.list, 'list');
						console.log(this.list1, 'list1');
					}
				})
			},
		}
	}
</script>

<style>
	.wrapper {
		background: #F2F2F2;
		height: 100vh;
		width: 100%;
	}

	.searchBox {
		width: 100%;
		height: 100rpx;
		/* line-height: 100rpx; */
		z-index: 100;
		position: relative;
		background-color: white;
		display: flex;
		align-items: center;
		position: fixed;
		top: 0;
	}

	.searchImg {
		width: 40rpx;
		height: 40rpx;
		left: 85rpx;
		top: 13rpx;
		position: absolute;
		line-height: 66rpx;
	}

	.searchBox input {
		margin: 0 auto;
		width: calc(90% - 68rpx);
		height: 66rpx;
		/* line-height: 66rpx; */
		background: #F7F7F7;
		border-radius: 30rpx;
		font-size: 24rpx;
		box-sizing: border-box;
		/* position: relative; */
		padding: 0 0 0 68rpx;
	}

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}


	.centerBox {
		background-color: white;
		margin-top: 40rpx;
		padding: 24rpx;
		box-sizing: border-box;
	}

	.centerBox>image:first-child {
		width: 100%;
		height: 350rpx;
	}

	.sectionBox>view:nth-child(2) {
		text-indent: 40rpx;
		display: flex;
		flex-direction: column;
		font-size: 26rpx;
		font-weight: 500;
		color: #424764;
	}

	.title {
		display: flex;
		padding: 21rpx 0 25rpx 0;
		align-items: center;
	}

	.title>text:first-child {
		font-size: 14rpx;
		border-radius: 4rpx;
		padding: 3rpx 5rpx;
		display: inline-block;
		height: 100%;
	}

	.title>text:last-child {
		flex: 1;
		font-size: 26rpx;
		font-weight: bold;
		color: #424764;
		padding-left: 10rpx;
	}

	.timer {
		display: flex;
		justify-content: space-between;
		padding-top: 23rpx;
	}

	.timer>text:first-child {
		font-size: 22rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #686E92;
	}

	.timer>view:last-child {
		font-size: 22rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #4DA4FF;
	}

	.timer image {
		width: 25rpx;
		height: 17rpx;
		padding-right: 5rpx;
	}

	.lastBox {
		background-color: white;
		margin-top: 20rpx;
	}

	.table-col {
		display: flex;
		padding: 34rpx 40rpx 34rpx 24rpx;
		border-bottom: 1rpx solid #E6E6E6;
	}

	.leftBox image {
		width: 240rpx;
		height: 164rpx;
	}

	.rightBox image {
		width: 25rpx;
		height: 17rpx;
		padding-right: 5rpx;
	}

	.rightBox {
		display: flex;
		flex-direction: column;
		justify-content: space-around;
		margin-left: 13rpx;
		flex: 1;
	}

	.right-Box-top {
		display: flex;
		align-items: baseline;
	}

	.right-Box-top>text:first-child {
		font-size: 14rpx;
		border-radius: 4rpx;
		padding: 3rpx 5rpx;
		display: inline-block;
		vertical-align: middle;
		height: 25rpx;
	}

	.right-Box-top>view:last-child {
		font-size: 26rpx;
		flex: 1;
		color: #424764;
		font-weight: bold;
		padding-left: 10rpx;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}


	.right-Box-bom {
		display: flex;
		justify-content: space-between;
		align-items: flex-end;

	}

	.right-Box-bom>text:first-child {
		font-size: 22rpx;
		color: #686E92;
	}

	.right-Box-bom>view>text {
		font-size: 22rpx;
		font-weight: 500;
		color: #4DA4FF;
	}

	.wrapper::after {
		content: " ";
		width: 100%;
		height: 100rpx;
		background-color: white;
		float: left;
	}
</style>
