index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <div class="flex main-layout">
  3. <div class="flex direction-column main-layout-left" :class="{ 'is-collapse': mainLayoutStore.collapse }">
  4. <div class="drag flex items-center justify-center dou-yu main-layout-left-logo">
  5. <span v-if="mainLayoutStore.collapse">CET</span>
  6. <img v-else src="../../assets/images/logo.png" />
  7. <!-- <span v-show="!mainLayoutStore.collapse"> 电子阅卷</span> -->
  8. </div>
  9. <div class="flex-1 scroll-y-auto">
  10. <left-menu></left-menu>
  11. </div>
  12. </div>
  13. <div class="flex flex-1 direction-column scroll-auto main-layout-right">
  14. <main-header :reply-user-id="replyUserId" :message-visible="messageVisible" :in-layout="true"></main-header>
  15. <div class="flex-1 scroll-auto main-layout-right-content">
  16. <RouterView></RouterView>
  17. </div>
  18. </div>
  19. </div>
  20. </template>
  21. <script setup lang="ts" name="MainLayout">
  22. import { ref, provide } from 'vue'
  23. import LeftMenu from './LeftMenu.vue'
  24. import MainHeader from './MainHeader.vue'
  25. import useMainLayoutStore from '@/store/layout'
  26. const mainLayoutStore = useMainLayoutStore()
  27. const replyUserId = ref<number>()
  28. const messageVisible = ref<boolean>(false)
  29. const setReplyUserId = (id: number) => {
  30. replyUserId.value = id
  31. }
  32. const setMessageVisible = (visible: boolean) => {
  33. messageVisible.value = visible
  34. }
  35. provide('setReplyUserId', setReplyUserId)
  36. provide('setMessageVisible', setMessageVisible)
  37. </script>
  38. <style scoped lang="scss">
  39. .main-layout {
  40. width: 100%;
  41. height: 100%;
  42. .main-layout-left {
  43. width: $LayoutLeftMenuWidth;
  44. // background-color: $LayoutLeftMenuBg;
  45. background-color: #333;
  46. transition: $LayoutLeftMenuTransition;
  47. border-right: $OnePixelLine;
  48. &.is-collapse {
  49. width: $LayoutLeftMenuCollapseWidth;
  50. }
  51. .main-layout-left-logo {
  52. min-height: $MainLayoutHeaderHeight;
  53. margin: 0 $BaseGapSpace;
  54. // border-bottom: $OnePixelLine;
  55. border-bottom: 1px solid #eee;
  56. font-size: $MainLayoutHeaderLogoFontSize;
  57. // color: $MainLayoutHeaderLogoFontColor;
  58. color: #fff;
  59. }
  60. }
  61. .main-layout-right {
  62. .main-layout-right-content {
  63. width: 100%;
  64. }
  65. }
  66. }
  67. </style>