浏览代码

fix: #10132 bug修改

TIANYONG 1 年之前
父节点
当前提交
95bde00dda
共有 2 个文件被更改,包括 13 次插入7 次删除
  1. 11 5
      src/helpers/formateMusic.ts
  2. 2 2
      vite.config.ts

+ 11 - 5
src/helpers/formateMusic.ts

@@ -1245,15 +1245,21 @@ export const verifyCanRepeat = (startNum: number, endNum: number) => {
 const analyzeEvxml = (xmlParse: any, xmlUrl?: string) => {
 	// xml拍号数
 	const xmlNum = xmlParse.getElementsByTagName("timegap")[0]?.getElementsByTagName("values")[0]?.getElementsByTagName("item")[0]?.getAttribute('num');
+	const denNum = xmlParse.getElementsByTagName("timegap")[0]?.getElementsByTagName("values")[0]?.getElementsByTagName("item")[0]?.getAttribute('den');
 	// 第一个音符的起始时间
-	const firstNoteBeginTime = xmlParse.getElementsByTagName("times")[0]?.getElementsByTagName("time")[0]?.getAttribute('begin');
-	state.evXmlBeginTime = firstNoteBeginTime ? firstNoteBeginTime / 1000 : xmlNum ? 60 / state.originSpeed * xmlNum : 0;
-	const hasTimeGap = xmlParse.getElementsByTagName("timegap").length > 0;
-	const hasTimes = xmlParse.getElementsByTagName("times").length > 0;
+	const firstMeasure = xmlParse.getElementsByTagName("measure")[0];
+	if (firstMeasure) {
+		const firstNoteBeginTime = firstMeasure.getElementsByTagName("times")[0]?.getElementsByTagName("time")[0]?.getAttribute('begin');
+		state.evXmlBeginTime = firstNoteBeginTime ? firstNoteBeginTime / 1000 : xmlNum ? 60 / state.originSpeed * xmlNum * 4/denNum : 0;
+		const hasTimeGap = xmlParse.getElementsByTagName("timegap").length > 0;
+		const hasTimes = xmlParse.getElementsByTagName("times").length > 0;
+		console.log('🚀 ~ evxml解析','有timegap:',hasTimeGap,'有times:',hasTimes)
+	}
+
 	// if (!hasTimeGap && !hasTimes) {
 	// 	state.noTimes.push(xmlUrl)
 	// }
-	console.log('🚀 ~ evxml解析','有timegap:',hasTimeGap,'有times:',hasTimes)
+	
 }
 
 /**

+ 2 - 2
vite.config.ts

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