Explorar el Código

Merge branch 'fix-tianyong'

TIANYONG hace 1 año
padre
commit
da9e4a2b65

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

@@ -352,14 +352,14 @@ export default defineComponent({
                 </>}
               </span>
             </div>
-            {/* {state.musicRendered && !query.lessonTrainingId && !query.questionId && state.isConcert && (
+            {state.musicRendered && !query.lessonTrainingId && !query.questionId && state.isConcert && (
               <div class={[styles.btn]} onClick={() => {
                 toggleMusicSheet.toggle(true)
               }}>
                 <img class={styles.iconBtn} src={headImg(`shenggui.svg`)} />
                 <span>声轨</span>
               </div>
-            )} */}
+            )}
             <div
               id={state.platform === IPlatform.PC ? "teacherTop-1" : "studnetT-1"}
               style={{ display: originBtn.value.display ? "" : "none" }}
@@ -372,7 +372,7 @@ export default defineComponent({
               <img style={{ display: state.playSource === "music" ? "none" : "" }} class={styles.iconBtn} src={headImg(`background.svg`)} />
               <span>{state.playSource === "music" ? "原声" : "伴奏"}</span>
             </div>
-            {/* <div
+            <div
               class={styles.btn}
               onClick={async () => {
                 metronomeData.disable = !metronomeData.disable;
@@ -382,7 +382,7 @@ export default defineComponent({
               <img style={{ display: metronomeData.disable ? "block" : "none" }} class={styles.iconBtn} src={headImg("tickoff.svg")} />
               <img style={{ display: !metronomeData.disable ? "block" : "none" }} class={styles.iconBtn} src={headImg("tickon.svg")} />
               <span style={{ whiteSpace: "nowrap" }}>节拍器</span>
-            </div>             */}
+            </div>            
             <div id={state.platform === IPlatform.PC ? "teacherTop-2" : "studnetT-2"} style={{ display: selectBtn.value.display ? "" : "none" }} class={[styles.btn, selectBtn.value.disabled && styles.disabled]} onClick={() => handleChangeSection()}>
               <img style={{ display: state.section.length === 0 ? "" : "none" }} class={styles.iconBtn} src={headImg(`section0.svg`)} />
               <img style={{ display: state.section.length === 1 ? "" : "none" }} class={styles.iconBtn} src={headImg(`section1.svg`)} />

+ 3 - 3
src/page-instrument/view-detail/index.tsx

@@ -159,6 +159,8 @@ export default defineComponent({
 			const track = data.code || data.track;
 			state.track = track ? track.replace(/ /g, "").toLocaleLowerCase() : "";
 			state.enableNotation = data.notation ? true : false;
+      // 是否是合奏,先根据background判断
+      state.isConcert = data.background?.length > 1
 
       // console.log("🚀 ~ state.subjectId:", state.subjectId, state.track as any , state.subjectId)
       // 是否打击乐
@@ -172,7 +174,7 @@ export default defineComponent({
       state.isSpecialBookCategory = !classids.includes(data.musicSheetCategoriesId) 
 
       // 设置指法
-      const code = mappingVoicePart(state.subjectId, "INSTRUMENT");
+      const code = state.isConcert ? mappingVoicePart(state.trackId, "ENSEMBLE") : mappingVoicePart(state.subjectId, "INSTRUMENT");
       state.fingeringInfo = subjectFingering(code);
       console.log("🚀 ~ state.fingeringInfo:", code, state.fingeringInfo, state.trackId, state.track);
 
@@ -189,8 +191,6 @@ export default defineComponent({
 
       //课堂乐器, 渲染类型: 五线谱, 简谱
       state.musicRenderType = query.musicRenderType || EnumMusicRenderType.firstTone;
-      // 是否是合奏,先根据background判断
-      state.isConcert = data.background?.length > 1
       console.log('state对象', state)
     };
 

+ 75 - 1
src/view/fingering/fingering-config.ts

@@ -56,7 +56,7 @@ export type IVocals =
 /** 映射声部ID */
 export const mappingVoicePart = (
 	id: number | string,
-	soruce: "GYM" | "COLEXIU" | "ORCHESTRA" | "INSTRUMENT"
+	soruce: "GYM" | "COLEXIU" | "ORCHESTRA" | "INSTRUMENT" | "ENSEMBLE"
 ): number => {
 	if (soruce === "GYM") {
 		return Number(id);
@@ -130,6 +130,80 @@ export const mappingVoicePart = (
 			nai: "melodica",
 		};
 		return subject[code] || 0;
+	} else if (soruce === "ENSEMBLE") {
+		let code = id;
+		const subject: { [_key: string | number]: any } = {
+			"Piccolo": "piccolo",
+			"Flute 1": 2,
+			"Flute 2": 2,
+			"Oboe": 4,
+			"Clarinet in Bb 1": 4,
+			"Clarinet in Bb 2": 4,
+			"Alto Clarinet in Eb": 4,
+			"Bass Clarinet in Bb": 4,
+			"Bassoon": 1,
+			"Alto Saxophone": 5,
+			"Tenor Saxophone": 5,
+			"Baritone Saxophone": 5,
+			"Trumpet in Bb 1": 12,
+			"Trumpet in Bb 2": 12,
+			"Horn in F": 13,
+			"Trombone 1": 14,
+			"Trombone 2": 14,
+			"Euphonium": 15,
+			"Tuba": 17,
+			"Chimes": 1,
+			"Bells": 1,
+			"Xylophone": 1,
+			"Snare Drum": 1,
+			"Bass Drum": 1,
+			"Triangle": 1,
+			"Suspended Cymbal": 1,
+			"Crash Cymbals": 1,
+			"Concert Toms": 1,
+			"Timpani": 1,
+			flute: 2,
+			oboe: 4,
+			clarinet: 4,
+			trombone: 14,
+			tuba: 17,
+			trumpet: 12,
+			horn: 13,
+			altosaxophone: 6,
+			tenorsaxophone: 6,
+			saxophone: 6,
+			upbasshorn: 15,
+			melodica: 137,
+			hulusiFlute: 136,
+			panflute: 135,
+			recorder: 120,
+			ukulele: 130,
+			mouthorgan: 140,
+			piano: 150,
+			4: "piccolo",
+			3: "hulusi-flute",
+			1: "pan-flute",
+			2: "ocarina",
+			5: "melodica",
+			26: 12,
+			tenorrecorder: "piccolo",
+			woodwind: "hulusi-flute",
+			panpipes: "pan-flute",
+			ocarina: "ocarina",
+			nai: "melodica",
+		};
+		let _track;
+		if (typeof code === 'string') {
+			for (let sKey in subject) {
+				if(sKey === code) {
+					_track = subject[sKey]
+					break;
+				}
+			}
+		} else {
+			_track = subject.code
+		}
+		return _track;
 	}
 	return 0;
 };

+ 14 - 3
src/view/plugins/toggleMusicSheet/choosePartName/index.tsx

@@ -1,4 +1,4 @@
-import { PropType, computed, defineComponent, ref, toRefs } from 'vue'
+import { PropType, computed, defineComponent, ref, toRefs, onMounted } from 'vue'
 import { Picker, Button, Icon } from 'vant'
 import styles from './index.module.less'
 
@@ -21,16 +21,27 @@ export default defineComponent({
     const columns = computed(() => {
       return partListNames.value
     })
-    console.log(partListNames.value, partIndex.value, selectIndex.value, columns.value, 999999)
+    // console.log(partListNames.value, partIndex.value, selectIndex.value, columns.value, 999999)
+    /**
+     * 默认选中的
+     * picker组件,3.x的版本可以使用defaultIndex,4.x的版本只能使用v-model传递
+     * */ 
+    const selValues = ref([partIndex.value]);
+    const myPicker = ref();
+    onMounted(() => {
+			console.log(myPicker.value)
+		});
     return () => (
       <div class={styles.container}>
         <div class={styles.top}>
-          <div class={styles.title}>请选择您练习的乐器</div>
+          <div class={styles.title}>请选择您练习的乐器2</div>
           <Icon name="cross" size={24} onClick={() => emit('close')} />
         </div>
         <Picker
+          ref={myPicker}
           class={styles.picker}
           defaultIndex={props.partIndex}
+          v-model={selValues.value}
           showToolbar={false}
           columns={columns.value}
           visibleItemCount={Math.ceil(document.body.clientHeight / 44 / 3)}

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

@@ -2,7 +2,6 @@ import { computed, defineComponent, reactive } from 'vue'
 import styles from './index.module.less'
 import { Icon, Popup } from 'vant'
 import ChoosePartName from './choosePartName'
-import runtime, * as RuntimeUtils from '/src/pages/detail/runtime'
 import state, { togglePlay } from "/src/state";
 import qs from 'query-string'
 import { getInstrumentName } from "/src/constant/instruments";
@@ -33,6 +32,7 @@ export default defineComponent({
     })
 
     const switchMusic = (index: number) => {
+      if (state.partIndex === index) return
       // 暂停播放
       togglePlay("paused");
       // 销毁播放器