Переглянути джерело

通知公告跳转,点击菜单记录,点击相同菜单刷新页面,只保留退出按钮

李文 4 роки тому
батько
коміт
139171523b

+ 11 - 1
src/views/main/main-content.vue

@@ -1,6 +1,6 @@
 <template>
   <main class="smp-content" :class="{'isIframe':isIframe}">
-    <iframe v-if="isIframe" :src="iframeURL" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe>
+    <iframe v-if="isIframe" ref="myIframe" :src="iframeURL" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe>
     <router-view v-else />
   </main>
 </template>
@@ -23,8 +23,18 @@ export default {
   },
   mounted () {
     this.initUrl()
+    this.addSelfToAllComponent()
   },
+  inject: ['allComponent'],
   methods: {
+    addSelfToAllComponent () {
+      this.allComponent['main-content'] = this
+    },
+    resetIframe (item) {
+      if (this.isIframe) {
+        this.$refs.myIframe.src = this.iframeURL
+      }
+    },
     initUrl () {
       this.isIframe = this.tabIsIframe(this.iframeURL)
     },

+ 15 - 0
src/views/main/main-navbar-menu.vue

@@ -108,12 +108,17 @@ export default {
     }
   },
   mounted () {
+    this.addSelfToAllComponent()
     this.initMenu()
     this.initMenuMoreBtn()
     this.getCurrentMenuByUrl()
     // this.setIndexPage()
   },
+  inject: ['allComponent'],
   methods: {
+    addSelfToAllComponent () {
+      this.allComponent['main-navbar-menu'] = this
+    },
     gotoPageByUUID (UUID) {
       let item = this.menuList.filter((e) => {
         return e.UUID === UUID
@@ -121,6 +126,12 @@ export default {
       console.log(UUID, this.menuList)
       this.gotoPage(item)
     },
+    gotoPageByName (name) {
+      let item = this.menuList.filter((e) => {
+        return e.ename === name
+      })[0]
+      this.gotoPage(item)
+    },
     clickOutSide () {
       this.menuOpen = false
     },
@@ -202,6 +213,9 @@ export default {
       item.on = true
       this.setSidebarByChild(item)
       this.$router.push({ path: item.url })
+      if (item.UUID === this.$route.meta.UUID) {
+        this.allComponent['main-content'].resetIframe(item)
+      }
     },
     setSidebarByChild (item) {
       if (!item.children || item.children.length === 0) {
@@ -226,6 +240,7 @@ export default {
         if (i <= this.lineWrapIndex) {
           return
         }
+        // console.log(e)
         if (e.name === item.name) {
           spliceItemIndex = i
         }

+ 11 - 4
src/views/main/main-navbar-news.vue

@@ -45,21 +45,28 @@ export default {
       }
     }
   },
+  inject: ['allComponent'],
   mounted () {
+    this.addSelfToAllComponent()
     this.getTask()
     this.getNotice()
   },
   methods: {
+    addSelfToAllComponent () {
+      this.allComponent['main-navbar-news'] = this
+    },
     showNews () {},
     showNotice () {
-      this.$parent.$parent.showNotice()
+      // this.$parent.$parent.showNotice()
       // this.$parent.$refs.navbarmenu.gotoPageByUUID('fe9b5adf20975c1bd13fd38cee3b09a68VfGsVRBgJ3')
-      // this.$router.push({ path: '/868d8c7a976fef5061445869bfe1977bpttjDGgxV5Q' })
+      this.allComponent['main-navbar-menu'].gotoPageByName('GRZX')
+      this.$router.push({ name: 'GRZXXXZX' })
     },
     showTask () {
-      this.$parent.$parent.showTask()
+      // this.$parent.$parent.showTask()
       // this.$parent.$refs.navbarmenu.gotoPageByUUID('fe9b5adf20975c1bd13fd38cee3b09a68VfGsVRBgJ3')
-      // this.$router.push({ path: '/7f66c3390e920c5a72a2252ce1dded62kj1sQpUXu8Q' })
+      this.allComponent['main-navbar-menu'].gotoPageByName('GRZX')
+      this.$router.push({ name: 'GRZXXXZX' })
     },
     getTask () {
       let config = {

+ 2 - 2
src/views/main/main-navbar-user.vue

@@ -17,14 +17,14 @@
     </div>
     <div class="nu-list-wraper" v-show="isUserFuncOpen">
       <ul class="nulw-ul">
-        <li class="nulw-li">
+        <!-- <li class="nulw-li">
           <i class="smp-nav-icon-16 smp-ni16-person"></i>
           <span>个人信息</span>
         </li>
         <li class="nulw-li">
           <i class="smp-nav-icon-16 smp-ni16-pass"></i>
           <span>修改密码</span>
-        </li>
+        </li> -->
         <li class="nulw-li" @click="logoutHandle">
           <i class="smp-nav-icon-16 smp-ni16-out"></i>
           <span>退出</span>

+ 22 - 0
src/views/main/main-sidebar-sub-menu.vue

@@ -57,11 +57,33 @@ export default {
   components: {
     SubMenu
   },
+  inject: ['allComponent'],
+  mounted () {
+    this.addSelfToAllComponent()
+  },
   methods: {
+    addSelfToAllComponent () {
+      this.allComponent['main-sidebar-sub-menu'] = this
+    },
+    subClick (item) {
+      // http://124.225.17.80:8156/api-idaas/mq/user/clicked/{ename}
+      //       Content-Type application/json
+      // sessionToken 6826e464bb0589f8679174469ec199d4
+      this.$http.get('/mq/user/click/' + item.ename).then(({ data: res }) => {
+        if (res.code !== 0) {
+          return this.$message.error(res.msg)
+        }
+      }).catch(() => {})
+    },
     gotoRouteHandle (item) {
       if (item.url) {
         this.$router.push({ path: item.url })
       }
+      if (item.UUID === this.$route.meta.UUID) {
+        // console.log(this.allComponent)
+        this.allComponent['main-content'].resetIframe(item)
+      }
+      this.subClick(item)
     }
   }
 }

+ 5 - 1
src/views/main/main.vue

@@ -35,9 +35,14 @@ import noticePop from './notice-pop'
 import taskPop from './task-pop'
 import basicCom from '@/views/modules/demo/basicComponent/basic-com'
 import { clearLoginInfo } from '@/utils'
+let allComponent = {
+  index: ''
+}
 export default {
   provide () {
+    allComponent.index = this
     return {
+      allComponent: allComponent,
       // 刷新
       refresh () {
         this.$store.state.contentIsNeedRefresh = true
@@ -107,7 +112,6 @@ export default {
     // },
     getMenuList () {
       this.menuDataAll = window.SITE_CONFIG['menuList']
-      console.log(this.menuDataAll)
     },
     checkMenu (origin) {
       let arr = this.menuDataAll.filter((e) => {