소스 검색

Update index.tsx

lex 1 년 전
부모
커밋
40896e4473
1개의 변경된 파일12개의 추가작업 그리고 10개의 파일을 삭제
  1. 12 10
      src/views/choose-homework/music-list/index.tsx

+ 12 - 10
src/views/choose-homework/music-list/index.tsx

@@ -169,17 +169,19 @@ export default defineComponent({
             }))
         ];
 
-        const studentSubjectIds =
-          baseState.platformType === 'TEACHER'
-            ? baseState.user.data.subjectId
-            : baseState.user.data.student.subjectIdList;
-        const id = studentSubjectIds ? studentSubjectIds.split(',')[0] : 0;
+        if (!appState.subjectId) {
+          const studentSubjectIds =
+            baseState.platformType === 'TEACHER'
+              ? baseState.user.data.subjectId
+              : baseState.user.data.student.subjectIdList;
+          const id = studentSubjectIds ? studentSubjectIds.split(',')[0] : 0;
 
-        appState.subjectOptions.forEach((subject: any) => {
-          if (Number(id) === subject.value) {
-            appState.subjectId = Number(id);
-          }
-        });
+          appState.subjectOptions.forEach((subject: any) => {
+            if (Number(id) === subject.value) {
+              appState.subjectId = Number(id);
+            }
+          });
+        }
       } catch (error) {
         //
       }