|
@@ -1,4 +1,4 @@
|
|
|
-import { computed, defineComponent, onMounted, reactive, ref, shallowRef } from "vue"
|
|
|
+import { computed, defineComponent, nextTick, onMounted, reactive, ref, shallowRef } from "vue"
|
|
|
import styles from "./index.module.scss"
|
|
|
import NavContainer from "@/businessComponents/navContainer"
|
|
|
import { ElEmpty, ElScrollbar } from "element-plus"
|
|
@@ -32,12 +32,14 @@ import { getInstrumentName } from "@/libs/instruments"
|
|
|
import { formatXML, getCustomInfo, onlyVisible } from "./instrument"
|
|
|
import { useFunction } from "./useData"
|
|
|
import userStore from "@/store/modules/user"
|
|
|
+import PlayLoading from "./component/play-loading"
|
|
|
+import PracticeForm from "@/businessComponents/practiceForm"
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: "cloudPractice",
|
|
|
setup() {
|
|
|
const userStoreHook = userStore()
|
|
|
- const { goToCloud } = useFunction()
|
|
|
+ const { goToCloud, isPracticeShow, practiceUrl, handlePracticeClose } = useFunction()
|
|
|
const navs = [
|
|
|
{
|
|
|
name: "主页",
|
|
@@ -73,6 +75,7 @@ export default defineComponent({
|
|
|
selectedPartName: "" as any,
|
|
|
selectedPartIndex: 0,
|
|
|
partXmlIndex: 0,
|
|
|
+ categoryShow: false, // 是否展开
|
|
|
playState: "pause" as "play" | "pause", // 播放状态
|
|
|
showPlayer: false // 是否显示播放器
|
|
|
})
|
|
@@ -92,7 +95,8 @@ export default defineComponent({
|
|
|
background: list?.background,
|
|
|
xmlUrl: item?.xmlUrl,
|
|
|
musicSheetType: item?.musicSheetType,
|
|
|
- audioFileUrl
|
|
|
+ audioFileUrl,
|
|
|
+ isComberRender: false
|
|
|
}
|
|
|
} else if (userStoreHook.roles === "GYT") {
|
|
|
tempList = {
|
|
@@ -101,7 +105,8 @@ export default defineComponent({
|
|
|
background: list?.background,
|
|
|
xmlUrl: list?.xmlFileUrl,
|
|
|
musicSheetType: list?.musicSheetType,
|
|
|
- audioFileUrl: list?.audioFileUrl
|
|
|
+ audioFileUrl: list?.audioFileUrl,
|
|
|
+ isComberRender: list?.musicSubject === "1"
|
|
|
}
|
|
|
} else if (userStoreHook.roles === "KLX") {
|
|
|
const item: any = list.background?.[0]
|
|
@@ -111,7 +116,8 @@ export default defineComponent({
|
|
|
background: list?.background,
|
|
|
xmlUrl: list?.xmlFileUrl,
|
|
|
musicSheetType: list?.musicSheetType,
|
|
|
- audioFileUrl: item?.audioFileUrl
|
|
|
+ audioFileUrl: item?.audioFileUrl,
|
|
|
+ isComberRender: false
|
|
|
}
|
|
|
}
|
|
|
return tempList
|
|
@@ -668,6 +674,11 @@ export default defineComponent({
|
|
|
state.listActive = 0
|
|
|
state.showPlayer = false
|
|
|
state.playState = "pause"
|
|
|
+ state.partNames = []
|
|
|
+ state.partList = []
|
|
|
+ state.selectedPartName = ""
|
|
|
+ state.selectedPartIndex = 0
|
|
|
+ state.partXmlIndex = 0
|
|
|
document.querySelector(".musicList-container")?.scroll(0, 0)
|
|
|
state.page = 1
|
|
|
state.finshed = false
|
|
@@ -682,7 +693,6 @@ export default defineComponent({
|
|
|
loading.value = false
|
|
|
return
|
|
|
}
|
|
|
- console.log(row, "row")
|
|
|
state.partNames = await getPartNames(row.xmlUrl)
|
|
|
let partList = row.background || []
|
|
|
partList = partList.filter((item: any) => !item.track?.toLocaleUpperCase()?.includes("COMMON"))
|
|
@@ -690,7 +700,7 @@ export default defineComponent({
|
|
|
const instrumentName = getInstrumentName(item.track)
|
|
|
const xmlIndex = state.partNames.findIndex((name: any) => name === item.track)
|
|
|
return {
|
|
|
- text: item.track + (instrumentName ? `(${instrumentName})` : ""),
|
|
|
+ label: item.track + (instrumentName ? `(${instrumentName})` : ""),
|
|
|
instrumentName: instrumentName,
|
|
|
xmlIndex,
|
|
|
value: index
|
|
@@ -701,15 +711,13 @@ export default defineComponent({
|
|
|
console.log(defaultShowStaff, partList)
|
|
|
state.selectedPartName = defaultShowStaff?.instrumentName
|
|
|
state.partXmlIndex = defaultShowStaff?.xmlIndex
|
|
|
-
|
|
|
- console.log(partColumns.value, "partColumns partColumns")
|
|
|
}
|
|
|
|
|
|
const getPartNames = async (xmlUrl: string) => {
|
|
|
const partNames: string[] = []
|
|
|
try {
|
|
|
const res: any = await axios.get(xmlUrl)
|
|
|
- const xml: any = new DOMParser().parseFromString(res, "text/xml")
|
|
|
+ const xml: any = new DOMParser().parseFromString(res.data, "text/xml")
|
|
|
for (const item of xml.getElementsByTagName("part-name")) {
|
|
|
if (item.textContent) {
|
|
|
partNames.push(item.textContent)
|
|
@@ -723,24 +731,33 @@ export default defineComponent({
|
|
|
|
|
|
const musicIframeLoad = async () => {
|
|
|
const iframeRef: any = document.getElementById("staffIframeRef")
|
|
|
- if (iframeRef && iframeRef.contentWindow?.renderXml) {
|
|
|
+ if (iframeRef && iframeRef.contentWindow.renderXml) {
|
|
|
staffLoading.value = true
|
|
|
- const res = await axios.get(activeItem.value.xmlUrl)
|
|
|
+ const res: any = await axios.get(activeItem.value.xmlUrl)
|
|
|
const parseXmlInfo = getCustomInfo(res.data)
|
|
|
const xml = formatXML(parseXmlInfo.parsedXML)
|
|
|
- const currentXml = onlyVisible(xml, state.selectedPartIndex)
|
|
|
- iframeRef.contentWindow.renderXml(currentXml, state.selectedPartIndex)
|
|
|
+ if (activeItem.value.isComberRender) {
|
|
|
+ iframeRef.contentWindow.renderXml(xml, state.partXmlIndex, activeItem.value.isComberRender)
|
|
|
+ } else {
|
|
|
+ const currentXml = onlyVisible(xml, state.partXmlIndex)
|
|
|
+ iframeRef.contentWindow.renderXml(currentXml, state.partXmlIndex, activeItem.value.isComberRender)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
const resetRender = async () => {
|
|
|
const iframeRef: any = document.getElementById("staffIframeRef")
|
|
|
- if (iframeRef && iframeRef.contentWindow?.renderXml) {
|
|
|
+ if (iframeRef && iframeRef.contentWindow.renderXml) {
|
|
|
staffLoading.value = true
|
|
|
- const res = await axios.get(activeItem.value.xmlUrl)
|
|
|
+ const res: any = await axios.get(activeItem.value.xmlUrl)
|
|
|
const parseXmlInfo = getCustomInfo(res.data)
|
|
|
const xml = formatXML(parseXmlInfo.parsedXML)
|
|
|
- const currentXml = onlyVisible(xml, state.selectedPartIndex)
|
|
|
- iframeRef.contentWindow.renderXml(currentXml, state.selectedPartIndex)
|
|
|
+ if (activeItem.value.isComberRender) {
|
|
|
+ iframeRef.contentWindow.renderXml(xml, state.partXmlIndex, activeItem.value.isComberRender)
|
|
|
+ } else {
|
|
|
+ console.log(state.partXmlIndex, " state.partXmlIndex")
|
|
|
+ const currentXml = onlyVisible(xml, state.partXmlIndex)
|
|
|
+ iframeRef.contentWindow.renderXml(currentXml, 0, activeItem.value.isComberRender)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -813,9 +830,11 @@ export default defineComponent({
|
|
|
<div
|
|
|
class={[styles.leftSection_item, item.id === state.firstTreeId && styles.leftSection_item__active]}
|
|
|
onClick={async () => {
|
|
|
+ if (loading.value) return
|
|
|
state.firstTreeId = item.id
|
|
|
await setDefaultData("first")
|
|
|
- handleGetList()
|
|
|
+ await handleGetList()
|
|
|
+ await toDetail()
|
|
|
}}
|
|
|
>
|
|
|
{item.name}
|
|
@@ -829,6 +848,8 @@ export default defineComponent({
|
|
|
{state.categoryList.length > 1 && (
|
|
|
<div class={[styles.categorySection]}>
|
|
|
<NPopselect
|
|
|
+ placement="bottom-start"
|
|
|
+ disabled={loading.value}
|
|
|
options={state.categoryList}
|
|
|
v-model:value={state.categoryId}
|
|
|
onUpdate:value={async (val: any) => {
|
|
@@ -837,13 +858,17 @@ export default defineComponent({
|
|
|
state.categoryName = item.label
|
|
|
state.categoryId = item.value
|
|
|
await setDefaultData("category")
|
|
|
- handleGetList()
|
|
|
+ await handleGetList()
|
|
|
+ await toDetail()
|
|
|
}
|
|
|
}}
|
|
|
+ onUpdate:show={(value: any) => {
|
|
|
+ state.categoryShow = value
|
|
|
+ }}
|
|
|
trigger="click"
|
|
|
class={"PopSelect"}
|
|
|
>
|
|
|
- <span class={styles.iconTagName}>{state.categoryName}</span>
|
|
|
+ <span class={[styles.iconTagName, state.categoryShow && styles.show]}>{state.categoryName}</span>
|
|
|
</NPopselect>
|
|
|
</div>
|
|
|
)}
|
|
@@ -854,6 +879,7 @@ export default defineComponent({
|
|
|
popperClass="classTypePopper"
|
|
|
v-model={state.subjectId}
|
|
|
height={42}
|
|
|
+ // disabled={loading.value}
|
|
|
options={state.subjectList}
|
|
|
placeholder="全部声部"
|
|
|
onChange={handleGetList}
|
|
@@ -863,6 +889,7 @@ export default defineComponent({
|
|
|
popperClass="classTypePopper"
|
|
|
v-model={state.levelId}
|
|
|
height={42}
|
|
|
+ // disabled={loading.value}
|
|
|
options={state.levelList}
|
|
|
placeholder="级别"
|
|
|
onChange={() => {
|
|
@@ -876,6 +903,7 @@ export default defineComponent({
|
|
|
popperClass="classTypePopper"
|
|
|
v-model={state.typeId}
|
|
|
height={42}
|
|
|
+ // disabled={loading.value}
|
|
|
options={state.typeList}
|
|
|
propsOpt={{
|
|
|
labelField: "name",
|
|
@@ -912,8 +940,9 @@ export default defineComponent({
|
|
|
{state.list.map((item: any, index: number) => (
|
|
|
<div
|
|
|
class={[styles.item, index === state.listActive && styles.active]}
|
|
|
- onClick={() => {
|
|
|
+ onClick={async () => {
|
|
|
state.listActive = index
|
|
|
+ await toDetail()
|
|
|
resetRender()
|
|
|
}}
|
|
|
>
|
|
@@ -928,14 +957,9 @@ export default defineComponent({
|
|
|
;(e.target as any).dataset.loaded = "true"
|
|
|
}}
|
|
|
/>
|
|
|
- {/* <PlayLoading
|
|
|
- class={[
|
|
|
- data.listActive === index &&
|
|
|
- data.playState === 'play'
|
|
|
- ? ''
|
|
|
- : styles.showPlayLoading
|
|
|
- ]}
|
|
|
- /> */}
|
|
|
+ <PlayLoading
|
|
|
+ class={[state.listActive === index && state.playState === "play" ? "" : styles.showPlayLoading]}
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class={styles.title}>
|
|
|
<div class={styles.titleName}>
|
|
@@ -949,8 +973,8 @@ export default defineComponent({
|
|
|
onClick={(e: any) => {
|
|
|
e.stopPropagation()
|
|
|
handlePlay(item)
|
|
|
- if (state.listActive === index && state.playState === "play") {
|
|
|
- musicIframeLoad()
|
|
|
+ if (state.listActive !== index) {
|
|
|
+ resetRender()
|
|
|
}
|
|
|
}}
|
|
|
>
|
|
@@ -983,10 +1007,13 @@ export default defineComponent({
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class={styles.rightContainer}>
|
|
|
- <i class={styles.leftArrow}></i>
|
|
|
+ {/* <i class={styles.leftArrow}></i> */}
|
|
|
|
|
|
<NSpin show={staffLoading.value} stroke="#FF531C">
|
|
|
- <div class={styles.musicName}>{activeItem.value.name}</div>
|
|
|
+ <div class={styles.musicName}>
|
|
|
+ {activeItem.value.name}
|
|
|
+ {activeItem.value.musicSheetType === "CONCERT" && state.selectedPartName ? `(${state.selectedPartName})` : ""}
|
|
|
+ </div>
|
|
|
<div class={[styles.staffImgs, !loading.value && !activeItem.value?.id && styles.staffImgsEmpty]}>
|
|
|
{state.iframeSrc && activeItem.value?.id && (
|
|
|
<iframe
|
|
@@ -1013,7 +1040,10 @@ export default defineComponent({
|
|
|
}}
|
|
|
class={[styles.goBtn]}
|
|
|
src={btnSubmit as any}
|
|
|
- onClick={() => goToCloud(activeItem.value.id)}
|
|
|
+ onClick={() => {
|
|
|
+ handleChangeAudio("pause")
|
|
|
+ goToCloud(activeItem.value.id, state.partXmlIndex)
|
|
|
+ }}
|
|
|
/>
|
|
|
|
|
|
<div
|
|
@@ -1021,15 +1051,21 @@ export default defineComponent({
|
|
|
style={{ display: activeItem.value.id && activeItem.value.musicSheetType === "CONCERT" ? "" : "none" }}
|
|
|
>
|
|
|
<NPopselect
|
|
|
- // options={data.trackList}
|
|
|
- trigger="hover"
|
|
|
- // v-model:value={data.musicInstrumentIndex}
|
|
|
- onUpdate:value={async () => {
|
|
|
- // await analyzeXml();
|
|
|
- // //
|
|
|
- // musicIfrcmeLoad();
|
|
|
+ options={partColumns.value}
|
|
|
+ trigger="click"
|
|
|
+ v-model:value={state.selectedPartIndex}
|
|
|
+ scrollable
|
|
|
+ onUpdate:value={async (value: any) => {
|
|
|
+ console.log(value, "value")
|
|
|
+ const item = partColumns.value.find((item: any) => item.value === value)
|
|
|
+ state.selectedPartIndex = value
|
|
|
+ state.selectedPartName = item.instrumentName
|
|
|
+ state.partXmlIndex = item.xmlIndex
|
|
|
+ nextTick(() => {
|
|
|
+ resetRender()
|
|
|
+ })
|
|
|
}}
|
|
|
- class={[styles.popSelect]}
|
|
|
+ class={"PopSelect"}
|
|
|
>
|
|
|
<img class={styles.transBtn} src={iconTransfer as any} />
|
|
|
</NPopselect>
|
|
@@ -1050,6 +1086,7 @@ export default defineComponent({
|
|
|
}}
|
|
|
/>
|
|
|
)}
|
|
|
+ <PracticeForm v-model={isPracticeShow.value} practiceUrl={practiceUrl.value} onClose={handlePracticeClose} />
|
|
|
</NavContainer>
|
|
|
)
|
|
|
}
|