فهرست منبع

fix: 妙极客曲子bug修复

TIANYONG 4 ماه پیش
والد
کامیت
075a78f2e9
3فایلهای تغییر یافته به همراه10 افزوده شده و 6 حذف شده
  1. 1 1
      osmd-extended
  2. 7 3
      src/helpers/formateMusic.ts
  3. 2 2
      vite.config.ts

+ 1 - 1
osmd-extended

@@ -1 +1 @@
-Subproject commit 3689e3c4aac7182ec7cc8ed24b0953dd37c41227
+Subproject commit 0eb177f216cead288330588bc281a2d60aa0bcfc

+ 7 - 3
src/helpers/formateMusic.ts

@@ -622,9 +622,11 @@ export const xmlAddPartName = (xml: string) => {
 	if (!xml) return "";
 	const xmlParse = new DOMParser().parseFromString(xml, "text/xml");
 	const scoreParts = Array.from(xmlParse.getElementsByTagName("score-part"));
+	// 曲子:1795013313499971585,有两条声轨,声轨1有name,声轨2没有name,需要判断是否都没有name,才把evxmlAddPartName赋值为true
+	state.evxmlAddPartName = scoreParts.every(item => item.getElementsByTagName("part-name").length === 0);
 	for (const scorePart of scoreParts) {
 		if (scorePart.getElementsByTagName("part-name").length === 0) {
-			state.evxmlAddPartName = true;
+			// state.evxmlAddPartName = true;
 			const name = scorePart.getAttribute("id") || "";
 			const newPartName = `<part-name>${name}</part-name>`
 			// scorePart.prepend(newPartName);
@@ -1226,8 +1228,10 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 				const staffEntries = note.sourceMeasure.verticalMeasureList?.[0]?.staffEntries || [];
 				//计算第一个小节里面的音符时值是否等于整个小节的时值
 				staffEntries.forEach((_a: any) => {
-					if (_a?.sourceStaffEntry?.voiceEntries?.[0]?.notes?.[0]?.length?.realValue) {
-						_firstMeasureRealValue += _a.sourceStaffEntry.voiceEntries[0].notes[0].length.realValue;
+					// 需要过滤掉倚音音符
+					const matchNote = _a?.sourceStaffEntry?.voiceEntries?.length > 1 ? _a?.sourceStaffEntry?.voiceEntries.find((item: any) => !item.isGrace) : _a?.sourceStaffEntry?.voiceEntries?.[0]
+					if (matchNote?.notes?.[0]?.length?.realValue) {
+						_firstMeasureRealValue += matchNote.notes[0].length.realValue;
 					}
 				});
 				if (_firstMeasureRealValue < vRealValue) {

+ 2 - 2
vite.config.ts

@@ -76,8 +76,8 @@ export default defineConfig({
         // target: "https://kt.colexiu.com",
         // target: "https://test.lexiaoya.cn",
         // target: "https://kt.colexiu.com",
-        // target: "https://test.resource.colexiu.com", // 内容平台开发环境,内容平台开发,需在url链接上加上isCbs=true
-        target: "https://test.kt.colexiu.com",
+        target: "https://test.resource.colexiu.com", // 内容平台开发环境,内容平台开发,需在url链接上加上isCbs=true
+        // target: "https://test.kt.colexiu.com",
         // target: "https://mec.colexiu.com",
         changeOrigin: true,
         rewrite: (path) => path.replace(/^\/instrument/, ""),