Browse Source

Merge branch 'feature-tianyong' of http://git.dayaedu.com/tianyong/gym-music-score into hqyDev

黄琪勇 7 months ago
parent
commit
7a82dcb125

+ 12 - 0
src/helpers/beatConfig.ts

@@ -58,3 +58,15 @@ export function beatUnitTo(beatUnit: string, isDot: boolean) {
    isDot && (multiple += ".")
    return multiple
 }
+
+/** 几分音符对应的速度图片 */
+export const unitImgs = {
+   "1/1": 'speed1',
+   "1/2": 'speed2',
+   "1/4": 'speed3',
+   "1/8": 'speed4',
+   "1/16": 'spee5',
+   "1/2.": 'speed6',
+   "1/4.": 'speed7',
+   "1/8.": 'speed8',
+} as Record<string, any>

BIN
src/page-instrument/header-top/image/speed1.png


BIN
src/page-instrument/header-top/image/speed2.png


BIN
src/page-instrument/header-top/image/speed3.png


BIN
src/page-instrument/header-top/image/speed4.png


BIN
src/page-instrument/header-top/image/speed5.png


BIN
src/page-instrument/header-top/image/speed6.png


BIN
src/page-instrument/header-top/image/speed7.png


BIN
src/page-instrument/header-top/image/speed8.png


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

@@ -857,7 +857,7 @@ export default defineComponent({
                   <img style={{ display: !metronomeData.disable ? "block" : "none" }} class={styles.iconBtn} src={headImg("tickoff.png")} />
                   <span style={{ whiteSpace: "nowrap" }}>节拍</span>
                   <div class={styles.speedCon}>
-                    <img src={headImg("speed.png")} />
+                    <img src={headImg(`${state.speedIcon}.png`)} />
                     <div>{Math.floor(state.speed)}</div>
                   </div>
                 </div>

+ 7 - 1
src/state.ts

@@ -23,7 +23,7 @@ import { headTopData } from "/src/page-instrument/header-top/index";
 import { api_lessonTrainingTrainingStudentDetail } from "/src/page-instrument/api"
 import { undoData, moveData } from "/src/view/plugins/move-music-score"
 import { HANDLE_WORK_ADD } from "/src/page-instrument/custom-plugins/work-index";
-import { speedBeatTo } from "/src/helpers/beatConfig"
+import { speedBeatTo, unitImgs } from "/src/helpers/beatConfig"
 
 const query: any = getQuery();
 
@@ -600,6 +600,8 @@ const state = reactive({
   isAutoRePlay: false,
   /** 跟练,是否收到了录音的回调 */
   hasFollowResult: false,  
+  /** 右上角速度图标,根据当前小节的速度是几分音符的动态变化 */
+  speedIcon: 'speed3', // 默认取1/4拍的图片
 });
 const browserInfo = browser();
 let offset_duration = 0;
@@ -2141,6 +2143,10 @@ function getNeedReduceMultipleRestNum(currMeasureIndex: number) {
 watch(
   () => state.activeMeasureIndex,
   () => {
+    // 监听音符小节的变化,取对应的小节速度图片
+    const currentNote = state.times[state.activeNoteIndex]
+    state.speedIcon = unitImgs[currentNote.speedBeatUnit]
+    
     // 需要减去的合并小节数
     // const needReduceMultipleRestNum = getNeedReduceMultipleRestNum(state.activeMeasureIndex)
     // const matchMeasureNum = state.activeMeasureIndex - needReduceMultipleRestNum - 1