<template>
	<view class="container" style="background-image: url('../../static/images/bg_home.png');">
		<view class="page">
			<view class="nav-top" @click="toCommunity()">
				<view class="title">汉江之星小区</view>
				<image src="../../static/images/icon_up.png" class="icon"></image>
			</view>
			<view class="banner">
				<swiper class="swiper" :autoplay="false" :interval="3000" :circular="true">
					<swiper-item>
						<image src="../../static/images/banner.png" class="swiper-item"></image>
					</swiper-item>
					<swiper-item>
						<image src="../../static/images/banner.png" class="swiper-item"></image>
					</swiper-item>
				</swiper>
			</view>
			<view class="message">
				<image src="../../static/images/icon_notice.png" class="icon"></image>
				<swiper class="swiper" circular :indicator-dots="false" :autoplay="true" :interval='3000'
					:vertical="true">
					<swiper-item :key="index" v-for="(item, index) in messageList">
						<view class="text" @click="toDetails(1)">{{item}}</view>
					</swiper-item>
				</swiper>
			</view>
			<view class="quick-entry">
				<view class="item" @click="quickEntry(1)">
					<view class="item-img">
						<image src="../../static/images/quick01.png" class="icon"></image>
						<view class="num">10</view>
					</view>
					<text>我的消息</text>
				</view>
				<view class="item" @click="quickEntry(2)">
					<image src="../../static/images/quick02.png" class="icon"></image><text>房屋登记</text>
				</view>
				<view class="item" @click="quickEntry(3)">
					<image src="../../static/images/quick03.png" class="icon"></image><text>生活缴费</text>
				</view>
				<view class="item" @click="quickEntry(4)">
					<image src="../../static/images/quick04.png" class="icon"></image><text>维修上报</text>
				</view>
				<view class="item" @click="quickEntry(5)">
					<image src="../../static/images/quick05.png" class="icon"></image><text>小区投诉</text>
				</view>
				<view class="item" @click="quickEntry(6)">
					<image src="../../static/images/quick06.png" class="icon"></image><text>公告公示</text>
				</view>
				<view class="item" @click="quickEntry(7)">
					<image src="../../static/images/quick07.png" class="icon"></image><text>缴纳物业费</text>
				</view>
			</view>
			<view class="housekeeper" style="background-image: url('../../static/images/bg_guanjia.png');">
				<view class="information">
					<image src="../../static/images/img01.png" class="icon"></image>
					<view class="title">
						<text class="name">王一一</text>
						<text class="about">您的专属管家</text>
					</view>
				</view>
				<view class="phone">
					<image src="../../static/images/icon_phone.png" class="icon"></image>
					<text>159-2546-5285</text>
				</view>
			</view>

			<view class="news">
				<view class="title">
					<text>社区活动公告</text>
					<image src="../../static/images/icon_more.png" class="icon"></image>
				</view>
				<view class="list">
					<view class="item" @click="toDetails(2)">
						<image src="../../static/images/img02.png" class="icon"></image>
						<view class="con">
							<view class="name">开展民族团结进步创建进社区 活动</view>
							<view class="time">物业服务中心 2020/09/08</view>
						</view>
					</view>
					<view class="item" @click="toDetails(2)">
						<image src="../../static/images/img03.png" class="icon"></image>
						<view class="con">
							<view class="name">开展民族团结进步创建进社区 活动</view>
							<view class="time">物业服务中心 2020/09/08</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	// import {
	// 	getHomeData
	// } from '@/config/api.js'
	export default {
		name: 'home',
		data() {
			return {
				messageList: [
					'紧急通知！！！ 所有居民请于下午3点于小区广场做核酸！',
					'住建部：2025年基本实现垃圾分类全覆盖，住房和城乡建设部表示，力争到今年年底前，地级及以上城市居民小区垃圾分类覆盖率达到90%以上，2025年底前基本实现垃圾分类全覆盖。',
				],
			}
		},
		methods: {
			toCommunity() {
				uni.navigateTo({
					url: '/pages/community/index',
				});
			},
			quickEntry(type) {
				if (type == 1) {
					uni.navigateTo({
						url: '/pages/message/index',
					});
				} else if (type == 2) {
					uni.navigateTo({
						url: '/pages/housing/index',
					});
				} else if (type == 3) {
					uni.navigateTo({
						url: '/pages/payCost/index',
					});
				} else if (type == 4) {
					uni.navigateTo({
						url: '/pages/maintenance/index',
					});
				} else if (type == 5) {
					uni.navigateTo({
						url: '/pages/complaints/index',
					});
				} else if (type == 6) {
					uni.navigateTo({
						url: '/pages/announcement/index',
					});
				} else if (type == 7) {
					uni.navigateTo({
						url: '/pages/payCostProperty/index',
					});
				}
			},
			toDetails(type) {
				if (type == 1) {
					uni.navigateTo({
						url: '/pages/messageDetails/index',
					});
				} else if (type == 2) {
					uni.navigateTo({
						url: '/pages/announcementDetails/index',
					});
				}
			}
		},
		onLoad() {

		},
		onPullDownRefresh() {

		},
		onReachBottom() {

		}
	}
</script>

<style lang="scss" scoped>
	.container {
		width: 100%;
		background-position: top center;
		background-repeat: no-repeat;
		background-size: cover;
	}

	.page {
		padding: 30rpx;
	}

	.nav-top {
		width: 100%;
		height: 44px;
		line-height: 44px;
		margin-top: 10rpx;
		display: flex;
		align-items: center;

		.title {
			font-size: 32rpx;
			color: #1D1F1C;
			font-weight: 700;
		}

		.icon {
			width: 20rpx;
			height: 12rpx;
			margin-left: 15rpx;
		}
	}

	.banner {
		margin-top: 20rpx;

		.swiper-item {
			width: 100%;
			height: 100%;
			border-radius: 16rpx;
		}
	}

	.message {
		height: 70rpx;
		line-height: 70rpx;
		overflow: hidden;
		line-height: 34rpx;
		background-color: #ffffff;
		border-radius: 16rpx;
		margin: 30rpx 0;
		display: flex;
		align-items: center;
		padding: 0 30rpx;

		.icon {
			width: 34rpx;
			height: 28rpx;
			margin-right: 20rpx;
		}

		.swiper {
			width: 100%;
			height: 70rpx;
			line-height: 70rpx;

			.text {
				text-overflow: ellipsis;
				white-space: nowrap;
				overflow: hidden;
				font-size: 28rpx;
				color: #373737;
			}
		}
	}

	.quick-entry {
		background-color: #ffffff;
		padding: 40rpx 30rpx 0;
		border-radius: 16rpx;
		display: flex;
		flex-wrap: wrap;

		.item {
			width: 25%;
			display: flex;
			flex-wrap: wrap;
			justify-content: center;
			margin-bottom: 40rpx;

			.item-img {
				position: relative;

				.num {
					position: absolute;
					top: -10px;
					right: -10px;
					font-size: 20rpx;
					color: #FFFFFF;
					padding: 4rpx 8rpx;
					background-color: #F6C864;
					border-radius: 20rpx;

				}
			}

			.icon {
				width: 74rpx;
				height: 74rpx;

			}

			text {
				margin-top: 12rpx;
				font-size: 28rpx;
				color: #373737;
			}

		}
	}

	.housekeeper {
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-radius: 16rpx;
		background-position: top center;
		background-repeat: no-repeat;
		background-size: cover;
		padding: 20rpx 30rpx;
		margin: 30rpx 0;

		.information {
			display: flex;
			justify-content: center;
			align-items: center;

			.icon {
				width: 70rpx;
				height: 70rpx;
				border: 1px solid #F6C864;
				border-radius: 702rpx;
			}

			.title {
				margin-left: 20rpx;

				.name {
					font-size: 28rpx;
					color: #ffffff;
					font-weight: bold;
					display: block;
				}

				.about {
					font-size: 24rpx;
					color: #ffffff;
					display: block;
				}

			}

		}

		.phone {
			height: 30rpx;
			line-height: 30rpx;
			background-color: #ffffff;
			border-radius: 30rpx;
			padding: 10rpx 24rpx;
			display: flex;
			justify-content: center;
			align-items: center;

			.icon {
				width: 24rpx;
				height: 22rpx;
			}

			text {
				margin-left: 14rpx;
				font-size: 24rpx;
				color: #5159EA;
			}
		}
	}

	.news {
		background-color: #ffffff;
		padding: 30rpx;
		border-radius: 16rpx;

		.title {
			height: 32rpx;
			line-height: 32rpx;
			display: flex;
			justify-content: space-between;

			text {
				font-size: 32rpx;
				color: #373737;
				font-weight: bold;
				padding-left: 18rpx;
				border-left: 3px solid #6852F0;
			}

			.icon {
				width: 10rpx;
				height: 16rpx;
			}
		}

		.list {
			.item {
				display: flex;
				justify-content: space-between;
				margin-top: 20px;
				padding-bottom: 20px;
				border-bottom: 1px solid #F0F0F2;

				.icon {
					width: 280rpx;
					height: 165rpx;
					border-radius: 6rpx;
				}

				.con {
					margin-left: 30rpx;

					.name {
						font-size: 30rpx;
						color: #373737;
					}

					.time {
						font-size: 24rpx;
						color: #B6B6BA;
						height: 30rpx;
						line-height: 30rpx;
						margin-top: 30rpx;
					}

				}
			}
		}


	}
</style>