|
@@ -124,7 +124,7 @@ export default defineComponent({
|
|
const data = reactive({
|
|
const data = reactive({
|
|
loading: true,
|
|
loading: true,
|
|
drawCount: 0,
|
|
drawCount: 0,
|
|
- isSave: false,
|
|
|
|
|
|
+ isSave: true,
|
|
musicId: "",
|
|
musicId: "",
|
|
musicName: "", // 曲谱名称
|
|
musicName: "", // 曲谱名称
|
|
creator: "", // 创建者
|
|
creator: "", // 创建者
|
|
@@ -331,7 +331,7 @@ export default defineComponent({
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- data.activePlayNote = {...ev};
|
|
|
|
|
|
+ data.activePlayNote = { ...ev };
|
|
var cursor = document.querySelector("#paper svg .ABCJS-cursor");
|
|
var cursor = document.querySelector("#paper svg .ABCJS-cursor");
|
|
if (cursor) {
|
|
if (cursor) {
|
|
cursor.setAttribute("x1", ev.left + ev.width / 2);
|
|
cursor.setAttribute("x1", ev.left + ev.width / 2);
|
|
@@ -406,10 +406,10 @@ export default defineComponent({
|
|
} else {
|
|
} else {
|
|
abcData.synthControl.restart();
|
|
abcData.synthControl.restart();
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
- if (!data.playState){
|
|
|
|
|
|
+ if (!data.playState) {
|
|
abcData.synthControl.play();
|
|
abcData.synthControl.play();
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
// console.log("🚀 ~ abcData.synthControl:", abcData.synthControl.timer.noteTimings);
|
|
// console.log("🚀 ~ abcData.synthControl:", abcData.synthControl.timer.noteTimings);
|
|
};
|
|
};
|
|
@@ -481,7 +481,7 @@ export default defineComponent({
|
|
data.playState = false;
|
|
data.playState = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ data.isSave = false;
|
|
return new Promise((resolve) => {
|
|
return new Promise((resolve) => {
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
data.music = renderMeasures(abcData.abc);
|
|
data.music = renderMeasures(abcData.abc);
|
|
@@ -578,6 +578,21 @@ export default defineComponent({
|
|
return notes;
|
|
return notes;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ const handleClose = () => {
|
|
|
|
+ // 判断是否在应用中
|
|
|
|
+ if (window.matchMedia("(display-mode: standalone)").matches) {
|
|
|
|
+ window.onbeforeunload = null;
|
|
|
|
+ window.parent.postMessage(
|
|
|
|
+ {
|
|
|
|
+ api: "notation_exit",
|
|
|
|
+ },
|
|
|
|
+ "*"
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ window.close();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
/**
|
|
/**
|
|
*
|
|
*
|
|
* @param key
|
|
* @param key
|
|
@@ -595,20 +610,29 @@ export default defineComponent({
|
|
abcData.abc.measures[data.active?.measureIndex]?.notes[data.active?.noteIndex] || null;
|
|
abcData.abc.measures[data.active?.measureIndex]?.notes[data.active?.noteIndex] || null;
|
|
|
|
|
|
if (type === "exit") {
|
|
if (type === "exit") {
|
|
- // 退出时先保存 不提示
|
|
|
|
- await handleSaveMusic(false);
|
|
|
|
- // 判断是否在应用中
|
|
|
|
- if (window.matchMedia("(display-mode: standalone)").matches) {
|
|
|
|
- window.onbeforeunload = null;
|
|
|
|
- window.parent.postMessage(
|
|
|
|
- {
|
|
|
|
- api: "notation_exit",
|
|
|
|
- },
|
|
|
|
- "*"
|
|
|
|
- );
|
|
|
|
- } else {
|
|
|
|
- window.close();
|
|
|
|
|
|
+ if (!data.isSave) {
|
|
|
|
+ showConfirmDialog({
|
|
|
|
+ title: "温馨提示",
|
|
|
|
+ message: "还没保存,是否保存?",
|
|
|
|
+ })
|
|
|
|
+ .then(async () => {
|
|
|
|
+ const msg = message.loading("保存中...");
|
|
|
|
+ await handleSaveMusic(false);
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ msg.type = "success";
|
|
|
|
+ msg.content = "保存成功";
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ msg.destroy();
|
|
|
|
+ handleClose();
|
|
|
|
+ }, 500);
|
|
|
|
+ }, 300);
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ handleClose();
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
+ handleClose();
|
|
}
|
|
}
|
|
// console.log(params, activeNote);
|
|
// console.log(params, activeNote);
|
|
if (type === "type") {
|
|
if (type === "type") {
|
|
@@ -1142,6 +1166,10 @@ export default defineComponent({
|
|
value: index,
|
|
value: index,
|
|
}));
|
|
}));
|
|
});
|
|
});
|
|
|
|
+ const instrumentName = computed(() => {
|
|
|
|
+ const code = ABCJS.synth.instrumentIndexToName[abcData.synthOptions.program];
|
|
|
|
+ return instrumentsNames[code as keyof typeof instrumentsNames];
|
|
|
|
+ });
|
|
const getDetailData = async () => {
|
|
const getDetailData = async () => {
|
|
data.loading = true;
|
|
data.loading = true;
|
|
const query: any = getQuery();
|
|
const query: any = getQuery();
|
|
@@ -1620,7 +1648,16 @@ export default defineComponent({
|
|
<div class={styles.btnImg} onClick={() => (popup.instrument = true)}>
|
|
<div class={styles.btnImg} onClick={() => (popup.instrument = true)}>
|
|
<img class={styles.topBtnIcon} src={getImage("icon_25.png")} />
|
|
<img class={styles.topBtnIcon} src={getImage("icon_25.png")} />
|
|
</div>
|
|
</div>
|
|
- <div>选择声部</div>
|
|
|
|
|
|
+ <div
|
|
|
|
+ style={{
|
|
|
|
+ overflow: "hidden",
|
|
|
|
+ textOverflow: "ellipsis",
|
|
|
|
+ whiteSpace: "nowrap",
|
|
|
|
+ maxWidth: "60px",
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ {instrumentName.value}
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
),
|
|
),
|
|
default: () => (
|
|
default: () => (
|