<template>
	<view class="banner">
		<view class="swiper-banner-content">
			<view class="swiper-banner-box">
				<swiper
					class="tui-banner-swiper tui-banner tui-skeleton-fillet"
					:autoplay="true"
					:interval="5000"
					:duration="500"
					@change="swiperChange"
					:circular="true"
				>
					<swiper-item v-for="(item, index) in list" :key="index" @click.stop="NavToDetailPage(item)">
						<image :src="item.image" class="tui-slide-image" mode="scaleToFill" />
					</swiper-item>
				</swiper>
				<view class="swiper__dots-box" v-if="list.length > 1">
					<view
						v-for="(item, idx) in list"
						:key="idx"
						:class="[idx === current ? 'swiper__dots-long' : 'none']"
						:data-index="current"
						class="swiper__dots-item"
					>
					</view>
				</view>
			</view>
		</view>
		<view class="swiper-banner-msg">
			<view class="content">
				<view class="item le">
					<text class="iconfont icon-zhengpin"><text class="sm">正品保证</text></text>
				</view>
				<view class="item ce">
					<text class="iconfont icon-jigou"><text class="sm">12000+机构</text></text>
				</view>
				<view class="item ri">
					<text class="iconfont icon-gongyingshang"><text class="sm">100+供应商</text></text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import cmsMixins from '@/mixins/cmsMixins.js'
export default {
	mixins: [cmsMixins],
	name: 'banner',
	props: {
		list: {
			type: Array
		}
	},
	data() {
		return {
			current: 0,
			StatusBar: this.StatusBar
		}
	},
	created() {},
	computed: {},
	methods: {
		swiperChange(e) {
			//轮播图切换
			const index = e.detail.current
			this.current = index
		},
		NavToDetailPage(item) {
			//跳转
			this.cmsSysStatistics(1,item.id)
			this.$api.FlooryNavigateTo(item)
		}
	}
}
</script>

<style lang="scss" scoped>
.banner {
	background-color: #f7f7f7;
}
.swiper-banner-content {
	width: 100%;
	height: auto;
	margin-top: 55px;
	background: url(https://static.caimei365.com/app/img/bg/new_home_cumres@2x.png) no-repeat;
	position: relative;
	background-size: cover;
	background-position-y: -170rpx;
}
.swiper-banner-box {
	width: 100%;
	height: 360rpx;
	position: relative;
	background-size: cover;
	display: flex;
}
.tui-banner-swiper {
	width: 700rpx;
	margin: 0 auto;
	height: 340rpx;
	border-radius: 24rpx;
	overflow: hidden;
	transform: translateY(0);
	box-shadow: 0px 3px 6px rgba(225, 86, 22, 0.08);
	margin-top: 16rpx;
	.banner-item {
		border-radius: 24rpx;
	}
	.tui-slide-image {
		width: 100%;
		height: 340rpx;
		display: block;
	}
}
.swiper__dots-box {
	position: absolute;
	bottom: 30rpx;
	left: 0;
	right: 0;
	/* #ifndef APP-NVUE */
	display: flex;
	/* #endif */
	flex: 1;
	flex-direction: row;
	justify-content: center;
	align-items: center;
	.swiper__dots-item {
		width: 8rpx;
		height: 8rpx;
		border-radius: 100%;
		margin-left: 6px;
		background-color: rgba(255, 255, 255, 0.7);
	}
	.swiper__dots-long {
		width: 35rpx;
		height: 8rpx;
		border-radius: 4rpx;
		background-color: #ffff;
		transition: all 0.4s;
	}
}
.swiper-banner-msg {
	width: 100%;
	height: 54rpx;
	box-sizing: border-box;
	padding: 0 24rpx;
	margin-top: 24rpx;
	.content {
		width: 100%;
		height: 54rpx;
		box-sizing: border-box;
		padding: 0 34rpx;
		background-color: #fff0e9;
		border-radius: 16rpx;
		.item {
			width: 33.33%;
			height: 54rpx;
			line-height: 54rpx;
			font-size: $font-size-24;
			color: $color-system;
			float: left;
			&.le {
				text-align: left;
			}
			&.ce {
				text-align: center;
			}
			&.ri {
				text-align: right;
			}
			.iconfont {
				color: $color-system;
				font-size: $font-size-32;
				.sm {
					font-size: $font-size-26;
				}
			}
		}
	}
}
</style>
