<template>
	<view class="page">
		<navBar title="详情" :back="true" color="black" background="white" />
		<view class="topImg">
			<u-swiper type='img' radius="0rpx 0rpx 0rpx 40rpx" :list="bannerList" keyName="image" indicator
				indicatorMode="line" :autoplay="true" height="1124rpx" imgMode="heightFix" circular
				@change="bannerChange">
				<view slot="indicator">
				</view>
			</u-swiper>

			<view class="indicatorBox1">
				<view class="indicator1">
					<view class="indicator1__dot1" style="" v-for="(item, index) in bannerList" :key="index"
						:class="[index === currentNum ?'indicator1__dot1--active1':'']">
					</view>
				</view>
			</view>
		</view>

		<view class="cen">
			<image class="water" src="/static/index/water.png" mode=""></image>
			<image class="halfC" src="/static/index/halfCircle_275.png" mode=""></image>
			<!-- 灯具参数 -->

			{{item.name}}
		</view>

		<view class="parmasBox">
			<view class="con">
				<view class="item" v-for="(item,index) in  item.params">
					<view class="name">
						{{item.event}}
					</view>
					<view class="des">
						{{item.value}}
					</view>
				</view>
			</view>
		</view>

		<view class="btnBox">
			<view class="lBtn" @click="reset">
				重新选择
			</view>
			<view class="rBtn" @click="chooseConfirm">
				选中
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		components: {

		},
		data() {
			return {
				picUrl: this.$picUrl,
				picBase: this.$picBase,
				item: null,
				bannerList: ['/static/index/halfCircle_275.png'],
				currentNum: 0,

				currIndex: -1,

				name: '',

				mianFromType: ''
			}
		},
		onLoad(o) {
			this.mianFromType = o.mianFromType
			this.item = getApp().ktItem
			this.currIndex = getApp().ktIndex
			this.name = getApp().ktName
			let images = []

			getApp().ktItem.image.forEach((item, index) => {
				images.push(this.$picBase + item)
			})

			this.bannerList = images

			console.log('最终收到的详情数据', this.item, this.bannerList);
		},
		methods: {
			reset() {
				uni.navigateBack({
					delta: 1
				})
			},
			bannerChange(e) {
				this.currentNum = e.current
			},
			chooseConfirm() {
				getApp().chooseItem_kt = this.item
				getApp().index_kt = this.currIndex
				getApp().chooseType = this.name


				console.log('this.mianFromType', this.mianFromType);
				if (this.mianFromType == 1) {
					uni.navigateBack({
						delta: 1
					})
				} else if (this.mianFromType == 2) {
					uni.navigateBack({
						delta: 2
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "./index.scss";
</style>