浏览代码

音频管理 播客专辑 修复新增解除关联bug

DESKTOP-O04BTUJ\muzen 2 年之前
父节点
当前提交
f13a10560d
共有 1 个文件被更改,包括 23 次插入11 次删除
  1. 23 11
      src/views/music/blog/detail.vue

+ 23 - 11
src/views/music/blog/detail.vue

@@ -113,7 +113,7 @@
 import Upload from '@/components/Upload/index.vue'
 import { classifyMixin, platformMixin, payTypeMixin, onOrOffMixin, isFreeMixin } from '@/mixin/index'
 import { selectAnchor } from '@/api/music/anchor'
-import { detail, submit, relieve, checkList} from '@/api/music/blog'
+import { detail, submit, relieve, checkList } from '@/api/music/blog'
 export default {
   mixins: [classifyMixin, platformMixin, payTypeMixin, onOrOffMixin, isFreeMixin],
   components: {
@@ -302,15 +302,25 @@ export default {
 
     // 解除关联
     getDelete() {
-      relieve({
-        id: this.form.id,
-        podcastProgramIds: this.ids
-      }).then(res => {
-        if (res.code === 0) {
-          this.$message.success('解除成功!')
-          this.getDetail()
-        }
-      })
+      if (this.form.id) {
+        relieve({
+          id: this.form.id,
+          podcastProgramIds: this.ids
+        }).then(res => {
+          if (res.code === 0) {
+            this.$message.success('解除成功!')
+            this.getDetail()
+          }
+        })
+      } else {
+        this.ids.map(i => {
+          this.form.adminPodCastProgramDetailResp.map((j, index) => {
+            if(j.id === i) {
+              this.form.adminPodCastProgramDetailResp.splice(index, 1)
+            }
+          })
+        })
+      }
     },
 
     // 确定
@@ -342,7 +352,9 @@ export default {
     // 多选
     handleSelect(e) {
       this.ids = []
-      e.map(i => this.ids.push(i.id))
+      e.map(i => {
+        this.ids.push(i.id)
+      })
     },
 
     // 取消