guhongwei 4 роки тому
батько
коміт
6b88171115
2 змінених файлів з 14 додано та 1 видалено
  1. 5 0
      src/store/topmessage.js
  2. 9 1
      src/views/service/parts/sign.vue

+ 5 - 0
src/store/topmessage.js

@@ -4,6 +4,7 @@ import _ from 'lodash';
 Vue.use(Vuex);
 const api = {
   topInfo: `/api/count/top`,
+  servenodeInfo: `/api/count/servenode`,
 };
 const state = () => ({});
 const mutations = {};
@@ -31,6 +32,10 @@ const actions = {
     const res = await this.$axios.$delete(`${api.newsInfo}/${payload}`);
     return res;
   },
+  async querytwo({ commit }, {}) {
+    const res = await this.$axios.$get(api.servenodeInfo, {});
+    return res;
+  },
 };
 
 export default {

+ 9 - 1
src/views/service/parts/sign.vue

@@ -90,6 +90,7 @@ export default {
       // 活跃应用
       hyyy: [],
       toDay: '',
+      serveTime: true,
     };
   },
   async created() {
@@ -99,9 +100,12 @@ export default {
   },
   mounted() {
     this.channel();
+    if (this.serveTime) {
+      this.searchNode();
+    }
   },
   methods: {
-    ...topmessage(['query', 'fetch', 'update', 'create', 'delete']),
+    ...topmessage(['query', 'querytwo']),
     async search({ skip = 0, limit = 300, ...info } = {}) {
       let res = await this.query({ skip, limit, ...info });
       if (this.$checkRes(res)) {
@@ -109,6 +113,10 @@ export default {
         this.$set(this, `hyyy`, res.data.reverse());
       }
     },
+    async searchNode() {
+      let res = await this.querytwo();
+      this.searchNode = false;
+    },
     channel() {
       this.$stomp({
         [`/exchange/service_count/nodes`]: this.onMessage,