Home.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <!--
  2. * @Author: zouwenying
  3. * @Date: 2020-10-22 15:51:29
  4. * @LastEditTime: 2021-04-19 10:58:38
  5. * @LastEditors: zwy
  6. * @Description: In User Settings Edit
  7. * @FilePath: \vue-manage-system-master\src\components\others\Home.vue
  8. -->
  9. <template>
  10. <div class="dmp-app">
  11. <v-sidebar></v-sidebar>
  12. <div class="dmp-content" :style="{ width: collapse ? 'calc(100% - 85px)' : 'calc(100% - 220px)' }">
  13. <v-head></v-head>
  14. <div class="main-wrap">
  15. <transition name="move" mode="out-in">
  16. <!-- <keep-alive :include="tagsList">
  17. <router-view></router-view>
  18. </keep-alive> -->
  19. <router-view></router-view>
  20. </transition>
  21. </div>
  22. </div>
  23. <xk-modal></xk-modal>
  24. <div class="dmp-alert" v-if="popupsList.length !== 0">
  25. <div class="dmp-alert-body" v-for="item in popupsList" :key="item.id">
  26. <alert-modal :params="item"></alert-modal>
  27. </div>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. import vHead from './Header.vue';
  33. import vSidebar from './Sidebar.vue';
  34. import vTags from './Tags.vue';
  35. export default {
  36. data() {
  37. return {};
  38. },
  39. computed: {
  40. collapse() {
  41. return this.$store.getters['getCollapse'];
  42. },
  43. tagsList() {
  44. let arr = [],
  45. msg = this.$store.getters['getTagsList'];
  46. for (let i = 0, len = msg.length; i < len; i++) {
  47. msg[i].name && arr.push(msg[i].name);
  48. }
  49. return arr;
  50. },
  51. popupsList() {
  52. return this.$store.getters.getPopups;
  53. }
  54. },
  55. methods: {
  56. beforeunloadHandler() {
  57. //页面刷新
  58. let taglist = this.$store.getters['getTagsList'] || [];
  59. sessionStorage.setItem('tabs', JSON.stringify(taglist));
  60. },
  61. // 获取用户权限
  62. getElement() {
  63. this.$http.post('/sc-user-center/menu/selectAuthCode').then((res) => {
  64. let data = res.data || [];
  65. this.$store.commit('setPermissionList', new Set(data));
  66. console.log('获取到的权限标识为', data);
  67. });
  68. },
  69. beforeunload() {
  70. window.addEventListener('beforeunload', this.beforeunloadHandler, false);
  71. }
  72. },
  73. components: {
  74. vHead,
  75. vSidebar,
  76. vTags
  77. },
  78. created() {
  79. this.getElement();
  80. this.$store.dispatch('tags', JSON.parse(sessionStorage.getItem('tabs')) || []);
  81. },
  82. mounted() {
  83. this.beforeunload();
  84. },
  85. destroyed() {
  86. window.removeEventListener('beforeunload', this.beforeunloadHandler, false);
  87. }
  88. };
  89. </script>
  90. <style lang='scss' scoped>
  91. // .dmp-content{
  92. // flex-direction: column;
  93. // .dmp-main{
  94. // background-color: #f4f7f9;
  95. // position: relative;
  96. // overflow: hidden;
  97. // padding: 0;
  98. // .main-wrap{
  99. // width: 100%;
  100. // height: 100%;
  101. // position: absolute;
  102. // overflow: auto;
  103. // padding: 20px;
  104. // }
  105. // }
  106. // }
  107. .dmp-content {
  108. flex: 1;
  109. display: flex;
  110. flex-direction: column;
  111. width: 0;
  112. }
  113. .main-wrap {
  114. background-color: #f4f7f9;
  115. position: relative;
  116. overflow-y: auto;
  117. overflow-x: hidden;
  118. padding: 20px 20px 10px 20px;
  119. height: 100%;
  120. }
  121. </style>