From f7f0e44c4be8eb0e77fd310296c3b43bde21e4f9 Mon Sep 17 00:00:00 2001
From: ZZJ <10913410+zzj2100@user.noreply.gitee.com>
Date: 星期四, 23 六月 2022 14:17:01 +0800
Subject: [PATCH] 新增联动场景

---
 src/views/hashrate/AlgManage/index.vue |   59 +++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/src/views/hashrate/AlgManage/index.vue b/src/views/hashrate/AlgManage/index.vue
index c09b0d0..3053435 100644
--- a/src/views/hashrate/AlgManage/index.vue
+++ b/src/views/hashrate/AlgManage/index.vue
@@ -10,7 +10,9 @@
         <div class="algCard" v-for="(item, index) in payAlg" :key="index">
           <img :src="item.logoUrl" alt="" draggable="false" />
           <div class="name">{{ item.productName }}</div>
-          <span class="button pay">璐拱</span>
+          <span class="button pay" @click="toDetail(item.productName)"
+            >璐拱</span
+          >
         </div>
       </div>
 
@@ -18,7 +20,7 @@
       <div class="label freeLabel">
         鍏嶈垂绠楁硶 <span class="des">浠庢澶勬嫋鎷界畻娉曞浘鏍囧畨瑁呭埌璁惧</span>
       </div>
-      <div class="freeList">
+      <div class="freeList scroll">
         <div
           class="algCard"
           v-for="(item, index) in freeAlg"
@@ -32,7 +34,9 @@
             @dragstart="dragStart(item)"
           />
           <div class="name">{{ item.productName }}</div>
-          <span class="button detail">鏌ョ湅璇︽儏</span>
+          <span class="button detail" @click="toDetail(item.productName)"
+            >鏌ョ湅璇︽儏</span
+          >
         </div>
       </div>
     </div>
@@ -71,7 +75,7 @@
           >
             <img src="/images/hashrate/绠楁硶绠$悊绌洪〉闈�.png" alt="" />
             <div class="des">
-              鏆傛湭瀹夎绠楁硶锛屼粠宸︿晶绠楁硶涓績鎷栧埌绠楁硶鍒版澶勶紝鍗冲彲瀹夎
+              鏆傛湭瀹夎绠楁硶锛屼粠宸︿晶绠楁硶涓績绠楁硶鍒版澶勶紝鍗冲彲瀹夎
             </div>
           </div>
         </div>
@@ -164,7 +168,12 @@
             console.log(item);
           }
 
-          item.logoUrl = "/httpImage/" + item.logoUrl;
+          if (
+            item.logoUrl.indexOf("http://apps.smartai.com/httpImage/") === -1
+          ) {
+            item.logoUrl = "/httpImage/" + item.logoUrl;
+          }
+
           if (item.priceBase === 0) {
             this.freeAlg.push(item);
           } else {
@@ -178,7 +187,12 @@
     async getEquipment() {
       const res = await findAllSdk();
       if (res && res.success) {
-        this.equipmentArr = res.data;
+        this.equipmentArr = [];
+        res.data.forEach((item, index) => {
+          if (item.sdkList) {
+            this.equipmentArr.push(item);
+          }
+        });
       }
     },
     //鎷栨嫿寮�濮�
@@ -196,16 +210,21 @@
         sdk_name: this.dragAlg.productName,
       });
 
-      const res = await downloadOrUpgrade({
-        nodeId: devId,
-        path: this.dragAlg.productBaseId,
-        userId: JSON.parse(sessionStorage.getItem("userInfo")).id,
-      });
-      if (res && res.success) {
-        this.$notify({
-          type: "success",
-          message: "鎿嶄綔鎴愬姛,璇风◢鍚�",
+      try {
+        const res = await downloadOrUpgrade({
+          nodeId: devId,
+          path: this.dragAlg.productBaseId,
+          userId: JSON.parse(sessionStorage.getItem("userInfo")).id,
+          inputText: this.dragAlg.productName,
         });
+        if (res && res.success) {
+          this.$notify({
+            type: "success",
+            message: "鎿嶄綔鎴愬姛,璇风◢鍚�",
+          });
+        }
+      } catch (err) {
+        algArr.pop();
       }
 
       this.dragAlg = null;
@@ -252,10 +271,18 @@
       if (res && res.success) {
         this.$notify({
           type: "success",
-          message: "鎿嶄綔鎴愬姛",
+          message: res.msg,
         });
       }
     },
+    toDetail(productName) {
+      this.$router.push({
+        path: "/productDetail",
+        query: {
+          name: productName,
+        },
+      });
+    },
   },
 };
 </script>

--
Gitblit v1.8.0