You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
uml-task/src/view/user/index.vue

203 lines
5.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<!-- 页面的最外层容器 -->
<div class="common-layout">
<!-- Element UI 的容器组件 -->
<el-container>
<!-- 顶部导航栏 -->
<el-header>
<!-- Element UI 的水平菜单组件 -->
<el-menu class="el-menu-demo" mode="horizontal">
<!-- 菜单项用于显示 Logo -->
<el-menu-item index="1">
<!-- Element UI 的图片组件用于显示 Logo 图片 -->
<el-image class="logo" src="/logo.png"></el-image>
</el-menu-item>
<!-- 首页菜单项 -->
<el-menu-item index="1">
<!-- Element UI 的文本组件 -->
<el-text>首页</el-text>
</el-menu-item>
<!-- 物流服务的下拉菜单 -->
<el-menu-item index="2">
<!-- Element UI 的子菜单组件 -->
<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">
<!-- Element UI 的栅格行组件 -->
<el-row class="tac">
<!-- Element UI 的栅格列组件 -->
<el-col>
<!-- Element UI 的垂直菜单组件用于非管理员用户 -->
<el-menu default-active="2" class="el-menu-vertical-demo" v-if="!userStore_.getIsAdmin">
<!-- -->
<el-sub-menu index="1">
<!-- 子菜单的标题 -->
<template #title>
<!-- Element UI 的图标组件 -->
<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">
<!-- Element UI 的图标组件 -->
<el-icon>
<document />
</el-icon>
<span>我的资料</span>
</router-link>
</el-menu-item>
</el-menu>
<!-- Element UI 的垂直菜单组件用于管理员用户 -->
<el-menu default-active="2" class="el-menu-vertical-demo" v-else>
<!-- -->
<el-menu-item index="1">
<!-- 路由链接到未签收快递列表页面 -->
<router-link to="/user/expressList">
<!-- Element UI 的图标组件 -->
<el-icon><icom-menu /></el-icon>
<span>未签收</span>
</router-link>
</el-menu-item>
<!-- 已签收菜单项 -->
<el-menu-item index="2">
<!-- 路由链接到已签收快递列表页面 -->
<router-link to="/user/signed">
<!-- Element UI 的图标组件 -->
<el-icon><icom-menu /></el-icon>
<span>已签收</span>
</router-link>
</el-menu-item>
</el-menu>
</el-col>
</el-row>
</el-aside>
<!-- 页面的主体内容区域 -->
<el-main>
<!-- Vue Router 的视图组件用于显示当前路由对应的组件 -->
<router-view></router-view>
</el-main>
</el-container>
</el-container>
</div>
</template>
<script setup>
// 导入用户状态管理的 store
import { userStore } from '../../store';
// 导入 Vue 的 ref 和 onBeforeMount 函数
import { ref, onBeforeMount } from "vue"
// 创建用户状态管理的 store 实例
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样式 */
.logo {
height: 58px;
}
/* 菜单样式,使物流服务菜单项靠右 */
.el-menu--horizontal>.el-menu-item:nth-child(3) {
margin-right: auto;
}
</style>