<template>
	<view class="hzIndex">
		<hzHeader title="服务申请"></hzHeader>
		<view class="hzContent" style="padding-top: 200upx;">
			<view style="padding: 20upx;">
				<view class="box box-wrap" style="width: 100%;padding: 20upx 20upx;border-radius: 10upx;background-color: white;position: relative;">
					<view :style="permissions.length==5?'width: 20%;':'width: 25%;'" style=" margin-bottom: 15upx;" @click="navTo(item.pageUrl,item.children)" class="box box-column box-align-center" v-for="(item, index) in permissions" :key="index" v-if="item.isOpen == 0">
						<image class="box" style="width: 100upx; height: 100upx;" :src="item.iconUrl"></image>
						<view style="font-size: 26upx;color: grey;">{{item.name}}</view>
					</view>
				</view>
			</view>
 
			<view  class="occupied" style="height: 200upx;"></view>
		</view>

		
	</view>
</template>

<script>
	import {getUserPermission3,getIssueVisitorByUserId} from '@/common/api.js';
	import {callbackRequest,formatDate,getStorage,callbackRequestNoLoading  } from '@/common/util.js';
	export default {
		data() {
			return {
				formatDate:formatDate,
				permissions:[],
				visitorReservationList:[],
				userId: getStorage('userInfo').userId,
				examineBatch:''
			}
		},
		onLoad(option) {
			let code = option.code||"";
			this.permissions = JSON.parse(option.permissions) ||[];
			this.examineBatch = option.examineBatch || 1;
			// console.log(this.permissions)
			// console.log(this.examineBatch)
			// this.getUserPermissions(code); 
		},
		methods: {
			getUserPermissions(code) {
				let that = this;
				// if (!that.userId) {
				// 	return;
				// }
				let userId= getStorage('userInfo').userId;
				callbackRequestNoLoading({ method: getUserPermission3, data: { userId: userId,parentCode:code } }).then(res => {
					if (res.data.returnCode == 1) {
						that.permissions = res.data.returnData;
					} else {
						console.log('获取权限失败');
					}
				});
			},
			navTo(url,child) {
				for(let i = 0;i<child.length;i++){
					if(child[i].type==1){
						if(url.indexOf('?')!=-1){
							url = url+'&'+child[i].pageUrl;
						}else{
							url = url+'?'+child[i].pageUrl;
						}
					}
				}
				uni.navigateTo({
					url
				});
			},
		}
	}
</script>

<style lang="scss">
	uni-page-body {
		background-color:#F6F9FF!important;
		min-height: 100% !important;
		height: auto !important;
	}
	
	.banner-box {
		width: 100%;
		height: 240upx;
		position: absolute;
		top: 0;
		left: 0;
		image {
			width: 100%;
			height: 100%;
		}
	}
.box {
	display: flex;
	display: -webkit-flex;
}

.box-row-reverse {
	flex-direction: row;
}

.box-column {
	flex-direction: column;
}

.box-left {
	justify-content: flex-start;
}

.box-right {
	justify-content: flex-end;
}

.box-center {
	justify-content: center;
}

.box-between {
	justify-content: space-between;
}
.box-around {
	justify-content: space-around;
}
.box-align-center {
	align-items: center;
}
// .box-align-be {
// 	align-items: b;
// }

.box-wrap {
	flex-wrap: wrap;
}	
	
.tab-banner{
	width: 100%;
	position: relative;
	
	.image{
		width: 100%;
		height: 200upx;
		position: absolute;
		top: 0upx;
	}
	.image2{
		position: absolute;
		top: 40upx;
		width: 100%;
		padding: 0px 20upx;
		height: 240upx;
	}
}

.list-cell {
		padding: 20upx 20upx;
		box-sizing: border-box;
		background: #fff;
		margin-bottom: 20upx;
	}
.cell-title {
	font-size: 28upx;
	/* line-height: 56upx; */
	word-break: break-all;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}
.sub-title {
		padding-top: 10upx;
		font-size: 28upx;
		color: #bcbcbc;
	}
.more {
	font-size: 20upx;
	padding: 10upx 40upx;
	float: right;
	color: rgb(77, 180, 234);
}
</style>
