Browse Source

Merge branch 'feature/v1.0.28' into feature/v1.0.29

yuanyuan 1 year ago
parent
commit
38e8dd48c6

+ 3 - 6
apps/work-bench/src/register-app.js

@@ -4,12 +4,9 @@ import Vue from 'vue'
 /**
  * 新旧应用路径拦截,分发
  */
-function addChangeOpenRouteType (router, {
-  appName = '',
-  qiankunRoutes = []
-}) {
+function addChangeOpenRouteType (router, { appName = '', qiankunRoutes = [] }) {
   router.beforeEach(async (to, from, next) => {
-    const inQK = qiankunRoutes.some(r => new RegExp(r).test(to?.path))
+    const inQK = qiankunRoutes.some((r) => new RegExp(r).test(to?.path))
     const canNext = to.path !== from.path && from.path !== '/'
 
     const params = {
@@ -182,6 +179,6 @@ function registerApps (apps = []) {
 }
 
 export function microAppsStart () {
-  const apps = Object.values(subApps).map(v => v.qiankun)
+  const apps = Object.values(subApps).map((v) => v.qiankun)
   registerApps(apps)
 }

+ 2 - 1
apps/work-bench/src/store/modules/work-bench.js

@@ -184,10 +184,11 @@ export default {
       size: 20
     }) {
       try {
-        const { code, data = [], unread = 0 } = await ajaxGetMessages(payload)
+        const { code, data = [], unread = 0, toDoUnread = 0 } = await ajaxGetMessages(payload)
         if (code === 0) {
           commit('navbar/setMessages', data || [])
           commit('navbar/changeCount', unread)
+          commit('navbar/changeTodoCount', toDoUnread)
         }
       } catch (error) {
         console.log(error)

+ 29 - 3
packages/work-bench-frame/packages/components/Navbar/index.vue

@@ -23,7 +23,7 @@
           <div
             class="nav-item"
             :class="nav.class"
-            v-for="(nav, index) in navs"
+            v-for="(nav, index) in computedNaves"
             :key="index"
             @click="onSelectNav(nav)"
           >
@@ -119,6 +119,11 @@ export default {
           icon: 'icon-nav-message',
           badge: 0
         },
+        {
+          label: '待办',
+          icon: 'icon-daiban',
+          badge: 0
+        },
         {
           label: '客服',
           icon: 'icon-kefu_xian',
@@ -144,7 +149,8 @@ export default {
   },
   computed: {
     ...mapState('work-bench/navbar', [
-      'messageCount'
+      'messageCount',
+      'todoCount'
     ]),
     ...mapGetters('work-bench/user', [
       'hasExclusiveCustomer',
@@ -161,7 +167,13 @@ export default {
     ...mapState('customer', [
       'showCustomer',
       'customerUrl'
-    ])
+    ]),
+    computedNaves () {
+      console.log(this.todoCount)
+      return this.navs.filter(item => {
+        return this.todoCount ? item : item.label !== '待办'
+      })
+    }
   },
   created () {
     // 判断是否配置启用自定义用户信息模块,提供默认配置
@@ -222,10 +234,12 @@ export default {
     async getMessageInfo () {
       await this.getMessages()
       this.navs.find(v => v.label === '消息中心').badge = this.messageCount  > 99 ? '99+' : this.messageCount
+      this.navs.find(v => v.label === '待办').badge = this.todoCount  > 99 ? '99+' : this.todoCount
       /**
        * 对外提供未读消息条数更新事件
        */
       this.$BRACE.$emit('update-message-count', this.messageCount)
+      this.$BRACE.$emit('update-todo-count', this.todoCount)
     },
     /**
      * 点击退出登录
@@ -246,6 +260,10 @@ export default {
           this.goSiteHome()
           break
         }
+        case '待办': {
+          this.goSiteTodo()
+          break
+        }
       }
     },
     /**
@@ -314,6 +332,14 @@ export default {
           break
         }
       }
+    },
+    goSiteTodo () {
+      this.$BRACE.$emit({
+        fKey: 'goSiteTodo',
+        spareFn: (link) => this.$BRACE.methods.open({
+          route: { link }
+        })
+      }, '/swordfish/frontPage/messageCenter/sess/index?type=11')
     }
   }
 }

+ 5 - 1
packages/work-bench-frame/packages/store/modules/navbar.js

@@ -18,7 +18,8 @@ export default {
       }
     },
     list: [],
-    messageCount: 0
+    messageCount: 0,
+    todoCount: 0
   }),
   mutations: {
     changeCount (state, data) {
@@ -29,6 +30,9 @@ export default {
     },
     setMessages (state, list = []) {
       state.list = list
+    },
+    changeTodoCount (state, data) {
+      state.todoCount = data
     }
   },
   actions: {},