left-menu.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <div class="menu">
  3. <div class="menu-header">
  4. <img class="web-logo" src="@imgs/layout/web-logo.png" alt="" />
  5. </div>
  6. <div class="menu-content">
  7. <MenuItem
  8. class="root-menu-item"
  9. v-for="menuItem in menu"
  10. :key="menuItem.label"
  11. :menu-item="menuItem"
  12. />
  13. </div>
  14. <div class="menu-footer">
  15. <div class="user-info">
  16. <div class="user-name">{{ mainStore.systemUserInfo?.name }}</div>
  17. <div class="exit-login" @click="handleExitLogin">
  18. <SvgIcon class="exit-icon" name="exit-icon" />
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. </template>
  24. <script setup lang="ts" name="LayoutLeftMenu">
  25. import MenuItem from "@/layout/menu-item.vue";
  26. import { exitLogin } from "@/utils/common";
  27. import { useMainStore } from "@/store/main";
  28. const mainStore = useMainStore();
  29. const menu = [
  30. { path: "/school", label: "学校管理", iconName: "school-icon" },
  31. {
  32. path: "",
  33. label: "考试管理",
  34. children: [
  35. { path: "/exam", label: "考试批次管理", iconName: "exam-icon" },
  36. { path: "/subjects", label: "科目试卷结构", iconName: "paper-icon" },
  37. ],
  38. },
  39. { path: "/user", label: "用户管理", iconName: "user-icon" },
  40. ];
  41. const handleExitLogin = () => {
  42. exitLogin();
  43. };
  44. </script>
  45. <style scoped lang="less">
  46. .menu {
  47. width: 100%;
  48. min-height: 100%;
  49. display: flex;
  50. flex-direction: column;
  51. .menu-header {
  52. padding: 0 16px;
  53. height: 86px;
  54. display: flex;
  55. align-items: center;
  56. justify-content: center;
  57. .web-logo {
  58. height: 22px;
  59. max-width: 100%;
  60. object-fit: contain;
  61. }
  62. }
  63. .menu-content {
  64. flex: 1 1 0;
  65. padding: 0 32px;
  66. overflow-y: auto;
  67. .root-menu-item {
  68. padding: 25px 0;
  69. border-bottom: 1px solid @border-color;
  70. &:first-child {
  71. border-top: 1px solid @border-color;
  72. }
  73. }
  74. }
  75. .menu-footer {
  76. padding: 16px;
  77. .user-info {
  78. display: flex;
  79. align-items: center;
  80. justify-content: space-between;
  81. height: 48px;
  82. padding: 0 16px;
  83. background-color: @bg-color;
  84. border-radius: @border-radius-base;
  85. background-image: url("@imgs/layout/user-info-bg.png");
  86. background-repeat: no-repeat;
  87. background-position: right top;
  88. background-size: contain;
  89. .user-name {
  90. font-size: @font-size-small;
  91. }
  92. .exit-login {
  93. color: @font-color;
  94. padding: 6px;
  95. cursor: pointer;
  96. .exit-icon {
  97. width: 16px;
  98. height: 16px;
  99. }
  100. &:hover {
  101. color: @font-light-color;
  102. }
  103. }
  104. }
  105. }
  106. }
  107. </style>