|
@@ -20,6 +20,7 @@ import { storeData } from "/src/store";
|
|
|
import { downloadXmlStr } from "./view/music-score"
|
|
|
import { musicScoreRef, headerColumnHide } from "/src/page-instrument/view-detail/index"
|
|
|
import { headTopData } from "/src/page-instrument/header-top/index";
|
|
|
+import { api_lessonTrainingTrainingStudentDetail } from "/src/page-instrument/api"
|
|
|
|
|
|
const query: any = getQuery();
|
|
|
|
|
@@ -1354,13 +1355,22 @@ const getMusicInfo = async (res: any) => {
|
|
|
if (state.isEvaluatReport) {
|
|
|
partIndex = state.partIndex;
|
|
|
}
|
|
|
+ // 布置作业 取作业的乐器id
|
|
|
+ const workRecord = query.workRecord
|
|
|
+ let workRecordInstrumentId:undefined | string
|
|
|
+ if(workRecord){
|
|
|
+ const res = await api_lessonTrainingTrainingStudentDetail(workRecord);
|
|
|
+ if (res?.code === 200) {
|
|
|
+ workRecordInstrumentId = res.data?.instrumentId
|
|
|
+ }
|
|
|
+ }
|
|
|
/* 获取声轨列表 */
|
|
|
let xmlString = await fetch(res.data.xmlFileUrl).then((response) => response.text());
|
|
|
xmlString = xmlAddPartName(xmlString);
|
|
|
downloadXmlStr.value = xmlString //给musice-score 赋值xmlString 以免加载2次
|
|
|
const tracks = xmlToTracks(xmlString) //获取声轨列表
|
|
|
// 设置音源 track 为当前的声轨 index为当前的
|
|
|
- const { track, index, musicalInstrumentId } = state.isSimplePage ? { track:tracks[0], index:0, musicalInstrumentId: '' } : initMusicSource(res.data, tracks, partIndex)
|
|
|
+ const { track, index, musicalInstrumentId } = state.isSimplePage ? { track:tracks[0], index:0, musicalInstrumentId: '' } : initMusicSource(res.data, tracks, partIndex, workRecordInstrumentId)
|
|
|
const realTrack = musicalInstrumentId && res.data?.musicalInstruments?.length ? res.data?.musicalInstruments.find((item: any) => item?.id == musicalInstrumentId)?.code?.split(',')?.[0] : '';
|
|
|
const musicInfo = {
|
|
|
...res.data,
|
|
@@ -1382,9 +1392,9 @@ function xmlToTracks(xmlString: string) {
|
|
|
}, []);
|
|
|
}
|
|
|
// 设置音源
|
|
|
-function initMusicSource(data: any, tracks: string[], partIndex: number) {
|
|
|
+function initMusicSource(data: any, tracks: string[], partIndex: number, workRecordInstrumentId?: string) {
|
|
|
let track:string,index:number, musicalInstrumentId: string
|
|
|
- const instrumentId = query.instrumentId || storeData.user?.instrumentId
|
|
|
+ const instrumentId = workRecordInstrumentId || query.instrumentId || storeData.user?.instrumentId
|
|
|
let { musicSheetType, isAllSubject, musicSheetSoundList, musicSheetAccompanimentList } = data
|
|
|
musicSheetSoundList || (musicSheetSoundList = [])
|
|
|
musicSheetAccompanimentList || (musicSheetAccompanimentList = [])
|