|
@@ -5,15 +5,14 @@
|
|
|
<div><a :class="[sort==='ASCE'?'active':'']" @click="handleChangeSort('ASCE')">正序</a><div class="border"></div><a :class="[sort==='DESC'?'active':'']" @click="handleChangeSort('DESC')">倒序</a></div>
|
|
|
</div>
|
|
|
<ul class="catalog">
|
|
|
- <li v-for="(item,index) in list" :key="index" :class="[isBuy||index<2?'buy':'',playNumber===index?'active':'']" @click="handleChangeCourse(index)">
|
|
|
- <span class="number">{{sort==='ASCE'?(index+1):(list.length-index) + '.'}}</span>
|
|
|
+ <li v-for="(item,index) in sort==='ASCE'?list:lessonCatalogEdsc" :key="index" :class="[playNumber===item.index?'active':'']" @click="handleChangeCourse(item.index)">
|
|
|
+ <span class="number">{{Number(item.index)+1 + '.'}}</span>
|
|
|
<div class="center">
|
|
|
<b class="title">{{item.name}}</b>
|
|
|
<span class="teacher">{{'主讲教师 '+item.teacher_name}}</span>
|
|
|
<span class="time-length">{{item.timeCn}}</span>
|
|
|
</div>
|
|
|
- <i class="el-icon-caret-right" v-if="playNumber===index"></i>
|
|
|
- <!-- <i class="el-icon-lock" v-if="!(isBuy||index<2)"></i> -->
|
|
|
+ <i class="el-icon-caret-right" v-if="playNumber===item.index"></i>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
@@ -22,11 +21,10 @@
|
|
|
<script>
|
|
|
//这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
|
|
//例如:import 《组件名称》from ‘《组件路径》';
|
|
|
-import { getLogin } from "@/api/ajax";
|
|
|
export default {
|
|
|
//import引入的组件需要注入到对象中才能使用
|
|
|
components: { },
|
|
|
- props: ["data", "isBuy","LoginNavIndex","userBg","headerBorder","headerBg"],
|
|
|
+ props: ["data", "lessonCatalogEdsc"],
|
|
|
data() {
|
|
|
//这里存放数据
|
|
|
return {
|
|
@@ -47,54 +45,12 @@ export default {
|
|
|
// 切换排序
|
|
|
handleChangeSort(value){
|
|
|
this.sort = value
|
|
|
- this.getInfos()
|
|
|
},
|
|
|
// 切换课程
|
|
|
handleChangeCourse(index){
|
|
|
this.playNumber = index
|
|
|
this.$emit("getInfo",index)
|
|
|
},
|
|
|
- // 获取课程信息
|
|
|
- getInfos(){
|
|
|
- this.loading = true
|
|
|
- let MethodName = "/CourseServer/Manager/LBCourseManager/GetLBCourseInfo";
|
|
|
- let data = {
|
|
|
- id: this.$route.query.id?this.$route.query.id:'',
|
|
|
- is_contain_cs_item:'true',
|
|
|
- cs_item_sort_mode: this.sort
|
|
|
- }
|
|
|
- getLogin(MethodName, data)
|
|
|
- .then((res) => {
|
|
|
- this.loading = false
|
|
|
- if(res.status===1){
|
|
|
- this.playNumber = this.list.length-this.playNumber-1
|
|
|
- this.list = res.cs_item_list
|
|
|
- this.list.forEach(item => {
|
|
|
- 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 = '-'
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.loading = false
|
|
|
- });
|
|
|
- }
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {
|
|
@@ -177,9 +133,7 @@ ul{
|
|
|
border: 1px solid #F7F8FA;
|
|
|
display: flex;
|
|
|
padding: 16px;
|
|
|
- &.buy{
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
+ cursor: pointer;
|
|
|
&.active{
|
|
|
border-color: #0081F1;
|
|
|
background: #E7F3FF;
|