Ver código fonte

在vuex中添加台架远程连接状态,用以设置双屏展示状态

hao lei 1 ano atrás
pai
commit
e7fdc39b81

+ 4 - 1
src/components/TabList/index.vue

@@ -61,7 +61,7 @@
       </div>
       <div
         class="secondScreen"
-        v-if="activeTab === 0 && benchDisplayLowerVisible"
+        v-if="activeTab === 0 && benchDisplayLowerVisible && !isOpenSquare && isConnected"
         @click="switchScreen"
       >
         <img
@@ -657,6 +657,9 @@ export default {
       isOpenSquare: (state) => {
         return state.common.isOpenSquare;
       },
+      isConnected: (state) => {
+        return state.common.isConnected;
+      },
       matchedBenchList(state) {
         return state.benchList.matchedBenchList;
       },

+ 3 - 0
src/store/modules/common/actions.js

@@ -12,6 +12,9 @@ export default {
   setSquareStatus({ commit }, data) {
     commit('setSquareStatus', data);
   },
+  setConnectedStatus({ commit }, data) {
+    commit('setConnectedStatus', data);
+  },
   set3dStatus({ commit }, data) {
     commit('set3dStatus', data);
   },

+ 3 - 0
src/store/modules/common/getters.js

@@ -22,5 +22,8 @@ export default {
   },
   getSquareStatus(state) {
     return state.isOpenSquare
+  },
+  getConnectedStatus(state) {
+    return state.isConnected
   }
 };

+ 1 - 0
src/store/modules/common/index.js

@@ -42,6 +42,7 @@ export default {
         label: ''
       }],
       isOpenSquare: false,
+      isConnected: false,
       isOpen3d: false
     };
   },

+ 3 - 0
src/store/modules/common/mutations.js

@@ -81,6 +81,9 @@ export default {
   setSquareStatus(state, data) {
     state.isOpenSquare = data;
   },
+  setConnectedStatus(state, data) {
+    state.isConnected = data;
+  },
   set3dStatus(state, data) {
     state.isOpen3d = data;
   },

+ 3 - 0
src/views/ordinaryPage/index.vue

@@ -929,6 +929,7 @@ export default {
     bus.on("goHome", () => {
       this.isConnected = false;
       this.$store.dispatch("common/setSquareStatus", false);
+      this.$store.dispatch("common/setConnectedStatus", false);
     });
 
     let autoCurrentTaskData = window.localStorage.getItem(
@@ -1525,6 +1526,7 @@ export default {
         ws.connectBench({ bench_id: String(benchId) })
           .then((res) => {
             self.isConnected = true;
+            this.$store.dispatch("common/setConnectedStatus", true);
             console.log("connect bench success");
             this.currentScreen = "upper";
             self.setSendAudioBus(benchId);
@@ -2235,6 +2237,7 @@ export default {
           this.benchDisplayVisible = false;
           this.benchDisplayLowerVisible = false;
           this.isConnected = false;
+          this.$store.dispatch("common/setConnectedStatus", false);
         }
       );
     },