浏览代码

Merge branch 'http_test' of git.xiaojukeji.com:jacklijiajia/thoth-frontend into http_test

qinzhipeng_v@didiglobal.com 4 年之前
父节点
当前提交
b139ba6da6
共有 2 个文件被更改,包括 33 次插入4 次删除
  1. 28 1
      src/components/newLayout/Head.vue
  2. 5 3
      src/views/quality/allStatistics.vue

+ 28 - 1
src/components/newLayout/Head.vue

@@ -5,6 +5,7 @@
     </div>
     <div v-for="item in headList" :key="item.path" class="nav-tag" @click="changeNavTag(item)">
       <div v-if="item.icon" class="icon">
+        <div v-show="notice && item.name.search(/工作台/)>0" class="if-notice" />
         <svg-icon :icon-class="item.icon" />
       </div>
       <div class="name">{{ item.name }}</div>
@@ -34,9 +35,11 @@
 <script>
 import { mapGetters } from 'vuex'
 import routes from '@/router/newRouter'
+import websocket from '@/views/workbench/mixins/websocket'
 import { memberGetLoginInMemberInfoByLdap } from '@/api/projectIndex'
 import { logoutUrl } from '@/apiConfig/requestIP.js'
 export default {
+  mixins: [websocket],
   data() {
     return {
       headList: routes.filter(item => item.name !== '业务线'),
@@ -44,7 +47,7 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['activeNavTag', 'navTagType'])
+    ...mapGetters(['activeNavTag', 'navTagType', 'notice'])
   },
   watch: {
     $route: {
@@ -89,6 +92,19 @@ export default {
     },
     topHome() {
       this.$router.push({ path: '/' })
+    },
+    // websocket数据接收
+    websocketonmessage(e) {
+      const { hasReminding } = JSON.parse(e.data)
+      if (hasReminding) {
+        this.$store.dispatch('data/setNotice', true)
+        const link = document.querySelector('link')
+        link.href = link.href.replace(/favicon.ico/, 'favicon-tips.ico')
+      } else {
+        this.$store.dispatch('data/setNotice', false)
+        const link = document.querySelector('link')
+        link.href = link.href.replace(/favicon-tips.ico/, 'favicon.ico')
+      }
     }
   }
 }
@@ -138,6 +154,17 @@ export default {
     width: 100%;
     height: 100%;
   }
+  .if-notice {
+    position: absolute;
+    z-index: 1;
+    height: 8px;
+    width: 8px;
+    background-color: #E02020;
+    border-radius: 50%;
+    top: 0;
+    right: 0;
+    transform: translateY(-50%);
+  }
 }
 .nav-tag-type {
   margin-top: auto;

+ 5 - 3
src/views/quality/allStatistics.vue

@@ -5,9 +5,11 @@
       <span class="control-item" :class="{'is-active':isActive === 2}" @click="isActive=2">任务统计</span>
       <span class="control-item" :class="{'is-active':isActive === 3}" @click="isActive=3">缺陷统计</span>
     </div>
-    <require-statistics v-if="isActive === 1" />
-    <task-statistics v-if="isActive === 2" />
-    <defect-statistics v-if="isActive === 3" />
+    <keep-alive>
+      <require-statistics v-if="isActive === 1" />
+      <task-statistics v-if="isActive === 2" />
+      <defect-statistics v-if="isActive === 3" />
+    </keep-alive>
   </section>
 </template>
 <script>