|
@@ -21,18 +21,19 @@ export default defineComponent({
|
|
|
type: Boolean,
|
|
|
default: false,
|
|
|
},
|
|
|
- subject:{
|
|
|
- type: String as PropType<IVocals>,
|
|
|
- default: ""
|
|
|
- }
|
|
|
+ subject: {
|
|
|
+ type: String as PropType<IVocals>,
|
|
|
+ default: "",
|
|
|
+ },
|
|
|
},
|
|
|
setup(props, { emit }) {
|
|
|
- const subject = props.subject || "pan-flute"
|
|
|
+ const subject = props.subject || "pan-flute";
|
|
|
const data = reactive({
|
|
|
subject: subject,
|
|
|
realKey: 0,
|
|
|
notes: [] as IFIGNER_INSTRUMENT_Note[],
|
|
|
soundFonts: {} as any,
|
|
|
+ viewIndex: 0,
|
|
|
});
|
|
|
const fingerData = reactive({
|
|
|
relationshipIndex: 0,
|
|
@@ -46,15 +47,19 @@ export default defineComponent({
|
|
|
}
|
|
|
};
|
|
|
const getFingeringData = async () => {
|
|
|
- fingerData.subject = await getFingeringConfig(data.subject);
|
|
|
+ const subject: any = data.subject + (data.viewIndex === 0 ? "" : data.viewIndex);
|
|
|
+ fingerData.subject = await getFingeringConfig(subject);
|
|
|
};
|
|
|
const getSounFonts = () => {
|
|
|
const pathname = /(192|localhost)/.test(location.origin) ? "/" : location.pathname;
|
|
|
for (let i = 0; i < data.notes.length; i++) {
|
|
|
const note = data.notes[i];
|
|
|
- // console.log("🚀 ~ note:", note)
|
|
|
+ // console.log("🚀 ~ note:", i)
|
|
|
+ let url = `${pathname}soundfonts/${data.subject}/`;
|
|
|
+ url += note.realName;
|
|
|
+ url += ".mp3";
|
|
|
const noteAudio = new Howl({
|
|
|
- src: `${pathname}soundfonts/${data.subject}/${note.name}${note.octave}.mp3`,
|
|
|
+ src: url,
|
|
|
loop: true,
|
|
|
});
|
|
|
data.soundFonts[note.realKey] = noteAudio;
|
|
@@ -108,11 +113,26 @@ export default defineComponent({
|
|
|
<div class={styles.fingerBox}>
|
|
|
<div class={styles.head}>
|
|
|
<div class={styles.left}>
|
|
|
- {/* data.subject === 'pan-flute' && styles.backRight */}
|
|
|
- <button class={[styles.backBtn ]} onClick={() => handleBack()}>
|
|
|
+ <button
|
|
|
+ class={[styles.backBtn, data.subject === "pan-flute" && styles.backRight]}
|
|
|
+ onClick={() => handleBack()}
|
|
|
+ >
|
|
|
<img src={icons.icon_back} />
|
|
|
</button>
|
|
|
- {/* {data.subject === 'pan-flute' && <div class={styles.baseBtn}>切换视图</div>} */}
|
|
|
+ {data.subject === "pan-flute" && (
|
|
|
+ <div
|
|
|
+ class={styles.baseBtn}
|
|
|
+ onClick={() => {
|
|
|
+ data.viewIndex++;
|
|
|
+ if (data.viewIndex > 1) {
|
|
|
+ data.viewIndex = 0;
|
|
|
+ }
|
|
|
+ getFingeringData();
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 切换视图
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
</div>
|
|
|
<div class={styles.rightBtn}>
|
|
|
<div class={[styles.item, styles.disabled]}>
|
|
@@ -169,9 +189,15 @@ export default defineComponent({
|
|
|
<img draggable={false} src={icons.icon_btn_blue} />
|
|
|
)}
|
|
|
|
|
|
- <div class={styles.noteKey}>
|
|
|
+ <div class={[styles.noteKey, data.realKey === note.realKey && styles.keyActive]}>
|
|
|
{note.step > 0 ? steps.map((n) => <span class={styles.dot}></span>) : null}
|
|
|
- <span>{note.key}</span>
|
|
|
+
|
|
|
+ <div class={styles.noteName}>
|
|
|
+ <sup>
|
|
|
+ {note.mark && (note.mark === "rise" ? "#" : "b")}
|
|
|
+ </sup>
|
|
|
+ {note.key}
|
|
|
+ </div>
|
|
|
{note.step < 0 ? steps.map((n) => <span class={styles.dot}></span>) : null}
|
|
|
</div>
|
|
|
</div>
|