From 1e09a7a01a6c1888e1a2a832eb007fb8c2b653a0 Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期三, 26 一月 2022 11:06:27 +0800
Subject: [PATCH] Merge branch 'bhomebus' of http://192.168.5.5:10010/r/web/vue-smart-ai into bhomebus

---
 src/pages/ai/index/App.vue |  174 ++++++++++++++-------------------------------------------
 1 files changed, 43 insertions(+), 131 deletions(-)

diff --git a/src/pages/ai/index/App.vue b/src/pages/ai/index/App.vue
index 2882fa9..51304be 100644
--- a/src/pages/ai/index/App.vue
+++ b/src/pages/ai/index/App.vue
@@ -169,8 +169,17 @@
                       class="other-btn"
                       round
                       @click="checkDetail(item)"
-                      v-if="activeName == '搴旂敤涓績'"
+                      v-if="activeName == '搴旂敤涓績' && item.price > 0"
                       >婵�娲�</el-button
+                    >
+                    <el-button
+                      size="small"
+                      type="primary"
+                      class="update-btn"
+                      round
+                      @click.stop="actived(item)"
+                      v-if="activeName == '搴旂敤涓績' && item.price == 0"
+                      >瀹夎</el-button
                     >
                     <el-button
                       size="small"
@@ -186,8 +195,6 @@
                       "
                       >鏌ョ湅</el-button
                     >
-                    <!-- @click.stop="unLoadSdkOrApp(item)" -->
-
                     <el-button
                       size="small"
                       type="primary"
@@ -351,6 +358,8 @@
             :detailProductID="detailProductID"
             :detailType="detailType"
             v-if="inDetail"
+            @flushSdk="getAllSdk"
+            @flushApp="getAllApps"
             @goback="goback"
           ></detailPage>
         </div>
@@ -495,8 +504,8 @@
       installedApps: [],
       storeApps: [],
       installFile: {},
-      appUpgreading: true,
-      sdkUpgreading: true,
+      appUpgreading: false,
+      sdkUpgreading: false,
       autoRefresh: true,
       productDetailVisible: false,
       isUpgrading: false,
@@ -537,11 +546,6 @@
     goback() {
       this.inDetail = false;
     },
-    isShow(authority) {
-      return (
-        this.isAdmin || this.buttonAuthority.indexOf("," + authority + ",") > -1
-      );
-    },
     batchUpdate(s) {
       if (s == "both") {
         this.batchUpdateSDK();
@@ -575,7 +579,6 @@
           this.tempList = this.installedList;
           this.tempDarkList = this.notInstalledList;
           break;
-
         case "鏇存柊":
           this.showQuickPath = false;
           this.tempList = this.hasNewVersionSdk;
@@ -588,7 +591,9 @@
       }
     },
     pickTab(val) {
-      this.activeTab = val;
+      if (val) {
+        this.activeTab = val;
+      }
       if (this.activeName == "搴旂敤涓績") {
         this.tempList =
           this.activeTab == "sdk"
@@ -609,11 +614,6 @@
         this.tempDarkList = [];
       }
     },
-    closeDial() {
-      this.productDetailVisible = false;
-      this.productDetail = {};
-      this.otherProducts = [];
-    },
     checkDetail(item, typ) {
       this.inDetail = true;
       this.detailProductID = item.id;
@@ -623,54 +623,8 @@
         this.detailType = this.activeName == "搴旂敤涓績" ? "inactive" : "active";
       }
     },
-    checkInWindow(item) {
-      this.backStack.push([this.productDetail, this.otherProducts]);
-      this.backDisable = false;
-      this.checkIsDefOrNot(item.id);
-
-      let _this = this;
-      getAppDetail({ id: item.id }).then((res) => {
-        _this.productDetail = res.data.detail;
-        _this.productDetail.iconBlob = item.iconBlob;
-        this.actId = _this.productDetail.productBaseId;
-        let flag = false;
-        const allNeedToNew = [
-          ...this.hasNewVersionSdk,
-          ...this.hasNewVersionApp,
-        ];
-        for (let i = 0; i < allNeedToNew.length; i++) {
-          const item = allNeedToNew[i];
-          if (item.id == _this.productDetail.productBaseId) {
-            flag = true;
-          }
-        }
-        this.needToUpgradeInWin = flag;
-        _this.productDetail.isUpgrade = flag;
-
-        _this.otherProducts = res.data.randoms;
-      });
-    },
     checkIsDefOrNot(id) {
-      if (id.length > 10) {
-        this.isDefaultApp = false;
-      } else {
-        this.isDefaultApp = true;
-      }
-    },
-    backwards() {
-      if (this.backStack.length == 0) {
-        this.backDisable = true;
-        return;
-      }
-      this.forwardStack.push([this.productDetail, this.otherProducts]);
-      let item = this.backStack.pop();
-      this.productDetail = item[0];
-      this.checkIsDefOrNot(this.productDetail.productBaseId);
-      this.otherProducts = item[1];
-      this.forwardDisable = false;
-      if (this.backStack.length == 0) {
-        this.backDisable = true;
-      }
+      this.isDefaultApp = id.length <= 10;
     },
     forwards() {
       if (this.forwardStack.length == 0) {
@@ -793,18 +747,6 @@
         })
         .catch((e) => {});
     },
-    toActivatePage(item) {
-      this.checkDetail(item, "inactive");
-      this.actType = this.activeTab;
-      this.actId = item.id;
-      this.actStep = 0;
-      this.activeCode = "";
-      this.activedSdkOrApp = this.newActInfo();
-    },
-    cancelActivate() {
-      this.showInputCode = false;
-      this.activeCode = "";
-    },
     newActInfo() {
       return {
         activateCode: "",
@@ -842,25 +784,21 @@
       getUnActivedApp().then((res) => {
         if (res.code == 200) {
           this.unActivedAppList = res.data;
+          this.pickTab();
         }
       });
     },
-    actived() {
+    actived(item) {
       let _this = this;
-      if (this.activeCode.trim() == "") {
-        this.$notify.error("婵�娲荤爜涓嶈兘涓虹┖");
-        return;
-      }
-      if (this.actType == "sdk") {
-        //婵�娲荤畻娉�
-        actPageAlg(this.actId, this.activeCode)
+      if (this.activeTab == "sdk") {
+        actPageAlg(item.id, "")
           .then((res) => {
             if (res.data.isSuccess) {
               this.productDetailVisible = false;
               _this.activedSdkOrApp = res.data.successMsg;
               this.showActivateSuccess = true;
               _this.actStep++;
-              _this.getUnActivedList();
+              _this.getUnActivedList(1);
               _this.getAllSdk();
             } else {
               _this.$notify.error(res.data.failMsg.failMsg);
@@ -869,9 +807,9 @@
           .catch((e) => {
             console.log(e);
           });
-      } else if (this.actType == "app") {
+      } else if (this.activeTab == "app") {
         //婵�娲诲簲鐢�
-        actApp(this.actId, this.activeCode)
+        actApp(item.id, "")
           .then((res) => {
             if (res.data.isSuccess) {
               this.productDetailVisible = false;
@@ -888,10 +826,6 @@
             console.log(e);
           });
       }
-    },
-    checkMyAlgorith() {
-      this.showActivateSuccess = false;
-      this.activeName = "宸叉縺娲�";
     },
     onFileUpload(file) {
       this.patchFile = { ...file };
@@ -910,6 +844,7 @@
                 version: res.data.apps[0].version,
                 productName: res.data.productName,
                 installContent: res.data.apps[0].installContent,
+                
               };
             }
             if (res.data.sdks.length > 0) {
@@ -927,12 +862,6 @@
         .catch((e) => {
           this.$message.error(e.msg);
         });
-    },
-    openApp() {
-      window.parent.postMessage(
-        { msg: "toOpenApp?" + this.productDetail.productBaseId },
-        "*"
-      );
     },
     onFileAdded(f) {
       this.patchUpdateStatus = "";
@@ -968,24 +897,7 @@
       this.notInstalledList = unInstalledList;
       this.toUpdateArr1 = this.installedList.slice(0, 10);
       this.hasNewVersionSdk = hasNewVersionList;
-    },
-    unloadSDKinWin() {
-      let appToUnload;
-      let sdkToUnload;
-      if (this.productDetail.productTypeName == "搴旂敤") {
-        appToUnload = this.installedApps.find((item) => {
-          return item.id == this.productDetail.productBaseId;
-        });
-        this.unloadApp(appToUnload);
-      } else {
-        sdkToUnload = this.installedList.find((item) => {
-          return item.id == this.productDetail.productBaseId;
-        });
-        this.unloadSdk(sdkToUnload);
-      }
-    },
-    unLoadSdkOrApp(item) {
-      this.activeTab == "sdk" ? this.unloadSdk(item) : this.unloadApp(item);
+      this.pickTab();
     },
     unloadSdk(sdk) {
       let _this = this;
@@ -1008,7 +920,6 @@
         })
         .catch((e) => {});
     },
-
     donwloadSDK(item) {
       let timer = null;
       item.upgradeLoading = true;
@@ -1021,6 +932,7 @@
           clearInterval(timer);
           item.upgradeLoading = false;
           this.downloadItem = "";
+
           window.parent.postMessage({ msg: "AppUpdate" }, "*");
         })
         .catch((err) => {
@@ -1032,20 +944,19 @@
       this.sdkUpgreading = true;
     },
     autoRefreshAppAndSdkState() {
-      // 鍏抽棴鍚庨��鍑�
+      this.getAllApps();
+      this.getAllSdk();
       if (!this.autoRefresh) {
         return;
       }
-      if (this.appUpgreading) {
-        this.getAllApps();
-      }
-      if (this.sdkUpgreading) {
-        this.getAllSdk();
-      }
-      let _this = this;
       setTimeout(() => {
-        _this.autoRefreshAppAndSdkState();
-      }, 500);
+        if (this.appUpgreading) {
+          this.getAllApps();
+        }
+        if (this.sdkUpgreading) {
+          this.getAllSdk();
+        }
+      }, 1000);
     },
   },
 };
@@ -1056,6 +967,7 @@
   height: 100%;
   box-sizing: border-box;
   text-align: left;
+  background-color: #fff;
 }
 
 .task-manage {
@@ -1451,9 +1363,9 @@
               text-align: center;
               position: relative;
               .check-btn {
-                background-color: #f2f2f7 !important;
-                border-color: #f2f2f7 !important;
-                color: #4f4f4f;
+                background-color: #ffffff !important;
+                border-color: #bdbdbd !important;
+                color: #333333;
               }
               .update-btn {
                 border-color: #23d7ee !important;
@@ -1490,7 +1402,7 @@
                 min-width: 100px;
                 text-align: end;
                 position: absolute;
-                right: 0;
+                right: 0;    width: 120px;
                 margin-top: 2px;
               }
               .rocket-icon {
@@ -1505,7 +1417,7 @@
             }
           }
           .front-page-item:hover {
-            // background-color: #f2f2f7;
+            background-color: #f2f2f7;
           }
           .item-dimmed {
             color: gray;

--
Gitblit v1.8.0