<template>
	<view class="share">
		<view :class="{'share-box': shareState}" @click="handleHiddenShare">
		</view>
		<view class="share-item" :class="{'share-show': shareState}">
			<view class="share-to">
				<text style="font-size: 16px;color: #000;">{{title}}</text>
			</view>


			<scroll-view scroll-y="true" class="scroll-Y">
				<view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(value, key) in historyList"
					:key="key">
					<view class="uni-media-list">

						<view class="uni-media-list-body">

							<view class="uni-media-list-text-top">
								<view class="tit-text">施工时间:</view>
								<view class="normal-text">{{value.createTime}}</view>
							</view>

							<view class="uni-media-list-text-top">
								<view class="uni-common-mt" style="width: 100%;">
									<text class="uni-title uni-common-pl" style=" font-size: 13px;color:
										#000;margin-top: 5px;">施工内容:</text>
									<view style="width: 100%;padding-right: 20rpx;box-sizing: border-box;">
										<textarea class="textarea" maxlength="255" :disabled="true"
											placeholder-style="padding: 10rpx;"
											style="width: 100%;height: 100%;border: 1rpx solid #cccccc; border-radius: 15rpx;padding: 10rpx;line-height:normal;"
											auto-height>{{value.remark}}</textarea>
									</view>
								</view>
							</view>
							<view class="cz-style" v-for="(a,index) in value.zEngineeringMaterialBo" :key="index">

								<view class="uni-media-list-text-top" style=" ">
									<view class="tit-text">材质:</view>
									<view class="normal-text">{{a.materialQualityName}}</view>
								</view>



								<view class="uni-media-list-text-top" style=" ">
									<view class="tit-text">规格:</view>
									<view class="normal-text">{{a.specificationsName}}</view>
								</view>



								<view class="uni-media-list-text-top" style=" ">
									<view class="tit-text">数量:</view>
									<view class="normal-text">{{a.number}}</view>
								</view>

							</view>


							<view class="uni-media-list-text-top">
								<view class="tit-text">负责人:</view>
								<view class="normal-text">{{value.constructUser}}</view>
							</view>
							<view class="uni-media-list-text-top">
								<view class="tit-text">负责人联系电话:</view>
								<view class="normal-text">{{value.constructPhone}}</view>
							</view>

							<view v-if="title=='下沟'">
								<view class="uni-common-mt" style="width: 100%;">
									<text class="uni-title uni-common-pl" style=" font-size: 13px;color:
											#000;margin-top: 5px; margin-left: 8px;">管道施工记录:</text>
								</view>

								<view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
									<view v-for="(item,index) in value.constructionRecords" :key="index"
										style="position: relative;">
										<view
											v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg'  || item.substring(item.length - 3) == 'jpeg'">
											<image :src="item" mode=""
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
												@click="showPhoto(index,value.constructionRecords)">
											</image>
										</view>
										<view v-else>
											<video :src="item"
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
										</view>
									</view>
								</view>

								<view class="uni-common-mt" style="width: 100%;">
									<text class="uni-title uni-common-pl" style=" font-size: 13px;color:
											#000;margin-top: 5px; margin-left: 8px;">管上皮深度测量照片:</text>
								</view>

								<view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
									<view v-for="(item,index) in value.ductalEpithelium" :key="index"
										style="position: relative;">
										<view
											v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg'  || item.substring(item.length - 3) == 'jpeg'">
											<image :src="item" mode=""
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
												@click="showPhoto(index,value.ductalEpithelium)">
											</image>
										</view>
										<view v-else>
											<video :src="item"
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
										</view>
									</view>
								</view>

								<view class="uni-common-mt" style="width: 100%;">
									<text class="uni-title uni-common-pl" style=" font-size: 13px;color:
											#000;margin-top: 5px;margin-left: 8px;">管沟远景照片:</text>
								</view>
								<view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
									<view v-for="(item,index) in value.trenchProspect" :key="index"
										style="position: relative;">
										<view
											v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg'  || item.substring(item.length - 3) == 'jpeg'">
											<image :src="item" mode=""
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
												@click="showPhoto(index,value.trenchProspect)">
											</image>
										</view>
										<view v-else>
											<video :src="item"
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
										</view>
									</view>
								</view>

								<view class="uni-common-mt" style="width: 100%;">
									<text class="uni-title uni-common-pl" style=" font-size: 13px;color:
											#000;margin-top: 5px;margin-left: 8px;">视频:</text>
								</view>
								<view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
									<view v-for="(item,index) in value.video" :key="index" style="position: relative;">
										<view
											v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg'  || item.substring(item.length - 3) == 'jpeg'">
											<image :src="item" mode=""
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
												@click="showPhoto(index,value.video)">
											</image>
										</view>
										<view v-else>
											<video :src="item"
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
										</view>

									</view>
								</view>

							</view>
							<view v-else-if="title=='沟上施工'">
								<view class="uni-common-mt" style="width: 100%;">
									<text class="uni-title uni-common-pl" style=" font-size: 13px;color:
											#000;margin-top: 5px;margin-left: 8px;">焊接照片:</text>
								</view>
								<view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
									<view v-for="(item,index) in value.welding" :key="index"
										style="position: relative;">
										<view
											v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg'  || item.substring(item.length - 3) == 'jpeg'">
											<image :src="item" mode=""
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
												@click="showPhoto(index,value.welding)">
											</image>
										</view>
										<view v-else>
											<video :src="item"
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
										</view>
									</view>
								</view>

								<view class="uni-common-mt" style="width: 100%;">
									<text class="uni-title uni-common-pl" style=" font-size: 13px;color:
											#000;margin-top: 5px;margin-left: 8px;">防腐照片:</text>
								</view>
								<view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
									<view v-for="(item,index) in value.aczoiling" :key="index"
										style="position: relative;">
										<view
											v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg'  || item.substring(item.length - 3) == 'jpeg'">
											<image :src="item" mode=""
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
												@click="showPhoto(index,value.aczoiling)">
											</image>
										</view>
										<view v-else>
											<video :src="item"
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
										</view>
									</view>
								</view>


							</view>
							<view v-else-if="title=='沟下施工'">
								<view class="uni-common-mt" style="width: 100%;">
									<text class="uni-title uni-common-pl" style=" font-size: 13px;color:
											#000;margin-top: 5px;margin-left: 8px;">管道下沟照片:</text>
								</view>
								<view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
									<view v-for="(item,index) in value.piping" :key="index" style="position: relative;">
										<view
											v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg'  || item.substring(item.length - 3) == 'jpeg'">
											<image :src="item" mode=""
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
												@click="showPhoto(index,value.piping)">
											</image>
										</view>
										<view v-else>
											<video :src="item"
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
										</view>
									</view>
								</view>

								<view class="uni-common-mt" style="width: 100%;">
									<text class="uni-title uni-common-pl" style=" font-size: 13px;color:
											#000;margin-top: 5px;margin-left: 8px;">警示带铺设照片:</text>
								</view>
								<view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
									<view v-for="(item,index) in value.warning" :key="index"
										style="position: relative;">
										<view
											v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg'  || item.substring(item.length - 3) == 'jpeg'">
											<image :src="item" mode=""
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
												@click="showPhoto(index,value.warning)">
											</image>
										</view>
										<view v-else>
											<video :src="item"
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
										</view>
									</view>
								</view>

								<view class="uni-common-mt" style="width: 100%;">
									<text class="uni-title uni-common-pl" style=" font-size: 13px;color:
											#000;margin-top: 5px;margin-left: 8px;">回填照片:</text>
								</view>
								<view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
									<view v-for="(item,index) in value.backfilling" :key="index"
										style="position: relative;">
										<view
											v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg'  || item.substring(item.length - 3) == 'jpeg'">
											<image :src="item" mode=""
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
												@click="showPhoto(index,value.backfilling)">
											</image>
										</view>
										<view v-else>
											<video :src="item"
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
										</view>
									</view>
								</view>

							</view>
							<view v-else>
								<view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
									<view v-for="(item,index) in value.zEngiineeringPhotoBoList" :key="index"
										style="position: relative;">
										<view
											v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg'  || item.substring(item.length - 3) == 'jpeg'">
											<image :src="item" mode=""
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
												@click="showPhoto(index,value.zEngiineeringPhotoBoList)">
											</image>
										</view>
										<view v-else>
											<video :src="item"
												style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
										</view>
									</view>
								</view>

							</view>
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			data: {
				type: Object,
				default: {}
			},

			TitleType: {
				type: String
			}

		},
		created() {
			this.getParamsData();
		},
		watch: {
			data(data) {
				this.getParamsData();
			}
		},
		data() {
			return {
				outPutData: {},
				historyList: [], //历史数据
				historyPhotoList: [], //历史图片数据
				shareState: false,
				title: '',
			};
		},
		methods: {
			// isEmpty(str) {

			// 	return (!str || 0 === str.length);

			// },

			showPhoto(index, list) {
				let newArr = [];
				list.forEach((item, index) => {
					if (item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' ||
						item.substring(item.length - 4) == 'jpeg') {
						newArr.push(item)
					}
				});
				uni.previewImage({
					current: index,
					urls: newArr,
				})

			},
			getParamsData() {
				var selectData = this.data;
				this.outPutData = selectData;

				this.title = this.TitleType;
				this.historyList = selectData.zEngineeringNodeBo.zEngineeringInfoBoList;




			},
			// 显示分享
			handleShowShare() {
				this.shareState = true;
			},
			// 隐藏分享
			handleHiddenShare() {
				this.shareState = false;
			}
		}
	}
</script>

<style lang="scss">
	.uni-media-list-body {
		border: 1px solid #eee;
		border-radius: 40rpx;
		margin: 10rpx 30rpx 20rpx;
		padding: 10rpx 0 40rpx;
		box-shadow: 0 0 5px #eee;
	}

	.share {
		width: 100%;
		height: 100%;

	}

	.tit-text {
		color: #4f535a;
		margin-right: 20rpx;
	}

	.normal-text {}

	.cz-style {
		background: #e8f4f9;
		margin: 20rpx;
		padding: 10rpx;
		border-radius: 20rpx;
		border: 1px solid #d4e3f0;
	}

	.uni-media-list-text-top {
		font-size: 14px;
		color: #696969;
		padding: 20rpx 20rpx;
		border-bottom: 1px solid #eee;
		display: flex;
		align-items: center;
	}

	.share-box {
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0rpx;
		left: 0rpx;
		bottom: 0rpx;
		right: 0rpx;
		background-color: rgba(0, 0, 0, 0.4);
		transition: .3s;
		z-index: 999;
	}

	// 进入分享动画
	.share-show {
		transition: all 0.3s ease;
		transform: translateY(0%) !important;
		border-radius: 20px 20px 0px 0px;
	}

	.scroll-Y {
		height: 58vh;
	}

	// 离开分享动画
	.share-item {
		position: fixed;
		left: 0;
		bottom: 0;
		width: 100%;
		height: 70%;
		background-color: #FFFFFF;
		transition: all 0.3s ease;
		transform: translateY(100%);
		z-index: 1999;

		.share-to {
			width: 100%;
			height: 30px;
			display: flex;
			justify-content: center;
			margin: 30rpx 0;
			align-items: center;

			// &::after {
			// 	content: '';
			// 	width: 240rpx;
			// 	height: 0rpx;
			// 	border-top: 1px solid #E4E7ED;
			// 	-webkit-transform: scaleY(0.5);
			// 	transform: scaleY(0.5);
			// 	margin-left: 30rpx;
			// }

			// &::before {
			// 	content: '';
			// 	width: 240rpx;
			// 	height: 0rpx;
			// 	border-top: 1px solid #E4E7ED;
			// 	-webkit-transform: scaleY(0.5);
			// 	transform: scaleY(0.5);
			// 	margin-right: 30rpx;
			// }
		}

		.content {
			width: 100%;
			height: auto;
			display: flex;
			flex-wrap: wrap;

			.block {
				width: 100%;
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: left;
				height: auto;

				image {
					width: 80rpx;
					height: 80rpx;
				}

				text {
					margin-top: 16rpx;
					font-size: 28rpx;
					color: #606266;
				}
			}
		}

		.cancel {
			width: 100%;
			height: 3rem;
			display: flex;
			justify-content: center;
			align-items: center;
			border-top: 1rpx solid #E4E7ED;
		}


	}
</style>