main.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div
  3. class="site-wrapper"
  4. :class="{ 'site-sidebar--fold': sidebarFold }"
  5. v-loading.fullscreen.lock="loading"
  6. element-loading-text="拼命加载中">
  7. <template v-if="!loading">
  8. <!-- <main-navbar /> -->
  9. <!-- <main-sidebar /> -->
  10. <!-- <div class="site-content__wrapper" :style="{ 'min-height': documentClientHeight + 'px' }"> -->
  11. <!-- <div :style="{ 'min-height': documentClientHeight + 'px' }">
  12. <main-content v-if="!$store.state.common.contentIsNeedRefresh" />
  13. </div> -->
  14. <el-container>
  15. <el-header v-if = "this.$route.path != '/visi-previewcsv'"><new-menue /></el-header>
  16. <el-main>
  17. <!-- <el-breadcrumb separator-class="el-icon-arrow-right" v-if="this.$router.currentRoute.path!='/home'">
  18. <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
  19. <el-breadcrumb-item>{{this.$router.currentRoute.name}}</el-breadcrumb-item>
  20. </el-breadcrumb> -->
  21. <main-content v-if="!$store.state.common.contentIsNeedRefresh" />
  22. </el-main>
  23. <el-footer v-if = "this.$route.path != '/visi-previewcsv'">
  24. <new-footer></new-footer>
  25. </el-footer>
  26. </el-container>
  27. </template>
  28. </div>
  29. </template>
  30. <script>
  31. import MainNavbar from './main-navbar'
  32. import MainSidebar from './main-sidebar'
  33. import MainContent from './main-content'
  34. import NewMenue from './new-menue'
  35. import NewFooter from './new-footer';
  36. export default {
  37. provide () {
  38. return {
  39. // 刷新
  40. refresh () {
  41. this.$store.commit('common/updateContentIsNeedRefresh', true)
  42. this.$nextTick(() => {
  43. this.$store.commit('common/updateContentIsNeedRefresh', false)
  44. })
  45. }
  46. }
  47. },
  48. data () {
  49. return {
  50. loading: true
  51. }
  52. },
  53. components: {
  54. MainNavbar,
  55. MainSidebar,
  56. MainContent,
  57. NewMenue,
  58. NewFooter
  59. },
  60. computed: {
  61. documentClientHeight: {
  62. get () { return this.$store.state.common.documentClientHeight },
  63. set (val) { this.$store.commit('common/updateDocumentClientHeight', val) }
  64. },
  65. sidebarFold: {
  66. get () { return this.$store.state.common.sidebarFold }
  67. },
  68. userId: {
  69. get () { return this.$store.state.user.id },
  70. set (val) { this.$store.commit('user/updateId', val) }
  71. },
  72. userName: {
  73. get () { return this.$store.state.user.name },
  74. set (val) { this.$store.commit('user/updateName', val) }
  75. }
  76. },
  77. created () {
  78. this.getUserInfo()
  79. },
  80. mounted () {
  81. this.resetDocumentClientHeight()
  82. },
  83. methods: {
  84. // 重置窗口可视高度
  85. resetDocumentClientHeight () {
  86. this.documentClientHeight = document.documentElement['clientHeight']
  87. window.onresize = () => {
  88. this.documentClientHeight = document.documentElement['clientHeight']
  89. }
  90. },
  91. // 获取当前管理员信息
  92. getUserInfo () {
  93. this.$http({
  94. url: this.$http.adornUrl('/sys/user/info'),
  95. method: 'get',
  96. params: this.$http.adornParams()
  97. }).then(({data}) => {
  98. if (data && data.code === 0) {
  99. this.loading = false
  100. this.userId = data.user.userId
  101. this.userName = data.user.username
  102. }
  103. })
  104. }
  105. }
  106. }
  107. </script>