| 
														
															@@ -45,11 +45,15 @@ import { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } from "naive-ui"; 
														 | 
														
														 | 
														
															 } from "naive-ui"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { LongArrowAltDown, LongArrowAltUp, GripLinesVertical } from "@vicons/fa"; 
														 | 
														
														 | 
														
															 import { LongArrowAltDown, LongArrowAltUp, GripLinesVertical } from "@vicons/fa"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { svg2canvas } from "/src/utils/svg2canvas"; 
														 | 
														
														 | 
														
															 import { svg2canvas } from "/src/utils/svg2canvas"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import { downloadFile } from "/src/utils"; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import { decodeUrl, downloadFile } from "/src/utils"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import FileBtn, { IFileBtnType } from "./component/file-btn"; 
														 | 
														
														 | 
														
															 import FileBtn, { IFileBtnType } from "./component/file-btn"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import TheSetting from "./component/the-setting"; 
														 | 
														
														 | 
														
															 import TheSetting from "./component/the-setting"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { useRoute } from "vue-router"; 
														 | 
														
														 | 
														
															 import { useRoute } from "vue-router"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import { api_musicSheetCreationDetail, api_musicSheetCreationUpdate } from "../api"; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	api_musicSheetCreationDetail, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	api_musicSheetCreationSave, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	api_musicSheetCreationUpdate, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+} from "../api"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import instrumentsNames from "/src/constant/instrmentsNames.json"; 
														 | 
														
														 | 
														
															 import instrumentsNames from "/src/constant/instrmentsNames.json"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { ALL_NOTES, ALL_Pitches } from "./noteData"; 
														 | 
														
														 | 
														
															 import { ALL_NOTES, ALL_Pitches } from "./noteData"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { Close } from "@vicons/ionicons5"; 
														 | 
														
														 | 
														
															 import { Close } from "@vicons/ionicons5"; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -58,6 +62,7 @@ import { getQuery } from "/src/utils/queryString"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import Metronome, { metronomeData } from "/src/helpers/metronome"; 
														 | 
														
														 | 
														
															 import Metronome, { metronomeData } from "/src/helpers/metronome"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import cleanDeep from "clean-deep"; 
														 | 
														
														 | 
														
															 import cleanDeep from "clean-deep"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { saveAs } from "file-saver"; 
														 | 
														
														 | 
														
															 import { saveAs } from "file-saver"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import qs from "query-string"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 export const initMusic = (total: number): IMeasure[] => { 
														 | 
														
														 | 
														
															 export const initMusic = (total: number): IMeasure[] => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	return new Array(total).fill(0).map((item, index) => { 
														 | 
														
														 | 
														
															 	return new Array(total).fill(0).map((item, index) => { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -338,7 +343,7 @@ export default defineComponent({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 							const progress = startTime / 1000 / totalTime; 
														 | 
														
														 | 
														
															 							const progress = startTime / 1000 / totalTime; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 							nextTick(() => { 
														 | 
														
														 | 
														
															 							nextTick(() => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 								(abcData.synthControl as any).seek(progress); 
														 | 
														
														 | 
														
															 								(abcData.synthControl as any).seek(progress); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-							}) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+							}); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 							return; 
														 | 
														
														 | 
														
															 							return; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 						} 
														 | 
														
														 | 
														
															 						} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					} 
														 | 
														
														 | 
														
															 					} 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -1237,8 +1242,8 @@ export default defineComponent({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			return instrumentsNames[code as keyof typeof instrumentsNames]; 
														 | 
														
														 | 
														
															 			return instrumentsNames[code as keyof typeof instrumentsNames]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		}); 
														 | 
														
														 | 
														
															 		}); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		const getDetailData = async () => { 
														 | 
														
														 | 
														
															 		const getDetailData = async () => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			const query = getQuery(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			data.loading = true; 
														 | 
														
														 | 
														
															 			data.loading = true; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			const query: any = getQuery(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			const res = await api_musicSheetCreationDetail(query.id); 
														 | 
														
														 | 
														
															 			const res = await api_musicSheetCreationDetail(query.id); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			if (res?.code == 200) { 
														 | 
														
														 | 
														
															 			if (res?.code == 200) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				data.musicId = res.data.id || ""; 
														 | 
														
														 | 
														
															 				data.musicId = res.data.id || ""; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -1269,21 +1274,63 @@ export default defineComponent({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			return res; 
														 | 
														
														 | 
														
															 			return res; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		}; 
														 | 
														
														 | 
														
															 		}; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		const handleSaveMusic = async (tips = true) => { 
														 | 
														
														 | 
														
															 		const handleSaveMusic = async (tips = true) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			await api_musicSheetCreationUpdate({ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				name: data.musicName, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				creator: data.creator, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				creationConfig: renderMeasures(abcData.abc, { hiddenIndex: true }), 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				creationData: JSON.stringify(cleanDeep(abcData.abc)), 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				id: data.musicId, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				subjectId: 3, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			}); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			const query = getQuery(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			if (query.id) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				await api_musicSheetCreationUpdate({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					name: data.musicName, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					creator: data.creator, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					creationConfig: renderMeasures(abcData.abc, { hiddenIndex: true }), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					creationData: JSON.stringify(cleanDeep(abcData.abc)), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					id: query.id, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					subjectId: "", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				}); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			} else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				const res = await api_musicSheetCreationSave({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					name: data.musicName, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					creator: data.creator, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					creationConfig: renderMeasures(abcData.abc, { hiddenIndex: true }), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					creationData: JSON.stringify(cleanDeep(abcData.abc)), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					subjectId: "", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				}); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				if (res?.data) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					const hash = location.hash.split("?"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					const qs_data = qs.parse(hash[1]); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					qs_data.id = res.data; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					try { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+						delete qs_data.config; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					} catch (error) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+						console.log("🚀 ~ error:", error) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					location.hash = hash[0] + "?" + qs.stringify(qs_data); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			if (tips) { 
														 | 
														
														 | 
														
															 			if (tips) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				message.success("保存成功"); 
														 | 
														
														 | 
														
															 				message.success("保存成功"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			} 
														 | 
														
														 | 
														
															 			} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			data.isSave = true; 
														 | 
														
														 | 
														
															 			data.isSave = true; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		}; 
														 | 
														
														 | 
														
															 		}; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		const hanldeInitCreate = () => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			const query = getQuery(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			const abc = decodeUrl(query.config); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			console.log("🚀 ~ abc:", abc); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			abcData.abc.celf = abc.celf ?? "K:treble"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			abcData.abc.key = abc.key ?? "K:C"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			abcData.abc.meter = abc.meter ?? "M:4/4"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			abcData.abc.speed = abc.speed ?? "Q:1/4=80"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			abcData.abc.visualTranspose = abc.visualTranspose ?? 0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			abcData.abc.subjectCode = abc.subjectCode ?? "acoustic_grand_piano"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			const _instruments = ABCJS.synth.instrumentIndexToName.indexOf(abcData.abc.subjectCode as any); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			abcData.synthOptions.program = _instruments > -1 ? _instruments : 0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			abcData.abc.measures = initMusic(abc.measure ?? 30); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			data.loading = false; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		}; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		onMounted(async () => { 
														 | 
														
														 | 
														
															 		onMounted(async () => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			await getDetailData(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			const query = getQuery(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			if (query.id) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				await getDetailData(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			} else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				hanldeInitCreate(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			if (ABCJS.synth.supportsAudio()) { 
														 | 
														
														 | 
														
															 			if (ABCJS.synth.supportsAudio()) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				abcData.synthControl = new ABCJS.synth.SynthController(); 
														 | 
														
														 | 
														
															 				abcData.synthControl = new ABCJS.synth.SynthController(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				// console.log("🚀 ~ abcData.synthControl:", abcData.synthControl) 
														 | 
														
														 | 
														
															 				// console.log("🚀 ~ abcData.synthControl:", abcData.synthControl) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -1758,6 +1805,8 @@ export default defineComponent({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 													await loadMiniMp3(); 
														 | 
														
														 | 
														
															 													await loadMiniMp3(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 													resetMidi(true); 
														 | 
														
														 | 
														
															 													resetMidi(true); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 													popup.selectSubjectShow = false; 
														 | 
														
														 | 
														
															 													popup.selectSubjectShow = false; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+													abcData.abc.subjectCode = 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+														ABCJS.synth.instrumentIndexToName[abcData.synthOptions.program]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 												}} 
														 | 
														
														 | 
														
															 												}} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 											></NSelect> 
														 | 
														
														 | 
														
															 											></NSelect> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 										</> 
														 | 
														
														 | 
														
															 										</> 
														 |