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. </transition>
  20. </div>
  21. </div>
  22. <xk-modal></xk-modal>
  23. <div class="dmp-alert" v-if="popupsList.length !== 0">
  24. <div class="dmp-alert-body" v-for="item in popupsList" :key="item.id">
  25. <alert-modal :params="item"></alert-modal>
  26. </div>
  27. </div>
  28. </div>
  29. </template>
  30. <script>
  31. import vHead from './Header.vue';
  32. import vSidebar from './Sidebar.vue';
  33. import vTags from './Tags.vue';
  34. export default {
  35. data() {
  36. return {
  37. };
  38. },
  39. computed:{
  40. collapse(){
  41. return this.$store.getters['getCollapse']
  42. },
  43. tagsList(){
  44. let arr = [],msg=this.$store.getters['getTagsList'];
  45. for (let i = 0, len = msg.length; i < len; i++) {
  46. msg[i].name && arr.push(msg[i].name);
  47. }
  48. return arr;
  49. },
  50. popupsList() {
  51. return this.$store.getters.getPopups;
  52. }
  53. },
  54. methods:{
  55. beforeunloadHandler() {
  56. //页面刷新
  57. let taglist=this.$store.getters['getTagsList']||[]
  58. sessionStorage.setItem("tabs", JSON.stringify(taglist));
  59. },
  60. // 获取用户权限
  61. getElement() {
  62. this.$http.post("/sc-user-center/menu/selectAuthCode").then(res => {
  63. let data = res.data || [];
  64. this.$store.commit("setPermissionList", new Set(data));
  65. console.log("获取到的权限标识为",data)
  66. });
  67. },
  68. beforeunload() {
  69. window.addEventListener('beforeunload', this.beforeunloadHandler, false)
  70. },
  71. },
  72. components: {
  73. vHead,
  74. vSidebar,
  75. vTags
  76. },
  77. created() {
  78. this.getElement();
  79. this.$store.dispatch('SET_MENU_LIST');
  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>