Browse Source

修改显示

lex 1 year ago
parent
commit
af73a5d27a
2 changed files with 35 additions and 7 deletions
  1. 33 5
      src/views/accompany/music-detail.tsx
  2. 2 2
      src/views/accompany/staff-change/index.tsx

+ 33 - 5
src/views/accompany/music-detail.tsx

@@ -76,6 +76,15 @@ export default defineComponent({
       }
     }
 
+    const resetRenderPage = (type: string, xmlUrl: string) => {
+      console.log(type, xmlUrl)
+      const iframeRef: any = document.getElementById('staffIframeRef')
+      if (iframeRef && iframeRef.contentWindow.renderXml) {
+        console.log('resetRenderPage')
+        iframeRef.contentWindow.resetRenderPage(type, xmlUrl)
+      }
+    }
+
     const renderStaff = async () => {
       try {
         // staffData.iframeSrc = `${location.origin}/osmd/index.html`
@@ -101,6 +110,10 @@ export default defineComponent({
     }
 
     const toDetail = async (row: any) => {
+      if (row.musicSheetType === 'SINGLE') {
+        loading.value = false
+        return
+      }
       staffData.partNames = await getPartNames(row.xmlFileUrl)
       let partList = row.background || []
       partList = partList.filter(
@@ -137,10 +150,6 @@ export default defineComponent({
           if (data.audioFileUrl) {
             initAudio()
           } else {
-            // if (data.musicSheetType === 'SINGLE') {
-            //   loading.value = false
-            //   return
-            // }
             await toDetail(staffData.details)
             renderStaff()
           }
@@ -353,7 +362,26 @@ export default defineComponent({
           class={styles.staffChange}
           round
         >
-          <StaffChange v-model:radio={staffData.radio} onClose={() => (staffData.status = false)} />
+          <StaffChange
+            radio={staffData.radio}
+            onClose={() => (staffData.status = false)}
+            onChange={(type: string) => {
+              // 更改预览状态
+
+              staffData.radio = type
+              staffData.status = false
+              if (type == 'first') {
+                loading.value = true
+                resetRenderPage('first', staffData.details.xmlFileUrl)
+              } else if (type == 'fixed') {
+                loading.value = true
+                resetRenderPage('fixed', staffData.details.xmlFileUrl)
+              } else {
+                loading.value = true
+                resetRenderPage('staff', staffData.details.xmlFileUrl)
+              }
+            }}
+          />
         </Popup>
 
         <Popup v-model:show={downloadStatus.value} position="bottom" round>

+ 2 - 2
src/views/accompany/staff-change/index.tsx

@@ -18,14 +18,14 @@ export default defineComponent({
       default: 'staff'
     }
   },
-  emits: ['update:radio', 'close'],
+  emits: ['change', 'close'],
   setup(props, { emit }) {
     const { radio } = toRefs(props)
 
     const onChangeStaff = (type: string) => {
       //
       radio.value = type
-      emit('update:radio', type)
+      emit('change', type)
       emit('close')
     }
     return () => (