<template>
	<div class="common-layout">
		<el-container>
			<el-header>
				<el-menu class="el-menu-demo" mode="horizontal">
					<el-menu-item index="1">

						<el-image class="logo" src="/logo.png"></el-image>
					</el-menu-item>
					<el-menu-item index="1">
						<el-text>首页</el-text>
					</el-menu-item>
					<el-menu-item index="2">
						<el-sub-menu>
							<template #title>物流服务</template>
							<el-menu-item index="2-1">即使配送</el-menu-item>
							<el-menu-item index="2-2">快递配送</el-menu-item>
							<el-menu-item index="2-3">国际服务</el-menu-item>
							<el-sub-menu index="2-4">
								<template #title>附加费用</template>
								<el-menu-item index="2-4-1">长途</el-menu-item>
								<el-menu-item index="2-4-2">短途</el-menu-item>
								<el-menu-item index="2-4-3">跨国</el-menu-item>
							</el-sub-menu>
						</el-sub-menu>
					</el-menu-item>
					<el-menu-item index="4">欢迎您： {{ userStore_.getUserInfo.loginId }} {{ userStore_.getIsAdmin ? "快递员" :
						"用户" }}</el-menu-item>
					<el-menu-item index="5" @click="userStore_.logoutUser">退出登录</el-menu-item>
				</el-menu>
			</el-header>
			<el-container>

				<el-aside width="200px" class="el-aside">
					<el-row class="tac">
						<el-col>
							<el-menu default-active="2" class="el-menu-vertical-demo" v-if="!userStore_.getIsAdmin">
								<el-sub-menu index="1">
									<template #title>
										<el-icon>
											<location />
										</el-icon>
										<span>我要寄件</span>
									</template>
									<el-menu-item-group>
										<router-link to="/user/expressform">
											<el-menu-item index="1-1">寄快递</el-menu-item>
											<el-menu-item index="1-2">批量寄</el-menu-item>
										</router-link>
									</el-menu-item-group>
								</el-sub-menu>

								<el-menu-item index="2">
									<router-link to="/user/myInfo">
										<el-icon>
											<document />
										</el-icon>
										<span>我的资料</span>
									</router-link>
								</el-menu-item>
							</el-menu>

							<el-menu default-active="2" class="el-menu-vertical-demo" v-else>
								<el-menu-item index="1">
									<router-link to="/user/expressList">
										<el-icon><icom-menu /></el-icon>
										<span>未签收</span>
									</router-link>
								</el-menu-item>
								<el-menu-item index="2">
									<router-link to="/user/signed">
										<el-icon><icom-menu /></el-icon>
										<span>已签收</span>
									</router-link>
								</el-menu-item>

							</el-menu>



						</el-col>
					</el-row>
				</el-aside>



				<el-main>
					<router-view></router-view>
				</el-main>
			</el-container>
		</el-container>
	</div>
</template>

<script setup>
import { userStore } from '../../store';
import { ref, onBeforeMount } from "vue"
const userStore_ = userStore()

</script>

<style>
.common-layout {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
}

.el-header,
.el-footer {
	background-color: white;
	color: #333;
	text-align: center;
	line-height: 60px;
}

.el-aside {
	background-color: #d9ecff;
	color: #333;
	text-align: center;
	line-height: 200px;
}

.el-main {
	background-color: #ecf5ff;
	color: #333;
	text-align: center;
	line-height: 160px;
}

.el-container {
	height: 100%;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
	line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
	line-height: 320px;
}

.logo {
	height: 58px;
}

.el-menu--horizontal>.el-menu-item:nth-child(3) {
	margin-right: auto;
}
</style>
