lex 1 năm trước cách đây
mục cha
commit
9ea8fd015b

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
public/osmd/opensheetmusicdisplay.min.js


+ 42 - 38
src/tenant/music/music-detail/new-index.tsx

@@ -350,40 +350,43 @@ export default defineComponent({
 
         uploadImgs.value = true
 
-        for (let i = 0; i < osmdImg.length; i++) {
-          const img = await svgtopng(
-            osmdImg[i].img,
-            osmdImg[i].width,
-            osmdImg[i].height
-          )
-          const fileName =
-            route.query.id + state.user.data.userId + +new Date() + '.png'
-          const obj = {
-            filename: fileName,
-            bucketName: 'cloud-coach',
-            postData: {
+        if (osmdImg) {
+          for (let i = 0; i < osmdImg.length; i++) {
+            const img = await svgtopng(
+              osmdImg[i].img,
+              osmdImg[i].width,
+              osmdImg[i].height
+            )
+            const fileName =
+              route.query.id + state.user.data.userId + +new Date() + '.png'
+            const obj = {
               filename: fileName,
+              bucketName: 'cloud-coach',
+              postData: {
+                filename: fileName,
+                acl: 'public-read',
+                key: fileName
+              }
+            }
+            const { data } = await getUploadSign(obj, true)
+            const dataObj = {
+              policy: data.policy,
+              signature: data.signature,
+              key: fileName,
+              KSSAccessKeyId: data.kssAccessKeyId,
               acl: 'public-read',
-              key: fileName
+              name: fileName
             }
+            const files = base64ToBlob(img)
+            const ossUploadUrl = getOssUploadUrl('cloud-coach')
+            const imgurl = await onOnlyFileUpload(ossUploadUrl, {
+              ...dataObj,
+              file: files
+            })
+            imgs.push(imgurl)
           }
-          const { data } = await getUploadSign(obj, true)
-          const dataObj = {
-            policy: data.policy,
-            signature: data.signature,
-            key: fileName,
-            KSSAccessKeyId: data.kssAccessKeyId,
-            acl: 'public-read',
-            name: fileName
-          }
-          const files = base64ToBlob(img)
-          const ossUploadUrl = getOssUploadUrl('cloud-coach')
-          const imgurl = await onOnlyFileUpload(ossUploadUrl, {
-            ...dataObj,
-            file: files
-          })
-          imgs.push(imgurl)
         }
+
         uploadImgs.value = false
         // 判断是否为独奏
         if (
@@ -457,7 +460,7 @@ export default defineComponent({
             userId: state.user.data?.userId
           }
         })
-        console.log(res)
+        // console.log(res)
         setTimeout(() => {
           musicDetail.value.coursewareId = res.data.id || ''
           Toast('添加成功')
@@ -684,12 +687,12 @@ export default defineComponent({
           staffData.xmlPartList = partList
         }
 
-        // staffData.iframeSrc = `${
-        //   location.origin
-        // }/osmd/index.html?t=${new Date().getTime()}`
-        staffData.iframeSrc = `${location.origin}${
-          location.pathname
-        }osmd/index.html?t=${new Date().getTime()}`
+        staffData.iframeSrc = `${
+          location.origin
+        }/osmd/index.html?t=${new Date().getTime()}`
+        // staffData.iframeSrc = `${location.origin}${
+        //   location.pathname
+        // }osmd/index.html?t=${new Date().getTime()}`
         staffData.musicXml = musicDetail.value?.xmlFileUrl || ''
         const tempList = musicDetail.value?.background || []
         const tempPartList = [] as any
@@ -705,6 +708,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.instrumentName =
@@ -712,7 +716,7 @@ export default defineComponent({
             ? getInstrumentName(staffData.partList[staffData.partIndex]?.track)
             : ''
 
-        console.log(staffData.partList, 'staffData', staffData.xmlPartList)
+        // console.log(staffData.partList, 'staffData', staffData.xmlPartList)
       } catch (error) {
         //
       }
@@ -728,7 +732,7 @@ export default defineComponent({
         const xml = formatXML(parseXmlInfo.parsedXML)
 
         const currentXml = onlyVisible(xml, staffData.partXmlIndex)
-        iframeRef.contentWindow.renderXml(currentXml, staffData.partXmlIndex)
+        iframeRef.contentWindow.renderXml(currentXml, 0)
 
         // iframeRef.contentWindow.renderXml(
         //   staffData.musicXml,

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác