deepsea 11 months ago
parent
commit
edd24846ed

+ 2 - 0
src/components/SearchBar/index.vue

@@ -78,11 +78,13 @@ export default {
       //     m: '8b934420_ZJUb_b6f9'
       //   }
       // })
+      this.$store.dispatch("common/setGoHome", true);
       this.$store.dispatch("common/setIsOpen", false);
       this.$store.dispatch("common/set3dStatus", false);
       this.$store.dispatch("common/setSquareStatus", false);
     },
     goSquare(){
+      this.$store.dispatch("common/setGoHome", false);
       this.$store.dispatch("common/set3dStatus", false);
       this.$store.dispatch("common/setSquareStatus", true);
       this.$store.dispatch("common/setIsOpen", false);

+ 2 - 0
src/components/SearchBarMain/index.vue

@@ -71,10 +71,12 @@ export default {
       //     m: '8b934420_ZJUb_b6f9'
       //   }
       // })
+      this.$store.dispatch("common/setGoHome", true);
       this.$store.dispatch("common/set3dStatus", false);
       this.$store.dispatch("common/setSquareStatus", false);
     },
     goSquare(){
+      this.$store.dispatch("common/setGoHome", false);
       this.$store.dispatch("common/set3dStatus", false);
       this.$store.dispatch("common/setSquareStatus", true);
     }

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

@@ -25,7 +25,7 @@
       <div
         class="origin-basic backgroundBox"
         v-if="activeTab === 0"
-        v-show="currentBench.type == 2 && remoteBenchList.indexOf(currentBench.benchId) > -1"
+        v-show="!isGoHome && currentBench.type == 2 && remoteBenchList.indexOf(currentBench.benchId) > -1"
       >
         <h2>{{ currentBench && currentBench.name }}</h2>
         <div class="originBasicRow">
@@ -646,6 +646,9 @@ export default {
       return this.tabs.map((_, index) => index);
     },
     ...mapState({
+      isGoHome(state) {
+        return state.common.isGoHome
+      },
       projectOptions(state) {
         return state.common.projectOptions;
       },
@@ -722,7 +725,6 @@ export default {
         unique_identifier: this.currentCase.unique_identifier,
       };
       this.$store.dispatch("caseList/updateCase", params);
-      debugger;
       this.$emit("turnNextCase");
     },
     cancelManualCase() {},

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

@@ -23,5 +23,8 @@ export default {
   },
   setIsOpen({commit}, data) {
     commit('setIsOpen', data)
+  },
+  setGoHome({commit}, data) {
+    commit('setGoHome',data)
   }
 };

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

@@ -44,7 +44,8 @@ export default {
       isOpenSquare: false,
       isConnected: false,
       isOpen3d: false,
-      isOpen: false
+      isOpen: false,
+      isGoHome: false
     };
   },
   mutations,

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

@@ -157,5 +157,8 @@ export default {
   },
   setIsOpen(state, data) {
     state.isOpen = data;
+  },
+  setGoHome(state, data) {
+    state.isGoHome = data
   }
 };

+ 25 - 25
src/views/ordinaryPage/index.vue

@@ -25,8 +25,9 @@
             <el-col v-for="(item, index) in images" :key="item" :span="8">
               <div
                 class="grid-item-background"
-                style="
-                  background-color: black;
+                :style="{
+                  backgroundColor: item.alt == selectedBenchId ? '#fff': '#000'
+                }
                 "
               >
                 <div class="grid-item">
@@ -692,7 +693,8 @@ export default {
       timerId: 0,
       autoPlanResultInterval: 0,
       remoteBenchList: [],
-      waterdotrefresh: false
+      waterdotrefresh: false,
+      selectedBenchId: 0
     };
   },
   computed: {
@@ -959,7 +961,6 @@ export default {
     
     {
       this.autoPlanResultInterval = setInterval(() => {
-        // debugger
         let autoCurrentTaskData = window.localStorage.getItem("autoCurrentTaskData");
         autoCurrentTaskData = JSON.parse(autoCurrentTaskData);
         if (autoCurrentTaskData) {
@@ -1448,6 +1449,8 @@ export default {
             console.log("connect bench success", benchId);
             self.getBenchImage(benchId, 1, wsArray[i], () => {});
             this.currentBench = this.benchList.find((b) => b.id == benchId) || {};
+            this.remoteBenchList.push(benchId)
+            this.$store.dispatch("common/setGoHome", false);
           })
           .catch((err) => {
             console.log("connect bench failed", benchId);
@@ -2324,17 +2327,16 @@ export default {
 
       }
       console.log("benchId", benchId);
-      let selectedBench = this.benchList.find((i) => i.benchId == benchId);
-      // console.log("selectedBench", selectedBench);
-      bus.emit("benchInfoVisible", selectedBench);
+      if (this.isOpenSquare) {
+        let selectedBench = this.benchList.find((i) => i.benchId == benchId);
+        bus.emit("benchInfoVisible", selectedBench);
+      }
       this.$nextTick(() => {
         if (benchId == this.currentBench.benchId) {
-          benchId = 0;
           let items = document.getElementsByClassName("grid-item-background");
           for (var index = 0; index < items.length; index++) {
             items[index].style.background = "#000000";
           }
-          this.currentBench = {};
           return;
         }
         let items = document.getElementsByClassName("grid-item-background");
@@ -2355,31 +2357,29 @@ export default {
         //{
         //  element.style = "{background: rgba(0, 0, 0, 1)}"
         //});
-        if (benchId == this.currentBench.id &&this.currentBench.selected) {
-          this.currentBench.selected = false;
-          this.currentBench.scale = 1;
-          this.currentBench = {};
-          let items = document.getElementsByClassName("item-box");
-          for (var index = 0; index < items.length; index++) {
-            items[index].style.background = "#00000032";
-          }
-          return;
-        }
+        // if (benchId == this.currentBench.id &&this.currentBench.selected) {
+        //   this.currentBench.selected = false;
+        //   this.currentBench.scale = 1;
+        //   this.currentBench = {};
+        //   let items = document.getElementsByClassName("item-box");
+        //   for (var index = 0; index < items.length; index++) {
+        //     items[index].style.background = "#00000032";
+        //   }
+        //   return;
+        // }
         let items = document.getElementsByClassName("item-box");
         for (var index = 0; index < items.length; index++) {
           items[index].style.background = "#00000032";
-          let title = items[index].getElementsByClassName("item-title");
           // console.log("textContent", title[0].textContent);
           let itemOther = this.benchList.find(
-            (b) => parseInt(b.id) == parseInt(title[0].textContent)
+            (b) => b.id == items[index].dataset.index
           );
           if (itemOther) {
             itemOther.selected = false;
           }
-          if (parseInt(benchId) == parseInt(title[0].textContent)) {
+          if (benchId == items[index].dataset.index) {
             items[index].style.background = "#000000C0";
-            this.currentBench = this.benchList.find((b) => b.id == benchId);
-            this.currentBench.selected = true;
+            this.selectedBenchId = benchId
           }
         }
         // console.log('this.currentBench', this.currentBench);
@@ -2444,6 +2444,7 @@ export default {
       this.selectBench(benchId);
     },
     handleClickImg(benchId, indexParam) {
+      this.selectedBenchId = benchId;
       this.$nextTick(() => {
         if (benchId == this.currentBenchId) {
           benchId = 0;
@@ -2464,7 +2465,6 @@ export default {
         }
       });
       this.$nextTick(() => {
-        debugger
         if (
           benchId == this.currentBench.id &&
           this.currentBench.selected == true