<template>
	<view class="specialOperations">
		<view class="fixedheader">
			<headers :themeType="true" :showBack="true">
				<view class="headerName">
					检测管理
				</view>
			</headers>
		</view>
		<view class="sp-menu">
			<!-- <view class="sp-menu" v-if="menuList.length > 0"> -->
			<!-- <view class="menu-item" @click="handleNavigateTo(item.path)" v-for="(item,i) in menuList">
				<view class="item-icon">
					<image :src="'/static/specialOperations/'+item.iconImg"></image>
				</view>
				<view class="item-text">
					<text>{{item.menuName}}</text>
				</view>
			</view> -->
			<!-- <view class="menu-item" @click="handleNavigateTo(1)">
				<view class="item-icon">
					<image src="@/static/specialOperations/fireWork.png"></image>
				</view>
				<view class="item-text">
					<text>动火作业</text>
				</view>
			</view>
			<view class="menu-item" @click="handleNavigateTo(4)">
				<view class="item-icon">
					<image src="@/static/specialOperations/highJob.png"></image>
				</view>
				<view class="item-text">
					<text>高处作业</text>
				</view>
			</view>
			<view class="menu-item" @click="handleNavigateTo(2)">
				<view class="item-icon">
					<image src="@/static/specialOperations/limitSpaceWork.png"></image>
				</view>
				<view class="item-text">
					<text>受限(类受限)空间作业</text>
				</view>
			</view>
			<view class="menu-item" @click="handleNavigateTo(5)">
				<view class="item-icon">
					<image src="@/static/specialOperations/hoistSafe.png"></image>
				</view>
				<view class="item-text">
					<text>起重吊装作业</text>
				</view>
			</view> -->
			<view class="menu-item" v-for="item in dataList" :key="item.id" @click="handleNavigateTo(item.id)">
				<view class="item-icon">
					<image :src="item.urlImage"></image>
				</view>
				<view class="item-text">
					<text>{{item.appName}}</text>
				</view>
			</view>

			<!-- <view class="menu-item" @click="handleNavigateTo(6)">
				<view class="item-icon">
					<image src="@/static/bthgIcon/groundSafe.png"></image>
				</view>
				<view class="item-text">
					<text>土建工程作业</text>
				</view>
			</view> -->
		</view>
		<!-- <levitatedsphere :x="100" :y="80"></levitatedsphere> -->
	</view>
</template>

<script>
	import levitatedsphere from "@/components/levitatedsphere/levitatedsphere.vue"
	import headers from '../../../components/headers/headers.vue'
	import groundSafe from "@/static/bthgIcon/groundSafe.png";
	import bindPlatePlug from "@/static/bthgIcon/bindPlatePlug.png";
	// import bindPlatePlug from "@/static/bthgIcon/bindPlatePlug.png";
	export default {
		navigationBarTitleText: '页面标题',
		data() {
			return {
				userInfo: {},
				moduleList: [],
				menuList: [],
				dataList: [{
					id: 6,
					urlImage: groundSafe,
					appName: "土建工程作业",
					appPath: '/project/operationManage/buildingProjectWorks'
				}, {
					id: 3,
					urlImage: bindPlatePlug,
					appName: "无损作业",
					appPath: '/project/operationManage/losslessWorks'
				}, {
					id: 1,
					urlImage: bindPlatePlug,
					appName: "见证取样记录",
					appPath: '/project/operationManage/witnessSamplingRecord'
				},{
					id: 2,
					urlImage: bindPlatePlug,
					appName: "桩基检测委托",
					appPath: '/project/operationManage/pileFoundationInspection'
				}]
			};
		},
		onReady() {

		},
		created() {

		},
		mounted() {

		},
		onLoad() {
			this.haveModuleList = uni.getStorageSync("haveModuleList");
			this.dataListUp();
		},
		methods: {
			dataListUp() {
				this.dataList = this.dataList.filter(item => {
					const res = this.$recursiveSearch(this.haveModuleList, item.appPath)
					// console.log(5555555, res);
					// debugger
					return res ? true : false
				});
				// console.log(this.haveModuleList)
			},
			handleNavigateTo(val) {
				if (val === 3) uni.navigateTo({
					url: "../operationManage/losslessWorks/work"
				})
				if (val === 6) uni.navigateTo({
					url: "../operationManage/buildingProjectWorks/work"
				})
				if (val === 1) uni.navigateTo({
					url: "../operationManage/witnessSamplingRecord/index"
				})
				if (val === 2) uni.navigateTo({
					url: "../operationManage/pileFoundationInspection/index"
				})
			}
		}
	}
</script>

<style lang="scss">


	.specialOperations {
		height: 100%;
		background-image: url(@/static/bthgIcon/main_bg1.png);
		background-repeat: no-repeat;
		background-size: 100%;
		padding-bottom: 20rpx;

		.fixedheader {
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
			z-index: 2;
			:deep( .headerBox ){
		background-color: transparent;
	}
		}

		.sp-menu {
			margin: 0 38rpx;
			padding-top: 200rpx;
			// height: 1200rpx;
			// height: 1000rpx;
			// background-color: darkred;
			display: grid;
			grid-gap: 24rpx;
			grid-template-columns: repeat(2, 1fr);

			// grid-template-columns: repeat(auto-fill, 220rpx);
			// place-items: center;
			// justify-content: center;
			.menu-item {
				// width: 220rpx;
				height: 274rpx;
				// background-color: darkblue;
				box-shadow: 0px 8rpx 15rpx 0px rgba(219, 229, 255, 0.6);
				border-radius: 10rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				flex-direction: column;
				background-color: #ffffff;

				.item-icon {
					// width: 220rpx;
					// height: 220rpx;
					display: flex;
					justify-content: center;
					align-items: center;
					margin-bottom: 14rpx;

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

				.item-text {
					align-items: center;
					// width: 220rpx;
					height: 54rpx;
					display: flex;
					justify-content: center;
					align-items: center;

					text {
						text-align: center;
						display: flex;
						justify-content: center;
					}
				}
			}
		}
	}
</style>