Logo.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <div
  3. class="sidebar-logo-container"
  4. :class="{ collapse: collapse }"
  5. :style="{
  6. backgroundColor:
  7. sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBg,
  8. }"
  9. >
  10. <transition name="sidebarLogoFade">
  11. <router-link
  12. v-if="collapse"
  13. key="collapse"
  14. class="sidebar-logo-link"
  15. to="/"
  16. >
  17. <!-- 途宝-->
  18. <img :src="logo" class="sidebar-logo-mini" />
  19. <!-- <h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.sidebarTitle : variables.sidebarLightTitle }">{{ title }} </h1> -->
  20. </router-link>
  21. <router-link v-else key="expand" class="sidebar-logo-link" to="/">
  22. <!-- 途宝-->
  23. <img :src="logo" class="sidebar-logo" />
  24. <div style="float: right;background-color: #fff" class="other" v-if="company === ''"></div>
  25. <!-- <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.sidebarTitle : variables.sidebarLightTitle }">{{ title }} </h1> -->
  26. </router-link>
  27. </transition>
  28. </div>
  29. </template>
  30. <script>
  31. import logoImg from "@/assets/logo/logo.png";
  32. import variables from "@/assets/styles/variables.scss";
  33. import Cookies from "js-cookie";
  34. import testLogo from "@/assets/logo/testLogo.png";
  35. export default {
  36. name: "SidebarLogo",
  37. props: {
  38. collapse: {
  39. type: Boolean,
  40. required: true,
  41. },
  42. },
  43. computed: {
  44. variables() {
  45. return variables;
  46. },
  47. sideTheme() {
  48. return this.$store.state.settings.sideTheme;
  49. },
  50. },
  51. data() {
  52. return {
  53. title: "途宝智慧云仓平台",
  54. logo: logoImg,
  55. company: '',
  56. sysType: "",
  57. };
  58. },
  59. mounted() {
  60. this.company = Cookies.get("companyName")
  61. this.sysType = Cookies.get("sysType");
  62. if (Cookies.get("test") == 0) {
  63. this.logo = testLogo;
  64. }
  65. },
  66. };
  67. </script>
  68. <style lang="scss" scoped>
  69. .sidebarLogoFade-enter-active {
  70. transition: opacity 1.5s;
  71. }
  72. .sidebarLogoFade-enter,
  73. .sidebarLogoFade-leave-to {
  74. opacity: 0;
  75. }
  76. .sidebar-logo-container {
  77. position: relative;
  78. // width: 100%;
  79. height: 60px;
  80. line-height: 60px;
  81. background: #014da1 !important;
  82. text-align: center;
  83. overflow: hidden;
  84. & .sidebar-logo-link {
  85. height: 100%;
  86. width: 100%;
  87. & .sidebar-logo {
  88. height: 60px;
  89. vertical-align: middle;
  90. margin-right: 12px;
  91. }
  92. & .sidebar-logo-mini {
  93. width: 50px;
  94. vertical-align: middle;
  95. margin: auto;
  96. }
  97. & .sidebar-title {
  98. display: inline-block;
  99. margin: 0;
  100. color: #fff;
  101. font-weight: 600;
  102. line-height: 50px;
  103. font-size: 14px;
  104. font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
  105. vertical-align: middle;
  106. }
  107. }
  108. &.collapse {
  109. .sidebar-logo {
  110. margin-right: 0px;
  111. }
  112. }
  113. }
  114. .other {
  115. width: 0;
  116. height: 0;
  117. border-bottom: 60px solid #014da1;
  118. border-left: 40px solid transparent;
  119. }
  120. </style>