<template>
	<view class="dangerbig-list">
		<view class="fixedheader">
			<headers :showBack="true">
				<view class="headerName">
					先锋模范明细
				</view>
			</headers>
		</view>
		<view :style="{ 'padding-top': (statusBarHeight + 45) * 1.5 + 'rpx' }">
			<view class="list">
				<view class="list-item">
					<view class="download" v-for="item in workDetail.image" :key="item.id">
						<image :src="item.url.includes('http://') ? item.url : url_config+'image/'+item.url"
							class="img"
							@click="previewImage(item.url.includes('http://') ? item.url : url_config+'image/'+item.url)">
						</image>
						<view class="list-info">
							{{workDetail.createDate}}
						</view>
					</view>
					<view class="list_status">
						<!-- <view>
							点击率：{{workDetail.clickRate}}
						</view> -->
						<view>
							阅读状态：{{workDetail.isRead == 1 ? "已读" : "未读" }}
						</view>
					</view>
					<view class="list-title">
						{{workDetail.title}}
					</view>
					<view class="list-content">
						<view class="list-info">
							<text class="vhtml" v-html="workDetail.content"></text>
						</view>
					</view>
				</view>
			</view>
			<!-- 	<view class="no-data" v-else>
				<image class="img" src="/static/noData.png"></image>
				<text class="txt">暂无数据</text>
			</view> -->
		</view>
	</view>
</template>

<script>
	import {
		isJSON
	} from '@/utils/tool.js'
	export default {
		data() {
			return {
				statusBarHeight: 0,
				pageNo: 1,
				pageSize: 10,
				projectSn: "",
				listData: [],
				isLoadMore: false,
				loadStatus: 'more',
				workDetail: [],
				levelList: [{
					id: 1,
					workCategoryName: "一级"
				}, {
					id: 2,
					workCategoryName: "二级"
				}, {
					id: 3,
					workCategoryName: "三级"
				}, {
					id: 4,
					workCategoryName: "普通"
				}],
				searchName: "",
			}
		},
		onShow() {
			this.statusBarHeight = uni.getStorageSync('systemInfo').statusBarHeight;
			this.projectSn = JSON.parse(uni.getStorageSync('userInfo')).sn
			this.getWorkList()
		},
		onLoad(val) {
			this.detailId = val.id
			// this.initData()

		},
		onReachBottom() {
			console.log(1)
			if (!this.isLoadMore) { //此处判断，上锁，防止重复请求
				this.isLoadMore = true
				this.pageNo += 1
				this.getWorkList()
			}
		},
		onPullDownRefresh() {
			console.log(2)
			this.pageNo = 1
			this.listData = []
			this.getWorkList()
		},
		methods: {
			//预览图片
			previewImage(url) {
				uni.previewImage({
					urls: [url]
				})
			},
			handleInput() {
				this.pageNo = 1;
				this.listData = []
				this.getWorkList();
			},
			getWorkList() {
				let data = {
					id: this.detailId,
					// projectSn: this.projectSn,
					type: 9,
				}
				this.sendRequest({
					url: 'xmgl/partyBuildingGuidance/queryById',
					method: 'get',
					data: data,
					success: res => {
						uni.hideLoading()
						if (res.code == 200) {
							console.log("workList======================", res)
							// this.listData = res.result.records
							// this.workList=this.workList.concat(res.result)

							this.workDetail = {
								...res.result,
								image: isJSON(res.result.file) ? JSON
									.parse(res.result.file) : [],
							}
						}
					}
				})
			},

			checkItem(val) {
				console.log(val)
				uni.navigateTo({
					url: './detail?id=' + val.id
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	.vhtml {
		flex: 1;

		:deep( img ){
			width: 100%;
		}
	}

	.searchBox {
		background-color: white;
	}

	.uni-form-item {
		position: relative;
		display: flex;
		align-items: center;
		font-size: 28rpx;
		/* .search-icon{
			position: absolute;
			top: 50%;
			right: 50rpx;
			transform: translateY(-50%);
		} */
	}

	.uni-input {
		border-radius: 40rpx;
		margin: 20rpx 20rpx;
		background-color: #f7f8fa;
		height: 70rpx;
		line-height: 60rpx;
		padding: 0 40rpx;
		font-size: 28rpx;
		flex: 1;
	}

	.screen {
		line-height: 100rpx;
		color: gray;
	}

	.flex {
		display: flex;
		align-items: center;
	}

	.content {
		padding: 0px 30rpx 20rpx;
		box-sizing: border-box;
		width: 100%;
	}

	.download {
		// display: flex;
		// flex-wrap: wrap;
		// align-items: center;
		// margin-top: 10rpx;
		// justify-content: center;
		border-radius: 16rpx;
		position: relative;
		height: 280rpx;
		
		.list-info {
			width: 100%;
			padding: 12rpx 40rpx;
			border-radius: 0 0 16rpx 16rpx;
			color: white;
			font-size: 24rpx;
			text-align: right;
			background: rgba(0,0,0,0.7);
			position: absolute;
			bottom: 0;
		}
	}

	.img {
		width: 100%;
		// width: 720rpx;
		height: 280rpx;
		border-radius: 16rpx;
	}

	.dangerbig-list {
		min-height: 100%;
		// background: #F6F6F6;

		.fixedheader {
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
			z-index: 2;

			.headerName {
				z-index: 1;
			}
		}

		.list {
			padding: 20rpx 30rpx;

			.list-item {
				background: #fff;
				margin-bottom: 20rpx;
				
				.list_status {
					padding: 12rpx 0 0 0;
					display: flex;
					align-items: center;
					justify-content: space-between;
					color: #1A1A1A;
					font-size: 24rpx;
				}

				.list-title {
					padding: 34rpx 0 20rpx 0;
					// border-bottom: 4rpx solid #F6F6F6;
					display: flex;
					align-items: center;
					justify-content: space-between;
					color: #1A1A1A;
					font-size: 32rpx;

					.tag {
						background: #F0AD4E;
						color: #fff;
						padding: 4rpx 8rpx;
						font-size: 24rpx;
						margin-right: 20rpx;
						margin-left: -20rpx;
						height: 32rpx;
					}

					.status1 {
						background: #2b8df3;
						color: #fff;
						padding: 4rpx 8rpx;
						font-size: 24rpx;
					}

					.status2 {
						background: #F0AD4E;
						color: #fff;
						padding: 4rpx 8rpx;
						font-size: 24rpx;
					}

					.status3 {
						background: #B22222;
						color: #fff;
						padding: 4rpx 8rpx;
						font-size: 24rpx;
					}

					.status4 {
						background: #ccc;
						color: #fff;
						padding: 4rpx 8rpx;
						font-size: 24rpx;
					}
				}

				.info-status {
					padding: 0 10rpx;
					border: 1px solid #DD524D;
					border-radius: 6rpx;
					color: #DD524D;
					margin-left: 10rpx;
				}
			}
		}

		.btn {
			height: 96rpx;
			width: 100%;
			line-height: 96rpx;
			text-align: center;
			background: #4181FE;
			color: #fff;
			position: fixed;
			bottom: 0;
			left: 0;
		}

		.no-data {
			text-align: center;

			.img {
				display: block;
				height: 200rpx;
				width: 200rpx;
				margin: 0 auto;
				margin-top: 560rpx;
				margin-bottom: 60rpx;
			}

			.txt {
				color: #CFC8CC;
			}
		}
	}
</style>