From 3613f5414bef610d8486c01eea3a795d62dabb16 Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期五, 05 三月 2021 13:55:01 +0800
Subject: [PATCH] 跨aap打开新app

---
 src/pages/ai/index/App.vue                        |   37 ++++++++++--------
 src/pages/desktop/index/components/ToolsEntry.vue |   40 +++++++++++---------
 2 files changed, 42 insertions(+), 35 deletions(-)

diff --git a/src/pages/ai/index/App.vue b/src/pages/ai/index/App.vue
index 3d93010..de7310d 100644
--- a/src/pages/ai/index/App.vue
+++ b/src/pages/ai/index/App.vue
@@ -920,7 +920,7 @@
                 >{{showNameById(id)}}</span> -->
                   <el-tag type="info" size="small" color="#fff" v-if="!isSDKDialog">搴旂敤</el-tag>
                   <el-tag type="info" size="small" color="#fff" v-if="isSDKDialog">绠楁硶</el-tag>
-                  <el-tag type="info"  size="small" color="#fff" >杞欢</el-tag>
+                  <el-tag type="info"  size="small" color="#fff" v-if="!isSDKDialog">杞欢</el-tag>
                 </div>
                 <div class="btns">
                   <el-button size="small" type="warning"  v-if="needToUpgradeInWin" @click="upgradeSDKinWin" >{{
@@ -928,7 +928,7 @@
                   }}</el-button>
                   <el-button size="small" type="primary" v-if="isActive" @click="unloadSDKinWin">鍗歌浇</el-button>
                   <el-button size="small" type="primary" v-if="!isActive" @click="showInputCode=!showInputCode">涓嬭浇婵�娲�</el-button>
-                  <el-button size="small" type="success" v-if="!isSDKDialog" @click="openAPP(productDetail.productBaseId)">鎵撳紑</el-button>
+                  <el-button size="small" type="success" v-if="!isSDKDialog" @click="openApp">鎵撳紑</el-button>
                 </div>
                
               </div>
@@ -1284,7 +1284,7 @@
 
     },
     checkInWindow(item){
-      this.backStack.push(this.productDetail)
+      this.backStack.push([this.productDetail,this.otherProducts])
       // debugger
       this.backDisable = false
       this.curCheckTarget = item;
@@ -1292,10 +1292,9 @@
       let _this = this;
       getAppDetail({ id: item.id }).then((res) => {
         _this.productDetail = res.data.detail;
-        // debugger
         this.actId = _this.productDetail.productBaseId
         let flag=false
-       const allNeedToNew = [...this.hasNewVersionSdk,...hasNewVersionApp]
+       const allNeedToNew = [...this.hasNewVersionSdk,...this.hasNewVersionApp]
         for (let i = 0; i < allNeedToNew.length; i++) {
           const item = allNeedToNew[i];
           if (item.id == _this.productDetail.productBaseId) {
@@ -1313,10 +1312,11 @@
       // forwardDisable:false,
       return
       }
-      console.log(this.backStack);
 
-   this.forwardStack.push(this.productDetail)
-   this.productDetail =  this.backStack.pop()
+   this.forwardStack.push([this.productDetail,this.otherProducts])
+   let item = this.backStack.pop()
+   this.productDetail =  item[0]
+   this.otherProducts = item[1]
   this.forwardDisable=false
  if (this.backStack.length ==0) {
         this.backDisable = true
@@ -1328,11 +1328,13 @@
         this.forwardDisable=true
         return
       }
-      console.log(this.backStack);
 
-        this.backStack.push(this.productDetail)
+        this.backStack.push([this.productDetail,this.otherProducts])
         this.backDisable=false
-      this.productDetail=this.forwardStack.pop()
+        let item = this.forwardStack.pop()
+
+        this.productDetail = item[0]
+        this.otherProducts = item[1]
       if (this.forwardStack.length==0) {
         this.forwardDisable=true
       }
@@ -1365,7 +1367,6 @@
           }
         })
         .catch((e) => {
-          console.log(e);
           this.isInstall = false;
           this.$message({
             type: "error",
@@ -1373,10 +1374,7 @@
           });
         });
     },
-    openAPP(id){
-      debugger
-      bus.$emit('open-app',id)
-    },
+
     downloadApp(app, action) {
       if (action == "upgrade") {
         app.upgradeLoading = true;
@@ -1613,7 +1611,12 @@
           });
         });
     },
-
+    openApp(){
+      let message = 'toOpenApp?'+this.productDetail.productBaseId;
+      window.parent.postMessage({
+        msg: message
+      }, "*")
+    },
 
     onFileAdded(f) {
       this.patchUpdateStatus = "";
diff --git a/src/pages/desktop/index/components/ToolsEntry.vue b/src/pages/desktop/index/components/ToolsEntry.vue
index aa26486..eefc72f 100644
--- a/src/pages/desktop/index/components/ToolsEntry.vue
+++ b/src/pages/desktop/index/components/ToolsEntry.vue
@@ -88,7 +88,6 @@
       ],
       //rowSize: 3,
       badgeNum: 0,
-      curDock: {}
     }
   },
   computed: {
@@ -139,18 +138,15 @@
           let params = msg.substring(7);
           this.addFrameByName("search", params)
         }
+
+        if (msg.indexOf("toOpenApp") >= 0) {
+          let id = msg.substring(10);
+          console.log(id);
+          this.addFrameByID(id)
+        }
       }
     });
-    this.$nextTick( () =>{
-       bus.$on("open-app", (val)=> {
-        debugger
-        const cur = this.stateDocks.find( (item)=> {
-          return item.id == val
-        })
-        this.dockClick(cur)
-        this.curDock = cur
-    })
-    })
+
   },
   methods: {
     chunk (arr, size) {
@@ -218,7 +214,6 @@
       dockMask.style.width = dockItems.length * 60 + 40 + 'px';
     },
     addFrameByName (name, params) {
-
       let dock = null;
       this.$store.state.desktop.docks.forEach(app => {
         if (app.name === name) {
@@ -244,13 +239,22 @@
         url: dock.url,
         screenshot: ''
       });
+    },
+    addFrameByID (id, params) {
+    
+      let dock = null;
+      let toClose = null
+      this.$store.state.desktop.docks.forEach(app => {
+        if (app.id == id) {
+          dock = app;
+        }
+        if(app.name=="algorithmManage"){
+          toClose = app
+        }
+      });
+      this.dockClick(dock)
     }
-  },
-  watch:{
-    curDock:function (val) {
-      this.dockClick(val)
-    }
-  },
+  }
 };
 </script>
 

--
Gitblit v1.8.0