|
@@ -1,4 +1,14 @@
|
|
-import { PropType, computed, defineComponent, nextTick, onBeforeMount, onMounted, onUnmounted, reactive, ref } from "vue";
|
|
|
|
|
|
+import {
|
|
|
|
+ PropType,
|
|
|
|
+ computed,
|
|
|
|
+ defineComponent,
|
|
|
|
+ nextTick,
|
|
|
|
+ onBeforeMount,
|
|
|
|
+ onMounted,
|
|
|
|
+ onUnmounted,
|
|
|
|
+ reactive,
|
|
|
|
+ ref,
|
|
|
|
+} from "vue";
|
|
import styles from "./index.module.less";
|
|
import styles from "./index.module.less";
|
|
import icons from "./image/icons.json";
|
|
import icons from "./image/icons.json";
|
|
import { FIGNER_INSTRUMENT_DATA, IFIGNER_INSTRUMENT_Note } from "/src/view/figner-preview";
|
|
import { FIGNER_INSTRUMENT_DATA, IFIGNER_INSTRUMENT_Note } from "/src/view/figner-preview";
|
|
@@ -43,6 +53,7 @@ export default defineComponent({
|
|
notes: [] as IFIGNER_INSTRUMENT_Note[],
|
|
notes: [] as IFIGNER_INSTRUMENT_Note[],
|
|
tones: [] as IFIGNER_INSTRUMENT_Note[],
|
|
tones: [] as IFIGNER_INSTRUMENT_Note[],
|
|
activeTone: {} as IFIGNER_INSTRUMENT_Note,
|
|
activeTone: {} as IFIGNER_INSTRUMENT_Note,
|
|
|
|
+ popupActiveTone: {} as IFIGNER_INSTRUMENT_Note,
|
|
activeToneName: "",
|
|
activeToneName: "",
|
|
soundFonts: {} as any,
|
|
soundFonts: {} as any,
|
|
viewIndex: 0,
|
|
viewIndex: 0,
|
|
@@ -72,6 +83,7 @@ export default defineComponent({
|
|
data.tones = fignerData.tones || [];
|
|
data.tones = fignerData.tones || [];
|
|
if (data.tones.length) {
|
|
if (data.tones.length) {
|
|
data.activeTone = data.tones[0];
|
|
data.activeTone = data.tones[0];
|
|
|
|
+ data.popupActiveTone = data.tones[0];
|
|
}
|
|
}
|
|
data.tips = fignerData.tips || [];
|
|
data.tips = fignerData.tips || [];
|
|
setNotes();
|
|
setNotes();
|
|
@@ -132,7 +144,7 @@ export default defineComponent({
|
|
data.realKey = 0;
|
|
data.realKey = 0;
|
|
data.noteAudio = null as unknown as Howl;
|
|
data.noteAudio = null as unknown as Howl;
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ };
|
|
|
|
|
|
/** 返回 */
|
|
/** 返回 */
|
|
const handleBack = () => {
|
|
const handleBack = () => {
|
|
@@ -203,7 +215,7 @@ export default defineComponent({
|
|
watch(
|
|
watch(
|
|
() => pageVisible.value,
|
|
() => pageVisible.value,
|
|
(val) => {
|
|
(val) => {
|
|
- if (val === 'hidden') {
|
|
|
|
|
|
+ if (val === "hidden") {
|
|
console.log("页面隐藏停止播放");
|
|
console.log("页面隐藏停止播放");
|
|
handleStop();
|
|
handleStop();
|
|
}
|
|
}
|
|
@@ -216,14 +228,14 @@ export default defineComponent({
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
- const noteBoxRef = ref()
|
|
|
|
- const scrollNoteBox = (type: 'left' | 'right') => {
|
|
|
|
|
|
+ const noteBoxRef = ref();
|
|
|
|
+ const scrollNoteBox = (type: "left" | "right") => {
|
|
const width = noteBoxRef.value.offsetWidth / 2;
|
|
const width = noteBoxRef.value.offsetWidth / 2;
|
|
(noteBoxRef.value as unknown as HTMLElement).scrollBy({
|
|
(noteBoxRef.value as unknown as HTMLElement).scrollBy({
|
|
- left: type === 'left' ? -width : width,
|
|
|
|
- behavior: 'smooth'
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ left: type === "left" ? -width : width,
|
|
|
|
+ behavior: "smooth",
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
|
|
/** 滚轮缩放 */
|
|
/** 滚轮缩放 */
|
|
const handleWheel = (e: WheelEvent) => {
|
|
const handleWheel = (e: WheelEvent) => {
|
|
@@ -338,10 +350,10 @@ export default defineComponent({
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class={styles.notes}>
|
|
<div class={styles.notes}>
|
|
- <Button class={styles.noteBtn} onClick={() => scrollNoteBox('left')}>
|
|
|
|
|
|
+ <Button class={styles.noteBtn} onClick={() => scrollNoteBox("left")}>
|
|
<Icon name="arrow-left" />
|
|
<Icon name="arrow-left" />
|
|
</Button>
|
|
</Button>
|
|
- <div class={[styles.noteContent, browsInfo.ios ? '' : styles.noteContentWrap]}>
|
|
|
|
|
|
+ <div class={[styles.noteContent, browsInfo.ios ? "" : styles.noteContentWrap]}>
|
|
<div ref={noteBoxRef} class={styles.noteBox}>
|
|
<div ref={noteBoxRef} class={styles.noteBox}>
|
|
{data.notes.map((note: IFIGNER_INSTRUMENT_Note, index: number) => {
|
|
{data.notes.map((note: IFIGNER_INSTRUMENT_Note, index: number) => {
|
|
const steps = new Array(Math.abs(note.step)).fill(1);
|
|
const steps = new Array(Math.abs(note.step)).fill(1);
|
|
@@ -374,7 +386,7 @@ export default defineComponent({
|
|
})}
|
|
})}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <Button class={styles.noteBtn} onClick={() => scrollNoteBox('right')}>
|
|
|
|
|
|
+ <Button class={styles.noteBtn} onClick={() => scrollNoteBox("right")}>
|
|
<Icon name="arrow" />
|
|
<Icon name="arrow" />
|
|
</Button>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
@@ -459,9 +471,9 @@ export default defineComponent({
|
|
<Button
|
|
<Button
|
|
round
|
|
round
|
|
plain
|
|
plain
|
|
- type={data.activeTone.realName === tone.realName ? "primary" : "default"}
|
|
|
|
|
|
+ type={data.popupActiveTone.realName === tone.realName ? "primary" : "default"}
|
|
onClick={() => {
|
|
onClick={() => {
|
|
- data.activeTone = tone;
|
|
|
|
|
|
+ data.popupActiveTone = tone;
|
|
setNotes();
|
|
setNotes();
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
@@ -470,7 +482,7 @@ export default defineComponent({
|
|
全按作
|
|
全按作
|
|
<div class={[styles.noteKey, styles.hulusiNoteKey]}>
|
|
<div class={[styles.noteKey, styles.hulusiNoteKey]}>
|
|
{tone.step > 0 ? <span class={styles.dot}></span> : null}
|
|
{tone.step > 0 ? <span class={styles.dot}></span> : null}
|
|
- <div class={styles.noteName}>
|
|
|
|
|
|
+ <div class={styles.noteName} style={{ fontSize: "0.25rem" }}>
|
|
<sup>{tone.mark && (tone.mark === "rise" ? "#" : "b")}</sup>
|
|
<sup>{tone.mark && (tone.mark === "rise" ? "#" : "b")}</sup>
|
|
{tone.key}
|
|
{tone.key}
|
|
</div>
|
|
</div>
|
|
@@ -492,7 +504,15 @@ export default defineComponent({
|
|
<Button type="primary" round plain onClick={() => (data.tnoteShow = false)}>
|
|
<Button type="primary" round plain onClick={() => (data.tnoteShow = false)}>
|
|
取消
|
|
取消
|
|
</Button>
|
|
</Button>
|
|
- <Button type="primary" round onClick={() => (data.tnoteShow = false)}>
|
|
|
|
|
|
+ <Button
|
|
|
|
+ type="primary"
|
|
|
|
+ round
|
|
|
|
+ onClick={() => {
|
|
|
|
+ data.activeTone = data.popupActiveTone;
|
|
|
|
+ setNotes();
|
|
|
|
+ data.tnoteShow = false;
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
确定
|
|
确定
|
|
</Button>
|
|
</Button>
|
|
</Space>
|
|
</Space>
|