<template>
	<view class="bg">
		<image class="back-icon" style="position: absolute;top: 20rpx;" src="/static/back.png" @click="goBack()"></image>
		<image :src="`/static/2/${current + 1}s.png`" class="text-img"></image>
		
		<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>
</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;
		height: 100vh;
		background-image: url('/static/2/bg.png');
		background-size: 100% 100%;
		position: relative;
		padding-top: 780rpx;
		box-sizing: border-box;
	}
	
	.text-img {
		width: 656rpx;
		height: 546rpx;
		position: absolute;
		top: 1.3rpx;
		left: 47rpx;
	}
	
	.swiper-box {
		height: 746rpx;
	}
	.swiper-item {
		width: 337rpx;
		height: 746rpx;
		
		image {
			width: 337rpx;
			height: 746rpx;
		}
	}
	.swiper-items {
		transform: scale(.8);
		filter: blur(2px)
	}
</style>