Browse Source

后台管理详情页接口联调

chaihaorui 1 year ago
parent
commit
83b54b4447

+ 40 - 18
src/pages/index/components/entityDetail.vue

@@ -7,28 +7,24 @@
7 7
       </div>
8 8
       <div class="basic-info">
9 9
         <div class="basic-info-content" v-for="(item, index) in basicInfo" :key="index">
10
-          <div class="basic-info-title">
10
+          <div class="basic-info-title clearfix">
11 11
             <div class="left">{{ item.title }}</div>
12 12
             <div class="right">
13
-              <span v-if="item.isListing" class="right-item">
13
+              <span v-if="renderBasicValue('isShelves')" class="right-item">
14 14
                 <img src="../../../assets/image/u1723.png" alt="">
15 15
                 已上架
16 16
               </span>
17
-              <span @click.stop="">
18
-                <span v-if="!item.isListing" class="active right-item"  @click="handleUp(item.id)">
19
-                  <img src="../../../assets/image/u1723.png" alt="">
20
-                  上架
21
-                </span>
17
+              <span v-if="!renderBasicValue('isShelves')" class="active right-item"  @click="handleUp(item.id)">
18
+                <img src="../../../assets/image/u1723.png" alt="">
19
+                上架
22 20
               </span>
23
-              <span v-if="!item.isListing"  class="right-item">
21
+              <span v-if="!renderBasicValue('isShelves')"  class="right-item">
24 22
                 <img src="../../../assets/image/u1720.png" alt="">
25 23
                 已下架
26 24
               </span>
27
-              <span @click.stop="">
28
-                <span v-if="item.isListing" class="active right-item" @click="handleDown(item.id)">
29
-                  <img src="../../../assets/image/u1720.png" alt="">
30
-                  下架
31
-                </span>
25
+              <span v-if="renderBasicValue('isShelves')" class="active right-item" @click="handleDown(item.id)">
26
+                <img src="../../../assets/image/u1720.png" alt="">
27
+                下架
32 28
               </span>
33 29
             </div>
34 30
           </div>
@@ -83,7 +79,7 @@ import data from './entityDetailData'
83 79
 import collectPentacle from '@/assets/image/entityDetail/u1517.svg'
84 80
 import unCollectPentacle from '@/assets/image/entityDetail/u3076.svg'
85 81
 import backIcon from '@/assets/image/entityDetail/u1522.png'
86
-
82
+import backApi from "@/api/index/search.js";
87 83
 export default {
88 84
   data() {
89 85
     let baseInfo = {}
@@ -239,11 +235,36 @@ export default {
239 235
     handleReturn() {
240 236
       this.$router.go(-1)
241 237
     },
242
-    handleDown() {
243
-      console.log('down')
238
+    handleDown(id) {
239
+      const params = this.getListingParam(id)
240
+      backApi.batchDownShelves(params).then(res => {
241
+        if (res.success) {
242
+          this.$message({ type: 'success', message: '下架成功!' })
243
+          this.getData()
244
+        }
245
+      })
244 246
     },
245
-    handleUp() {
246
-      console.log('up')
247
+    handleUp(id) {
248
+      const params = this.getListingParam(id)
249
+      backApi.batchUpShelves(params).then(res => {
250
+        if (res.success) {
251
+          this.$message({ type: 'success', message: '上架成功!' })
252
+          this.getData()
253
+        }
254
+      })
255
+    },
256
+    getListingParam(id) {
257
+      const params = {resourceType: 'theme', resourceIds: [id],}
258
+      if (this.type === 'special') {
259
+        params.resourceType = 'specialSubject'
260
+      }
261
+      if (this.type === 'target') {
262
+        params.resourceType = 'index'
263
+      }
264
+      if (this.type === 'api' || this.type === 'message') {
265
+        params.resourceType = 'service'
266
+      }
267
+      return params
247 268
     }
248 269
   }
249 270
 };
@@ -294,6 +315,7 @@ export default {
294 315
       margin-right: 10px;
295 316
     }
296 317
     .active{
318
+      cursor: pointer;
297 319
       color: #0000FF;
298 320
       z-index: 10;
299 321
     }

+ 5 - 0
src/pages/index/components/searchPage.vue

@@ -475,6 +475,11 @@ export default {
475 475
     }
476 476
     .list-wrap {
477 477
       width: 75%;
478
+      .empty-block{
479
+        height: 300px;
480
+        text-align: center;
481
+        line-height: 200px;
482
+      }
478 483
       .entity-card {
479 484
         cursor: pointer;
480 485
         width: 100%;