|
@@ -1332,10 +1332,11 @@ const getMusicInfo = async (res: any) => {
|
|
|
downloadXmlStr.value = xmlString //给musice-score 赋值xmlString 以免加载2次
|
|
|
const tracks = xmlToTracks(xmlString) //获取声轨列表
|
|
|
// 设置音源 track 为当前的声轨 index为当前的
|
|
|
- const { track, index } = state.isSimplePage ? { track:tracks[0], index:0} : initMusicSource(res.data, tracks, partIndex)
|
|
|
+ const { track, index, musicalInstrumentId } = state.isSimplePage ? { track:tracks[0], index:0, musicalInstrumentId: '' } : initMusicSource(res.data, tracks, partIndex)
|
|
|
+ const realTrack = musicalInstrumentId && res.data?.musicalInstruments?.length ? res.data?.musicalInstruments.find((item: any) => item?.id == musicalInstrumentId)?.code?.split(',')?.[0] : '';
|
|
|
const musicInfo = {
|
|
|
...res.data,
|
|
|
- track
|
|
|
+ track: realTrack
|
|
|
};
|
|
|
console.log("🚀 ~ musicInfo:", musicInfo);
|
|
|
setState(musicInfo, index);
|
|
@@ -1354,7 +1355,7 @@ function xmlToTracks(xmlString: string) {
|
|
|
}
|
|
|
// 设置音源
|
|
|
function initMusicSource(data: any, tracks: string[], partIndex: number) {
|
|
|
- let track:string,index:number
|
|
|
+ let track:string,index:number, musicalInstrumentId: string
|
|
|
const instrumentId = query.instrumentId || storeData.user?.instrumentId
|
|
|
let { musicSheetType, isAllSubject, musicSheetSoundList, musicSheetAccompanimentList } = data
|
|
|
musicSheetSoundList || (musicSheetSoundList = [])
|
|
@@ -1383,6 +1384,7 @@ function initMusicSource(data: any, tracks: string[], partIndex: number) {
|
|
|
index = tracks.findIndex(item => {
|
|
|
return item === track
|
|
|
})
|
|
|
+ musicalInstrumentId = musicObj?.musicalInstrumentId
|
|
|
} else {
|
|
|
/* 合奏 */
|
|
|
// 支持总谱 并且当前是总谱。partIndex是999时候,或者默认是总谱并且partIndex为-1时候 -1就是partIndex没有值
|
|
@@ -1410,6 +1412,7 @@ function initMusicSource(data: any, tracks: string[], partIndex: number) {
|
|
|
}
|
|
|
track = "总谱"
|
|
|
index = 999
|
|
|
+ musicalInstrumentId = ''
|
|
|
}else{
|
|
|
// 合奏只显示一个声轨
|
|
|
track = tracks[partIndex===-1?0:partIndex]
|
|
@@ -1429,6 +1432,7 @@ function initMusicSource(data: any, tracks: string[], partIndex: number) {
|
|
|
index = tracks.findIndex(item => {
|
|
|
return item === track
|
|
|
})
|
|
|
+ musicalInstrumentId = musicObj?.musicalInstrumentId
|
|
|
}
|
|
|
}
|
|
|
// 当没有任何曲目的时候报错
|
|
@@ -1473,7 +1477,8 @@ function initMusicSource(data: any, tracks: string[], partIndex: number) {
|
|
|
}
|
|
|
return {
|
|
|
index,
|
|
|
- track
|
|
|
+ track,
|
|
|
+ musicalInstrumentId
|
|
|
}
|
|
|
}
|
|
|
const setState = (data: any, index: number) => {
|
|
@@ -1589,7 +1594,8 @@ const setState = (data: any, index: number) => {
|
|
|
* 各平台的乐器声部id不统一,为了兼容处理老的数据,加上乐器code码,此码唯一
|
|
|
* 获取指法code
|
|
|
*/
|
|
|
- const code = state.isConcert ? matchVoicePart(state.trackId, "CONCERT") : matchVoicePart(state.musicalCodeId, "SINGLE");
|
|
|
+ // const code = state.isConcert ? matchVoicePart(state.trackId, "CONCERT") : matchVoicePart(state.musicalCodeId, "SINGLE");
|
|
|
+ const code = matchVoicePart(state.trackId, "CONCERT")
|
|
|
state.fingeringInfo = subjectFingering(code);
|
|
|
console.log("🚀 ~ state.fingeringInfo:", code, state.fingeringInfo, state.trackId, state.track);
|
|
|
state.musicalCodeId = state.fingeringInfo?.id || 0
|