|
@@ -247,14 +247,14 @@ export type CustomInfo = {
|
|
|
};
|
|
|
|
|
|
/** 从xml中获取自定义信息,并删除多余的字符串 */
|
|
|
-export const getCustomInfo = (xml: string): CustomInfo => {
|
|
|
+export const getCustomInfo = (xml: string, resourceType?: string): CustomInfo => {
|
|
|
const data = {
|
|
|
showSpeed: true,
|
|
|
parsedXML: xml,
|
|
|
};
|
|
|
//console.time('解析xml 耗时3')
|
|
|
// const xmlParse = new DOMParser().parseFromString(xml, "text/xml");
|
|
|
- const xmlParse = xmlDocRef.value ? xmlDocRef.value : new DOMParser().parseFromString(xml, "text/xml");
|
|
|
+ const xmlParse = xmlDocRef.value && resourceType === 'init' ? xmlDocRef.value : new DOMParser().parseFromString(xml, "text/xml");
|
|
|
//console.timeEnd('解析xml 耗时3')
|
|
|
const words: any = xmlParse?.getElementsByTagName("words");
|
|
|
for (const word of words) {
|
|
@@ -656,11 +656,11 @@ export const xmlAddPartName = (xml: string) => {
|
|
|
/** 格式化曲谱
|
|
|
* 1.全休止符的小节,没有音符默认加个全休止符
|
|
|
*/
|
|
|
-export const formatXML = (xml: string, xmlUrl?: string): string => {
|
|
|
+export const formatXML = (xml: string, xmlUrl?: string, resourceType?: string): string => {
|
|
|
if (!xml) return "";
|
|
|
//console.time('解析xml 耗时7')
|
|
|
// const xmlParse = new DOMParser().parseFromString(xml, "text/xml");
|
|
|
- const xmlParse = xmlDocRef.value ? xmlDocRef.value : new DOMParser().parseFromString(xml, "text/xml");
|
|
|
+ const xmlParse = xmlDocRef.value && resourceType === 'init' ? xmlDocRef.value : new DOMParser().parseFromString(xml, "text/xml");
|
|
|
//console.timeEnd('解析xml 耗时7')
|
|
|
// 声调
|
|
|
const fifths = xmlParse.getElementsByTagName("fifths");
|