Browse Source

修改用户点击菜单提交接口,右上角未读消息接口变更和跳转的页面带上特定识别参数,面包屑点击优化,token无效的返回值增加,路由优化可以保留参数

李文 4 years ago
parent
commit
5798331e25

+ 1 - 0
public/index.html

@@ -39,6 +39,7 @@
   <!-- 开发环境 -->
   <% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
     <script>window.SITE_CONFIG['apiURL'] = 'http://124.225.17.80:8156/api-idaas';</script>
+    <script>window.SITE_CONFIG['apiURL'] = 'http://10.110.35.55:9900/api-idaas';</script>
     <!-- <script>window.SITE_CONFIG['apiURL'] = '/api';</script> -->
   <% } %>
   <!-- 集成测试环境 -->

+ 6 - 1
src/assets/scss/smp.scss

@@ -1127,12 +1127,17 @@ html,body{
     color:$smp--color-font-color-6;
     padding:0 10px 0 0;
     display: flex;
+    align-items: center;
     i{
       padding:0 10px 0 0;
     }
     span{
+      color:#999;
+    }
+    span.canClick{
+      color:#666;
       cursor: pointer;
-      &.on{
+      &.on,&:hover{
         color:$smp--color-blue;
       }
     }

+ 6 - 2
src/router/index.js

@@ -87,8 +87,12 @@ router.beforeEach((to, from, next) => {
 
     window.SITE_CONFIG['menuList'] = res.menuList
     fnAddDynamicMenuRoutes(window.SITE_CONFIG['menuList'])
-    // console.log(firstPath)
-    next({path: firstPath, replace: true})
+    let obj = {
+      ...to,
+      path: firstPath,
+      name: ''
+    }
+    next({...obj, replace: true})
   }).catch(() => {
     next({name: 'login'})
   })

+ 1 - 1
src/utils/request.js

@@ -52,7 +52,7 @@ http.interceptors.request.use(config => {
  * 响应拦截
  */
 http.interceptors.response.use(response => {
-  if (response.data.code === 401 || response.data.code === 10001) {
+  if (response.data.code === 401 || response.data.code === 402 || response.data.code === 403 || response.data.code === 10001) {
     clearLoginInfo()
     router.replace({ name: 'login' })
     return Promise.reject(response.data.msg)

+ 20 - 6
src/views/main/main-content-crumb.vue

@@ -1,12 +1,12 @@
 <template>
   <div class="smp-crumb">
-    <el-breadcrumb separator-class="el-icon-arrow-right">
+    <!-- <el-breadcrumb separator-class="el-icon-arrow-right">
       <el-breadcrumb-item v-for="(item,index) in menuChain" :key="index" :to="{ path: '/'+item.UUID }">{{item.name}}</el-breadcrumb-item>
-    </el-breadcrumb>
-    <!-- <div class="smpc-item" v-for="(item,index) in menuChain" :key="index">
-      <i v-if="index!==0">></i>
-      <span :class="index===menuChain.length-1">{{item.name}}</span>
-    </div> -->
+    </el-breadcrumb> -->
+    <div class="smpc-item" v-for="(item,index) in menuChain" :key="index">
+      <i v-if="index!==0" class="el-icon-arrow-right"></i>
+      <span :class="{canClick:canClick(item,index)}" @click="gotoPage(item)">{{item.name}}</span>
+    </div>
     <!-- <div class="smpc-item"><span>首页</span></div>
     <div class="smpc-item">
       <i>></i>
@@ -56,6 +56,20 @@ export default {
       // this.menuChain = menuChain
       // console.log(this.menuChain, this.menuList)
     },
+    canClick (item, index) {
+      // if (index === this.menuChain.length - 1) {
+      //   return false
+      // }
+      if (!item.url) {
+        return false
+      }
+      return true
+    },
+    gotoPage (item) {
+      if (item.url) {
+        this.$router.push({ path: '/' + item.UUID })
+      }
+    },
     findParent (parentId) {
       let parent = this.menuList.filter((e) => {
         return e.UUID === parentId

+ 4 - 0
src/views/main/main-content.vue

@@ -52,6 +52,10 @@ export default {
         prevWord = '&'
       }
       let _url = url + prevWord + 'sessionToken=' + Cookies.get('token') + '&menu=' + this.$route.name
+      let params = this.$route.params
+      if (params.tab) {
+        _url += '&tab=' + params.tab
+      }
       return _url
     }
   }

+ 26 - 21
src/views/main/main-navbar-news.vue

@@ -2,10 +2,10 @@
   <div class="navbar-news">
     <!-- 权限写法 -->
     <!-- <div class="nn-item" v-if="$hasPermission2('sys_test_add')" > -->
-    <div class="nn-item" @click="showTask" title="用户消息">
-      <i class="smp-nav-icon smp-ni-news" :class="{shansuo:taskNum}">
+    <div class="nn-item" @click="showNews" title="消息提醒">
+      <i class="smp-nav-icon smp-ni-news" :class="{shansuo:newsNum}">
       </i>
-      <span v-if="taskNum">{{taskStr}}</span>
+      <span v-if="newsNum">{{newsStr}}</span>
     </div>
     <div class="nn-item" @click="showNotice" title="通知公告">
       <i class="smp-nav-icon smp-ni-notice" :class="{shansuo:noticeNum}">
@@ -20,19 +20,18 @@ export default {
   data () {
     return {
       isOpen: false,
-      taskUrl: 'http://124.225.17.80:8146/odae/clue/supervisionTask/pressTaskList',
-      taskNum: 0,
+      newsNum: 0,
       noticeNum: 0
     }
   },
   computed: {
-    taskStr () {
-      if (this.taskNum > 0) {
-        if (this.taskNum > 9) {
+    newsStr () {
+      if (this.newsNum > 0) {
+        if (this.newsNum > 9) {
           return '9+'
         }
 
-        return this.taskNum
+        return this.newsNum
       }
     },
     noticeStr () {
@@ -48,32 +47,31 @@ export default {
   inject: ['allComponent'],
   mounted () {
     this.addSelfToAllComponent()
-    this.getTask()
-    this.getNotice()
+    this.getNews()
+    // this.getNotice()
   },
   methods: {
     addSelfToAllComponent () {
       this.allComponent['main-navbar-news'] = this
     },
-    showNews () {},
-    showNotice () {
-      // this.$parent.$parent.showNotice()
+    showNews () {
+      // this.$parent.$parent.shownews()
       // this.$parent.$refs.navbarmenu.gotoPageByUUID('fe9b5adf20975c1bd13fd38cee3b09a68VfGsVRBgJ3')
       this.allComponent['main-navbar-menu'].gotoPageByName('GRZX')
-      this.$router.push({ name: 'GRZXXXZX' })
+      this.$router.push({ name: 'GRZXXXZX', params: {tab: 'todo'} })
     },
-    showTask () {
-      // this.$parent.$parent.showTask()
+    showNotice () {
+      // this.$parent.$parent.showNotice()
       // this.$parent.$refs.navbarmenu.gotoPageByUUID('fe9b5adf20975c1bd13fd38cee3b09a68VfGsVRBgJ3')
       this.allComponent['main-navbar-menu'].gotoPageByName('GRZX')
-      this.$router.push({ name: 'GRZXXXZX' })
+      this.$router.push({ name: 'GRZXXXZX', params: {tab: 'remind'} })
     },
-    getTask () {
+    getNews () {
       let config = {
         status: 0
       }
       this.$http.get(
-        '/sys/message/list',
+        '/csb/user/messageNewsCount/new',
         {
           params: config
         }
@@ -82,7 +80,14 @@ export default {
         if (res.code !== 0) {
           return this.$message.error(res.msg)
         }
-        this.taskNum = res.messageList.length
+        res.data.forEach((e) => {
+          if (e.type === 'news') {
+            this.newsNum = e.count
+          }
+          if (e.type === 'message') {
+            this.noticeNum = e.count
+          }
+        })
       }).catch(() => {
 
       })

+ 3 - 1
src/views/main/main-sidebar-sub-menu.vue

@@ -69,7 +69,9 @@ export default {
       // 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 }) => {
+      this.$http.post('/mq/user/click', {
+        url: item.sourceIframeUrl
+      }).then(({ data: res }) => {
         if (res.code !== 0) {
           return this.$message.error(res.msg)
         }

+ 1 - 0
src/views/main/main-sidebar.vue

@@ -234,6 +234,7 @@ export default {
         if (!e.noMenu) {
           let obj = {
             ...e,
+            sourceIframeUrl: e.url,
             lv: lv,
             id: e.UUID,
             // url: e.path ? ('/' + e.path) : '',