index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <div
  3. class="logo"
  4. :class="{
  5. 'collapsed-login': isCollapsed,
  6. }"
  7. >
  8. <img v-if="isCollapsed" src="~@/assets/images/skyeye-logo-img.png" alt="" :class="{ 'mr-2': !isCollapsed }" />
  9. <div v-else class="openWrapper">
  10. <div>
  11. <img src="~@/assets/images/skyeye-logo-img.png" alt="" class="logoOpen" />
  12. </div>
  13. <div class="titleWrapper">
  14. {{ title }}
  15. </div>
  16. </div>
  17. <!-- <img
  18. v-show="!isCollapsed || navMode === 'horizontal' || (navMode === 'horizontal-mix' && mixMenu)"
  19. class="mt-0 title"
  20. src="~@/assets/images/skyeye-logo-text.png"
  21. alt=""
  22. :class="{ 'mr-2': !isCollapsed }"
  23. /> -->
  24. </div>
  25. </template>
  26. <script lang="ts" setup>
  27. import { inject, computed, unref } from 'vue';
  28. import { useDesignSetting } from '@/hooks/setting/useDesignSetting';
  29. import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
  30. import { useGlobSetting } from '@/hooks/setting';
  31. // NavMode的设置按钮已禁用 这里用不上 之后有需要再放开
  32. const { getNavTheme, getMenuWidth, getMenuMinWidth, getNavMode, getMenuSetting } = useProjectSetting();
  33. const { getDarkTheme } = useDesignSetting();
  34. const isCollapsed = inject('collapsed');
  35. const { title } = useGlobSetting();
  36. const navMode = getNavMode;
  37. const getBgColor = computed(() => {
  38. let isLight = getNavTheme.value === 'light';
  39. return getDarkTheme.value ? 'rgb(24, 24, 28)' : isLight ? '#fff' : '#001428';
  40. });
  41. const getColor = computed(() => {
  42. let isLight = getNavTheme.value === 'light';
  43. return isLight ? '#333' : '#FFFFFF';
  44. });
  45. const mixMenu = computed(() => {
  46. return unref(getMenuSetting).mixMenu;
  47. });
  48. const menuWidth = computed(() => {
  49. return getMenuWidth.value + 'px';
  50. });
  51. const minMenuWidth = computed(() => {
  52. return getMenuMinWidth.value + 'px';
  53. });
  54. </script>
  55. <style lang="scss" scoped>
  56. .logo {
  57. width: v-bind(menuWidth);
  58. display: flex;
  59. align-items: center;
  60. // justify-content: center;
  61. height: 64px;
  62. // line-height: 64px;
  63. // padding-left: 20px;
  64. // padding-right: 20px;
  65. overflow: hidden;
  66. white-space: nowrap;
  67. background: v-bind(getBgColor);
  68. color: v-bind(getColor);
  69. transition: width 0.3s cubic-bezier(0.2, 0, 0, 1) 0s, left 0.3s cubic-bezier(0.2, 0, 0, 1) 0s, box-shadow 0.3s cubic-bezier(0.2, 0, 0, 1) 0s, border-color var(--el-transition-duration),
  70. background-color var(--el-transition-duration), color var(--el-transition-duration);
  71. img {
  72. width: 157px;
  73. height: auto;
  74. margin: auto;
  75. }
  76. .title {
  77. margin-bottom: 0;
  78. }
  79. }
  80. .collapsed-login {
  81. width: v-bind(minMenuWidth);
  82. padding-left: 2px;
  83. padding-right: 2px;
  84. }
  85. .logo .logoOpen {
  86. width: 50px;
  87. }
  88. .titleWrapper {
  89. line-height: 30px;
  90. font-weight: bold;
  91. }
  92. .openWrapper {
  93. width: v-bind(menuWidth);
  94. overflow: hidden;
  95. }
  96. .titleWrapper {
  97. // justify-content: left;
  98. text-align: center;
  99. margin-left: 12px;
  100. margin-right: 12px;
  101. overflow: hidden;
  102. }
  103. </style>