|
@@ -47,20 +47,23 @@ export default defineComponent({
|
|
|
} catch {
|
|
|
//
|
|
|
}
|
|
|
- const list = this.subjectList.map((n: any) => n.subjects).flat().filter(n => typeof n === 'object').sort((a,b) => a.id - b.id)
|
|
|
+ const list = this.subjectList
|
|
|
const userSubjectId = state.user.data?.subjectId.split(',').map(n => parseInt(n)) || [this.params.lessonSubject]
|
|
|
let isRest = true
|
|
|
for(let i = 0; i < list.length; i++){
|
|
|
- if (userSubjectId.includes(list[i].id)) {
|
|
|
- this.params.lessonSubject = list[i].id
|
|
|
- this.params.subjectName = list[i].name
|
|
|
- isRest = false
|
|
|
- break;
|
|
|
+ const subjects = (list[i] as any).subjects || []
|
|
|
+ for(let j = 0; j < subjects.length; j++){
|
|
|
+ if (userSubjectId.includes(subjects[j].id)) {
|
|
|
+ this.params.lessonSubject = subjects[j].id
|
|
|
+ this.params.subjectName = subjects[j].name
|
|
|
+ isRest = false
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- if (isRest && list.length){
|
|
|
- this.params.lessonSubject = list[0].id
|
|
|
- this.params.subjectName = list[0].name
|
|
|
+ if (isRest && list.length && (list[0] as any).subjects){
|
|
|
+ this.params.lessonSubject = (list[0] as any).subjects[0].id
|
|
|
+ this.params.subjectName = (list[0] as any).subjects[0].name
|
|
|
}
|
|
|
sessionStorage.removeItem('videoClassSubjectId')
|
|
|
this.getList()
|