|
@@ -32,10 +32,10 @@
|
|
|
<div class="item_wrap">
|
|
|
<ul>
|
|
|
<li
|
|
|
- v-for="(item, key) in course_zhangjie"
|
|
|
- :key="key"
|
|
|
+ v-for="(item, index) in course_zhangjie"
|
|
|
+ :key="index"
|
|
|
class="out_wrap"
|
|
|
- @click="zhedie(item.id)"
|
|
|
+ @click="zhedie(index)"
|
|
|
>
|
|
|
<div class="zhangjie">
|
|
|
<div class="left">
|
|
@@ -87,7 +87,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import {
|
|
|
- getCourseDetail,
|
|
|
+ videoList,
|
|
|
videoDetail,
|
|
|
lookRecord,
|
|
|
} from './api/video'
|
|
@@ -133,6 +133,7 @@
|
|
|
danmu: 'admin-pro',
|
|
|
},
|
|
|
player: null,
|
|
|
+ videoIndex:0
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -188,18 +189,20 @@
|
|
|
async getCourse_detail() {
|
|
|
const { data } = await chapterList({id:this.courseId})
|
|
|
console.log(data, 'xaingqing')
|
|
|
- this.course_zhangjie = data.data
|
|
|
+ // this.course_zhangjie = data.data
|
|
|
// this.course_fenlei = data
|
|
|
},
|
|
|
//章节折叠
|
|
|
zhedie(e) {
|
|
|
- if (this.current_zhedie.includes(e)) {
|
|
|
- this.current_zhedie = this.current_zhedie.filter((item) => {
|
|
|
- return item != e
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.current_zhedie.push(e)
|
|
|
- }
|
|
|
+ // if (this.current_zhedie.includes(e)) {
|
|
|
+ // this.current_zhedie = this.current_zhedie.filter((item) => {
|
|
|
+ // return item != e
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // this.current_zhedie.push(e)
|
|
|
+ // }
|
|
|
+ this.videoIndex = e
|
|
|
+ this.lookVideo()
|
|
|
},
|
|
|
//点击重新播放
|
|
|
refLook() {
|
|
@@ -348,24 +351,22 @@
|
|
|
},
|
|
|
//获取课程详情章节列表和视频列表
|
|
|
async getCourseDetail() {
|
|
|
- let slug = this.$route.query.course_slug
|
|
|
- console.log(slug, 'getCourseDetail')
|
|
|
- const { data } = await getCourseDetail(slug)
|
|
|
-
|
|
|
- this.directory = data.directory
|
|
|
+ const { data } = await videoList()
|
|
|
+ console.log(data)
|
|
|
+ this.course_zhangjie = data.data
|
|
|
|
|
|
- if (this.videoId) {
|
|
|
- this.isLearn = this.videoId
|
|
|
- //this.isLearn = this.video_slug
|
|
|
- let route = this.$route
|
|
|
- this.vIndex = route.query.v_index
|
|
|
- this.cIndex = route.query.c_index
|
|
|
- } else {
|
|
|
- console.log(data, 'YYYYY YYY')
|
|
|
- this.isLearn = this.videoId = data.directory[0].children[0].id
|
|
|
- //this.isLearn = this.video_slug = data.directory[0].children[0].slug
|
|
|
- this.videoList = this.directory[0].children
|
|
|
- }
|
|
|
+ // if (this.videoId) {
|
|
|
+ // this.isLearn = this.videoId
|
|
|
+ // //this.isLearn = this.video_slug
|
|
|
+ // let route = this.$route
|
|
|
+ // this.vIndex = route.query.v_index
|
|
|
+ // this.cIndex = route.query.c_index
|
|
|
+ // } else {
|
|
|
+ // console.log(data, 'YYYYY YYY')
|
|
|
+ // this.isLearn = this.videoId = data.directory[0].children[0].id
|
|
|
+ // //this.isLearn = this.video_slug = data.directory[0].children[0].slug
|
|
|
+ // this.videoList = this.directory[0].children
|
|
|
+ // }
|
|
|
|
|
|
this.lookVideo()
|
|
|
// this.videoComments()
|
|
@@ -396,10 +397,11 @@
|
|
|
myPlayer.removeRemoteTextTrack(oldTracks[i])
|
|
|
}
|
|
|
// const { data } = await videoDetail({ id: this.videoId })
|
|
|
- const { data } = await videoDetail(this.video_slug)
|
|
|
+ // const { data } = await videoDetail(this.video_slug)
|
|
|
console.log(this.video_slug, 'this.video_slug')
|
|
|
- this.videoTitle = data.video.title
|
|
|
- myPlayer.src(data.video.url_resource.url)
|
|
|
+ // this.videoTitle = data.video.title
|
|
|
+ console.log(this.course_zhangjie)
|
|
|
+ myPlayer.src(this.course_zhangjie[this.videoIndex].url_resource)
|
|
|
|
|
|
this.attaches = data.attaches
|
|
|
this.videoDescription = data.video.description
|
|
@@ -443,7 +445,7 @@
|
|
|
path: 'courseDetail',
|
|
|
query: {
|
|
|
course_slug: this.course_slug,
|
|
|
- course_id: this.courseId,
|
|
|
+ id: this.courseId,
|
|
|
},
|
|
|
})
|
|
|
},
|