更新:免费课程增加分类筛选

This commit is contained in:
2025-10-29 17:48:17 +08:00
parent 26c81cef98
commit cca49e7fdd
8 changed files with 258 additions and 129 deletions

View File

@@ -306,7 +306,6 @@
},
// 获取播放凭证
async getLive(isChange, newVideoData) {
console.log('获取播放凭证11111111111111', newVideoData);
if (this.reaquestFlag) {
uni.showToast({
title: '操作太快了,歇一下吧',
@@ -335,13 +334,28 @@
},
})
.then(async (res) => {
console.log('获取播放凭证666',res.video.m3u8Url);
console.log('获取播放凭证666',res.video.m3u8Url);
this.reaquestFlag = false
if (this.$platform == 'ios') {
if (res.video.type == 1 && res.video.m3u8Url == null || res.video
.type == 1 && res.video.m3u8Url == '') {
if (this.$platform !== 'ios') {
if (res.video.type == 1 && (res.video.m3u8Url == null || res.video.m3u8Url == '')) {
// 只存在私有加密
this.show = true
$http.request({
url: "medical/course/addErrorCourse",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
// "courseId": this.videoData.courseId,
// "catalogueId": this.videoData.catalogueId,
"chapterId": res.video.chapterId,
"videoId": res.video.id,
"sort": res.video.sort
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(() => {
console.log('记录IOS不能看的视频成功', res.video)
}).catch(() => { console.log('数据报错') })
this.UnlockChangeVideo() // 解锁按钮
uni.showModal({
content: '抱歉,苹果手机不支持此加密视频格式,您可以在安卓端观看本视频',

View File

@@ -3,10 +3,13 @@
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar title="免费课程"></z-nav-bar>
<!-- <view class="tabsBox" :class="[fixed ? 'fixed' : '' ]">
<u-tabs v-if="tabList.length > 0" :class="['tabList']" @click="fatherClick" :current="curTagId"
:activeStyle="activeStyle" :scrollable="scrollable" :list="tabList"
itemStyle="padding-left: 15px; background-color:#fff; padding-right: 15px; height: 50px;"></u-tabs>
<view class="tabsBox" :class="[fixed ? 'fixed' : '' ]">
<u-tabs v-if="tabList.length > 0" :class="['tabList']" @click="handleClassFilter" :current="curTabIndex"
:activeStyle="tabList[curTabIndex].style" :lineColor="tabList[curTabIndex].style.color" :scrollable="false" :list="tabList"
itemStyle="flex:1; padding-left: 15px; background-color:#fff; padding-right: 15px; width:33.33%; height: 40px;"></u-tabs>
</view>
<!-- <view class="class-filter-box">
<u-button v-for="item in tabList" :text="item.name" class="class-filter-item" @click="handleClassFilter(item.type)"></u-button>
</view> -->
<view class="learnBox box" >
<view class="newBox">
@@ -53,6 +56,7 @@
} from 'vuex';
export default {
data() {
const activeStyle = { fontWeight: "bold", transform: "scale(1.2)" }
return {
playData: {},
tagId: null,
@@ -61,6 +65,25 @@
status:0, // 0 不显示, 1 加载中2 加载全部完成3 暂无数据
page:1,
flag:true, // 函数是否执行完
activeStyle: {
fontWeight: "bold",
transform: "scale(1.2)",
},
tabList: [{
type: "medicine",
name: '医学',
style: { ...activeStyle, color: '#FA5151' }
}, {
type: "psyche",
name: '心理',
style: { ...activeStyle, color: '#10AEFF' }
}, {
type: "sociology",
name: '国学',
style: { ...activeStyle, color: '#91D300' }
}],
curTabIndex: 0,
fixed: false,
};
},
//第一次加载
@@ -72,6 +95,13 @@
console.log(e, '传入分类id')
this.getData();
},
// onPageScroll(e) {
// if (e.scrollTop > 0) {
// this.fixed = true
// } else {
// this.fixed = false
// }
// },
onReachBottom() {
if(this.status != 2){
this.page ++
@@ -93,13 +123,18 @@
},
//方法
methods: {
handleClassFilter(e) {
console.log(e,'tabitem')
this.curTabIndex = e.index
this.getData('filter')
},
// 跳转
onPageJump(url,thatId,title) {
uni.navigateTo({
url: `${url}?id=${thatId}&title=${title}`
});
},
getData() {
getData(source) {
if(!this.flag){
console.log('正在执行,未完成')
return
@@ -111,7 +146,8 @@
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"limit": 12,
"page": this.page
"page": this.page,
"type": this.tabList[this.curTabIndex].type
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
@@ -122,7 +158,7 @@
console.log('res.code at line 116:', res)
if (res.courseList.length > 0) {
var list = res.courseList
this.courseList = this.courseList.concat(list)
source === 'filter' ? this.courseList = list : this.courseList = this.courseList.concat(list)
// if(res.data.pages > this.page){
// this.status = 0
// }else{
@@ -246,4 +282,30 @@
}
}
}
.fixed {
position: fixed;
z-index: 2; width: 100%; background-color: #fff;
}
.tabList {
text-align: center;
width: 100%;
background-color: #fff;
}
.class-filter-box {
display: flex;
justify-content: space-evenly;
padding: 0 10px;
gap: 6px;
margin-bottom: -10px;
background-color: #fff;
&.fixed {
position: fixed;
z-index: 2; width: 100%; background-color: #fff;
}
.class-filter-item {
flex: 1;
}
}
</style>