浏览代码

曲目编辑界面改版

yuanliang 1 年之前
父节点
当前提交
6c90c22f4c
共有 2 个文件被更改,包括 35 次插入27 次删除
  1. 33 25
      src/views/music-library/music-sheet/modal/music-operationV2.tsx
  2. 2 2
      vite.config.ts

+ 33 - 25
src/views/music-library/music-sheet/modal/music-operationV2.tsx

@@ -384,7 +384,8 @@ export default defineComponent({
           }
           if (musicSheetType == 'SINGLE') {
             forms.musicSheetSoundList_YZ.forEach((musicSheetSound: any) => {
-              if (forms.multiInstrumentSelection.includes(musicSheetSound.musicalInstrumentId)) {
+              if (forms.musicalInstrumentIdList.includes(musicSheetSound.musicalInstrumentId) &&
+                  forms.multiInstrumentSelection.includes(musicSheetSound.musicalInstrumentId)) {
                 musicSheetSoundList.push({
                   ...musicSheetSound,
                   musicSheetId: props.data.id,
@@ -747,6 +748,14 @@ export default defineComponent({
             item.disabled = !item.enableFlag
 
             state.instrumentIdNameMap.set(item.id + '', item.name)
+
+            forms.musicSheetSoundList_YZ.push({
+              'musicSheetId': props.data.id,
+              'musicalInstrumentId': item.id + '',
+              'musicalInstrumentName': item.name,
+              'audioFileUrl': null,
+              'audioPlayType':'PLAY'
+            });
           })
           state.instrumentList = tempList
         } catch {
@@ -855,21 +864,21 @@ export default defineComponent({
           })
 
           // 初始化演奏
-          forms.musicalInstrumentIdList.forEach((next: any) => {
-            let item = {} as any
-            item.musicSheetId = props.data.id
-            item.musicalInstrumentId = next;
-            item.musicalInstrumentName = state.instrumentIdNameMap.get(next)
-            item.audioPlayType = 'PLAY'
-            for (let i = 0; i < state.musicSheetSoundList.length; i++) {
-              if (state.musicSheetSoundList[i].musicalInstrumentId == next) {
-                item.audioFileUrl = state.musicSheetSoundList[i].audioFileUrl
-                forms.multiInstrumentSelection.push(next)
-                break
+          for (let i = 0; i < state.musicSheetSoundList.length; i++) {
+            for (let j = 0; j < forms.musicSheetSoundList_YZ.length; j++) {
+              let musicalInstrumentId = state.musicSheetSoundList[i].musicalInstrumentId;
+              if (musicalInstrumentId && musicalInstrumentId == forms.musicSheetSoundList_YZ[j].musicalInstrumentId) {
+                forms.musicSheetSoundList_YZ[j].audioFileUrl = state.musicSheetSoundList[i].audioFileUrl
               }
             }
-            forms.musicSheetSoundList_YZ.push(item);
-          })
+          }
+
+          for (let i = 0; i < state.musicSheetSoundList.length; i++) {
+            if (state.musicSheetSoundList[i].musicalInstrumentId) {
+              forms.multiInstrumentSelection.push(state.musicSheetSoundList[i].musicalInstrumentId)
+            }
+          }
+
 
           setOwnerName()
           axios.get(data.xmlFileUrl).then((res: any) => {
@@ -1452,17 +1461,16 @@ export default defineComponent({
                       multiple
                       maxTagCount={2}
                       onUpdateValue={async (value: any) => {
-                        forms.musicSheetSoundList_YZ = [];
                         state.instrumentList.forEach((instrument: any) => {
-                          if (value.includes(instrument.value)) {
-                            forms.musicSheetSoundList_YZ.push({
-                              'musicSheetId': props.data.id,
-                              'musicalInstrumentId': instrument.id + '',
-                              'musicalInstrumentName': instrument.name,
-                              'audioFileUrl': null,
-                              'audioPlayType':'PLAY'
-                            });
-                          }
+                          // if (value.includes(instrument.value)) {
+                          //   forms.musicSheetSoundList_YZ.push({
+                          //     'musicSheetId': props.data.id,
+                          //     'musicalInstrumentId': instrument.id + '',
+                          //     'musicalInstrumentName': instrument.name,
+                          //     'audioFileUrl': null,
+                          //     'audioPlayType':'PLAY'
+                          //   });
+                          // }
                         })
                       }}
                   />
@@ -1611,7 +1619,7 @@ export default defineComponent({
                       return (
                           <>
                             <NGrid cols={1}>
-                              {forms.multiInstrumentSelection.includes(item.musicalInstrumentId) && (
+                              {forms.musicalInstrumentIdList.includes(item.musicalInstrumentId) && forms.multiInstrumentSelection.includes(item.musicalInstrumentId) && (
                                   <NFormItemGi
                                       span={12}
                                       label={item.musicalInstrumentName}

+ 2 - 2
vite.config.ts

@@ -19,9 +19,9 @@ function pathResolve(dir: string) {
 }
 
 // const proxyUrl = 'https://dev.lexiaoya.cn'
-// const proxyUrl = 'http://127.0.0.1:7293/'
+const proxyUrl = 'http://127.0.0.1:7293/'
 // const proxyUrl = 'https://resource.colexiu.com/'
-const proxyUrl = 'https://test.resource.colexiu.com'
+// const proxyUrl = 'https://test.resource.colexiu.com'
 // https://test.resource.colexiu.com/
 
 export default ({ command, mode }: ConfigEnv): UserConfig => {