Browse Source

Merge branch 'feature-tianyong-newVersion' into ktyq-test-new

TIANYONG 5 months ago
parent
commit
50a3058656

+ 14 - 3
src/helpers/formateMusic.ts

@@ -772,14 +772,25 @@ export const formatXML = (xml: string, xmlUrl?: string): string => {
           <type>whole</type>
         </note>`;
 		}
+		// if (state.musicRenderType !== 'staff') {
+		// 	transferJianNote(measure, divisions, beats)
+		// }
 	}
 	return new XMLSerializer().serializeToString(xmlParse);
 };
 
 /** 转换简谱的全休止符和二分休止符 */
-export const transferJianNote = () => {
-	//
-}
+// export const transferJianNote = (measure: any, divisions, beats) => {
+// 	const notes = measure.getElementsByTagName("note")
+// 	for (const note of notes) {
+// 		const noteType = note.getElementsByTagName("type")?.[0]?.textContent || '';
+// 		if (noteType === 'whole') {
+// 			measure.removeChild(note);
+// 		} else if (noteType === 'half') {
+// 			measure.removeChild(note);
+// 		}
+// 	}
+// }
 
 /** 获取所有音符的时值,以及格式化音符 */
 export const formateTimes = (osmd: OpenSheetMusicDisplay) => {

+ 2 - 1
src/page-instrument/evaluat-model/evaluat-result/index.tsx

@@ -68,7 +68,8 @@ export default defineComponent({
         playTime: evaluatingData.resultData.playTime / 1000, // 播放时长
         heardLevel: state.setting.evaluationDifficulty, // 听力等级
         recordFilePath: evaluatingData.resultData.url, // 录音文件路径
-        delFlag: evaluatingData.oneselfCancleEvaluating
+        delFlag: evaluatingData.oneselfCancleEvaluating,
+        instrumentId: state.instrumentId,
       };
       data.saveLoading = true;
       const res = await api_musicPracticeRecordSave(body);

+ 4 - 0
src/state.ts

@@ -577,6 +577,8 @@ const state = reactive({
   /** 是否是C调,切换到唱名时,只有C调所有的谱面类型都可以播放唱名文件;其它调的只有首调可以播放唱名,因为唱名是按照C调制作的,没有其它调的唱名文件 */
   isCTone: false,
   evxmlAddPartName: false, // 妙极客的部分曲子没有part-name,需要自行添加的part-name
+  /** 乐器id */
+  instrumentId: null,
 });
 const browserInfo = browser();
 let offset_duration = 0;
@@ -1414,6 +1416,7 @@ function xmlToTracks(xmlString: string) {
 function initMusicSource(data: any, tracks: string[], partIndex: number, workRecordInstrumentId?: string) {
   let track:string,index:number, musicalInstrumentId: string
   const instrumentId = workRecordInstrumentId || query.instrumentId || storeData.user?.instrumentId
+  state.instrumentId = instrumentId;
   let { musicSheetType, isAllSubject, musicSheetSoundList, musicSheetAccompanimentList } = data
   musicSheetSoundList || (musicSheetSoundList = [])
   musicSheetAccompanimentList || (musicSheetAccompanimentList = [])
@@ -2200,6 +2203,7 @@ export const checkMoveNoSave = async () => {
 
 /** 刷新谱面 */
 export const refreshMusicSvg = () => {
+  moveData.noteCoords = []
   moveData.modelList = []
   clearSelection();
   resetBaseRate();

+ 2 - 0
src/view/plugins/move-music-score/index.module.less

@@ -102,6 +102,8 @@
         position: relative;
         width: 76PX;
         box-sizing: border-box;
+        cursor: pointer;
+        pointer-events: all;
         img {
             width: 18PX;
             height: 18PX;

+ 1 - 1
src/view/plugins/move-music-score/index.tsx

@@ -341,7 +341,7 @@ const renderSvgItem = (item: any) => {
 /** 设置元素位置 */
 async function setModelPostion(item: any, x: number, y: number, repeatEdit?: boolean) {
 	// console.log(item)
-	//console.log('位置',x,y)
+	// console.log('位置',x,y)
 	if (item) {
 		const g = document.querySelector("#" + item.id)!; // svg元素
 		const el: HTMLElement = document.querySelector(`[data-id=${item.id}]`)!; // svg元素的背景div