Browse Source

红点提示优化

wangziqian 4 years ago
parent
commit
71dcd61773

+ 5 - 5
src/layout/components/Sidebar/index.vue

@@ -13,7 +13,7 @@
           :collapse-transition="false"
           mode="vertical"
         >
-          <sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path" :show-tips="showTips" />
+          <sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path" :show-tips="notice" />
         </el-menu>
       </el-scrollbar>
     </el-main>
@@ -38,13 +38,13 @@ export default {
   mixins: [websocket],
   data() {
     return {
-      showTips: false
     }
   },
   computed: {
     ...mapGetters([
       'sidebar',
-      'routes'
+      'routes',
+      'notice'
     ]),
     // routes() {
     //   return this.$router.options.routes
@@ -78,11 +78,11 @@ export default {
     websocketonmessage(e) { // websocket数据接收
       const { hasReminding } = JSON.parse(e.data)
       if (hasReminding) {
-        this.showTips = true
+        this.$store.dispatch('data/setNotice', true)
         const link = document.querySelector('link')
         link.href = link.href.replace(/favicon.ico/, 'favicon-tips.ico')
       } else {
-        this.showTips = false
+        this.$store.dispatch('data/setNotice', false)
         const link = document.querySelector('link')
         link.href = link.href.replace(/favicon-tips.ico/, 'favicon.ico')
       }

+ 2 - 1
src/store/getters.js

@@ -11,6 +11,7 @@ const getters = {
   status: state => state.data.status,
   RichText: state => state.data.RichText,
   bizId: state => state.data.bizId,
-  routes: state => state.data.routes
+  routes: state => state.data.routes,
+  notice: state => state.data.notice
 }
 export default getters

+ 8 - 1
src/store/modules/data.js

@@ -4,7 +4,8 @@ const state = {
   subMenu: '',
   RichText: '',
   status: false,
-  bizId: false
+  bizId: false,
+  notice: false
 }
 
 const mutations = {
@@ -25,6 +26,9 @@ const mutations = {
   },
   RICHTEXT: (state, value) => {
     state.RichText = value
+  },
+  SETNOTICE: (state, value) => {
+    state.notice = value
   }
 }
 
@@ -40,6 +44,9 @@ const actions = {
   },
   setRoutes({ commit }, value) {
     commit('SETROUTES', value)
+  },
+  setNotice({ commit }, value) {
+    commit('SETNOTICE', value)
   }
 }
 

+ 12 - 0
src/views/workbench/person/index.vue

@@ -187,6 +187,7 @@
 
 <script>
 // const _ = require('lodash')
+import { mapGetters } from 'vuex'
 import moment from 'moment'
 import {
   queryTeamInfoList,
@@ -233,6 +234,11 @@ export default {
     }
   },
   mixins: [websocket],
+  computed: {
+    ...mapGetters([
+      'notice'
+    ])
+  },
   data() {
     return {
       activeName: '1', // 顶部导航栏
@@ -420,6 +426,7 @@ export default {
       }
       const res = await queryWorkListByTime(params)
       if (res.code === 200) {
+        res.data = res.data.sort((a, b) => a.id - b.id)
         let num = 0
         this.calendarEvents = res.data.map((item, index) => {
           const title = item.origin ? '日程' : '排期'
@@ -504,6 +511,11 @@ export default {
       } else if (e === '缺陷') {
         this.tabTips.bug = show
       }
+      if (!this.tabTips.require && !this.tabTips.task && !this.tabTips.bug) {
+        this.$store.dispatch('data/setNotice', false)
+      } else {
+        this.$store.dispatch('data/setNotice', true)
+      }
     },
     changeData(e, idList, name) { // 数据变更
       if (e === '需求') {