Browse Source

前台、后台搜索页面批量取消收藏、批量上下架前未选取数据给提示

chaihaorui 1 year ago
parent
commit
91a4cd9127

+ 7 - 0
src/pages/homepage/components/searchPage.vue

@@ -240,6 +240,13 @@ export default {
240 240
     },
241 241
     // 批量取消收藏
242 242
     batchCancelCollect() {
243
+      if (this.selectIds.length === 0) {
244
+        this.$message({
245
+          message: '请先选择要取消的数据!',
246
+          type: 'warning'
247
+        })
248
+        return
249
+      }
243 250
       this.cancelCollect(this.selectIds)
244 251
     },
245 252
     singleCancelCollect (id) {

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

@@ -426,6 +426,13 @@ export default {
426 426
     },
427 427
     // 批量上架
428 428
     batchListing() {
429
+      if (this.selectIds.length === 0) {
430
+        this.$message({
431
+          message: '请先选择要上架的数据!',
432
+          type: 'warning'
433
+        })
434
+        return
435
+      }
429 436
       const params = this.getListingParam()
430 437
       backApi.batchUpShelves(params).then(res => {
431 438
         if (res.success) {
@@ -437,6 +444,13 @@ export default {
437 444
     },
438 445
     // 批量下架
439 446
     batchOffShelf() {
447
+      if (this.selectIds.length === 0) {
448
+        this.$message({
449
+          message: '请先选择要下架的数据!',
450
+          type: 'warning'
451
+        })
452
+        return
453
+      }
440 454
       const params = this.getListingParam()
441 455
       backApi.batchDownShelves(params).then(res => {
442 456
         if (res.success) {