<template>
	<view class="backgroundContainer">
		<view v-for="(item,index) in menuArray" :key="index">
			<view class="menuCard" @click="jumpTo(item.url)">
				{{item.name}}
			</view>
		</view>
		<!-- 服务考核页面要保留啊啊啊 -->
		<!-- <view class="small-button" @click="jumpTo(`/pages/assess/index`)">
			服务考核
		</view> -->
	</view>
	<!-- 自动更新组件  -->
	<zy-update ref="zyupgrade" :noticeflag="true" theme="blue" :h5preview="false" oldversion="1.0.0"
		:appstoreflag="true" :autocheckupdate="true"></zy-update>
</template>

<script setup lang="ts">
	import { ref, onMounted, onBeforeUnmount, computed, nextTick, } from 'vue';
	import { onLoad, onShow } from '@dcloudio/uni-app';
	import ZyUpdate from '@/component/zy-upgrade/zy-upgrade.vue'
	// 暗黑模式
	const darkFans = ref(false);
	const zyupgrade = ref(null)
	type darkFanstype = {
		darkFans : boolean
	}
	const menuArray = [
		{
			name: "初始化",
			url: "/pages/Initialization/index"
		},
		{
			name: "护理单元",
			url: "/pages/Nursing/index"
		},
		{
			name: "仓库",
			url: "/pages/Warehousing/index"
		},
	]
	const jumpTo = (url : string) => {
		uni.navigateTo({
			url: url
		});
	}
	// 生命周期钩子
	onLoad((options : darkFanstype) => {
		// 为uni.navigateBack()啥这么写，因为options给我返回的是字符串这个`false`,只能这么写，前端中`false`是true
		// uni.navigateBack()
	});

	// 生命周期钩子
	onShow(() => {
		zyupgrade.value?.check_update()
	});
</script>

<style scoped lang="less">
	.backgroundContainer {
		display: flex;
		position: relative;
		width: 100%;
		height: 100vh;
		background-image: url('/static/index/lightbgcnew.png');
		background-size: cover;
		background-position: center center;
		overflow: hidden;
		justify-content: center;
		align-items: center;
	}

	.menuCard {
		width: 400rpx;
		margin: 0 100rpx;
		height: 400rpx;
		background: linear-gradient(to bottom, #04BCED, #0160CE);
		color: #fff;
		font-size: 50rpx;
		border-radius: 10%;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.small-button{
		position: absolute;
		width: 300rpx;
		top: 200rpx;
		left: 600rpx;
		height: 200rpx;
		background: linear-gradient(to bottom, #04BCED, #0160CE);
		border-radius: 30rpx;
		color: #fff;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	// //暗黑模式
	// .darkbackgroundContainer {
	// 	display: flex;
	// 	position: relative;
	// 	width: 100%;
	// 	height: 100vh;
	// 	background-image: url('/static/index/background.png');
	// 	background-size: cover;
	// 	background-position: center center;
	// 	overflow: hidden;
	// }
</style>