Logo.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBg }">
  3. <transition name="sidebarLogoFade">
  4. <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
  5. <img v-if="logo" :src="logo" class="sidebar-logo">
  6. <h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.sidebarTitle : variables.sidebarLightTitle }">{{ title }} </h1>
  7. </router-link>
  8. <router-link v-else key="expand" class="sidebar-logo-link" to="/">
  9. <img v-if="logo" :src="logo" class="sidebar-logo">
  10. <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.sidebarTitle : variables.sidebarLightTitle }">{{ title }} </h1>
  11. </router-link>
  12. </transition>
  13. </div>
  14. </template>
  15. <script>
  16. import logoImg from '@/assets/images/logo1.png'
  17. import back from '@/assets/images/logi_bg1.jpg'
  18. import {listSscDomain } from "@/api/login";
  19. import variables from '@/assets/styles/variables.scss'
  20. export default {
  21. name: 'SidebarLogo',
  22. props: {
  23. collapse: {
  24. type: Boolean,
  25. required: true
  26. }
  27. },
  28. computed: {
  29. variables() {
  30. return variables;
  31. },
  32. sideTheme() {
  33. return this.$store.state.settings.sideTheme
  34. }
  35. },
  36. data() {
  37. return {
  38. title: '',
  39. logo: logoImg
  40. }
  41. },
  42. created() {
  43. //this.getlistDomain();
  44. },
  45. // 查询域名
  46. methods:{
  47. getlistDomain() {
  48. var sscDomain = document.location.hostname;
  49. listSscDomain(sscDomain).then(response => {
  50. if(response && response.data.lenth > 0){
  51. const sscConfig = response.data[0].sscConfig;
  52. const imgForm = JSON.parse(sscConfig);
  53. if(imgForm){
  54. this.BackgroundImg = imgForm.BackgroundImg;
  55. this.logo = imgForm.indexLogo;
  56. }
  57. console.log( this.indexLogo)
  58. }
  59. });
  60. },}
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. .sidebarLogoFade-enter-active {
  65. transition: opacity 1.5s;
  66. }
  67. .sidebarLogoFade-enter,
  68. .sidebarLogoFade-leave-to {
  69. opacity: 0;
  70. }
  71. .sidebar-logo-container {
  72. position: relative;
  73. width: 100%;
  74. height: 50px;
  75. line-height: 50px;
  76. background: #929499;
  77. text-align: center;
  78. overflow: hidden;
  79. & .sidebar-logo-link {
  80. height: 100%;
  81. width: 100%;
  82. & .sidebar-logo {
  83. width: 155px;
  84. height: 32px;
  85. vertical-align: middle;
  86. margin-top: 18px;
  87. }
  88. & .sidebar-title {
  89. display: inline-block;
  90. margin: 0;
  91. color: #fff;
  92. font-weight: 600;
  93. line-height: 50px;
  94. font-size: 14px;
  95. font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
  96. vertical-align: middle;
  97. }
  98. }
  99. &.collapse {
  100. .sidebar-logo {
  101. margin-right: 0px;
  102. }
  103. }
  104. }
  105. </style>