Browse Source

部分优化

wolyshaw 3 năm trước cách đây
mục cha
commit
247e56dddf

+ 6 - 2
src/teacher/music/upload/index.tsx

@@ -65,6 +65,7 @@ export default defineComponent({
       canEvaluate: 1,
       canEvaluate: 1,
       notation: 0,
       notation: 0,
       musicPrice: '',
       musicPrice: '',
+      subJectIndex: 0,
       selectTagVisible: false,
       selectTagVisible: false,
       subJectVisible: false,
       subJectVisible: false,
       tags: [] as string[],
       tags: [] as string[],
@@ -131,7 +132,7 @@ export default defineComponent({
       })
       })
       .then(res => (this.music_sheet_service_fee = res.data.paramValue))
       .then(res => (this.music_sheet_service_fee = res.data.paramValue))
     // if (teacherState.subjectList.length <= 0) {
     // if (teacherState.subjectList.length <= 0) {
-    request.get('/api-teacher/subject/subjectSelect').then(res => {
+    await request.get('/api-teacher/subject/subjectSelect').then(res => {
       teacherState.subjectList = res.data || []
       teacherState.subjectList = res.data || []
       this.subjectListNames = this.getSubjectListNames(teacherState.subjectList)
       this.subjectListNames = this.getSubjectListNames(teacherState.subjectList)
     })
     })
@@ -165,7 +166,9 @@ export default defineComponent({
           label: res.data.musicSubject,
           label: res.data.musicSubject,
           value: res.data.subjectNames
           value: res.data.subjectNames
         }
         }
-
+        this.subJectIndex = Object.keys(this.subjectListNames).findIndex(
+          key => key === res.data.musicSubject
+        )
         const names = res.data.musicTagNames.split(',')
         const names = res.data.musicTagNames.split(',')
         this.tags = res.data.musicTag.split(',')
         this.tags = res.data.musicTag.split(',')
 
 
@@ -768,6 +771,7 @@ export default defineComponent({
           onUpdate:show={val => (this.showPicker = val)}
           onUpdate:show={val => (this.showPicker = val)}
         >
         >
           <Picker
           <Picker
+            defaultIndex={this.subJectIndex}
             columnsFieldNames={{
             columnsFieldNames={{
               text: 'value'
               text: 'value'
             }}
             }}