<template>
	<view>
		<image :src="redata.returnImageUrl" 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" v-for="(item, index) in redata.returnArray" :key="index">
				<view class="successName">
					{{ item.name }}
				</view>
				
				<view class="success_ul">
					<view class="successName_list">
						<view class="successName_listCircle">
							<image :src="item.img_urls[0]" mode="" class="successName_listCircle_img"></image>
						</view>
					</view>
				</view>
				<view class="success_btn">
					<u-button @click="examineData(index)" size="medium" type="success" shape="circle" :ripple="true" ripple-bg-color="#909399">查看详情</u-button>
				</view>
			</view> -->
			<u-cell-group>
				<u-cell-item icon="tags" @click="examineData(index)" :title="`${item[0]}--${item[1]}(${item[2]})`" v-for="(item, index) in redata.returnArray" :value="`查看详情`" :key="index"></u-cell-item>
			</u-cell-group>
		</view>
		
		
		<!-- </scroll-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>
</template>

<script>
	export default {
		data() {
			return {
				redata: {}, //数据
				old: {
					scrollTop: 0
				},
			}
		},
		methods: {
			// 点击放大图片
			examine() {
				var img = []
				//没有更换头像
				img.push(this.redata.image_url)
				uni.previewImage({
					urls: img
				})
			},
			
			// 滑动
			scroll(e) {
				console.log(e)
				this.old.scrollTop = e.detail.scrollTop
			},
			
			// 查看详情
			async examineData(index) {
				var dat = this.redata.returnArray[index][0];
				const res = await this.$myRequest({
					url: '/api/api_gateway?method=wheat.discreen.zhichong_pest_info',
					data: {
						pest_name: dat
						// pest_name: '稻飞虱'
					}
				})
				if(res.url) {
					// console.log(res)
					uni.navigateTo({
						url: `/pages/identifyPest/detailsA/detailsA?pestName=${JSON.stringify(res)}`
					})
				} else {
					uni.showToast({
					    title: `暂无${dat}介绍`,
					    duration: 2000,
						icon:"none"
					});
				}
			},
		},
		onLoad(options) {
			this.redata = JSON.parse(options.data)
			// 处理图片
			// var dat = this.redata.list
			// for (var i = 0; i < dat.length; i++) {
			// 	var b = dat[i].img_urls.replace(/#/g, "，")
			// 	var Adata = new Array();
			// 	Adata = b.split("，");
			// 	dat[i].img_urls = Adata
			// }
		},
	}
</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>
