lex-xin 4 months ago
parent
commit
2e32d9e961
2 changed files with 15 additions and 54 deletions
  1. 4 25
      src/tenant/music/music-detail/new-index.tsx
  2. 11 29
      src/views/music/music-detail/index.tsx

+ 4 - 25
src/tenant/music/music-detail/new-index.tsx

@@ -645,25 +645,6 @@ export default defineComponent({
 
       // 通过isScoreRender判断是否合并渲染
       // 多声轨,  不是单声部多声轨, 不是老师布置作业选择曲谱
-      // if (row.musicSheetType === 'SINGLE') {
-      //   staffData.isConcert = false
-      //   const musicSheetSoundList = staffData.details?.musicSheetSoundList || []
-      //   const songs = filterSoundInfo(musicSheetSoundList)
-      //   if (songs) {
-      //     staffData.metronomeMp3Url = songs.audioFileUrl
-      //   } else {
-      //     // 为了处理节奏练习
-      //     if (musicSheetSoundList.length > 0) {
-      //       staffData.metronomeMp3Url = musicSheetSoundList[0].audioFileUrl
-      //     }
-      //   }
-      // } else {
-      //   staffData.isConcert = true
-      //   const { audioFileUrl } = row.musicSheetAccompanimentList.find(
-      //     (item: any) => item.audioPlayType == 'PLAY'
-      //   )
-      //   staffData.metronomeUrl = audioFileUrl
-      // }
       audioFileUrl.value = row.mp3Url
       if (
         audioFileUrl.value
@@ -733,8 +714,8 @@ export default defineComponent({
           } else {
             const url = getPreViewCloud(
               staffData.musicId,
-              currentColumn.value.xmlIndex,
-              currentColumn.value.track
+              currentColumn.value?.xmlIndex || 0,
+              currentColumn.value?.track || ''
             )
             console.log(url, 'staffIframeRef')
             const iframeRef = document.querySelector('#staffIframeRef') as any
@@ -749,9 +730,7 @@ export default defineComponent({
 
     const resetRender = () => {
       const iframeRef: any = document.getElementById('staffIframeRef')
-      iframeRef.contentWindow.location.replace(
-        getPreViewCloud(staffData.musicId, currentColumn.value.xmlIndex, currentColumn.value.track)
-      )
+      iframeRef.contentWindow.location.replace(getPreViewCloud(staffData.musicId, currentColumn.value?.xmlIndex || 0, currentColumn.value.track))
     }
 
     const onDownloadApp = () => {
@@ -904,7 +883,7 @@ export default defineComponent({
                   : ''
               ]}
               onClick={() => {
-                if (!browser().isApp) {
+                if (browser().isApp) {
                   if(staffData.imgs.length <= 0 && !staffData.musicPdfUrl) return
                   if (staffData.musicPdfUrl) {
                     const songName =

+ 11 - 29
src/views/music/music-detail/index.tsx

@@ -122,7 +122,6 @@ export default defineComponent({
 
     // 当前先中的数据
     const currentColumn = computed(() => {
-      console.log(1, partColumns.value, staffData.selectedPartIndex)
       return partColumns.value.find((item: any) => item.value === staffData.selectedPartIndex)
     })
 
@@ -154,20 +153,20 @@ export default defineComponent({
       if (type == 'FIRST') {
         loading.value = false
         const tempPdf = staffData.details?.firstPdfUrl
-        initIframe(tempPdf, 'FIRST', staffData.musicXml)
+        initIframe(tempPdf, 'FIRST')
       } else if (type == 'JIAN') {
         loading.value = false
         const tempPdf = staffData.details?.jianPdfUrl
         console.log(tempPdf, 'tempPdf')
-        initIframe(tempPdf, 'JIAN', staffData.musicXml)
+        initIframe(tempPdf, 'JIAN')
       } else {
         loading.value = false
         const tempPdf = staffData.details?.musicPdfUrl
-        initIframe(tempPdf, 'STAVE', staffData.musicXml)
+        initIframe(tempPdf, 'STAVE')
       }
     }
 
-    const initIframe = (tempPdf: string, staff: string, xml: string) => {
+    const initIframe = (tempPdf: string, staff: string) => {
       if (tempPdf) {
         staffData.musicPdfUrl = tempPdf
       } else {
@@ -612,7 +611,7 @@ export default defineComponent({
     });
 
     staffData.details = row || {};
-    staffData.musicXml = staffData.details?.xmlFileUrl;
+    // staffData.musicXml = staffData.details?.xmlFileUrl;
     staffData.isComberRender = staffData.details?.isScoreRender;
     
 
@@ -678,24 +677,6 @@ export default defineComponent({
     }
 
     // 通过isScoreRender判断是否合并渲染
-    // 多声轨,  不是单声部多声轨, 不是老师布置作业选择曲谱
-    // if (row.musicSheetType === "SINGLE") {
-    //   staffData.isConcert = false;
-    //   const musicSheetSoundList = staffData.details?.musicSheetSoundList  || []
-    //   const songs = filterSoundInfo(musicSheetSoundList)
-    //   if(songs) {
-    //     staffData.metronomeMp3Url = songs.audioFileUrl
-    //   } else {
-    //     // 为了处理节奏练习
-    //     if(musicSheetSoundList.length > 0) {
-    //       staffData.metronomeMp3Url = musicSheetSoundList[0].audioFileUrl
-    //     }
-    //   }
-    // } else {  
-    //   staffData.isConcert = true;
-    //   const { audioFileUrl } = row.musicSheetAccompanimentList.find((item: any) => item.audioPlayType == 'PLAY')
-    //   staffData.metronomeUrl = audioFileUrl
-    // }
     audioFileUrl.value = row.mp3Url
     if (
       audioFileUrl.value
@@ -711,6 +692,7 @@ export default defineComponent({
 
 
   const getPreViewCloud = (musicId: string, partIndex: number, track: string) => {
+    console.log(partIndex, track, 'getPreViewCloud')
     const Authorization = sessionStorage.getItem("Authorization") || "";
     const musicScorePath = "/klx-music-score/";
     const musicScoreUrl = getHttpOrigin() + musicScorePath;
@@ -758,8 +740,7 @@ export default defineComponent({
           iframeRef.contentWindow.location.replace(url)
           // staffData.iframeSrc = url
         } else {
-          const url = getPreViewCloud(staffData.musicId, currentColumn.value.xmlIndex, currentColumn.value.track)
-          console.log(url, 'staffIframeRef')
+          const url = getPreViewCloud(staffData.musicId, currentColumn.value?.xmlIndex || 0, currentColumn.value?.track || '')
           const iframeRef = document.querySelector('#staffIframeRef') as any
           iframeRef.contentWindow.location.replace(url)
           // staffData.iframeSrc = url
@@ -767,13 +748,14 @@ export default defineComponent({
       })
     } catch (error) {
       //
+      console.log(error, 'error');
     }
   }
 
     const resetRender = () => {
       const iframeRef: any = document.getElementById("staffIframeRef")
-      console.log(currentColumn.value, "currentColumn.value")
-      iframeRef.contentWindow.location.replace(getPreViewCloud(staffData.musicId, currentColumn.value?.xmlIndex, currentColumn.value.track))
+      console.log(currentColumn.value, "currentColumn.value---------")
+      iframeRef.contentWindow.location.replace(getPreViewCloud(staffData.musicId, currentColumn.value?.xmlIndex || 0, currentColumn.value.track))
     }
     return () => {
       return (
@@ -891,7 +873,7 @@ export default defineComponent({
                             }
                           }}
                         >
-                          <img class={styles.iconAlbum2} src={iconAlbum2} />
+                          {/* <img class={styles.iconAlbum2} src={iconAlbum2} /> */}
                           <span>
                             { staffData.details?.userName ||
                               '游客' + ( staffData.details?.userId || '')}