Browse Source

增加选段后台设置训练标准

skyblued 2 năm trước cách đây
mục cha
commit
23fbc180ee

+ 1 - 1
src/pages/detail/helpers.ts

@@ -571,7 +571,7 @@ export const getNoteBySlursStart = (note: any, anyNoteHasSlurs?: boolean, pos?:
   if (!slursNote && anyNoteHasSlurs) {
     for (const _item of activeNote.measures) {
       const item = state.times.find((n: any) => n.NoteToGraphicalNoteObjectId == _item.NoteToGraphicalNoteObjectId)
-      console.log("🚀 ~ item", item)
+      // console.log("🚀 ~ item", item)
       if (item.noteElement.slurs.length) {
         slursNote = getSlursNote(item, pos)
         activeNote = item

+ 40 - 18
src/subpages/colexiu/afterClassTraining/index.tsx

@@ -1,21 +1,43 @@
-import { defineComponent, onMounted, watch } from "vue";
+import { defineComponent, onMounted, watch } from 'vue'
 import state from '/src/pages/detail/state'
 
 export default defineComponent({
-    name: 'afterClassTraining',
-    setup(){
-        watch(() => state.initRendered, () => {
-            if (state.initRendered){
-                // console.log(state.times)
-                // window.parent.postMessage({
-                //     api: 'selectMusicMeasure',
-
-                // }, '*')
-            }
-        })
-        // onMounted(() => {
-
-        // })
-        return () => <div></div>
-    }
-})
+  name: 'afterClassTraining',
+  setup() {
+    watch(
+      () => state.initRendered,
+      () => {
+        if (state.initRendered) {
+          window.parent.postMessage(
+            {
+              api: 'admin-selectMusicMeasure',
+              start: state.times[0]?.measureNumberPrinted,
+              end: state.times[state.times.length - 1]?.measureNumberPrinted,
+              speed: state.activeSpeed,
+            },
+            '*'
+          )
+        }
+      }
+    )
+    watch(
+      () => state.section.length,
+      () => {
+        if (state.section.length === 2) {
+        //   console.log(state.section)
+          window.parent.postMessage(
+            {
+              api: 'admin-selectMusicMeasure',
+              start: state.section[0]?.measureNumberPrinted,
+              end: state.section[1]?.measureNumberPrinted,
+              speed: state.activeSpeed,
+              change: true
+            },
+            '*'
+          )
+        }
+      }
+    )
+    return () => <div></div>
+  },
+})