<template>
	<view>
		<!-- 图片及其他 -->
		<view class="imgAndOther">
			<view class="wrap">
				<u-swiper @click="upImg" height="450" :effect3d="true" :list="imgArr"></u-swiper>
			</view>
		
		
			<!-- 其他 -->
			<view class="other_box">
				<view class="other_boxLeft">
					<view class="other_boxLeft_name">
						{{ redata.name }}
					</view>
				</view>
			</view>
		</view>
		
		<!-- 详情列表 -->
		<view class="details_ul">
			<view class="details_list" v-if="item !== ''" v-for="item in redata.list">
				<view class="details_txtBox">
					<view class="details_txtBox_main">
						{{ item }}
					</view>
				</view>
			</view>
		
		</view>
			
		<!-- 弹框提示 -->
		<u-top-tips ref="uTips"></u-top-tips>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				redata: {},
				txtArr: [], //内容
				imgArr: [],
			}
		},
		methods: {
			information() {
				var centerTxt = this.redata.prevention
				var b = centerTxt.replace(/]/g, "：")
				var Adata = new Array();
				Adata = b.split("[");
				var arr = []
				for (var i = 0; i < Adata.length; i++) {
					if (Adata[i] !== '') {
						var obj = {}
						var index = Adata[i].lastIndexOf('：')
						obj['title']= Adata[i].substring(0, index)
						obj['txt']= Adata[i].substring(index + 1, obj.length)
						arr.push(obj)
					}
				}
				this.txtArr = arr
			},
			// 轮播图点击事件
			upImg(index) {
				var img = []
				img.push(this.imgArr[index])
				uni.previewImage({
					urls: img,
				})
			},
		},
		onLoad(options) {
			var data = JSON.parse(options.data)
			this.imgArr.push(data.img_ulrs)
			this.redata = data
			console.log(data)
			// this.information() //详情数据处理
			
		},
	}
</script>

<style lang="scss">
page {
		background: #f7f8fc;
		padding: 25rpx 0 25rpx 0;
	}

	// 顶部导航左图标
	.navTopLeftIcon {
		width: 50rpx;
		height: 50rpx;
		margin: 0 0 0 25rpx;
	}

	// 顶部导航右
	.navRight {
		position: absolute;
		top: 23rpx;
		right: 18rpx;

		.navTopRigthIcon {
			width: 40rpx;
			height: 40rpx;
		}

		text {
			width: 100rpx;
			font-size: 13px;
			color: #fff;
			display: inline-block;
			text-overflow: ellipsis;
		}
	}

	// 图片及其他
	.imgAndOther {
		background: #fff;
		margin: -26rpx 0 0 0;

		// 图片
		.imgAndOther_img {
			display: block;
			margin: 0 auto;
			width: 730rpx;
			height: 450rpx;
			border-radius: 5px;
		}
	}

	// 其他
	.other_box {
		display: flex;
		justify-content: space-between;
		padding-bottom: 25rpx;
		width: 730rpx;
		margin: 25rpx auto;

		.other_boxLeft {
			display: flex;

			.other_boxLeft_name {
				font-size: 18px;
				font-weight: 550;
				color: #545454;
			}

			.other_boxLeft_subject {
				color: #9f9f9f;
				font-size: 13px;
				line-height: 52rpx;
				margin: 0 0 0 15rpx;
			}
		}

		.other_boxRight {
			button {
				margin: 0 5rpx 0 15rpx;
			}
		}
	}

	// 详情列表
	.details_ul {

		// border: 1px solid #000;
		.details_list {
			background: #fff;
			padding: 15rpx;
			margin: 15rpx 0 0 0;

			.details_txtBox {
				.details_txtBox_tlt {
					font-size: 16px;
					font-weight: 550;
					margin: 0 0 10rpx 0;
				}

				.details_txtBox_main {
					color: #868686;
					font-size: 13px;
					font-weight: 530;
					line-height: 40rpx;
				}
			}
		}
	}
</style>
