HomeHeader.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <div id="header_main">
  3. <div id="logo">
  4. <router-link to="/" style="text-decoration: none">
  5. <el-text :line-clamp="1" size="large"><h1>PMail</h1></el-text>
  6. </router-link>
  7. </div>
  8. <div id="settings" @click="settings" v-if="isLogin">
  9. <el-icon style="font-size: 25px;">
  10. <TbSettings style="color:#FFFFFF"/>
  11. </el-icon>
  12. </div>
  13. <el-drawer v-model="openSettings" size="80%" :title="lang.settings">
  14. <el-tabs tab-position="left">
  15. <el-tab-pane :label="lang.security">
  16. <SecuritySettings/>
  17. </el-tab-pane>
  18. <el-tab-pane :label="lang.group_settings">
  19. <GroupSettings/>
  20. </el-tab-pane>
  21. <el-tab-pane :label="lang.rule_setting">
  22. <RuleSettings/>
  23. </el-tab-pane>
  24. <el-tab-pane v-if="userInfos.is_admin" :label="lang.user_management">
  25. <UserManagement/>
  26. </el-tab-pane>
  27. <el-tab-pane :label="lang.plugin_settings">
  28. <PluginSettings/>
  29. </el-tab-pane>
  30. </el-tabs>
  31. </el-drawer>
  32. </div>
  33. </template>
  34. <script setup>
  35. import {TbSettings} from "vue-icons-plus/tb";
  36. import {ref} from 'vue'
  37. import SecuritySettings from '@/components/SecuritySettings.vue'
  38. import lang from '../i18n/i18n';
  39. import GroupSettings from './GroupSettings.vue';
  40. import RuleSettings from './RuleSettings.vue';
  41. import UserManagement from './UserManagement.vue';
  42. import PluginSettings from './PluginSettings.vue';
  43. import {useGlobalStatusStore} from "@/stores/useGlobalStatusStore";
  44. const globalStatus = useGlobalStatusStore();
  45. const isLogin = globalStatus.isLogin;
  46. const userInfos = globalStatus.userInfos;
  47. const openSettings = ref(false)
  48. const settings = function () {
  49. if (Object.keys(userInfos).length === 0) {
  50. globalStatus.init(()=>{
  51. Object.assign(userInfos,globalStatus.userInfos)
  52. openSettings.value = true;
  53. })
  54. } else {
  55. openSettings.value = true;
  56. }
  57. }
  58. </script>
  59. <style scoped>
  60. #header_main {
  61. height: 50px;
  62. background-color: #000;
  63. display: flex;
  64. padding: 0;
  65. }
  66. #logo {
  67. height: 3rem;
  68. line-height: 3rem;
  69. font-size: 2.3rem;
  70. flex-grow: 1;
  71. width: 200px;
  72. color: #FFF;
  73. text-align: left;
  74. }
  75. #logo h1 {
  76. padding-left: 20px;
  77. color: white;
  78. }
  79. #search {
  80. height: 3rem;
  81. width: 100%;
  82. }
  83. #settings {
  84. display: flex;
  85. justify-content: center;
  86. align-items: center;
  87. padding-right: 20px;
  88. }
  89. </style>