From d5b2bf5ffaa96d002b21575016a262b376763a74 Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期四, 11 三月 2021 15:46:00 +0800
Subject: [PATCH] 已激活但未安装的算法的弹窗显示安装而非激活,添加激活安装成功的提示

---
 src/pages/ai/index/App.vue |  204 +++++++++++++++-----------------------------------
 1 files changed, 63 insertions(+), 141 deletions(-)

diff --git a/src/pages/ai/index/App.vue b/src/pages/ai/index/App.vue
index 761e6f3..4dcf33d 100644
--- a/src/pages/ai/index/App.vue
+++ b/src/pages/ai/index/App.vue
@@ -26,47 +26,6 @@
                 >
                   <p class="src-title">绠楁硶杞欢</p>
                   <div class="flex-list">
-                    <!-- <div class="wrap-box" v-for="item in ungradeList" :key="'upgrade'+item.id">
-                      <div class="list-choose-item-left">
-                        <div class="list-complete-item-handle">
-                          <div
-                            class="svg-wrap"
-                            :class="{willUpGrade:item.isUpgrade}"
-                            v-loading="item.upgradeLoading"
-                            :element-loading-text="item.progressMsg"
-                            element-loading-background="rgba(0,0,0,.8)"
-                          >
-                            <i class="iconfont iconupdate" v-if="item.isUpgrade"></i>
-                            <div class="mask">
-                              <div class="info-onmask">
-                                <div>褰撳墠鐗堟湰:{{item.version}}</div>
-                                <div>鏈�鏂扮増鏈�:{{item.remoteVersion}}</div>
-                              </div>
-                              <div class="mask-btn">
-                                <el-button
-                                  type="warning"
-                                  class="bot-btn"
-                                  size="small"
-                                  @click="donwload(item)"
-                                >鍗囩骇</el-button>
-                              </div>
-                            </div>
-                            <img
-                              v-if="item.iconBlob"
-                              class="baseImg"
-                              :src="item.iconBlob.indexOf(',')>0? item.iconBlob:`data:image/png;base64,${item.iconBlob}`"
-                              alt
-                            />
-                            <img v-else class="baseImg" :src="item.icon" alt />
-                          </div>
-                          <div class="alg-name">
-                            <div style="padding:0px 10px 0px 10px;">
-                              <span>{{ item.sdk_name }}</span>
-                            </div>
-                          </div>
-                        </div>
-                      </div>
-                    </div>-->
                     <div
                       class="wrap-box"
                       v-for="item in installedList"
@@ -168,7 +127,7 @@
                               </div>
                               <div
                                 class="info-onmask"
-                                @click="checkDetail(item, 'inactive')"
+                                @click="checkDetail(item, 'activeNotInstall')"
                               >
                                 鏌ョ湅璇︽儏
                               </div>
@@ -548,74 +507,8 @@
                     </div>
                   </div>
                 </div>
-                <el-drawer
-                  title="涓嬭浇"
-                  :visible.sync="actDrawerShow"
-                  :direction="direction"
-                >
-                  <div class="drawer-content">
-                    <div class="current-step">
-                      <el-steps
-                        align-center
-                        :active="actStep"
-                        finish-status="success"
-                      >
-                        <el-step title="娣诲姞婵�娲荤爜"></el-step>
-                        <el-step title="婵�娲绘垚鍔�"></el-step>
-                      </el-steps>
-                    </div>
-
-                    <div v-if="actStep == 0">
-                      <div class="act-code">
-                        <p>浣跨敤婵�娲荤爜灏嗘柊鐨勭畻娉曟坊鍔犲埌鎮ㄧ殑璐︽埛</p>
-                        <el-input
-                          v-model="activeCode"
-                          placeholder="00000-00000-00000-00000-00000"
-                          @blur="getCodeDetail"
-                        ></el-input>
-                      </div>
-                      <div class="text-right">
-                        <el-button type="primary" @click="actived"
-                          >婵�娲�</el-button
-                        >
-                      </div>
-                    </div>
-                    <div v-else-if="actStep == 1">
-                      <ul class="desc">
-                        <li>
-                          <label>婵�娲荤爜:</label>
-                          <span>{{ activedSdkOrApp.activateCode }}</span>
-                        </li>
-                        <li>
-                          <label>浜у搧鍚嶇О:</label>
-                          <span>{{ activedSdkOrApp.productName }}</span>
-                        </li>
-                        <li>
-                          <label>閰嶇疆璇︽儏:</label>
-                          <span>{{ activedSdkOrApp.setting }}</span>
-                        </li>
-                        <li>
-                          <label>鏈嶅姟鍒版湡鏃�:</label>
-                          <span>{{ activedSdkOrApp.expireTime }}</span>
-                        </li>
-                        <li>
-                          <label>璁稿彲璇�:</label>
-                          <span>{{ activedSdkOrApp.licence }}</span>
-                        </li>
-                        <!-- <li>
-                          <label>璁惧ID:</label>
-                          <span>3342-235f-ret55-fdsg</span>
-                        </li>-->
-                      </ul>
-                      <div class="text-right">
-                        <el-button type="primary" @click="checkMyAlgorith"
-                          >纭畾</el-button
-                        >
-                        <p class="tip">鎻愮ず锛氳鍦ㄢ�滃凡婵�娲烩�濅腑鏌ョ湅骞跺畨瑁呯畻娉�</p>
-                      </div>
-                    </div>
-                  </div>
-                </el-drawer>
+                <!--  -->
+                
               </el-tab-pane>
               <el-tab-pane name="update">
                 <span slot="label">
@@ -935,21 +828,16 @@
                   <span>{{ productDetail.productName  }}</span>
                 </el-tooltip></div>
                 <div class="tags">
-                  <!-- <span
-                  class="tag"
-                  v-for="(id, index) in curCheckTarget.productLabelId"
-                  :key="index+'i'" 
-                >{{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" v-if="!isSDKDialog">杞欢</el-tag> -->
                 </div>
                 <div class="btns">
                   <el-button size="small" type="warning"  v-if="needToUpgradeInWin||productDetail.isUpgrade" @click="upgradeSDKinWin" >{{
                     isUpgrading ? "鍗囩骇涓�.." : "鍗囩骇"
                   }}</el-button>
                   <el-button size="small" type="primary" v-if="isActive&&!isDefaultApp" @click="unloadSDKinWin">鍗歌浇</el-button>
-                  <el-button size="small" type="primary" v-if="!isActive" @click="showInputCode=!showInputCode">婵�娲�</el-button>
+                  <el-button size="small" type="primary" v-if="!isActive&&!showInstallNotActive" @click="showInputCode=!showInputCode">婵�娲�</el-button>
+                  <el-button size="small" type="primary" v-if="!isActive&&showInstallNotActive" @click="downloadSdkInSide">{{isUpgrading?"瀹夎涓�..":"瀹夎"}}</el-button>
                   <el-button size="small" type="success" v-if="!isSDKDialog&&isActive" @click="openApp">鎵撳紑</el-button>
                 </div>
                
@@ -1068,7 +956,6 @@
         </div>
       </div>
     </el-dialog>
-  <!--  -->
     <el-dialog 
     :visible.sync="showActivateSuccess"
     title="婵�娲绘垚鍔燂紒"
@@ -1185,7 +1072,6 @@
       downloadItem: "",
       downloading: false,
       direction: "rtl",
-      actDrawerShow: false,
       actStep: 0,
       showActivateSuccess:false,
       activeCode: "",
@@ -1232,6 +1118,7 @@
       showInputCode:false,
       needToUpgradeInWin:false,
       errMsg:"",
+      showInstallNotActive:false
     };
   },
   directives: {
@@ -1278,10 +1165,16 @@
     checkDetail(item,type) {
       if (type =='inactive') {
         this.isActive =false
+         this.showInstallNotActive = false
         this.showInputCode = false
-      }else{
+      }else if (type =='active'){
         this.showInputCode = false
+         this.showInstallNotActive = false
          this.isActive =true
+      }else if (type =='activeNotInstall'){
+        this.showInputCode = false
+         this.isActive =false
+         this.showInstallNotActive = true
       }
       this.checkIsDefOrNot(item.id)
         this.needToUpgradeInWin = item.isUpgrade?true:false
@@ -1374,7 +1267,6 @@
       }
       
     },
-
     //绂荤嚎瀹夎
     offlineInstall() {
       this.installDialogVisible = false;
@@ -1420,6 +1312,11 @@
       installApp({ path: app.id })
         .then((res) => {
           if (res && res.success) {
+            _this.$notify({
+               title: "鎴愬姛",
+               message: "瀹夎搴旂敤鎴愬姛",
+               type: "success",
+             });
             setTimeout(() => {
               if (action == "upgrade") {
                 app.upgradeLoading = false;
@@ -1501,6 +1398,11 @@
                   },
                   "*"
                 );
+                _this.$notify({
+                  title: "鎴愬姛",
+                  message: "鍗歌浇搴旂敤鎴愬姛",
+                  type: "success",
+                });
               }
             })
             .catch((e) => {
@@ -1512,18 +1414,11 @@
           console.log(e);
         });
     },
-    // actSdk (id) {
-    //   this.actSdkId = id;
-    //   this.actDrawerShow = true;
-    //   this.actStep = 0;
-    //   this.activeCode = '';
-    //   this.activedSdkOrApp = this.newActInfo()
-    // },
+
     actSdkOrApp(item, type = "sdk") {
       this.checkDetail(item, 'inactive')
       this.actType = type;
       this.actId = item.id;
-      // this.actDrawerShow = true;
       this.actStep = 0;
       this.activeCode = "";
       this.activedSdkOrApp = this.newActInfo();
@@ -1712,6 +1607,11 @@
             .then((res) => {
               if (res && res.success) {
                 sdk.unloadLoading = false;
+                this.$notify({
+                title: "鎴愬姛",
+                message: "鍗歌浇瀹屾垚",
+                type: "success",
+              });
                 _this.getAllSdk();
                 window.parent.postMessage(
                   {
@@ -1763,14 +1663,14 @@
       this.appUpgreading = true;
       }else{
         downloadSdk({path:this.productDetail.productBaseId}).then((res)=>{
+          this.needToUpgradeInWin=false
+        this.productDetail.isUpgrade = false
+        this.isUpgrading = !this.isUpgrading;
         this.$notify({
           title: "鎴愬姛",
           message: "鍗囩骇瀹屾垚",
           type: "success",
         });
-        this.needToUpgradeInWin=false
-        this.productDetail.isUpgrade = false
-        this.isUpgrading = !this.isUpgrading;
       }).catch((err)=>{
         this.$notify({
           title: "鍗囩骇澶辫触",
@@ -1785,21 +1685,43 @@
 
       
     },
-
+    downloadSdkInSide(){
+      this.downloadItem = this.productDetail.productBaseId;
+      this.isUpgrading = true
+      downloadSdk({ path: this.productDetail.productBaseId })
+        .then((rsp) => {
+          this.productDetailVisible = false
+          this.downloadItem = "";
+          this.$notify({
+            type: "success",
+            message: "绠楁硶宸插畨瑁�"
+          });
+      this.isUpgrading=false
+        })
+        .catch((err) => {
+          this.$notify({
+            type: "warning",
+            message: err.data,
+          });
+          this.downloadItem = "";
+      this.isUpgrading=false
+        });
+      // 寮�鍚嚜鍔ㄥ埛鏂�
+      this.sdkUpgreading = true;
+    },
     donwload(item) {
       item.upgradeLoading = true;
-      //this.downloading = true;
       this.downloadItem = item.id;
 
       downloadSdk({ path: item.id })
         .then((rsp) => {
-          // this.$notify({
-          //   type: "success",
-          //   message: "绠楁硶宸插畨瑁�"
-          // });
           item.upgradeLoading = false;
           //this.downloading = false;
           this.downloadItem = "";
+          this.$notify({
+            type: "success",
+            message: "绠楁硶瀹夎鎴愬姛"
+          });
         })
         .catch((err) => {
           this.$notify({
@@ -2022,9 +1944,9 @@
 
             }
             .text {
-                 height: 156px;
-    overflow: auto;
-    padding: 0 15px 0px 15px;
+                height: 156px;
+              overflow: auto;
+              padding: 0 15px 0px 15px;
 
 
               .single-desc {

--
Gitblit v1.8.0