heyujie
2021-11-25 3da82371b3826dc047f8c30fb0b5fb6ef3aff46e
应用中心修改
2个文件已修改
225 ■■■■ 已修改文件
src/pages/ai/index/App.vue 219 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/ai/index/detail.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>
@@ -537,11 +546,11 @@
    goback() {
      this.inDetail = false;
    },
    isShow(authority) {
      return (
        this.isAdmin || this.buttonAuthority.indexOf("," + authority + ",") > -1
      );
    },
    // isShow(authority) {
    //   return (
    //     this.isAdmin || this.buttonAuthority.indexOf("," + authority + ",") > -1
    //   );
    // },
    batchUpdate(s) {
      if (s == "both") {
        this.batchUpdateSDK();
@@ -588,7 +597,9 @@
      }
    },
    pickTab(val) {
      this.activeTab = val;
      if (val) {
        this.activeTab = val;
      }
      if (this.activeName == "应用中心") {
        this.tempList =
          this.activeTab == "sdk"
@@ -609,11 +620,11 @@
        this.tempDarkList = [];
      }
    },
    closeDial() {
      this.productDetailVisible = false;
      this.productDetail = {};
      this.otherProducts = [];
    },
    // closeDial() {
    //   this.productDetailVisible = false;
    //   this.productDetail = {};
    //   this.otherProducts = [];
    // },
    checkDetail(item, typ) {
      this.inDetail = true;
      this.detailProductID = item.id;
@@ -623,33 +634,33 @@
        this.detailType = this.activeName == "应用中心" ? "inactive" : "active";
      }
    },
    checkInWindow(item) {
      this.backStack.push([this.productDetail, this.otherProducts]);
      this.backDisable = false;
      this.checkIsDefOrNot(item.id);
    // 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;
    //   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;
      });
    },
    //     _this.otherProducts = res.data.randoms;
    //   });
    // },
    checkIsDefOrNot(id) {
      if (id.length > 10) {
        this.isDefaultApp = false;
@@ -657,21 +668,21 @@
        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;
      }
    },
    // 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;
    //   }
    // },
    forwards() {
      if (this.forwardStack.length == 0) {
        this.forwardDisable = true;
@@ -793,18 +804,18 @@
        })
        .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 = "";
    },
    // 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 +853,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 +876,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;
@@ -889,10 +896,10 @@
          });
      }
    },
    checkMyAlgorith() {
      this.showActivateSuccess = false;
      this.activeName = "已激活";
    },
    // checkMyAlgorith() {
    //   this.showActivateSuccess = false;
    //   this.activeName = "已激活";
    // },
    onFileUpload(file) {
      this.patchFile = { ...file };
      this.fileAdded = true;
@@ -928,12 +935,12 @@
          this.$message.error(e.msg);
        });
    },
    openApp() {
      window.parent.postMessage(
        { msg: "toOpenApp?" + this.productDetail.productBaseId },
        "*"
      );
    },
    // openApp() {
    //   window.parent.postMessage(
    //     { msg: "toOpenApp?" + this.productDetail.productBaseId },
    //     "*"
    //   );
    // },
    onFileAdded(f) {
      this.patchUpdateStatus = "";
    },
@@ -968,25 +975,26 @@
      this.notInstalledList = unInstalledList;
      this.toUpdateArr1 = this.installedList.slice(0, 10);
      this.hasNewVersionSdk = hasNewVersionList;
      this.pickTab()
    },
    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);
    },
    // 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);
    // },
    unloadSdk(sdk) {
      let _this = this;
      this.$confirm("确定要卸载该算法吗?", "提示")
@@ -1021,6 +1029,7 @@
          clearInterval(timer);
          item.upgradeLoading = false;
          this.downloadItem = "";
          window.parent.postMessage({ msg: "AppUpdate" }, "*");
        })
        .catch((err) => {
src/pages/ai/index/detail.vue
@@ -546,7 +546,8 @@
            .then((res) => {
              if (res && res.success) {
                app.unloadLoading = false;
                _this.getAllApps();
                // _this.getAllApps();
                this.$emit("flushApp")
                window.parent.postMessage(
                  {
                    msg: "AppUpdate",
@@ -766,7 +767,8 @@
              if (res && res.success) {
                sdk.unloadLoading = false;
                this.$notify.success("卸载完成");
                _this.getAllSdk();
                // _this.getAllSdk();
                this.$emit("flushSdk")
                window.parent.postMessage({ msg: "AppUpdate" }, "*");
              }
            })