lex 1 年之前
父节点
当前提交
f5381c55f9
共有 1 个文件被更改,包括 12 次插入5 次删除
  1. 12 5
      src/views/user-info/music-operation/index.tsx

+ 12 - 5
src/views/user-info/music-operation/index.tsx

@@ -224,6 +224,7 @@ export default defineComponent({
             musicalInstrumentId: item.id,
             musicalInstrumentName: item.trackName,
             audioFileUrl: item.url,
+            track: item.track,
             audioPlayType: 'PLAY' // SING
           })), // 原音
           musicalInstrumentIds: form.backgroundMp3s
@@ -246,9 +247,15 @@ export default defineComponent({
 
         const tempMp3s: BackgroundMp3[] = []
         for (const i of partNames) {
-          const index = this.cbsInstrumentList.findIndex(
-            cbs => cbs.code?.indexOf(i) > -1
-          )
+          let index = -1
+          this.cbsInstrumentList.forEach((item: any, j: number) => {
+            const code = item.code ? item.code.split(',') : ''
+            for (const p of code) {
+              if (i.indexOf(p) > -1) {
+                index = j
+              }
+            }
+          })
           if (index === -1) {
             resultIndexStatus = true
             break
@@ -256,12 +263,11 @@ export default defineComponent({
 
           const currentItem = this.cbsInstrumentList[index]
           if (currentItem) {
-            console.log(currentItem, 'currentItem')
             tempMp3s.push({
               url: '',
               id: currentItem.id,
               trackName: currentItem.name,
-              track: currentItem.code,
+              track: i,
               loading: currentItem.loading
             })
           }
@@ -275,6 +281,7 @@ export default defineComponent({
 
         this.formated = formated
         this.form.backgroundMp3s = tempMp3s
+        console.log(this.form.backgroundMp3s, '121212', tempMp3s)
       })
     },
     onSubmit() {