<template>
	<view class="bg">
		
		<image class="bg-image" src="/static/2/bg.png" mode="widthFix"></image>
		
		<view class="bg-content">
		<image style="display: block;" class="back-icon" src="/static/back.png" @click="goBack()"></image>
		<image :src="`/static/2/${current + 1}s.png`" class="text-img"></image>
		<view class="line"></view>
		
		<swiper class="swiper-box" :circular="false" previous-margin="210rpx" next-margin="210rpx" 
		:duration="800"
			:current="current" circular="true" @change="swiperChange">
			<swiper-item v-for="(item, index) in 3" :key="index" class="flex-center"
			@click="goShanJuan(item,index)">
				<view :class="['swiper-item', {'swiper-items': index != current}]">
					<image :src="`/static/2/${item}.png`" mode="aspectFill"></image>
				</view>
			</swiper-item>
		</swiper>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				current: 0
			}
		},
		methods: {
			//轮播图左右滑动
			swiperChange(e) {
				let {
					current,
					source
				} = e.detail;
				//在自动或手动的时候才赋予current值
				if (source === 'autoplay' || source === 'touch') {
					this.current = current;
				}
			},
			goShanJuan (item, index) {
				if (index==0) {
					uni.navigateTo({
						url:"/pages/index/shanJuan"
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.bg {
		width: 100vw;
		min-height: 100vh;
		position: relative;
		box-sizing: border-box;
		font-size: 0;
		background: black;
		.bg-image{
			width: 100%;
			height: auto;
		}
		.bg-content{
			width: 100%;
			height: 100%;
			position: absolute;
			left: 0;
			right: 0;
			top: 0;
			bottom: 0;
		}
	}
	
	.text-img {
		width: 656rpx;
		height: 546rpx;
		margin: 0 auto;
		display: block;
	}
	.line{
		width: 654rpx;
		height: 2rpx;
		background: #FCF1E6;
		margin: 32rpx auto 100rpx;
	}
	
	.swiper-box {
		height: 746rpx;
	}
	.swiper-item {
		width: 337rpx;
		height: 746rpx;
		
		image {
			width: 337rpx;
			height: 746rpx;
		}
	}
	.swiper-items {
		transform: scale(.8);
		transform-origin : 50% 100%;
		position: relative;
		&:before{
			content: "";
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			background: rgba(0,0,0,0.5);
			z-index: 2;
		}
		// filter: blur(2px)
	}
</style>