|
@@ -27,7 +27,7 @@ import {
|
|
|
} from "@/api/cloudPractice.api"
|
|
|
import axios from "axios"
|
|
|
import { getInstrumentName } from "@/libs/instruments"
|
|
|
-import { formatXML, getCustomInfo, onlyVisible } from "./instrument"
|
|
|
+import { formatXML, getCustomInfo, onlyMutVisible, onlyVisible } from "./instrument"
|
|
|
import { useFunction } from "./useData"
|
|
|
import userStore from "@/store/modules/user"
|
|
|
import PlayLoading from "./component/play-loading"
|
|
@@ -41,7 +41,7 @@ export default defineComponent({
|
|
|
name: "cloudPractice",
|
|
|
setup() {
|
|
|
const userStoreHook = userStore()
|
|
|
- const { goToCloud, isPracticeShow, practiceUrl, handlePracticeClose } = useFunction()
|
|
|
+ const { goToCloud, getPreViewCloud, isPracticeShow, practiceUrl, handlePracticeClose } = useFunction()
|
|
|
const navs = [
|
|
|
{
|
|
|
name: "主页",
|
|
@@ -102,7 +102,8 @@ export default defineComponent({
|
|
|
musicSheetType: item?.musicSheetType,
|
|
|
audioFileUrl,
|
|
|
// titleImg: list?.titleImg,
|
|
|
- isComberRender: item?.isScoreRender,
|
|
|
+ isScoreRender: item?.isScoreRender,
|
|
|
+ defaultScoreRender: item?.defaultScoreRender,
|
|
|
musicPdfUrl: item?.musicPdfUrl // 独奏使用PDF
|
|
|
}
|
|
|
} else if (userStoreHook.roles === "GYT") {
|
|
@@ -114,7 +115,8 @@ export default defineComponent({
|
|
|
musicSheetType: list?.musicSheetType,
|
|
|
audioFileUrl: list?.audioFileUrl,
|
|
|
titleImg: list?.titleImg,
|
|
|
- isComberRender: list?.musicSubjectId === "1",
|
|
|
+ isScoreRender: list?.isScoreRender,
|
|
|
+ defaultScoreRender: list?.defaultScoreRender,
|
|
|
musicPdfUrl: list?.musicPdfUrl
|
|
|
}
|
|
|
} else if (userStoreHook.roles === "KLX") {
|
|
@@ -127,7 +129,8 @@ export default defineComponent({
|
|
|
musicSheetType: list?.musicSheetType,
|
|
|
audioFileUrl: item?.audioFileUrl,
|
|
|
titleImg: list?.titleImg,
|
|
|
- isComberRender: false,
|
|
|
+ isScoreRender: false,
|
|
|
+ defaultScoreRender: false,
|
|
|
musicPdfUrl: list?.musicPdfUrl
|
|
|
}
|
|
|
}
|
|
@@ -751,12 +754,28 @@ export default defineComponent({
|
|
|
}
|
|
|
})
|
|
|
// 初始化数据
|
|
|
+ // 是否显示总谱
|
|
|
+ console.log(row, "rows")
|
|
|
+ if (row.isScoreRender) {
|
|
|
+ partColumns.value.unshift({
|
|
|
+ label: "总谱",
|
|
|
+ instrumentName: null,
|
|
|
+ track: null,
|
|
|
+ musicPdfUrl: "",
|
|
|
+ xmlIndex: 999,
|
|
|
+ value: 999
|
|
|
+ })
|
|
|
+
|
|
|
+ if (row.defaultScoreRender) {
|
|
|
+ state.selectedPartIndex = 999
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- const defaultShowStaff = partColumns.value[state.selectedPartIndex]
|
|
|
+ const defaultShowStaff = partColumns.value.find((item: any) => item.value === state.selectedPartIndex)
|
|
|
state.selectedPartName = defaultShowStaff?.instrumentName
|
|
|
state.selectedTrack = defaultShowStaff?.track
|
|
|
state.partXmlIndex = defaultShowStaff?.xmlIndex
|
|
|
- if (row.isComberRender) {
|
|
|
+ if (row.isScoreRender && row.defaultScoreRender) {
|
|
|
state.musicPdfUrl = row?.musicPdfUrl || ""
|
|
|
} else {
|
|
|
state.musicPdfUrl = defaultShowStaff?.musicPdfUrl || ""
|
|
@@ -780,32 +799,50 @@ export default defineComponent({
|
|
|
}
|
|
|
|
|
|
const musicIframeLoad = async () => {
|
|
|
+ if (userStoreHook.roles === "GYM") {
|
|
|
+ // 判断是用哪个渲染的
|
|
|
+ loading.value = false
|
|
|
+ staffLoading.value = false
|
|
|
+ return
|
|
|
+ }
|
|
|
const iframeRef: any = document.getElementById("staffIframeRef")
|
|
|
- if (iframeRef && iframeRef.contentWindow.renderXml) {
|
|
|
+ if (iframeRef && iframeRef.contentWindow?.renderXml) {
|
|
|
staffLoading.value = true
|
|
|
const res: any = await axios.get(activeItem.value.xmlUrl)
|
|
|
const parseXmlInfo = getCustomInfo(res.data)
|
|
|
const xml = formatXML(parseXmlInfo.parsedXML)
|
|
|
- if (activeItem.value.isComberRender) {
|
|
|
- iframeRef.contentWindow.renderXml(xml, state.partXmlIndex, activeItem.value.isComberRender)
|
|
|
+ console.log(activeItem.value, "activeItem.value")
|
|
|
+ if (activeItem.value.isScoreRender) {
|
|
|
+ const canSelectTracks: any = []
|
|
|
+ const background = activeItem.value.background || []
|
|
|
+ background.forEach((item: any) => {
|
|
|
+ canSelectTracks.push(item.track)
|
|
|
+ })
|
|
|
+ iframeRef.contentWindow.renderXml(xml, activeItem.value.isScoreRender)
|
|
|
} else {
|
|
|
const currentXml = onlyVisible(xml, state.partXmlIndex)
|
|
|
- iframeRef.contentWindow.renderXml(currentXml, state.partXmlIndex, activeItem.value.isComberRender)
|
|
|
+ iframeRef.contentWindow.renderXml(currentXml)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
const resetRender = async () => {
|
|
|
const iframeRef: any = document.getElementById("staffIframeRef")
|
|
|
- if (iframeRef && iframeRef.contentWindow.renderXml) {
|
|
|
+ if (userStoreHook.roles === "GYM") {
|
|
|
+ iframeRef.contentWindow.location.replace(getPreViewCloud(activeItem.value.id, state.partXmlIndex))
|
|
|
+ // state.iframeSrc = getPreViewCloud(activeItem.value.id, state.partXmlIndex)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (iframeRef && iframeRef.contentWindow?.renderXml) {
|
|
|
staffLoading.value = true
|
|
|
const res: any = await axios.get(activeItem.value.xmlUrl)
|
|
|
const parseXmlInfo = getCustomInfo(res.data)
|
|
|
const xml = formatXML(parseXmlInfo.parsedXML)
|
|
|
- if (activeItem.value.isComberRender) {
|
|
|
- iframeRef.contentWindow.renderXml(xml, state.partXmlIndex, activeItem.value.isComberRender)
|
|
|
+ if (activeItem.value.isScoreRender) {
|
|
|
+ iframeRef.contentWindow.renderXml(xml, activeItem.value.isScoreRender)
|
|
|
} else {
|
|
|
const currentXml = onlyVisible(xml, state.partXmlIndex)
|
|
|
- iframeRef.contentWindow.renderXml(currentXml, 0, activeItem.value.isComberRender)
|
|
|
+ iframeRef.contentWindow.renderXml(currentXml)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -818,7 +855,11 @@ export default defineComponent({
|
|
|
// https://cdn.oss.dayaedu.com/daya202409/UOFVK2A.pdf
|
|
|
// https://cdn.oss.dayaedu.com/daya202409/UODQffO.pdf
|
|
|
} else {
|
|
|
- state.iframeSrc = `/osmd/index.html`
|
|
|
+ if (userStoreHook.roles === "GYM") {
|
|
|
+ state.iframeSrc = getPreViewCloud(activeItem.value.id, state.partXmlIndex)
|
|
|
+ } else {
|
|
|
+ state.iframeSrc = `/osmd/index.html`
|
|
|
+ }
|
|
|
}
|
|
|
} catch (error) {
|
|
|
//
|
|
@@ -877,7 +918,6 @@ export default defineComponent({
|
|
|
((activeItem.value.musicSheetType === "CONCERT" && state.selectedPartName) || state.selectedTrack
|
|
|
? `(${state.selectedPartName || state.selectedTrack})`
|
|
|
: "")
|
|
|
- console.log(musicName, "musicName")
|
|
|
try {
|
|
|
const osmdImg = e.data.osmdImg
|
|
|
const imgs = []
|
|
@@ -1233,9 +1273,7 @@ export default defineComponent({
|
|
|
/>
|
|
|
|
|
|
<div class={styles.rightBtns} style={{ display: activeItem.value.id ? "" : "none" }}>
|
|
|
- <div
|
|
|
- // style={{ display: state.musicPdfUrl ? "" : "none" }}
|
|
|
- >
|
|
|
+ <div style={{ display: state.musicPdfUrl || state.imgs.length > 0 ? "" : "none" }}>
|
|
|
<NTooltip showArrow={false}>
|
|
|
{{
|
|
|
trigger: () => (
|
|
@@ -1264,7 +1302,7 @@ export default defineComponent({
|
|
|
state.partXmlIndex = item.xmlIndex
|
|
|
nextTick(() => {
|
|
|
let tempPdf = ""
|
|
|
- if (activeItem.value?.isComberRender) {
|
|
|
+ if (activeItem.value?.isScoreRender && value === 999) {
|
|
|
if (activeItem.value?.musicPdfUrl) {
|
|
|
tempPdf = activeItem.value?.musicPdfUrl
|
|
|
}
|