<template>
	<view class="contentStyle" style="">
		<view class="status-bar"></view>
		<uni-nav-bar title="服务" backgroundColor="transparent" :border="false">
		</uni-nav-bar>
		<!-- 表单区域 -->
		<view class="page" :style="{ height: `calc(100vh  - ${statusBarHeight}px)` }">
			<view class="container">
				<!-- 顶部 Banner 轮播 -->
				<view class="banner-box" style="overflow-y: hidden;">
					<image class="banner-img" src="/static/propertyImgs/serviceImg.png" />
				</view>

				<!-- 常用功能区 -->
				<view class="func-section">
					<view class="section-title">
						<text class="title-text">常用功能</text>
					</view>
					<view class="func-grid">
						<view class="func-item" v-for="(item, index) in commonFuncList" :key="index"
							@click="handleFuncClick(item)">
							<view class="func-icon"
								:style="{'background-image': 'url(' + (item.icon) + ')', 'background-repeat': 'no-repeat','background-size': '100% 100%','background-position': 'center',}">
								<!-- <image :src="item.icon" mode="aspectFit"></image> -->
							</view>
							<text class="func-name">{{ item.name }}</text>
						</view>
					</view>
				</view>

				<!-- 智慧社区功能区 -->
				<view class="func-section" style="margin-bottom: 0px;">
					<view class="section-title">
						<text class="title-text">智慧社区</text>
					</view>
					<view class="func-grid community-grid">
						<view class="func-item" v-for="(item, index) in communityFuncList" :key="index"
							@click="handleFuncClick(item)">
							<view class="func-icon">
								<image :src="item.icon" mode="aspectFit"></image>
							</view>
							<text class="func-name">{{ item.name }}</text>
						</view>
					</view>
				</view>
			</view>

		</view>
	</view>



</template>

<script>
	export default {
		onReady: function(e) {},
		components: {

		},

		computed: {

			


		},
		created() {
			
		},
		onShow() {

		},

		mounted() {},

		onReady() {
			this.$nextTick(() => {

			})
		},
		data() {
			return {
				/* 设定状态栏默认高度 */
				statusBarHeight: 20,
				// 常用功能列表
				commonFuncList: [{
						name: "一键开门",
						icon: "/static/propertyImgs/icon-door.png",
						path: "/pages/door/index"
					},
					{
						name: "生活缴费",
						icon: "/static/propertyImgs/icon-pay.png",
						path: "/pages/pay/index"
					},
					{
						name: "在线报修",
						icon: "/static/propertyImgs/icon-repair.png",
						path: "/pages/repair/index"
					},
					{
						name: "访客邀请",
						icon: "/static/propertyImgs/icon-visitor.png",
						path: "/pages/visitor/index"
					}
				],
				// 智慧社区功能列表
				communityFuncList: [{
						name: "一键开门",
						icon: "/static/propertyImgs/icon-door.png",
						path: "/pages/door/index"
					},
					{
						name: "生活缴费",
						icon: "/static/propertyImgs/icon-pay.png",
						path: "/pages/pay/index"
					},
					{
						name: "在线报修",
						icon: "/static/propertyImgs/icon-repair.png",
						path: "/pages/repair/index"
					},
					{
						name: "访客邀请",
						icon: "/static/propertyImgs/icon-visitor.png",
						path: "/pages/visitor/index"
					},
					{
						name: "投诉意见",
						icon: "/static/propertyImgs/icon-complaint.png",
						path: "/subpkg/service/complaintsSuggestionsIndex"
					},
					{
						name: "问卷调查",
						icon: "/static/propertyImgs/icon-survey.png",
						path: "/subpkg/service/questionnaireSurveyIndex"
					},
					{
						name: "社区活动",
						icon: "/static/propertyImgs/icon-activity.png",
						path: "/pages/activity/index"
					},
					{
						name: "公告公示",
						icon: "/static/propertyImgs/icon-notice.png",
						path: "/pages/notice/index"
					},
					{
						name: "联系物业",
						icon: "/static/propertyImgs/icon-contact.png",
						path: "/subpkg/service/contactProperty"
					}
				]


			}
		},


		methods: {
			// 功能点击事件
			handleFuncClick(item) {
				console.log(item.path);
				uni.redirectTo({
					url: item.path,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},


		},


	}
</script>
<style lang="scss">
	page {
		background: #f2f1f6;
	}
</style>

<style scoped>
	.status-bar {
		width: 100vw;
		height: 46px;
	}

	.contentStyle {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		display: flex;
		flex-direction: column;
		padding-bottom: 30px;
		background: linear-gradient(to left bottom, #e2efff 0%, #f9f9f9 50%);

		/* background: #fff; */
	}

	/* 页面整体 */
	.page {
		/* min-height: 100vh; */
		/* background-color: #fff; */
		flex: 1;
		height: 0;
		/* 必须加！小程序必加 */
		overflow-y: auto;
	}

	.container {
		padding: 20px;
	}

	/* Banner 轮播 */
	.banner-box {
		width: 100%;
		border-radius: 10px;
		overflow: hidden;
		margin-bottom: 20px;
		height: 111px;
	}

	.banner-img {
		width: 100%;
		height: 111px;

	}


	/* 功能区通用样式 */
	.func-section {
		width: 100%;
		background-color: #ffffff;
		border-radius: 10px;
		padding: 10px;
		box-sizing: border-box;
		margin-bottom: 20px;
	}

	.section-title {
		display: flex;
		align-items: center;
		margin-bottom: 25px;
	}

	.title-line {
		width: 6px;
		height: 24px;
		background-color: #007aff;
		border-radius: 3px;
		margin-right: 10px;
	}

	.title-text {
		font-size: 16px;
		font-weight: 600;
		color: #000000;
	}

	/* 功能网格 */
	.func-grid {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
	}

	.func-item {
		width: 22%;
		display: flex;
		flex-direction: column;
		align-items: center;
		margin-bottom: 20px;
	}

	.func-icon {
		width: 42px;
		height: 42px;
		border-radius: 50%;
		background-color: #f0f5ff;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-bottom: 10px;
		position: relative;
	}


	.func-icon image {
		max-height: 100%;
		/* 限制最大高度不超出 */
		object-fit: cover;
		/* 保持比例 */
		/* width: 200px; */
		/* height: 200px; */
	}

	.func-name {
		font-size: 14px;
		color: #000000;
		font-weight: 400;
		text-align: center;
		line-height: 1.4;
	}

	/* 智慧社区网格（适配9个图标，最后一个左对齐） */
	.community-grid .func-item {
		width: 22%;
	}

	.community-grid .func-item:nth-child(9) {
		margin-right: auto;
		margin-left: 0;
	}
</style>