|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="course-detail">
|
|
|
+ <div class="course-detail" v-loading="loading" v-if="lessonInfo">
|
|
|
<Header
|
|
|
:headerBg="headerBg"
|
|
|
:headerBorder="headerBorder"
|
|
@@ -10,7 +10,7 @@
|
|
|
<div class="navBar-left">
|
|
|
<a class="goback" @click="$router.go(-1)"><i class="el-icon-arrow-left"></i>{{previousPage}}</a>
|
|
|
<div class="border"></div>
|
|
|
- <p>{{data.navTitle}}</p>
|
|
|
+ <p>{{info.name}}</p>
|
|
|
</div>
|
|
|
<div class="navBar-right">
|
|
|
<a @click="handleShare">
|
|
@@ -24,17 +24,17 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="main">
|
|
|
- <h2>{{data.title}}</h2>
|
|
|
+ <h2>{{info.name}}</h2>
|
|
|
<div class="main-top">
|
|
|
<svg-icon icon-class="headset" className="icon-headset"></svg-icon>
|
|
|
- <span class="playsNumber">{{data.playsNumber}}</span>
|
|
|
- <span class="progress">已更新{{data.updateLessons}}课时/共{{data.totalLessons}}课时</span>
|
|
|
+ <span class="playsNumber">{{play_total_count}}</span>
|
|
|
+ <span class="progress">已更新{{info.cs_item_count_valid}}课时/共{{info.cs_item_count}}课时</span>
|
|
|
</div>
|
|
|
<div class="main-center">
|
|
|
- <h1>{{data.number+' '+data.lessonTitle}}</h1>
|
|
|
- <p class="teacher">主讲教师 {{data.teacher}}</p>
|
|
|
- <div class="audioline-box">
|
|
|
- <audio-line audioId='course-detail-audio' :mp3="data.lessonCatalog[0].src"></audio-line>
|
|
|
+ <h1>{{(lessonIndex+1)+'. '+lessonInfo.lb_course_cs_item.name}}</h1>
|
|
|
+ <p class="teacher">主讲教师 {{lessonInfo.lb_course_cs_item.teacher_name}}</p>
|
|
|
+ <div class="audioline-box" v-if="lessonInfo.lb_course_cs_item.file_url">
|
|
|
+ <audio-line audioId='course-detail-audio' :mp3="lessonInfo.lb_course_cs_item.file_url"></audio-line>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="main-bottom">
|
|
@@ -43,10 +43,10 @@
|
|
|
<a class="info-btn" :class="[infoIndex===0?'active':'']" @click="handleChangeInfo(0)">课节信息</a>
|
|
|
<a class="info-btn" :class="[infoIndex===1?'active':'']" @click="handleChangeInfo(1)">课节资源</a>
|
|
|
</div>
|
|
|
- <div class="info-detail" v-html="data.lessonInfo" v-if="infoIndex===0"></div>
|
|
|
- <resources-list :data="data.resourcesList" v-if="infoIndex===1"></resources-list>
|
|
|
+ <div class="info-detail" v-html="lessonInfo.lb_course_cs_item.intro" v-if="infoIndex===0"></div>
|
|
|
+ <resources-list :data="lessonInfo.resource_file_list" type='audio' v-if="infoIndex===1"></resources-list>
|
|
|
</div>
|
|
|
- <lesson-catalog :data="data.lessonCatalog" class="main-bottom-right"></lesson-catalog>
|
|
|
+ <lesson-catalog :data="lessonCatalog" :lessonCatalogEdsc="lessonCatalogEdsc" :lessonIndex="lessonIndex" :isBuy="isBuy" @getInfo="getLessonInfo" class="main-bottom-right"></lesson-catalog>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -59,6 +59,7 @@ import Header from "../../components/Header.vue";
|
|
|
import LessonCatalog from "./components/LessonCatalog.vue"
|
|
|
import AudioLine from "@/components/common/AudioLine.vue"
|
|
|
import ResourcesList from "./components/ResourcesList.vue"
|
|
|
+import { getLogin } from "@/api/ajax";
|
|
|
|
|
|
export default {
|
|
|
//import引入的组件需要注入到对象中才能使用
|
|
@@ -167,7 +168,16 @@ export default {
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
- infoIndex: 0 // 课节信息tabs
|
|
|
+ infoIndex: 0, // 课节信息tabs
|
|
|
+ courseId: this.$route.query.id?this.$route.query.id:'', // 课程id
|
|
|
+ lessonIndex: this.$route.query.index?this.$route.query.index*1:0, // 目录索引
|
|
|
+ loading: false,
|
|
|
+ lessonCatalog: [],
|
|
|
+ lessonCatalogEdsc: [],
|
|
|
+ info: null,
|
|
|
+ isBuy: false,
|
|
|
+ lessonInfo: null,
|
|
|
+ play_total_count: null,
|
|
|
}
|
|
|
},
|
|
|
//计算属性 类似于data概念
|
|
@@ -187,10 +197,85 @@ export default {
|
|
|
// 切换infotabs
|
|
|
handleChangeInfo(value){
|
|
|
this.infoIndex = value
|
|
|
+ },
|
|
|
+ // 获取课程信息
|
|
|
+ getInfo(){
|
|
|
+ this.loading = true
|
|
|
+ let MethodName = "/CourseServer/Client/LBCourseQuery/GetLBCourseInfo";
|
|
|
+ let data = null
|
|
|
+ data = {
|
|
|
+ id: this.courseId,
|
|
|
+ is_contain_cs_item: "true",
|
|
|
+ cs_item_sort_mode: "ASCE"
|
|
|
+ }
|
|
|
+ getLogin(MethodName, data)
|
|
|
+ .then((res) => {
|
|
|
+ if(res.status===1){
|
|
|
+ this.info = res.lb_course
|
|
|
+ this.lessonCatalog = res.cs_item_list
|
|
|
+ this.lessonCatalog.forEach((item,index) => {
|
|
|
+ item.index = index
|
|
|
+ if(item.file_media_duration){
|
|
|
+ if(item.file_media_duration<60){
|
|
|
+ item.timeCn = '1分钟'
|
|
|
+ }else if(item.file_media_duration<600){
|
|
|
+ item.timeCn = Math.ceil(item.file_media_duration/60)+'分钟'
|
|
|
+ }else{
|
|
|
+ let first = Math.ceil(item.file_media_duration/60).toString().substring(0,Math.ceil(item.file_media_duration/60).toString().length-1)*1
|
|
|
+ let last = Math.ceil(item.file_media_duration/60).toString().substring(Math.ceil(item.file_media_duration/60).toString().length-1)*1
|
|
|
+ if(last<5){
|
|
|
+ item.timeCn = first+'0分钟'
|
|
|
+ }else{
|
|
|
+ item.timeCn = (first+1)+'0分钟'
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ item.timeCn = '-'
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.lessonCatalogEdsc = JSON.parse(JSON.stringify(this.lessonCatalog)).reverse()
|
|
|
+ this.isBuy = res.buy_info.is_buy==='true'?true:false
|
|
|
+ let sales = res.play_info.play_total_count
|
|
|
+ if(sales<1000){
|
|
|
+ this.play_total_count = sales
|
|
|
+ }else if(1000<=sales&&sales<10000){
|
|
|
+ this.play_total_count = (sales/1000).toFixed(1)+'千'
|
|
|
+ }else if(10000<=sales&&sales<100000000){
|
|
|
+ this.play_total_count = (sales/10000).toFixed(1)+'万'
|
|
|
+ }else if(100000000<=sales){
|
|
|
+ this.play_total_count = (sales/100000000).toFixed(1)+'亿+'
|
|
|
+ }
|
|
|
+ this.getLessonInfo()
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 获取课节信息
|
|
|
+ getLessonInfo(index){
|
|
|
+ let MethodName = "/CourseServer/Client/LBCourseQuery/GetLBCourseCSItemInfo";
|
|
|
+ let data = {
|
|
|
+ id: index||index===0?this.lessonCatalog[index].id:this.lessonCatalog[this.lessonIndex].id
|
|
|
+ }
|
|
|
+ getLogin(MethodName, data)
|
|
|
+ .then((res) => {
|
|
|
+ this.loading = false
|
|
|
+ if(res.status===1){
|
|
|
+ this.lessonInfo = res
|
|
|
+ this.lessonIndex = index||index===0?index:this.lessonIndex
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {
|
|
|
+ this.getInfo()
|
|
|
if(this.config){
|
|
|
let arr = this.config.split('&&&')
|
|
|
this.LoginNavIndex = arr[0] * 1
|