<template>
	<view>
		<image @click.stop="examine()" :src="redata.img_ulr" class="successImg" mode=""></image>

		<scroll-view class="scroll-view_H" scroll-x="true" @scroll="scroll" scroll-left="120">

			<view class="successBox_flex">
				<view class="successBox">
					<view class="successName">
						{{ redata.name }}
					</view>


					<view class="success_ul">
						<view class="successName_list">
							<view class="successName_listCircle">
								<image :src="redata.img_ulrs" mode="" class="successName_listCircle_img"></image>
							</view>
						</view>
					</view>
					<!-- 查看详情 -->
					<view class="success_btn">
						<u-button @click="examineData()" size="medium" type="success" shape="circle" :ripple="true" ripple-bg-color="#909399">查看详情</u-button>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				redata: {}, //数据
				old: {
					scrollTop: 0
				},
			}
		},
		methods: {
			// 点击放大图片
			examine() {
				var img = []
				//没有更换头像
				img.push(this.redata.img_ulr)
				console.log(img)
				uni.previewImage({
					urls: img
				})
			},

			// 滑动
			scroll(e) {
				console.log(e)
				this.old.scrollTop = e.detail.scrollTop
			},

			// 查看详情
			examineData() {
				uni.navigateTo({
					url: '/pages/detailsWorn/detailsWorn?data=' + JSON.stringify(this.redata)
				})
			},
		},
		onLoad(options) {
			//老接口
			console.log(options)
			console.log(options)
			// var data = JSON.parse(options.data)
			var data = options.data !== null ? JSON.parse(options.data) : null
			if (data !== null) {
				var Adata = data[0].prevention
				var obj = {}
				var a = Adata.replace(/]/g, "：");
				let Bdata = new Array();
				Bdata = a.split("[");
				obj['img_ulrs'] = data[0].img_urls
				obj['img_ulr'] = options.img
				obj['list'] = Bdata
				obj['name'] = data[0].name
				this.redata = obj
				console.log(this.redata)
				console.log(this.redata)
			} else {
				console.log(options)
			}
		},
	}
</script>

<style lang="scss">
	.successImg {
		width: 750rpx;
		height: 550rpx;
		margin-top: -1rpx;
	}

	.successName {
		text-align: center;
		font-size: 20px;
		font-weight: 550;
		margin-top: 65rpx;
	}

	.success_ul {
		margin-top: 65rpx;

		.successName_list {
			width: 420rpx;
			height: 420rpx;
			margin: 0 auto;
			border-radius: 150px;
			border: 2px dashed #59ab49;

			.successName_listCircle {
				.successName_listCircle_img {
					display: block;
					margin: 18rpx auto;
					border-radius: 150px;
					width: 380rpx;
					height: 380rpx;
				}
			}
		}
	}

	.success_btn {
		width: 270rpx;
		margin: 65rpx auto;
	}

	// 结果轮播
	.successBox_flex {
		display: flex;
	}

	.successBox {
		width: 750rpx;
		// margin: 0 0 0 165rpx;
	}
</style>
