Bladeren bron

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

TIANYONG 6 maanden geleden
bovenliggende
commit
f0485070b1

+ 1 - 1
osmd-extended

@@ -1 +1 @@
-Subproject commit e291a4360a2abea541f003b80d2ec282ba36c435
+Subproject commit 6106f19f06cc5815d2f2069a1370cac1cb228d8e

+ 2 - 2
src/helpers/formateMusic.ts

@@ -1258,7 +1258,7 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 			 * evxml的曲子,如果曲谱xml中带有times信息,则音符时值优先取times中的值
 			 * 曲子:1795013295024062466(春暖花开),如果音符有times信息,休止符没有times信息,此种规则是认为休止符不参与时值计算的,需要过滤掉该休止符
 			 */
-			if (state.isEvxml && note.isRestFlag && note?.noteTimeInfo?.length === 0 && state.xmlHasTimes) {
+			if (state.isEvxml && note.isRestFlag && note?.noteTimeInfo?.length === 0 && state.xmlHasTimes && _notes[i-1]?.note?.noteTimeInfo?.[0]?.end === _notes[i+1]?.note?.noteTimeInfo?.[0]?.begin) {
 				note.maxNoteNum = note.maxNoteNum - 1;
 				continue;
 			}
@@ -1555,7 +1555,7 @@ const customizationXml = (xmlParse: any) => {
 		const hasRepeat = xmlParse.querySelectorAll('repeat').length > 0;
 		if (!hasRepeat) {
 			const parts = xmlParse.querySelectorAll('score-partwise>part')
-			if (parts.length > 1) {
+			if (parts.length) {
 				for (const part of parts) {
 					const currentMeasures = part.querySelectorAll('measure').length ? Array.from(part.querySelectorAll('measure')) : [];
 					const lastMeasure: any = currentMeasures.last();

+ 1 - 1
src/page-instrument/App.tsx

@@ -98,7 +98,7 @@ export default defineComponent({
       const _loading = document.getElementById("loading");
       _loading && document.body.removeChild(_loading);
       // console.log(query);
-      if (query.platform == "pc") {
+      if (query.platform == "pc" || query.isPreView) {
         document.body.addEventListener("keyup", (e: KeyboardEvent) => onKeyBoard(e));
         // 禁用右键菜单
         document.addEventListener("contextmenu", function (event) {

+ 4 - 2
src/page-instrument/custom-plugins/helper-model/recommendation/index.module.less

@@ -114,9 +114,11 @@
                         }
                     }
                     .recommendationDropdownItem{
-                        top: 106px !important;
-                        left: 14px;
+                        position: absolute !important; 
+                        top: 30px !important;
+                        left: -10px;
                         width: 172px;
+                        height: 182px;
                         .van-dropdown-item__content{
                             margin: 6px 0 0 10px;
                             width: 152px;

+ 1 - 1
src/page-instrument/custom-plugins/helper-model/recommendation/index.tsx

@@ -113,7 +113,7 @@ export default defineComponent({
 		}
 		return () => (
 			<div class={[styles.recommendation,styles[state.modeType]]}>
-				<div class={[styles.head, "top_drag"]}>
+				<div class={[styles.head, "top_draging"]}>
 					<img class={styles.headTit} src={headImg("recommendationName.png")} />
 					<img class={styles.closeImg} src={headImg("closeImg.png")} onClick={()=>{ emit("close") }} />
 				</div>

+ 2 - 6
src/page-instrument/header-top/index.tsx

@@ -528,10 +528,6 @@ export default defineComponent({
       if (query.workRecord) {
         return;
       }
-      // 总控平台 隐藏返回按钮
-      if (query.isCbs) {
-        headTopData.showBack = false;
-      } 
       /** 作业模式 end */
       if (state.defaultModeType == 1) {
         headTopData.handleChangeModeType("practise");
@@ -594,14 +590,14 @@ export default defineComponent({
         ? {
             styleDrag: { value: null },
           }
-        : useDrag([`${parentClassName} .top_drag`, `${parentClassName} .bom_drag`], parentClassName, toRef(headTopData, "settingMode"), userId);
+        : useDrag([`${parentClassName} .top_draging`, `${parentClassName} .bom_drag`], parentClassName, toRef(headTopData, "settingMode"), userId);
     const speedClassName = "speedBoxClass_drag";
     const speedInfo =
       state.platform !== IPlatform.PC
         ? {
             styleDrag: { value: null },
           }
-        : useDrag([`${speedClassName} .top_drag`, `${speedClassName} .bom_drag`], speedClassName, toRef(headData, "speedShow"), userId);
+        : useDrag([`${speedClassName} .top_draging`, `${speedClassName} .bom_drag`], speedClassName, toRef(headData, "speedShow"), userId);
     onMounted(() => {
       getQueryModelSetModelType();
       window.addEventListener("message", changePlay);

+ 2 - 2
src/page-instrument/header-top/settting/index.tsx

@@ -32,7 +32,7 @@ export default defineComponent({
 			? {
 				styleDrag: { value: null },
 			  }
-			: useDrag([`${parentClassName} .top_drag`, `${parentClassName} .bom_drag`], parentClassName, toRef(helperData, "recommendationShow"), userId);
+			: useDrag([`${parentClassName} .top_draging`, `${parentClassName} .bom_drag`], parentClassName, toRef(helperData, "recommendationShow"), userId);
 
 		// 完成拖动弹窗引导页
 		const handleGuide = async () => {
@@ -66,7 +66,7 @@ export default defineComponent({
 
 		return () => (
 			<div class={[styles.settting, styles[state.modeType]]}>
-                <div class={[styles.head, "top_drag"]}>
+                <div class={[styles.head, "top_draging"]}>
 					<img class={styles.headTit} src={headImg("settingName.png")} />
 					<img class={styles.closeImg} src={headImg("closeImg.png")} onClick={()=>{ headTopData.settingMode = false }} />
 				</div>

+ 1 - 1
src/page-instrument/header-top/speed/index.tsx

@@ -106,7 +106,7 @@ export default defineComponent({
 		};
 		return () => (
 			<div class={[styles.speedContainer, styles[state.modeType]]}>
-				<div class={[styles.head, "top_drag"]}>
+				<div class={[styles.head, "top_draging"]}>
 					<img class={styles.headTit} src={headImg("headTit.png")} />
 					<img class={styles.closeImg} src={headImg("closeImg.png")} onClick={()=>{ headData.speedShow = false }} />
 				</div>

+ 10 - 0
src/page-instrument/view-detail/index.module.less

@@ -254,6 +254,16 @@
                 stroke: #000000;
             }
         }
+        .voiceActive {
+            rect {
+                fill: #000000;
+                stroke: #000000;
+            }
+        }
+        .rectActive {
+            fill: #000000;
+            stroke: #000000;
+        }
     }
 }
 

+ 15 - 1
src/state.ts

@@ -1836,6 +1836,11 @@ export const fillWordColor = () => {
     stemEl?.classList.remove('noteActive')
     // stemLine?.classList.remove('noteActive')
     svgEl?.parentElement?.classList.remove('voiceActive')
+    const si = state.times[prevActiveNoteIndex].si || 0;
+    svgEl?.parentElement?.querySelectorAll('rect')?.forEach((item: any) => {
+      item?.classList.remove('rectActive');
+    })
+    // svgEl?.parentElement?.querySelectorAll('rect')?.[si]?.classList.remove('rectActive');
   }
   const activeNoteId = state.times[state.activeNoteIndex]?.svgElement?.attrs?.id
   const svgEl = document.getElementById(`vf-${activeNoteId}`)
@@ -1849,7 +1854,16 @@ export const fillWordColor = () => {
     // const parentVoice = svgEl?.parentElement;
     // 简谱模式下,二分音符和全音符才显示音符右侧的"-"
     if (state.times[state.activeNoteIndex].noteElement?.length?.realValue >= 0.5) {
-      svgEl?.parentElement?.classList.add('voiceActive');
+      // 如果是二分音符,只亮该音符后面那个"-",本小节其它的"-"不亮
+      if (state.times[state.activeNoteIndex].noteElement?.length?.realValue === 0.5) {
+        const si = state.times[state.activeNoteIndex].si || 0;
+        const halfNotes = state.times[state.activeNoteIndex].measures.filter((item: any) => item?.noteElement?.length?.realValue === 0.5) || [];
+        const sIdx = halfNotes?.findIndex((item: any) => item?.noteElement === state.times[state.activeNoteIndex]?.noteElement);
+        const filterRects = svgEl?.parentElement?.querySelectorAll('rect')?.length ? Array.from(svgEl?.parentElement?.querySelectorAll('rect')).filter(item => item.parentElement === svgEl?.parentElement) : [];
+        filterRects?.[sIdx]?.classList.add('rectActive');
+      } else {
+        svgEl?.parentElement?.classList.add('voiceActive');
+      }
     }
   }
   prevActiveNoteIndex = state.activeNoteIndex

+ 4 - 0
src/view/music-score/index.module.less

@@ -52,6 +52,10 @@
             stroke: #FFC121;
         }
     }
+    .rectActive {
+        fill: #FFC121;
+        stroke: #FFC121;
+    }
     .vf-numbered_note_lines {
         rect {
             fill: #FFFFFF;

+ 26 - 24
src/view/music-score/index.tsx

@@ -210,30 +210,32 @@ export default defineComponent({
 		});
 
 		/** 刷新曲谱 */
-		const refreshMusicScore = async () => {
-			console.log('刷新谱面123')
-			isLoadingCss.value = true
-			const container = document.getElementById('musicAndSelection'), svgDom = document.getElementById('osmdCanvasPage1'), selectionBox = document.getElementById('selectionBox'), selectionBgBox = document.getElementById('selectionBgBox');
-			if (container) {
-				svgDom && container?.removeChild(svgDom)
-				selectionBox && container?.removeChild(selectionBox)
-				selectionBgBox && container?.removeChild(selectionBgBox)
-			}
-			state.vfmeasures = [];
-			musicData.showSelection = false;
-			state.osmd.clear();
-			musicData.isRenderLoading = true;
-			musicData.isRefreshLoading = true;
-			// 在下一帧再执行,确保出现loading
-			requestAnimationFrame(async ()=>{
-				getContainerWidth();
-				//setRenderType();
-				await getXML();
-				await init();
-				musicData.isRenderLoading = false;
-				musicData.isRefreshLoading = false;
-				musicData.showSelection = true;
-				isLoadingCss.value = false
+		const refreshMusicScore = () => {
+			// 有可能会有 其他地方的js执行 阻塞 这里下一帧再执行确保加载条出来
+			requestAnimationFrame(() =>{
+				isLoadingCss.value = true
+				requestAnimationFrame(async () => {
+					const container = document.getElementById('musicAndSelection'), svgDom = document.getElementById('osmdCanvasPage1'), selectionBox = document.getElementById('selectionBox'), selectionBgBox = document.getElementById('selectionBgBox');
+					if (container) {
+						svgDom && container?.removeChild(svgDom)
+						selectionBox && container?.removeChild(selectionBox)
+						selectionBgBox && container?.removeChild(selectionBgBox)
+					}
+					state.evXmlBeginArr = [];
+					state.vfmeasures = [];
+					musicData.showSelection = false;
+					state.osmd.clear();
+					musicData.isRenderLoading = true;
+					musicData.isRefreshLoading = true;
+					getContainerWidth();
+					//setRenderType();
+					await getXML();
+					await init();
+					musicData.isRenderLoading = false;
+					musicData.isRefreshLoading = false;
+					musicData.showSelection = true;
+					isLoadingCss.value = false
+				})
 			})
 		}
 		expose({

+ 1 - 1
src/view/plugins/toggleMusicSheet/choosePartName/index.tsx

@@ -54,7 +54,7 @@ export default defineComponent({
 
     return () => (
       <div class={[styles.container, state.platform === IPlatform.PC && styles.pcContainer, styles[state.modeType]]}>
-        <div class={[styles.head, "top_drag"]}>
+        <div class={[styles.head, "top_draging"]}>
           <img class={styles.headTit} src={changeName} />
           <img class={styles.closeImg} src={headImg("closeImg.png")} onClick={() => emit("close")} />
         </div>

+ 1 - 1
src/view/plugins/toggleMusicSheet/index.tsx

@@ -91,7 +91,7 @@ export default defineComponent({
       styleDrag: { value: null }
     } : useDrag(
       [
-        `${parentClassName} .top_drag`,
+        `${parentClassName} .top_draging`,
         `${parentClassName} .bom_drag`
       ],
       parentClassName,