<template>
	<view class="banner">
<!-- 		<view class="swiper-banner-msg">
			<view class="content">
				<view class="item le">
					<view class="item-icon">
						<text class="iconfont icon-zhengpin1"></text>
					</view>
					<view class="item-sm">
						<text>正品保证</text>
					</view>
				</view>
				<view class="item ce">
					<view class="item-icon">
						<text class="iconfont icon-jigou1"></text>
					</view>
					<view class="item-sm">
						<text>12000+机构</text>
					</view>
				</view>
				<view class="item ri">
					<view class="item-sm">
						<text>100+供应商</text>
					</view>
					<view class="item-icon">
						<text class="iconfont icon-gongyingshang1"></text>
					</view>
				</view>
			</view>
		</view -->
		<!-- <view class="tui-rolling-view">
			<view class="tui-rolling-content">
				<view class="tui-rolling-news">
					<text class="tui-roll-label">公告：</text>
					<swiper vertical autoplay circular interval="3500" class="tui-swiper">
						<swiper-item v-for="(item, index) in list" :key="index" class="tui-swiper-item">
							<view class="tui-news-item" @tap="detail(item)">
								<text class="news-dot"></text> {{ item.title }}
							</view>
						</swiper-item>
					</swiper>
					<view class="tui-roll-more" @tap="newsList(item)">
						更多<text class="iconfont icon-xiayibu"></text>
					</view>
				</view>
			</view>
		</view> -->
		<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>
</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: {
		detail(item){// 跳转公告详情
			this.$api.navigateTo(`/pages/service/news-detailes?id=${item.id}`)
		},
		newsList(){// 公告列表
			this.$api.navigateTo('/pages/service/news-list')
		},
		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 {
	margin-top: 170rpx;
	background: #f7f7f7;
}
.swiper-banner-content {
	width: 100%;
	height: auto;
	position: relative;
	background: linear-gradient(180deg, #FFFFFF 0%, rgba(255,255,255,0) 100%);
}
.swiper-banner-box {
	width: 100%;
	height: auto;
	position: relative;
	background-size: cover;
	display: flex;
	opacity: 1;
	background: linear-gradient(180deg, #FFFFFF 0%, rgba(255,255,255,0) 100%);
}
.tui-banner-swiper {
	width: 702rpx;
	margin: 10rpx auto;
	height: 280rpx;
	border-radius: 16rpx;
	overflow: hidden;
	transform: translateY(0);
	background: linear-gradient(180deg, #FFFFFF 0%, rgba(255,255,255,0) 100%);
	.banner-item {
		border-radius: 16rpx;
	}
	.tui-slide-image {
		width: 100%;
		height: 280rpx;
		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: 48rpx;
	box-sizing: border-box;
	background-color: #FFFFFF;
	padding: 0 24rpx;
	.content {
		width: 100%;
		height: 48rpx;
		box-sizing: border-box;
		padding: 0 24rpx;
		border-radius: 16rpx;
		.item {
			width: 30%;
			height: 48rpx;
			float: left;
			.item-icon{
				height: 48rpx;
				line-height: 48rpx;
				float: left;
				margin-right: 2px;
				.iconfont {
					color: #ffffff;
					font-size: $font-size-28;
				}
			}
			.item-sm{
				line-height: 48rpx;
				font-size: $font-size-22;
				color: #ffffff;
				float: left;
			}
			&.le {
				width: 37%;
				text-align: left;
			}
			&.ce {
				width: 25%;
				text-align: center;
			}
			&.ri {
				width: 37%;
				.item-icon{
					float: right;
				}
				.item-sm{
					float: right;
				}
			}
		}
	}
}
.tui-rolling-view {
	width: 100%;
	height: 96rpx;
	background-color: #FF5B00;
}
.tui-rolling-content{
	width: 100%;
	height: 100%;
	box-sizing: border-box;
	padding: 20rpx 24rpx;
	border-radius: 24rpx 24rpx 0 0;
	background-color: #FFFFFF;
}
.tui-rolling-news {
	width: 100%;
	padding: 0 20rpx;
	border-radius: 8rpx;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: nowrap;
	line-height: 56rpx;
	background: #fff7f3;
	background-size: cover;
	.tui-roll-label {
		font-weight: bold;
		font-size: $font-size-26;
		color: #ff5b00;
	}
	.tui-roll-more {
		font-size: $font-size-24;
		color: #999999;
		.icon-xiayibu {
			font-size: $font-size-22;
		}
	}
}

.tui-swiper {
	font-size: 28rpx;
	height: 50rpx;
	flex: 1;
}

.tui-swiper-item {
	display: flex;
	align-items: center;
}

.tui-news-item {
	width: 480rpx;
	line-height: 28rpx;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-size: $font-size-24;
	color: #666666;
	.news-dot {
		display: inline-block;
		width: 10rpx;
		height: 10rpx;
		background-color: #999999;
		border-radius: 50%;
		margin-right: 8rpx;
		float: left;
		margin-top: 10rpx;
	}
}
.tui-drop-item {
	color: #333;
	height: 80rpx;
	font-size: 28rpx;
	padding: 20rpx 40rpx 20rpx 40rpx;
	box-sizing: border-box;
	display: inline-block;
	width: 50%;
}
</style>
