From 98710e70bb52e761a1769c6454a290040b610aee Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@iotlink.com>
Date: 星期三, 07 四月 2021 18:20:46 +0800
Subject: [PATCH] 在请求index.js时添加参数,解决缓存的问题

---
 src/pages/ai/index/App.vue |  929 +++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 596 insertions(+), 333 deletions(-)

diff --git a/src/pages/ai/index/App.vue b/src/pages/ai/index/App.vue
index 10345bb..679fc32 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"
@@ -97,7 +56,7 @@
                               </div>
                               <div
                                 class="info-onmask"
-                                @click="checkDetail(item)"
+                                @click="checkDetail(item, 'active')"
                               >
                                 鏌ョ湅璇︽儏
                               </div>
@@ -111,7 +70,7 @@
                                 >
                                 <el-button
                                   v-if="item.isUpgrade"
-                                  @click="donwload(item)"
+                                  @click="donwload(item,0)"
                                   type="warning"
                                   size="small"
                                   class="bot-btn"
@@ -150,7 +109,6 @@
                         </div>
                       </div>
                     </div>
-                    <!-- </draggable> -->
                     <div
                       class="wrap-box"
                       v-for="item in notInstalledList"
@@ -161,12 +119,28 @@
                         v-loading="downloading && downloadItem == item.id"
                       >
                         <div class="mask">
-                          <el-button
-                            type="primary"
-                            class="bot-btn"
-                            @click="donwload(item)"
-                            >瀹夎</el-button
-                          >
+                           <div class="left-top">
+                                <div v-if="item.installed">褰撳墠鐗堟湰:{{ item.version }}</div>
+                                <div v-if="item.remoteVersion">
+                                  鏈�鏂扮増鏈�:{{ item.remoteVersion }}
+                                </div>
+                              </div>
+                              <div
+                                class="info-onmask"
+                                @click="checkDetail(item, 'activeNotInstall')"
+                              >
+                                鏌ョ湅璇︽儏
+                              </div>
+                              <div class="mask-btn">
+                                <el-button
+                                 @click="donwload(item,1)"
+                                  type="primary"
+                                  class="bot-btn"
+                                  >瀹夎</el-button
+                                >
+                                
+                              </div>
+                  
                         </div>
                         <div class="click-download" title="涓嬭浇">
                           <span class="iconfont iconxiazai1"></span>
@@ -232,15 +206,16 @@
                                   鏈�鏂扮増鏈�:{{ item.remoteVersion }}
                                 </div>
                               </div>
+                                  <!-- v-if="!item.isDefault" -->
                               <div
                                 class="info-onmask"
-                                @click="checkDetail(item)"
+                                @click="checkDetail(item,'active')"
                               >
                                 鏌ョ湅璇︽儏
                               </div>
                               <div class="mask-btn">
                                 <el-button
-                                  v-if="!item.isDefault"
+                                  v-show="!item.isDefault"
                                   @click="unLoad(item)"
                                   type="primary"
                                   size="small"
@@ -301,6 +276,7 @@
                             element-loading-background="rgba(0,0,0,.8)"
                           >
                             <div class="mask">
+                             
                               <el-button
                                 size="small"
                                 type="primary"
@@ -376,7 +352,7 @@
                       <div class="list-choose-item-left">
                         <div class="list-complete-item-handle">
                           <div class="alg-icon svg-wrap">
-                            <div class="mask" @click="actSdkOrApp(item.id)">
+                            <!-- <div class="mask" @click="actSdkOrApp(item.id)">
                               <span
                                 class="iconfont iconyunxiazai"
                                 style="
@@ -387,6 +363,33 @@
                                   left: 45%;
                                 "
                               ></span>
+                            </div> -->
+                            <div
+                              class="mask"
+                              v-if="!item.isDefault || item.isUpgrade"
+                            >
+                              <div class="left-top">
+                                <div>褰撳墠鐗堟湰:{{ item.version }}</div>
+                                <div v-if="item.remoteVersion">
+                                  鏈�鏂扮増鏈�:{{ item.remoteVersion }}
+                                </div>
+                              </div>
+                              <div
+                                class="info-onmask"
+                                @click="actSdkOrApp(item)"
+                              >
+                                鏌ョ湅璇︽儏
+                              </div>
+                              <div class="mask-btn">
+                                <el-button
+                                  @click="actSdkOrApp(item)"
+                                  type="primary"
+                                  size="small"
+                                  class="bot-btn"
+                                  >婵�娲�</el-button
+                                >
+                                
+                              </div>
                             </div>
                             <img
                               v-if="item.iconBlob"
@@ -421,6 +424,9 @@
                   </div>
                   <p class="src-title">搴旂敤杞欢</p>
                   <div class="app-list flex-list">
+                     <div v-if="!unActivedAppList.length" class="empty-tip">
+                      鏆傛棤鏁版嵁
+                    </div>
                     <div
                       class="wrap-box"
                       v-for="item in unActivedAppList"
@@ -429,9 +435,9 @@
                       <div class="list-choose-item-left">
                         <div class="list-complete-item-handle">
                           <div class="alg-icon svg-wrap">
-                            <div
+                            <!-- <div
                               class="mask"
-                              @click="actSdkOrApp(item.id, 'app')"
+                              @click="actSdkOrApp(item, 'app')"
                             >
                               <span
                                 class="iconfont iconyunxiazai"
@@ -443,6 +449,33 @@
                                   left: 45%;
                                 "
                               ></span>
+                            </div> -->
+                             <div
+                              class="mask"
+                              v-if="!item.isDefault || item.isUpgrade"
+                            >
+                              <div class="left-top">
+                                <div>褰撳墠鐗堟湰:{{ item.version }}</div>
+                                <div v-if="item.remoteVersion">
+                                  鏈�鏂扮増鏈�:{{ item.remoteVersion }}
+                                </div>
+                              </div>
+                              <div
+                                class="info-onmask"
+                                @click="actSdkOrApp(item,'app')"
+                              >
+                                鏌ョ湅璇︽儏
+                              </div>
+                              <div class="mask-btn">
+                                <el-button
+                                  @click="actSdkOrApp(item,'app')"
+                                  type="primary"
+                                  size="small"
+                                  class="bot-btn"
+                                  >婵�娲�</el-button
+                                >
+                                
+                              </div>
                             </div>
                             <img
                               v-if="item.iconBlob"
@@ -474,78 +507,12 @@
                     </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">
-                  <el-badge class="update-badge" :value="updateNum"
+                  <el-badge class="update-badge" :value="updateNum" :hidden="updateNum==0"
                     >鏇存柊</el-badge
                   >
                 </span>
@@ -560,8 +527,8 @@
                     >
                   </div>
                   <div class="flex-list">
-                    <div v-if="!hasNewVersionSdk.length" class="empty-tip">
-                      鏆傛棤鏁版嵁锛岃绋嶅悗閲嶈瘯...
+                    <div v-if="hasNewVersionSdk.length==0" class="empty-tip">
+                      {{errMsg?errMsg:"鏆傛棤鏁版嵁"}}
                     </div>
                     <div
                       class="wrap-box"
@@ -593,7 +560,7 @@
                               </div>
                               <div
                                 class="info-onmask"
-                                @click="checkDetail(item)"
+                                @click="checkDetail(item,'active')"
                               >
                                 鏌ョ湅璇︽儏
                               </div>
@@ -607,7 +574,7 @@
                                 >
                                 <el-button
                                   v-if="item.isUpgrade"
-                                  @click="donwload(item)"
+                                  @click="donwload(item,0)"
                                   type="warning"
                                   size="small"
                                   class="bot-btn"
@@ -649,7 +616,7 @@
                   </div>
                   <div class="flex-list">
                     <div v-if="!hasNewVersionApp.length" class="empty-tip">
-                      鏆傛棤鏁版嵁锛岃绋嶅悗閲嶈瘯...
+                      鏆傛棤鏁版嵁
                     </div>
                     <div
                       class="wrap-box"
@@ -680,7 +647,7 @@
                               </div>
                               <div
                                 class="info-onmask"
-                                @click="checkDetail(item)"
+                                @click="checkDetail(item,'active')"
                               >
                                 鏌ョ湅璇︽儏
                               </div>
@@ -792,15 +759,15 @@
       @close="closeDial"
     >
     <!-- <el-button-group> -->
-      <div class="button-group">
-  <el-button   plain size="small" @click="backwards" :disabled="backDisable"> &#60; </el-button>
+      <div class="button-group" v-show="!backDisable||!forwardDisable">
+  <el-button    size="small" @click="backwards" :disabled="backDisable"> <span>&#60;</span> </el-button>
   <!-- <el-button type="primary" size="small" icon="el-icon-arrow-left"></el-button> -->
-  <el-button   plain size="small" @click="forwards" :disabled="forwardDisable">></el-button>
+  <el-button    size="small" @click="forwards" :disabled="forwardDisable">></el-button>
   <!-- <el-button type="primary" size="small"><i class="el-icon-arrow-right el-icon--right"></i></el-button> -->
 
       </div>
 <!-- </el-button-group> -->
-      <div class="dialog-title" slot="title">{{curCheckTarget.sdk_type===undefined?"搴旂敤璇︽儏":"绠楁硶璇︽儏"}}</div>
+      <div class="dialog-title" slot="title">{{isSDKDialog?"绠楁硶璇︽儏":"搴旂敤璇︽儏"}}</div>
       <div class="dialog-content">
         <div class="box-top">
           <div class="top-left">
@@ -845,57 +812,59 @@
             <div class="summary">
               <div class="icon">
                 <img
-                  v-if="curCheckTarget.iconBlob"
+                  v-if="productDetail.iconBlob"
                   class="baseImg"
                   :src="
-                    curCheckTarget.iconBlob.indexOf(',') > 0
-                      ? curCheckTarget.iconBlob
-                      : `data:image/png;base64,${curCheckTarget.iconBlob}`
+                    productDetail.iconBlob.indexOf(',') > 0
+                      ? productDetail.iconBlob
+                      : `data:image/png;base64,${productDetail.iconBlob}`
                   "
                   alt
                 />
               </div>
               <div class="right-desc">
-                <div class="name">{{ productDetail.productName }}</div>
+                  
+                <div class="name"><el-tooltip class="" effect="dark" :content="productDetail.productName  " placement="right-start">
+                  <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" color="#fff">搴旂敤</el-tag>
-                  <el-tag type="info" color="#fff">绠楁硶</el-tag>
-                  <el-tag type="info" color="#fff">杞欢</el-tag>
-                  <!-- <span
-                  class="tag"
-                >搴旂敤</span>
-                <span
-                  class="tag"
-                >绠楁硶</span>
-                <span
-                  class="tag"
-                >杞欢</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>
                 </div>
                 <div class="btns">
-                  <el-button size="medium" type="warning" @click="upgrade">{{
+                  <el-button size="small" type="warning"  v-if="needToUpgradeInWin||productDetail.isUpgrade" @click="upgradeSDKinWin" >{{
                     isUpgrading ? "鍗囩骇涓�.." : "鍗囩骇"
                   }}</el-button>
-                  <el-button size="medium" type="primary" @click="unload"
-                    >鍗歌浇</el-button
-                  >
-                  <el-button size="medium" type="success">鎵撳紑</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&&!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>
+               
               </div>
             </div>
+            <div class="jihuo-input" v-if="showInputCode">
+                        <el-input size="small"
+                          v-model="activeCode"
+                          placeholder="00000-00000-00000-00000-00000"
+                          @blur="getCodeDetail"
+                        ></el-input>
+                         <el-button type="primary" size="small" @click="actived"
+                          >婵�娲�</el-button
+                        >
+                           <el-button type="primary" size="small" @click="cancelActivate"
+                          >鍙栨秷</el-button
+                        >
+                      </div>
             <div class="product-intruduction">
-              <div class="part-title">绠�浠�</div>
+              <div class="part-title" v-if="!showInputCode">绠�浠�</div>
               <div class="text">
                 <div class="single-desc">
                   <div>鐗堟湰锛�</div>
                   <div>
                     {{
                       productDetail.productVersion === ""
-                        ? "鏆傛棤鏁版嵁"
+                        ? "鏆傛棤"
                         : productDetail.productVersion
                     }}
                   </div>
@@ -905,7 +874,7 @@
                   <div>
                     {{
                       productDetail.description === ""
-                        ? "鏆傛棤鏁版嵁"
+                        ? "鏆傛棤"
                         : productDetail.description
                     }}
                   </div>
@@ -915,7 +884,7 @@
                   <div>
                     {{
                       productDetail.summary === ""
-                        ? "鏆傛棤鏁版嵁"
+                        ? "鏆傛棤"
                         : productDetail.summary
                     }}
                   </div>
@@ -926,7 +895,7 @@
         </div>
         <div class="box-bottom">
           <div class="bot-left">
-            <div class="part-title">鍔熻兘鐗圭偣</div>
+            <div class="part-title">{{isSDKDialog?"搴旂敤鍦烘櫙":"鍔熻兘鐗圭偣"}}</div>
             <div class="list-zone">
               <div
                 class="list-item"
@@ -934,12 +903,12 @@
                 :key="index"
               >
                 <el-tag type="" size="small" effect="dark">
-                  {{ item.title === "" ? "鏍囬鏆傛棤鏁版嵁" : item.title }}
+                  {{ item.title === "" ? "鏆傛棤鏁版嵁" : item.title }}
                 </el-tag>
                 <div class="desc">
                   {{
                     item.desc === ""
-                      ? "璇ユ绱㈤噰鐢ㄥぇ鏁版嵁鏋舵瀯锛屽垎甯冨紡鏁版嵁澶勭悊锛屽彲鏀寔娴烽噺鏁版嵁澶嶆潅妫�绱㈡绉掔骇杩斿洖锛岃璁℃湁鏅鸿兘妫�绱㈡锛屾悳绱㈠唴瀹瑰皢鏍规嵁TF/IDF绠楁硶璁$畻鎵�寰楀緱鍒嗭紝璇ョ畻娉曢�氳繃姝ゅ唴瀹瑰尮閰嶇▼搴︼紝璇嶉鏁帮紝璇嶉暱鍗犳瘮绛夛紝璁$畻鍑哄悓鎵�鎼滃唴瀹圭殑绗﹀悎搴︼紝杩斿洖绗﹀悎搴︽渶楂樼殑鏁版嵁锛岃嫢绗﹀悎搴︿竴鑷达紝灏嗚繑鍥炴嵁浠婃渶杩戠殑鏁版嵁"
+                      ? "鏆傛棤鏁版嵁"
                       : item.desc
                   }}
                 </div>
@@ -970,16 +939,58 @@
                     "
                     alt
                   />
-                  <div class="icon-name">
-                    {{ item.name === "" ? "鏆傛棤鏁版嵁" : item.name }}
+
+                <div class="icon-name">
+                  <el-tooltip class="" effect="dark" :content="item.name === '' ? '鏆傛棤鏁版嵁':item.name" placement="top-start">
+                  <span>{{ item.name === "" ? "鏆傛棤鏁版嵁" : item.name }}</span>
+                </el-tooltip>
                   </div>
+                  
                 </div>
                 <div class="look-button">
-                  <el-button type="primary" size="small" @click="checkInWindow(item)">鏌ョ湅</el-button>
+                  <el-button type="primary" size="mini" @click="checkInWindow(item)">鏌ョ湅</el-button>
                 </div>
               </div>
             </div>
           </div>
+        </div>
+      </div>
+    </el-dialog>
+    <el-dialog 
+    :visible.sync="showActivateSuccess"
+    title="婵�娲绘垚鍔燂紒"
+  width="30%"
+  class="active-Dial"
+  :before-close="handleClose"
+    >
+      <div class="dialog-active">
+        <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>
+        </ul>
+        <div class="text-right">
+          <el-button type="primary" @click="checkMyAlgorith"
+            >纭畾</el-button
+          >
+          <p class="tip">鎻愮ず锛氳鍦ㄢ�滃凡婵�娲烩�濅腑鏌ョ湅骞跺畨瑁呯畻娉�</p>
         </div>
       </div>
     </el-dialog>
@@ -1004,6 +1015,7 @@
   actApp,
 } from "@/api/app";
 
+import bus from '@/plugin/bus'
 import FileUploader from "@/components/subComponents/FileUpload/index";
 export default {
   name: "algorithmManage",
@@ -1060,17 +1072,20 @@
       downloadItem: "",
       downloading: false,
       direction: "rtl",
-      actDrawerShow: false,
       actStep: 0,
+      showActivateSuccess:false,
       activeCode: "",
       isInstall: false,
       installDialogVisible: false,
       installPackage: {},
       installAppPackage: null,
       installSdkPackage: null,
+      isActive:true,
+      isDefaultApp:false,
       installPercentage: 0,
       unActivedSDKList: [],
       unActivedAppList: [],
+      isSDKDialog:true,
       //actSdkId: '',
       actType: "",
       actId: "",
@@ -1100,6 +1115,10 @@
       forwardStack: [],
       backDisable:true,
       forwardDisable:true,
+      showInputCode:false,
+      needToUpgradeInWin:false,
+      errMsg:"",
+      showInstallNotActive:false
     };
   },
   directives: {
@@ -1109,12 +1128,14 @@
       },
     },
   },
+
   mounted() {
     // 鑾峰彇鎵�鏈夊簲鐢�
     this.autoRefreshAppAndSdkState();
 
     this.getUnActivedList();
     this.getUnActivedAppList();
+    
   },
   beforeDestroy() {
     this.autoRefresh = false;
@@ -1128,7 +1149,7 @@
     batchUpdate(type) {
       if (type == "sdk") {
         this.hasNewVersionSdk.forEach((sdk) => {
-          this.donwload(sdk);
+          this.donwload(sdk,0);
         });
       } else {
         this.hasNewVersionApp.forEach((app) => {
@@ -1141,14 +1162,35 @@
       this.productDetail = {}
       this.otherProducts = []
     },
-    checkDetail(item) {
+    checkDetail(item,type) {
+      if (type =='inactive') {
+        this.isActive =false
+         this.showInstallNotActive = false
+        this.showInputCode = false
+      }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
       this.resetStack()
-      this.curCheckTarget = item;
-      // debugger
+      if (item.sdk_type===undefined) {
+       this.isSDKDialog=false
+      }else{
+       this.isSDKDialog=true
+      }
       this.productDetailVisible = true;
       let _this = this;
       getAppDetail({ id: item.id }).then((res) => {
         _this.productDetail = res.data.detail;
+        _this.productDetail.isUpgrade = item.isUpgrade
+        _this.productDetail.iconBlob = item.iconBlob
+
         _this.otherProducts = res.data.randoms;
 
       });
@@ -1161,28 +1203,47 @@
 
     },
     checkInWindow(item){
-      this.backStack.push(this.productDetail)
-      console.log(this.backStack);
+      this.backStack.push([this.productDetail, this.otherProducts])
       this.backDisable = false
-      this.curCheckTarget = item;
-      // this.productDetailVisible = true;
+      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
-      // forwardDisable:false,
       return
       }
-      console.log(this.backStack);
 
-      // debugger
-   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.checkIsDefOrNot(this.productDetail.productBaseId) 
+   this.otherProducts = item[1]
   this.forwardDisable=false
  if (this.backStack.length ==0) {
         this.backDisable = true
@@ -1194,12 +1255,13 @@
         this.forwardDisable=true
         return
       }
-      // debugger
-      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
       }
@@ -1231,7 +1293,6 @@
           }
         })
         .catch((e) => {
-          console.log(e);
           this.isInstall = false;
           this.$message({
             type: "error",
@@ -1239,17 +1300,7 @@
           });
         });
     },
-    upgrade() {
-      this.isUpgrading = !this.isUpgrading;
-      setTimeout(() => {
-        this.$notify({
-          title: "鎴愬姛",
-          message: "鍗囩骇瀹屾垚",
-          type: "success",
-        });
-        this.isUpgrading = !this.isUpgrading;
-      }, 1200);
-    },
+
     downloadApp(app, action) {
       if (action == "upgrade") {
         app.upgradeLoading = true;
@@ -1261,19 +1312,16 @@
       installApp({ path: app.id })
         .then((res) => {
           if (res && res.success) {
+            _this.$notify({
+               title: "鎴愬姛",
+               message: "瀹夎搴旂敤鎴愬姛",
+               type: "success",
+             });
             setTimeout(() => {
               if (action == "upgrade") {
                 app.upgradeLoading = false;
-                // _this.$notify({
-                //   type: 'success',
-                //   message: '鍗囩骇鎴愬姛'
-                // });
               } else {
                 app.installLoading = false;
-                // _this.$notify({
-                //   type: 'success',
-                //   message: '瀹夎鎴愬姛'
-                // });
               }
               // _this.getAllApps();
               window.parent.postMessage(
@@ -1283,10 +1331,16 @@
                 "*"
               );
             }, 3000);
+          }else {
+        
           }
         })
         .catch((e) => {
-          console.log(e);
+            _this.$notify({
+              title: "瀹夎澶辫触",
+              message: e.data,
+              type: "warning",
+            });
           if (action == "upgrade") {
             app.upgradeLoading = false;
           } else {
@@ -1324,39 +1378,14 @@
       this.storeApps = sArry;
       this.hasNewVersionApp = nArry;
     },
-    //鍗歌浇绠楁硶
-    unLoadSdk(sdk) {
-      let _this = this;
-      this.$confirm("纭畾瑕佸嵏杞借绠楁硶鍚�?", "鎻愮ず")
-        .then(() => {
-          sdk.unloadLoading = true;
-          removeSdk({ sdkId: sdk.id })
-            .then((res) => {
-              if (res && res.success) {
-                sdk.unloadLoading = false;
-                _this.getAllSdk();
-                window.parent.postMessage(
-                  {
-                    msg: "AppUpdate",
-                  },
-                  "*"
-                );
-              }
-            })
-            .catch((e) => {
-              console.log(e);
-              sdk.unloadLoading = false;
-            });
-        })
-        .catch((e) => {
-          console.log(e);
-        });
-    },
-    //鍗歌浇搴旂敤
+
+    //鍗歌浇
     unLoad(app) {
       let _this = this;
       this.$confirm("纭畾瑕佸嵏杞借搴旂敤鍚�?", "鎻愮ず")
         .then(() => {
+      _this.productDetailVisible = false
+
           app.unloadLoading = true;
           removeApp({ appId: app.id })
             .then((res) => {
@@ -1369,6 +1398,11 @@
                   },
                   "*"
                 );
+                _this.$notify({
+                  title: "鎴愬姛",
+                  message: "鍗歌浇搴旂敤鎴愬姛",
+                  type: "success",
+                });
               }
             })
             .catch((e) => {
@@ -1380,20 +1414,19 @@
           console.log(e);
         });
     },
-    // actSdk (id) {
-    //   this.actSdkId = id;
-    //   this.actDrawerShow = true;
-    //   this.actStep = 0;
-    //   this.activeCode = '';
-    //   this.activedSdkOrApp = this.newActInfo()
-    // },
-    actSdkOrApp(id, type = "sdk") {
+
+    actSdkOrApp(item, type = "sdk") {
+      this.checkDetail(item, 'inactive')
       this.actType = type;
-      this.actId = id;
-      this.actDrawerShow = true;
+      this.actId = item.id;
       this.actStep = 0;
       this.activeCode = "";
       this.activedSdkOrApp = this.newActInfo();
+    },
+
+    cancelActivate(){
+      this.showInputCode= false
+      this.activeCode = ""
     },
     newActInfo() {
       return {
@@ -1421,12 +1454,21 @@
     },
     actived() {
       let _this = this;
+      if (this.activeCode.trim()=="") {
+        this.$notify({
+          type: "error",
+          message: "婵�娲荤爜涓嶈兘涓虹┖",
+        });
+        return
+      }
       if (this.actType == "sdk") {
         //婵�娲荤畻娉�
         actPageAlg(this.actId, this.activeCode)
           .then((res) => {
             if (res.data.isSuccess) {
+              this.productDetailVisible = false
               _this.activedSdkOrApp = res.data.successMsg;
+              this.showActivateSuccess=true
               _this.actStep++;
               _this.getUnActivedList();
               _this.getAllSdk();
@@ -1445,7 +1487,9 @@
         actApp(this.actId, this.activeCode)
           .then((res) => {
             if (res.data.isSuccess) {
+              this.productDetailVisible = false
               _this.activedSdkOrApp = res.data.successMsg;
+              this.showActivateSuccess=true
               _this.actStep++;
               _this.getUnActivedAppList();
               _this.getAllApps();
@@ -1463,7 +1507,7 @@
     },
     getCodeDetail() {},
     checkMyAlgorith() {
-      this.actDrawerShow = false;
+      this.showActivateSuccess = false;
       this.activeName = "myAlgorithm";
     },
     onFileUpload(file) {
@@ -1503,24 +1547,11 @@
           });
         });
     },
-    unload() {
-      this.$confirm("纭畾瑕佸嵏杞借绠楁硶涔堬紵", "鎻愮ず", {
-        confirmButtonText: "纭畾",
-        cancelButtonText: "鍙栨秷",
-        type: "warning",
-      })
-        .then(() => {
-          this.$message({
-            type: "success",
-            message: "鍗歌浇鎴愬姛!",
-          });
-        })
-        .catch(() => {
-          // this.$message({
-          //   type: 'info',
-          //   message: '宸插彇娑堝嵏杞�'
-          // });
-        });
+    openApp(){
+      let message = 'toOpenApp?' + this.productDetail.productBaseId;
+      window.parent.postMessage({
+        msg: message
+      }, "*")
     },
 
     onFileAdded(f) {
@@ -1548,27 +1579,155 @@
 
           //绠楁硶杞欢 宸插畨瑁呭叾涓寘鍚緟鍗囩骇 鏈畨瑁�
           item.installed ? installedList.push(obj) : unInstalledList.push(obj);
+          item.isUpgrade ? hasNewVersionList.push(obj): null
         });
       }
       this.installedList = installedList;
       this.notInstalledList = unInstalledList;
       this.hasNewVersionSdk = hasNewVersionList;
     },
+    unloadSDKinWin(){
 
-    donwload(item) {
+      let appToUnload
+      let sdkToUnload
+      if (this.productDetail.productTypeName=="搴旂敤") {
+        appToUnload= this.installedApps.find((item)=>{
+          return item.id == this.productDetail.productBaseId
+        })
+        this.unLoad(appToUnload)
+      }else{
+          sdkToUnload= this.installedList.find((item)=>{
+          return item.id == this.productDetail.productBaseId
+        })
+        this.unLoadSdk(sdkToUnload)
+      }
+    },
+    //鍗歌浇绠楁硶
+    unLoadSdk(sdk) {
+      let _this = this;
+      this.$confirm("纭畾瑕佸嵏杞借绠楁硶鍚�?", "鎻愮ず")
+        .then(() => {
+      _this.productDetailVisible = false
+          sdk.unloadLoading = true;
+          removeSdk({ sdkId: sdk.id })
+            .then((res) => {
+              if (res && res.success) {
+                sdk.unloadLoading = false;
+                this.$notify({
+                title: "鎴愬姛",
+                message: "鍗歌浇瀹屾垚",
+                type: "success",
+              });
+                _this.getAllSdk();
+                window.parent.postMessage(
+                  {
+                    msg: "AppUpdate",
+                  },
+                  "*"
+                );
+              }
+            })
+            .catch((e) => {
+              console.log(e);
+              sdk.unloadLoading = false;
+            });
+        })
+        .catch((e) => {
+          console.log(e);
+        });
+    },
+    upgradeSDKinWin(){
+
+      this.isUpgrading = !this.isUpgrading;
+
+      let _this = this;
+      if (this.productDetail.productTypeName=="搴旂敤") {
+      installApp({ path: this.productDetail.productBaseId})
+        .then((res) => {
+          if (res && res.success) {
+         this.$notify({
+          title: "鎴愬姛",
+          message: "鍗囩骇瀹屾垚",
+          type: "success",
+        });
+        this.needToUpgradeInWin=false
+        this.productDetail.isUpgrade = false
+        this.isUpgrading = !this.isUpgrading;
+        
+          }
+        })
+        .catch((e) => {
+            _this.$notify({
+              title: "鍗囩骇澶辫触",
+              message: e.data,
+              type: "warning",
+            });
+             this.isUpgrading = !this.isUpgrading;
+        });
+
+      // 寮�鍚嚜鍔ㄥ埛鏂�
+      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",
+        });
+      }).catch((err)=>{
+        this.$notify({
+          title: "鍗囩骇澶辫触",
+          message: err.data,
+          type: "warning",
+        });
+        this.isUpgrading = !this.isUpgrading;
+      })
+      this.sdkUpgreading = true;
+      }
+
+
+      
+    },
+    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,typ) {
       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: typ==1? "绠楁硶瀹夎鎴愬姛":"绠楁硶鍗囩骇鎴愬姛"
+          });
         })
         .catch((err) => {
           this.$notify({
@@ -1583,7 +1742,6 @@
       this.sdkUpgreading = true;
     },
     inputBlur(item) {
-      // console.log(item, '淇敼鍚嶇О')
       this.$set(item, "isEdit", false);
     },
     handleTabClick() {},
@@ -1644,29 +1802,44 @@
   }
   .product-detail-dialog {
     .dialog-title{
-      font-size: 14px;
+          font-size: 13px;
+
     }
     .el-dialog {
-      width: 60%;
+      width: 50%;
       min-width: 920px;
       position: relative;
     }
     .el-dialog__header {
       text-align: center;
-      padding: 15px;
+          padding: 6px;
+
+      .el-dialog__headerbtn {
+          position: absolute;
+             top: 5px;
+
+          right: 20px;
+          padding: 0;
+          background: transparent;
+          outline: none;
+          cursor: pointer;
+          font-size: 20px;
+      }
     }
     .el-dialog__body {
       background-color: rgba(222, 225, 230, 1);
-      padding: 10px 5px;
+          padding: 8px 3px;
       .button-group{
         position: absolute;
-            top: 9px;
+               top: 3px;
+
             left:6px;
                 left: 10px;
+      .el-button--small {
+        padding: 5px 12px;
 
+    }
         button{
-          // margin-right: 6px;
-          background-color: #ecf5ff;
           font-size: 18px;
         line-height: 12px;  
         }
@@ -1675,22 +1848,28 @@
 
     .dialog-content {
       .box-top {
-        height: 380px;
+        height: 330px;
         .top-left {
           float: left;
           width: 55%;
           background-color: rgba(253, 253, 253, 1);
           margin: 0 0.5%;
-          height: 380px;
+          height: 330px;
+          border-radius: 2px;
           .banner {
         text-align: center;
-        margin-top: 30px;
+        margin-top: 3px;
            video {
 
-            margin: 20px auto;
+            margin: 0px auto;
+                 margin-top: 23px;
+
             width: 443px;
           height: 277px;
-            // background: aquamarine;
+          }
+          img{
+                max-width: 90%;
+                     margin-top: 28px;
           }
           }
         }
@@ -1698,30 +1877,40 @@
           float: left;
           width: 43%;
           margin: 0 0.5%;
-          // background-color: lightgoldenrodyellow;
-          height: 380px;
+          height: 330px;
           background-color: rgba(253, 253, 253, 1);
           position: relative;
+          border-radius: 2px;
+          overflow: hidden;
           .summary {
-            height: 140px;
-            margin: 5px;
+                height: 120px;
+
+
+                margin: 5px 5px 0 5px;
+
             .icon {
-              margin: 0 5px;
-              margin-top: 5px;
+             margin: 0 10px;
+                margin-top: 8px;
+
               float: left;
               .baseImg{
-                max-width: 128px;
-                max-height: 128px;
+         max-width: 106px;
+    max-height: 106px;
               }
             }
+            
             .right-desc {
               float: left;
               position: absolute;
-              left: 150px;
+                 left: 140px;
               .name {
-                font-size: 30px;
-                // font-weight: bold;
+                    font-size: 28px;
+
                 margin-bottom: 5px;
+                text-overflow: ellipsis;
+          white-space: nowrap;
+          overflow: hidden;
+          width: 250px;
               }
               .tags {
                 margin-bottom: 10px;
@@ -1730,90 +1919,120 @@
                 }
               }
             }
+           
           }
+           .jihuo-input{
+             margin-left: 10px;
+             margin-bottom: 10px;
+              .el-input{
+                float: left;
+                width: 63%;
+                margin-bottom: 8px;
+                margin-right: 10px;
+              }
+              el-button{
+                float: left;
+              }
+            }
           .product-intruduction {
-            height: 230px;
-            // background-color: lightgrey;
+            height: 200px;
+               margin-top: 3px;
+
             .part-title {
               display: block;
-              line-height: 35px;
+                  line-height: 20px;
+
               font-size: 16px;
               margin-left: 24px;
-              // height: 30px;
               border-bottom: 3px solid #3d68e1;
               width: fit-content;
-              margin-bottom: 8px;
-              height: 35px;
+                 height: 26px;
+            margin-bottom: 8px;
+
             }
             .text {
-              padding: 10px 15px;
+                height: 156px;
+              overflow: auto;
+              padding: 0 15px 0px 15px;
+
+
               .single-desc {
-                margin-bottom: 10px;
+                   margin-bottom: 10px;
+                        font-size: 13px;
+
+
               }
             }
           }
         }
       }
       .box-bottom {
-        margin-top: 10px;
-        height: 260px;
+            margin-top: 8px;
+
+        height: 240px;
         .bot-left {
           width: 49%;
-          height: 260px;
+          height: 240px;
           background-color: rgba(253, 253, 253, 1);
           margin: 0 0.5%;
+          border-radius: 2px;
           float: left;
-          // background-color: lightblue;
           .part-title {
             display: block;
             line-height: 35px;
             font-size: 16px;
             margin-left: 24px;
-            // height: 30px;
             border-bottom: 3px solid #3d68e1;
             width: fit-content;
-            margin-bottom: 8px;
-            height: 35px;
+               margin-bottom: 10px;
+
+              height: 33px;
+
           }
           .list-zone {
             overflow: auto;
-            height: 225px;
-            padding: 0 8px;
+                height: 190px;
+                padding: 0 20px;
             .list-item {
               .desc {
                 background-color: rgba(242, 242, 242, 1.3);
+                      margin: 5px 12px 0 12px;
+                    font-size: 12px;
+                        line-height: 18px;
+
               }
+               margin-bottom: 12px;
             }
           }
         }
         .bot-right {
-          height: 260px;
+          height: 240px;
           float: left;
           background-color: rgba(253, 253, 253, 1);
           width: 49%;
-          // background-color: lightgoldenrodyellow;
           margin: 0 0.5%;
+          border-radius: 2px;
 
           .part-title {
             display: block;
             line-height: 35px;
             font-size: 16px;
             margin-left: 24px;
-            // height: 30px;
             border-bottom: 3px solid #3d68e1;
             width: fit-content;
             margin-bottom: 5px;
-            height: 35px;
+                height: 33px;
+
           }
           .item-zone {
             overflow: auto;
             height: 225px;
-            padding: 0 10px;
+              padding: 0px 12px;
+
             .item {
               height: 165px;
               width: 130px;
               float: left;
-              // text-align: center;
               border-radius: 10px;
               box-shadow: 0px 5px 14px rgba(0, 0, 0, 0.0666666666666667);
               position: relative;
@@ -1823,27 +2042,32 @@
                 margin: 8px;
               }
               .icon {
-                // width: 100%;
-                // height: 68px;
-                // width: 68px;
-                position: absolute;
-                // margin: 0 auto;
                 margin: 0 auto;
-                top: 21%;
-                left: 26%;
                 img {
-                  // display: block;
                   max-width: 60px;
                   max-height: 60px;
+                      position: absolute;
+                top: 20%;
+                left: 26%;
                 }
                 .icon-name {
-                  text-align: center;
+                 text-align: center;
+                position: absolute;
+                top: 61%;
+                   left: 12%;
+            width: 100px;
+            text-overflow: ellipsis;
+            white-space: nowrap;
+            overflow: hidden;
+              font-size: 13px;
+
                 }
               }
               .look-button {
                 position: absolute;
-                left: 28%;
-                top: 75%;
+                      left: 30%;
+
+                top: 76%;
               }
             }
           }
@@ -2004,7 +2228,8 @@
             max-width: 200px;
             .mask {
               width: 100%;
-
+              
+            
               .el-button + .el-button {
                 margin-left: 0 !important;
               }
@@ -2253,6 +2478,7 @@
         flex-wrap: wrap;
         justify-content: center;
         top: 0;
+       
         .bot-btn {
           flex: 1;
         }
@@ -2526,5 +2752,42 @@
     }
   }
 }
+.active-Dial{
+  .el-dialog{
+
+    min-width: 400px;
+  }
+
+  .dialog-active{
+          .desc {
+          padding: 0 30px;
+          margin-bottom: 30px;
+          li {
+            border-bottom: 1px solid #eee;
+            height: 45px;
+            line-height: 45px;
+            font-size: 14px;
+            &:last-child {
+              border-bottom: none;
+            }
+            label {
+              display: inline-block;
+              width: 90px;
+              padding-left: 14px;
+              font-weight: bold;
+            }
+          }
+        }
+        .text-right {
+          padding-right: 30px;
+          text-align: right;
+          .tip {
+            color: #999;
+            line-height: 38px;
+          }
+        }
+}
+}
+
 </style>
 

--
Gitblit v1.8.0