<template>
	<view class="page">

		<view class="status-bar"></view>
		<view class="content">
			<!-- 搜索框 -->
			<view class="search">
				<view class="search-content">
					<image src="../../static/images/ic_search.png" class="icon" mode="aspectFill"></image>
					<input @input="onSearchInput" placeholder="请输入关键字搜索" />
				</view>
				<view class="btn" @click="doSearch">搜索</view>
			</view>
			<!-- 轮播图 -->
			<swiper v-if="slider.length > 0" class="swiper" :indicator-dots="true" :autoplay="true" :circular="true">
				<swiper-item v-for="(item, index) in slider" :key="index">
					<navigator class="item" hover-class="none" :url="'/pages/duty/list'">
						<image :lazy-load="true" :src="item.imageUrl" mode="aspectFill"></image>

					</navigator>
				</swiper-item>
			</swiper>
			<view class="func-box">
				<view class="item" @click="openActivity()">
					<image src="../../static/images/ic_labour_pious_icon.png" mode="aspectFill"></image>
					<text>劳动尽责</text>
				</view>
				<view class="item" @click="openCertificate">
					<image src="../../static/images/ic_certify_search_icon.png" mode="aspectFill"></image>
					<text>证书查询</text>
				</view>
				<view class="item" @click="openExplain">
					<image src="../../static/images/ic_duty_answer_icon.png" mode="aspectFill"></image>
					<text>尽责说明</text>
				</view>
			</view>
			<image class="divider" src="../../static/images/ic_duty_divider.png" mode="aspectFill"></image>
		</view>
	</view>
</template>

<script>
	import pageLoading from '@/components/loading/pageLoading.vue';
	export default {
		components: {
			pageLoading
		},
		data() {
			return {
				showPageLoading: true,
				slider: [{
					imageUrl: "https://img1.baidu.com/it/u=1470385559,3839180880&fm=253&fmt=auto&app=138&f=JPEG?w=667&h=500"
				}], //轮播图
			};
		},
		methods: {
			doSearch() {

			},
			onSearchInput(event) {

			},
			openActivity() {
				uni.navigateTo({
					url: "/pages/duty/activitylist"
				})
			},
			openExplain() {
				uni.navigateTo({
					url: "/pages/duty/dutyexplain"
				})
			},
			openCertificate() {
				uni.navigateTo({
					url: "/pages/user/mine_certif_search"
				})
			}
		}

	};
</script>

<style scoped lang="scss">
	page {
		height: 100%;
	}

	.page {
		display: flex;
		flex: 1;
		flex-direction: column;
		overflow: hidden;
		height: 100%;
		background: #fff;
	}

	.content {
		flex: 1;
		width: 100%;
		height: 100rpx;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
	}

	/*幻灯片广告 */
	.swiper {
		height: 350rpx;
		margin: 14rpx 24rpx 0;

		image {
			height: 350rpx;
			width: 100%;
			border-radius: 15rpx;
			//box-shadow: 0 0 12px #dddee1;
		}

		.current {
			width: 98%;
			height: 350rpx;
			margin: 1.0% 1.0%;
			transition: all 0.2s ease-in 0s;
		}

		.item {
			position: relative;

			.title {
				position: absolute;
				left: 0;
				bottom: 0;
				display: flex;
				justify-content: center;
				width: 100%;

				text {
					margin: 7% 6%;
					display: flex;
					align-items: center;
					color: #fff;
					display: -webkit-box;
					text-overflow: ellipsis;
					word-break: break-all;
					-webkit-line-clamp: 2;
					-webkit-box-orient: vertical;
					overflow: hidden;
					font-size: 34rpx;
					padding: 14rpx 20rpx;
					max-width: 610rpx;
					line-height: 1.3;
					border-radius: 5rpx;
				}
			}
		}
	}

	.func-box {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-around;
		padding: 20rpx 10rpx;

		.item {
			display: flex;
			flex-direction: column;
			align-items: center;

			image {
				width: 80rpx;
				height: 80rpx;
			}

			text {
				color: black;
				font-size: 30rpx;
				margin-top: 10rpx;
			}
		}
	}

	.divider {
		width: 96%;
		height: 100rpx;
		align-self: center;
	}

	/*搜索*/
	.search {
		padding: 10rpx 24rpx 10rpx 24rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.search-content {
			background: #f2f2f2;
			border-radius: 15px;
			padding: 10rpx 24rpx 10rpx 24rpx;
			margin-right: 15rpx;
			flex: 1;
			display: flex;
			align-items: center;
		}

		/deep/.input {
			color: #8cc7b5;
		}

		.icon {
			width: 30rpx;
			height: 30rpx;
			margin-right: 15rpx;
		}

		.btn {
			color: #b3b3b3;
		}
	}
</style>
