index.vue 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <el-config-provider :locale="localeLang">
  3. <div class="tjm_wrapper">
  4. <div class="tjm_warpper_container fixed" :class="!hasTabs && 'no-tabs-bar'">
  5. <tjm-side-bar v-if="layoutStyle == 'vertical'" />
  6. <div class="tjm_container" :class="{ 'is-collapse': collapse, 'is-layoutStyle': layoutStyle == 'horizontal' }">
  7. <div class="header_container fixed-header"
  8. :class="{ 'is-collapse': collapse, 'is-layoutStyle': layoutStyle == 'horizontal' }">
  9. <tjm-nav-bar />
  10. <tjm-tabs-bar v-if="hasTabs" />
  11. </div>
  12. <div class="content_container">
  13. <tjm-main :hasTabs="hasTabs" />
  14. </div>
  15. </div>
  16. </div>
  17. </div>
  18. </el-config-provider>
  19. </template>
  20. <script setup>
  21. import { useI18n } from "vue-i18n";
  22. import { getConfig } from "@/config/config";
  23. import { useSettingStore } from "@/store/settings";
  24. import TjmSideBar from "./components/SideBar/index.vue";
  25. import TjmNavBar from "./components/NavBar/index.vue";
  26. import TjmTabsBar from "./components/TabsBar/index.vue";
  27. import TjmMain from "./components/Main/index.vue";
  28. const route = useRoute();
  29. const hasTabs = computed(() => route.name != "homePolicyDetail");
  30. const { collapse, layoutStyle } = storeToRefs(useSettingStore());
  31. const { messages, locale, t } = useI18n();
  32. const localeLang = ref(messages[getConfig("globalI18n")])
  33. // 修改element 和 i18n 默认语言
  34. const changeLanguage = () => {
  35. locale.value = getConfig("globalI18n");
  36. localeLang.value = messages.value[locale.value];
  37. }
  38. // 监听修改语言实现element
  39. watchEffect(changeLanguage)
  40. </script>
  41. <style lang="scss" scoped>
  42. @mixin fix-header {
  43. position: fixed;
  44. top: 0;
  45. right: 0px;
  46. z-index: $base-z-index - 2;
  47. width: calc(100% - $base-sidebar-width);
  48. }
  49. .tjm_wrapper {
  50. position: relative;
  51. height: 100%;
  52. width: 100%;
  53. overflow: auto;
  54. .tjm_warpper_container {
  55. &.fixed {
  56. padding-top: calc(#{$base-navbar-height} + #{$base-tabsbar-height});
  57. }
  58. &.fixed.no-tabs-bar {
  59. padding-top: $base-navbar-height;
  60. }
  61. .tjm_container {
  62. min-height: 100%;
  63. margin-left: $base-sidebar-width;
  64. &.is-collapse {
  65. margin-left: $base-sidebar-width-min;
  66. border-right: 0;
  67. }
  68. &.is-layoutStyle {
  69. margin-left: 0;
  70. border-right: 0;
  71. }
  72. .header_container {
  73. box-shadow: 0 1px 4px rgb(0 21 41 / 8%);
  74. &.fixed-header {
  75. @include fix-header;
  76. }
  77. &.is-collapse {
  78. width: calc(100% - $base-sidebar-width-min);
  79. }
  80. &.is-layoutStyle {
  81. width: 100%;
  82. }
  83. }
  84. .content_container {
  85. background: #f7f8fa;
  86. }
  87. }
  88. }
  89. }
  90. </style>