Browse Source

Merge branch 'dev' of http://git.dayaedu.com/huangqiyong/classroom into staging

黄琪勇 8 tháng trước cách đây
mục cha
commit
23efaa297f

+ 1 - 1
src/views/cloudPractice/cloudPractice.tsx

@@ -27,7 +27,7 @@ import {
 } from "@/api/cloudPractice.api"
 import axios from "axios"
 import { getInstrumentName } from "@/libs/instruments"
-import { formatXML, getCustomInfo, onlyMutVisible, onlyVisible } from "./instrument"
+import { formatXML, getCustomInfo, onlyVisible } from "./instrument"
 import { useFunction } from "./useData"
 import userStore from "@/store/modules/user"
 import PlayLoading from "./component/play-loading"

+ 0 - 88
src/views/cloudPractice/instrument.ts

@@ -49,94 +49,6 @@ export const formatXML = (xml: string): string => {
    return new XMLSerializer().serializeToString(xmlParse)
 }
 
-export const onlyMutVisible = (xml: string, partIndexs: number[]): string => {
-   if (!xml) return ""
-   const xmlParse = new DOMParser().parseFromString(xml, "text/xml")
-   const partList = xmlParse.getElementsByTagName("part-list")?.[0]?.getElementsByTagName("score-part") || []
-   const partListNames = Array.from(partList).map(item => item.getElementsByTagName("part-name")?.[0].textContent || "")
-   const parts: any = xmlParse.getElementsByTagName("part")
-   const part: any = parts[0]
-   const firstMeasures = [...part.getElementsByTagName("measure")]
-   const metronomes = [...part.getElementsByTagName("metronome")]
-
-   /** 第一分谱如果是约定的配置分谱则跳过 */
-   if (partListNames[0]?.toLocaleUpperCase?.() === "COMMON") {
-      // partIndex++
-      partIndexs.forEach((item: any) => {
-         item++
-      })
-      partListNames.shift()
-   }
-   const ids: any = []
-   partIndexs.forEach((partIndex: any) => {
-      const visiblePartInfo = partList[partIndex]
-      console.log(visiblePartInfo, partIndex)
-      if (visiblePartInfo) {
-         const id = visiblePartInfo.getAttribute("id")
-         ids.push(id)
-      }
-   })
-   if (ids.length > 0) {
-      Array.from(parts).forEach((part: any) => {
-         const attrId = part?.getAttribute("id")
-         if (part && !ids.includes(attrId)) {
-            part.parentNode?.removeChild(part)
-            // 不等于第一行才添加避免重复添加
-         } else if (part && attrId !== "P1") {
-            // 速度标记仅保留最后一个
-            const metronomeData: {
-               [key in string]: Element
-            } = {}
-            for (let i = 0; i < metronomes.length; i++) {
-               const metronome = metronomes[i]
-               const metronomeContainer = metronome.parentElement?.parentElement?.parentElement
-               if (metronomeContainer) {
-                  const index = firstMeasures.indexOf(metronomeContainer)
-                  metronomeData[index] = metronome
-               }
-            }
-            Object.values(metronomeData).forEach(metronome => {
-               const metronomeContainer: any = metronome.parentElement?.parentElement
-               const parentMeasure: any = metronomeContainer?.parentElement
-               const measureMetronomes = [...(parentMeasure?.childNodes || [])]
-               const metronomesIndex = metronomeContainer ? measureMetronomes.indexOf(metronomeContainer) : -1
-               // console.log(parentMeasure)
-               if (parentMeasure && metronomesIndex > -1) {
-                  const index = firstMeasures.indexOf(parentMeasure)
-                  const activeMeasure = part.getElementsByTagName("measure")[index]
-                  setElementNoteBefore(metronomeContainer, parentMeasure, activeMeasure)
-               }
-            })
-         }
-
-         // 最后一个小节的结束线元素不在最后 调整
-         if (part && ids.includes(attrId)) {
-            const barlines = part.getElementsByTagName("barline")
-            const lastParent = barlines[barlines.length - 1]?.parentElement
-            if (lastParent?.lastElementChild?.tagName !== "barline") {
-               const children: any = lastParent?.children || []
-               for (const el of children) {
-                  if (el.tagName === "barline") {
-                     // 将结束线元素放到最后
-                     lastParent?.appendChild(el)
-                     break
-                  }
-               }
-            }
-         }
-      })
-      Array.from(partList).forEach(part => {
-         const attrId = part?.getAttribute("id")
-         if (part && !ids.includes(attrId)) {
-            part.parentNode?.removeChild(part)
-         }
-      })
-   }
-
-   console.log(xmlParse)
-   return new XMLSerializer().serializeToString(appoggianceFormate(xmlParse))
-}
-
 export const onlyVisible = (xml: string, partIndex: number): string => {
    if (!xml) return ""
    const xmlParse = new DOMParser().parseFromString(xml, "text/xml")

+ 4 - 3
src/views/coursewarePlay/coursewarePlay.vue

@@ -442,9 +442,10 @@ function showController() {
    _showTimer = setTimeout(hideController, 3000)
 }
 function hideController() {
-   if (fileType.value === "VIDEO" && videoPlayDom.value?.playType === "pause") {
-      return
-   }
+   // 取消暂停的时候收起
+   // if (fileType.value === "VIDEO" && videoPlayDom.value?.playType === "pause") {
+   //    return
+   // }
    isShowController.value = false
 }
 /* 结束课程 */