lex-xin 3 mēneši atpakaļ
vecāks
revīzija
63048ccf9d

+ 28 - 10
src/views/cloudPractice/cloudPractice.tsx

@@ -146,7 +146,6 @@ export default defineComponent({
                // defaultScoreRender: false,
                // musicPdfUrl: list?.musicPdfUrl
             }
-            console.log(tempList, "tempList -- tempList", list)
          }
          return tempList
       })
@@ -777,13 +776,26 @@ export default defineComponent({
          await handleAllGetList()
       }
 
+      // 获取PDF
+      const getCurrentPdf = (item: any, scoreType: string) => {
+         let pdfUrl = ""
+         if (scoreType === "FIRST") {
+            pdfUrl = item.firstPdfUrl
+         } else if (scoreType === "JIAN") {
+            pdfUrl = item.jianPdfUrl
+         } else if (scoreType === "STAVE") {
+            pdfUrl = item.musicPdfUrl
+         }
+         return pdfUrl || ""
+      }
+
       const toDetailGYM = () => {
          // const row: any = activeItem.value
          const details: any = state.details
          state.imgs = []
          if (details.musicSheetType === "SINGLE") {
             loading.value = false
-            state.musicPdfUrl = details.musicPdfUrl
+            state.musicPdfUrl = getCurrentPdf(details, details.scoreType)
             return
          }
          // state.partNames = await getPartNames(row.xmlUrl)
@@ -797,7 +809,7 @@ export default defineComponent({
                label: item.track + (instrumentName ? `(${instrumentName})` : ""),
                instrumentName: instrumentName,
                track: item.track,
-               musicPdfUrl: item.musicPdfUrl,
+               musicPdfUrl: getCurrentPdf(item, details.scoreType),
                // xmlIndex: -1,
                value: index
             }
@@ -806,11 +818,12 @@ export default defineComponent({
          // 初始化数据
          // 是否显示总谱
          if (details.isScoreRender) {
+            console.log(details, details.scoreType, getCurrentPdf(details, details.scoreType), "getCurrentPdf(details, details.scoreType)")
             partColumns.value.unshift({
                label: "总谱",
                instrumentName: null,
                track: null,
-               musicPdfUrl: "",
+               musicPdfUrl: getCurrentPdf(details, details.scoreType),
                xmlIndex: 999,
                value: 999
             })
@@ -843,7 +856,7 @@ export default defineComponent({
          }
 
          defaultShowStaff || (defaultShowStaff = partColumns.value.find((item: any) => item.value === state.selectedPartIndex))
-
+         console.log(defaultShowStaff, "defaultShowStaff --- defaultShowStaff")
          state.selectedPartName = defaultShowStaff?.instrumentName
          state.selectedTrack = defaultShowStaff?.track
          state.partXmlIndex = defaultShowStaff?.xmlIndex
@@ -1490,13 +1503,18 @@ export default defineComponent({
                               state.imgs = []
                               nextTick(() => {
                                  let tempPdf = ""
-                                 if (activeItem.value?.isScoreRender && value === 999) {
-                                    if (activeItem.value?.musicPdfUrl) {
-                                       tempPdf = activeItem.value?.musicPdfUrl
-                                    }
-                                 } else {
+                                 if(userStoreHook.roles === "GYM" || userStoreHook.roles === "KLX") {
                                     tempPdf = item.musicPdfUrl
+                                 } else {
+                                    if (activeItem.value?.isScoreRender && value === 999) {
+                                       if (activeItem.value?.musicPdfUrl) {
+                                          tempPdf = activeItem.value?.musicPdfUrl
+                                       }
+                                    } else {
+                                       tempPdf = item.musicPdfUrl
+                                    }
                                  }
+                                 
                                  if (tempPdf) {
                                     state.musicPdfUrl = tempPdf
                                     staffLoading.value = true

+ 4 - 1
src/views/cloudPractice/useData.ts

@@ -24,15 +24,18 @@ export const useFunction = () => {
    function goToCloud(musicId: string, partIndex = 0, track = "") {
       //  GYM,GYT,KLX 区分   云教练
       let gymUrl = `${URL_TEACH_GYM}#/?id=${musicId}&Authorization=${getToken()}&platform=pc&isYjt=1&isHideMusicList=true&systemType=teacher`
+      let klxUrl = `${URL_TEACH_KLX}#/?id=${musicId}&Authorization=${getToken()}&platform=pc&isYjt=1&isHideMusicList=true&systemType=teacher`
       if (partIndex === 999) {
          gymUrl += `&part-index=${partIndex}`
+         klxUrl += `&part-index=${partIndex}`
       } else {
          gymUrl += `&part-name=${track}`
+         klxUrl += `&part-name=${track}`
       }
       const urlObj = {
          GYT: `${URL_TEACH_GYT}?id=${musicId}&modelType=practice&modeType=json&part-index=${partIndex}&Authorization=${getToken()}&isYjt=1&&isHideBack=false`,
          GYM: gymUrl,
-         KLX: `${URL_TEACH_KLX}#/?id=${musicId}&Authorization=${getToken()}&platform=pc&part-index=${partIndex}&isYjt=1&isHideMusicList=true&systemType=teacher`
+         KLX: klxUrl
       }
       isPracticeShow.value = true
       practiceUrl.value = urlObj[userStoreHook.roles!]