소스 검색

feat: 谱面编辑

TIANYONG 1 년 전
부모
커밋
ec3bfcd15d
3개의 변경된 파일19개의 추가작업 그리고 7개의 파일을 삭제
  1. 1 0
      src/state.ts
  2. 6 6
      src/view/plugins/move-music-score/index.tsx
  3. 12 1
      src/view/selection/index.tsx

+ 1 - 0
src/state.ts

@@ -801,6 +801,7 @@ const setState = (data: any, index: number) => {
   state.canSelectTracks = data.multiTracksSelection;
   // 开启预备小节
   state.isOpenPrepare = true;
+  state.extStyleConfigJson = data.extStyleConfigJson || {}
   // console.log("🚀 ~ state.subjectId:", state.subjectId, state.track as any , state.subjectId)
   // 是否打击乐
   /**

+ 6 - 6
src/view/plugins/move-music-score/index.tsx

@@ -378,7 +378,7 @@ const handleUndo = () => {
 };
 
 /** 根据移动数据渲染 */
-const renderForMoveData = () => {
+export const renderForMoveData = () => {
 	if (state.extStyleConfigJson) {
 		try {
 			extStyleConfigJson = JSON.parse(state.extStyleConfigJson);
@@ -386,8 +386,8 @@ const renderForMoveData = () => {
 			extStyleConfigJson = {};
 		}
 	}
-
 	if (!extStyleConfigJson || !extStyleConfigJson?.[moveData.partIndex]) return;
+	initSvgId();
 	const list = extStyleConfigJson?.[moveData.partIndex];
 	if (list && Array.isArray(list)) {
 		console.log("🚀 ~ list", list);
@@ -414,10 +414,10 @@ export default defineComponent({
 		const isOpen = query.isMove === "1" ? true : false;
 		console.log("🚀 ~ isOpen:", isOpen);
 		onMounted(() => {
-			if (isOpen) {
-				initSvgId();
-			}
-			renderForMoveData();
+			// if (isOpen) {
+			// 	initSvgId();
+			// }
+			// renderForMoveData();
 			const toolBox = document.getElementById("toolBox");
 			toolBox && document.body.appendChild(toolBox);
 		});

+ 12 - 1
src/view/selection/index.tsx

@@ -5,10 +5,12 @@ import { metronomeData } from "/src/helpers/metronome";
 import { evaluatingData } from "../evaluating";
 import { leveByScoreMeasureIcons } from "../evaluating/evaluatResult";
 import { Icon } from "vant";
-import MoveMusicScore from "../plugins/move-music-score";
+import MoveMusicScore, { moveData, renderForMoveData } from "../plugins/move-music-score";
 import { useRoute } from "vue-router";
 import { getQuery } from "/src/utils/queryString";
 
+const query: any = getQuery();
+
 const selectData = reactive({
 	notes: [] as any[],
 	staves: [] as any[],
@@ -202,6 +204,15 @@ export default defineComponent({
 		});
 		onMounted(() => {
 			calcNoteData();
+			// 初始化移动
+			try {
+			moveData.partIndex = query['part-index'] as string || '0'
+			console.log(6666,moveData.partIndex,query['part-index'])
+			
+			setTimeout(() => {
+				renderForMoveData()
+			}, 1);
+			} catch (error) {}
 		});
 		return () => (
 			<div