Forráskód Böngészése

Merge branch 'iteration-large-version' of http://git.dayaedu.com/lex/classroom-instruments into iteration-large-version

TIANYONG 1 éve
szülő
commit
3bd57fba91

+ 15 - 2
src/views/prepare-lessons/model/select-resources/select-item/index.tsx

@@ -17,6 +17,7 @@ import { useDebounceFn, useResizeObserver } from '@vueuse/core';
 import CardPreview from '/src/components/card-preview';
 import { eventGlobal } from '/src/utils';
 import ClassSearchGroup from './class-search-group';
+import { useCatchStore } from '/src/store/modules/catchData';
 
 const formatType = (type: string) => {
   if (type === 'shareResources') {
@@ -43,6 +44,7 @@ export default defineComponent({
   },
   setup(props) {
     const prepareStore = usePrepareStore();
+    const catchStore = useCatchStore();
     const { type } = toRefs(props);
     const className = 'resourceSearchGroup' + +new Date();
     const state = reactive({
@@ -57,8 +59,9 @@ export default defineComponent({
         type: 'MUSIC', //
         name: '',
         bookVersionId: null,
-        subjectId: prepareStore.getSubjectId,
+        // subjectId: prepareStore.getSubjectId,
         sourceType: formatType(type.value),
+        musicalInstrumentId: null as any,
         enableFlag: true
       },
       tableList: [] as any,
@@ -163,7 +166,17 @@ export default defineComponent({
       }
     };
 
-    onMounted(() => {
+    onMounted(async () => {
+      // 获取声部
+      await catchStore.getSubjects();
+      catchStore.getSubjectInstruments.forEach((item: any) => {
+        if (item.id == prepareStore.getSubjectId) {
+          if (item.instruments && item.instruments.length > 0) {
+            state.searchGroup.musicalInstrumentId = item.instruments[0].value;
+          }
+        }
+      });
+
       getList();
 
       useResizeObserver(