created ( ) { / / 当前请求的 url this. url = window . location / / 课程 id this.courseId = this.$route.params.courseId / / 课程计划 id this.chapter = this.$route.params.chapter / / 查询课程信息 systemApi.course_view ( this.courseId ) . then ( ( view_course ) = > { if ( !view_course || !view_course[this.courseId] ) { this.$ message . error ( "获取课程信息失败,请从新进入此页面!" ) return ; } let courseInfo = view_course[this.courseId] console. log ( courseInfo ) this.coursename = courseInfo. name if ( courseInfo.teachplan ) { / / 将从服务端获取的课程计划json转成对象 let teachplan = JSON.parse ( courseInfo.teachplan ) ; / / 将课程计划赋值给数据模型 this.teachplanList = teachplan.children; console. log ( this.teachplanList ) if ( !this.chapter || this.chapter = = ' 0 ' ) { / / 取出第一个教学计划 this.chapter = this.getFirstTeachplan ( ) console. log ( this.chapter ) / / 开始学习 this.study ( this.chapter ) } } } ) } , |