Browse Source

feat: 云教练预览页切换声轨修改

TIANYONG 1 year ago
parent
commit
f4fba5a52d
2 changed files with 18 additions and 5 deletions
  1. 17 5
      src/views/xiaoku-music/index.tsx
  2. 1 0
      src/views/xiaoku-music/type.ts

+ 17 - 5
src/views/xiaoku-music/index.tsx

@@ -287,11 +287,23 @@ export default defineComponent({
       });
       return temp;
     });
+
+    // 根据musicSheetType返回的值,判断是否显示切换声轨按钮
     const isEnsemble = computed(() => {
-      const details: any = data.list[data.listActive];
-      const musics: any = details?.musicalInstruments;
-      if (musics && musics.length > 1) {
-        return true;
+      // const details: any = data.list[data.listActive];
+      // const musics: any = details?.musicalInstruments;
+      // if (musics && musics.length > 1) {
+      //   return true;
+      // } else {
+      //   return false;
+      // }
+      if (data.list.length) {
+        const musicSheetType: any = data.list[data.listActive]?.musicSheetType;
+        if (musicSheetType === 'SINGLE') {
+          return false;
+        }  else {
+          return true;
+        }
       } else {
         return false;
       }
@@ -362,7 +374,7 @@ export default defineComponent({
     // 解析xml,获取分轨信息
     const analyzeXml = async () => {
       const details: any = data.list[data.listActive];
-      if (details.musicalInstruments?.length > 1) {
+      if (details?.musicSheetType === 'CONCERT') {
         if (details.xmlFileUrl) {
           const res = await fetch(details.xmlFileUrl).then(response =>
             response.text()

+ 1 - 0
src/views/xiaoku-music/type.ts

@@ -19,4 +19,5 @@ export interface IMusicItem {
   musicFirstImg: string;
   musicJianSvg: string;
   musicJianImg: string;
+  musicSheetType: string;
 }