Browse Source

修改问题

lex-xin 1 month ago
parent
commit
70ea3f20e2

+ 5 - 2
src/tenant/music/music-detail/new-index.tsx

@@ -108,16 +108,19 @@ export default defineComponent({
     const onChangeStaff = (type: string) => {
       staff.radio = type
       staff.status = false
-      const tempPdf = musicDetail.value?.firstPdfUrl
+      
       if (type == 'first' && (!defaultImgs.value.first || musicDetail.value?.firstPdfUrl)) {
         loading.value = false
+        const tempPdf = musicDetail.value?.firstPdfUrl
         initIframe(tempPdf, 'first', staffData.musicXml)
       } else if (type == 'fixed' && (!defaultImgs.value.fixed || musicDetail.value?.jianPdfUrl)) {
         loading.value = false
+        const tempPdf = musicDetail.value?.jianPdfUrl
         initIframe(tempPdf, 'first', staffData.musicXml)
       } else {
         if (!defaultImgs.value.staff) {
           loading.value = false
+          const tempPdf = musicDetail.value?.musicPdfUrl
           initIframe(tempPdf, 'first', staffData.musicXml)
         }
       }
@@ -502,7 +505,7 @@ export default defineComponent({
         staffData.tempPartList = JSON.parse(JSON.stringify(staffData.partList))
         staffData.partList = instrumentSort(staffData.partList)
         // console.log(staffData.partList, ' staffData.partList')
-        staffData.partXmlIndex = staffData.partList[0].index || 0
+        staffData.partXmlIndex = staffData.partList[0]?.index || 0
         staffData.instrumentName =
           musicDetail.value?.musicSheetType === 'CONCERT'
             ? getInstrumentName(staffData.partList[staffData.partIndex]?.track)

+ 5 - 4
src/views/music/music-detail/index.tsx

@@ -134,8 +134,7 @@ export default defineComponent({
     const onChangeStaff = (type: string) => {
       staff.radio = type
       staff.status = false
-
-      if (type == 'first' && !defaultImgs.value.first) {
+      if (type == 'first' && (!defaultImgs.value.first || musicDetail.value?.firstPdfUrl )) {
         loading.value = false
         const tempPdf = musicDetail.value?.firstPdfUrl
         initIframe(tempPdf, 'first', staffData.musicXml)
@@ -596,10 +595,9 @@ export default defineComponent({
         })
 
         staffData.partList = tempPartList
-
         staffData.tempPartList = JSON.parse(JSON.stringify(staffData.partList))
         staffData.partList = instrumentSort(staffData.partList)
-        staffData.partXmlIndex = staffData.partList[0].index || 0
+        staffData.partXmlIndex = staffData.partList[0]?.index || 0
 
         staffData.instrumentName =
           musicDetail.value?.musicSheetType === 'CONCERT'
@@ -611,8 +609,11 @@ export default defineComponent({
         } else {
           musicPdfUrl.value = staffData.partList[0]?.musicPdfUrl
         }
+
+        console.log(musicPdfUrl.value)
       } catch (error) {
         //
+        console.log(error, 'error')
       }
     }