课程说明未完成

This commit is contained in:
@fawn-nine
2024-06-20 17:04:17 +08:00
parent 910a546584
commit 2523845927
8 changed files with 718 additions and 211 deletions

View File

@@ -22,7 +22,7 @@ Vue.prototype.$getHours = nowHour
Vue.prototype.$baseUrl = "https://api.nuttyreading.com/"
// 安卓安卓包下载地址
// Vue.prototype.$apkUrl = "https://www.nuttyreading.com/nuttyreading.apk" // 本地地址
Vue.prototype.$apkUrl = "https://a.app.qq.com/o/simple.jsp?pkgname=com.cn.nuttyreading" // 应用宝
Vue.prototype.$apkUrl = "https://a.app.qq.com/o/simple.jsp?pkgname=com.cn.medicine" // 应用宝
// 判断手机型号

View File

@@ -1,7 +1,7 @@
{
// "easycom": {
// "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
// },
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
"pages": [
{
"path": "pages/peanut/home",

View File

@@ -17,15 +17,6 @@
@tap="renderScript.handleClick"
id="url-player-test"
:videoData="videoData"
:winWidth="winWidth"
:winHeight="winHeight"
:currentVideoList="currentVideoList"
:firstTime="firstTime"
:change:videoData="renderScript.receiveMsg"
:change:winWidth="renderScript.receiveWinWidth"
:change:winHeight="renderScript.receiveWinHeight"
:change:firstTime="renderScript.receiveFirstTime"
:change:currentVideoList="renderScript.receiveVideoList"
></div>
<div @tap="renderScript.emitData" ref="videoContent1" v-show="false">
直接调用renderjs中的emitData的方法,传递当前播放时长
@@ -152,7 +143,7 @@ export default {
this.options = JSON.parse(options.data);
this.videoId = this.options.video;
this.videoId = this.options.id;
this.timer = setInterval(() => {
var that = this;
@@ -212,7 +203,7 @@ export default {
}
this.options = data.currentVideo;
console.log("this.options at line 64:", this.options);
this.videoId = this.options.video;
this.videoId = this.options.id;
this.timer = setInterval(async () => {
var that = this;
if (this.currentTime) {
@@ -297,13 +288,14 @@ export default {
},
// 获取数据
getLive() {
console.log(this.options,'----------------11111111111111--------')
var data = {
...this.options,
};
console.log(data,'------------------------')
$http
.request({
url: `sociology/course/checkVideo`,
url: "medical/course/checkVideoByMD",
method: "Post", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: {
@@ -313,22 +305,23 @@ export default {
})
.then((res) => {
console.log("res at line 252111111111111111111111111111:", res);
if (this.currentVideo.type == 1) {
var playAuth = res.video.playAuth.replace(/=/g, "");
var playAuth = res.playAuth.replace(/=/g, "");
this.videoData = {
...res.video,
videoId: res.video.video,
...res,
video: res.id,
playAuth: playAuth,
};
this.playAuth = playAuth;
} else {
this.videoData = res.video;
this.videoUrl =
// "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/taiHuClass/" +
res.video.videoUrl;
this.$nextTick(async () => {
await this.getData();
});
// this.videoData = res.video;
// this.videoUrl =
// // "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/taiHuClass/" +
// res.video.videoUrl;
// this.$nextTick(async () => {
// await this.getData();
// });
}
this.$forceUpdate();
@@ -505,6 +498,9 @@ this.player.fullscreenService.requestFullScreen();
ownerInstance.callMethod('handleEnd', )
},
getLive() {
console.log(this.videoData,'走没走。。。。。。。。。。')
if(this.videoData.type==1){
var fullScreenButtonComponent = Aliplayer.Component({
/**
@@ -732,15 +728,15 @@ this.player.on('ended', function() {
// console.log('vm', vm)
},
checkValue() {
console.log(this.videoId, this.authId, "1111888888")
if (!this.videoData.playAuth||!this.currentVideoList) {
console.log(this.videoId, this.videoData, "1111888888")
if (!this.videoData.playAuth) {
setTimeout(() => {
this.checkValue();
}, 1000);
} else {
console.log('this.videoList at line 这是这只只是594:', this.currentVideoList)
this.getLive();
this.getLive();console.log('this.videoList at line 这是这只只是594:',this.videoData)
}
},
loadWebPlayerSDK() {

View File

@@ -591,12 +591,12 @@
},
// 查询课程的评论
getSayList() {
this.status = 1
if (this.loadFlag) {
console.log('有未完成的进程');
return
}
this.loadFlag = true
this.status = 1
$http.request({
url: "common/courseGuestbook/getCourseGuestbookList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档

View File

@@ -19,11 +19,22 @@
<text :class="[leve2Index == index ? 'cur' : '']" v-for="(item, index) in Leve2" :key="index"
@click="leve2Click(item, index)">{{item.title}}</text>
</view>
<!-- {{leve3store}}
<pre>
{{Leve3.length}}
</pre> -->
<view class="tabLeve3 subItem flexbox" v-if="leve3store.length > 0 && Leve3.length == 0">
<text :class="[leve3Index == index ? 'cur' : '']" v-for="(item, index) in leve3store" :key="index"
@click="leve3Click(item, index,leve3store)">{{item.title}}</text>
</view>
<view class="tabLeve3 subItem flexbox" v-if="Leve3.length > 0">
<text :class="[leve3Index == index ? 'cur' : '']" v-for="(item, index) in Leve3" :key="index"
@click="leve3Click(item, index)">{{item.title}}</text>
</view>
<view class="containerBg">
<view class="" v-if="courseInfo.content == '' && courseInfo.media == ''">
<u-divider text="本门课程没有编写课程说明"></u-divider>
</view>
<view class="containerBg" v-else>
<view class="infoBox" v-if="courseInfo.id">
<uni-section :title="courseTitle" type="line" titleFontSize="16px">
<view class="audio" style="margin-bottom: 20rpx;"
@@ -31,20 +42,23 @@
<audio style="text-align: left" :src="courseInfo.media" :poster="audioPoster"
:name="courseTitle" author="吴门医述" :action="audioAction" controls></audio>
</view>
<view>
<!-- <view v-if="courseInfo.mediaType ==1 && courseInfo.media != ''" style="width: 100%;height: 100%;text-align: center;" v-html="videoHTML">
</view> -->
<!-- <view class="container" >
<view style="margin-top: 50px;">
<view class="container" v-if="courseInfo.mediaType ==1 && courseInfo.media != ''">
<div ref="videoContent" @tap="renderScript.handleClick" id="url-player-test"
:videoData="videoData" :change:videoData="renderScript.receiveMsg"></div>
</view> -->
:videoData="videoData"
:change:videoData="renderScript.receiveMsg"></div>
</view>
<!-- {{videoData}} -->
</view>
<!-- <rich-text v-if="courseInfo.content" class="content"
:nodes="formatRichText(courseInfo.content)"></rich-text> -->
<!-- <text>超强树选择器树组件树插件无限级联树单选树多选树自定义样式树树形选择 </text> -->
<!-- <div class="fullScreenButton-container">
<div
:class="`prism-fullscreen-btn ${isFullScreen ? 'fullscreen' : ''}`"
@tap="renderScript.changeVideoScreen"
></div>
<!-- <img class=" iconfont icon-list" src="../../../../static/icon/cate_bg.png" style="width: 60px;height: 10px;"></img> -->
<!-- </div> -->
<rich-text v-if="courseInfo.content" class="content"
:nodes="formatRichText(courseInfo.content)"></rich-text>
</uni-section>
</view>
@@ -65,6 +79,7 @@
data() {
return {
playData: {},
// destroyPlayer:false,
Leve1: [],
Leve2: [],
Leve3: [],
@@ -116,6 +131,7 @@
audioAction: {
method: 'pause'
},
leve3store:[],
curId: null,
courseTitle: '',
showTemp: true,
@@ -152,12 +168,14 @@
// #endif
this.showTemp = true
this.videoContext = null
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
},
components: {
// musicPlay
// commonVideo
},
created() {
// this.getLive();//获取播放凭证
@@ -172,16 +190,27 @@
// var playAuth = playAuthsss
this.videoData = {
// ...res.video,//视频其他信息
type: 1,
videoId: this.videoId, //阿里云视频id
playAuth: this.playAuth,//阿里云播放凭证
playAuth: playAuth, //阿里云播放凭证
};
console.log('到这')
console.log('得到播放凭证')
this.playAuth = playAuth;
this.$forceUpdate();
// setTimeout(() => {
// console.log('销毁播放器')
// // this.player.dispose()
// this.player = null
// player = null
// console.log('销毁后',this.player, player)
// },2000)
},
tabChange(e) {
console.log(e, 'e');
// this.destroyPlayer = true
let _index = e.index
this.clickCourseInfo(this.treeList[_index])
this.curTagIndex = _index
@@ -207,21 +236,25 @@
this.Leve1 = []
this.Leve2 = []
this.Leve3 = []
this.leve3store = []
}
// this.destroyPlayer = false
},
leve1Click(val, index) {
console.log(this.Leve1[index], 'val');
this.leve1Index = index
this.leve2Index = null
this.leve3Index = null
this.clickCourseInfo(val)
if (this.Leve1[index].isLast == 0 && this.Leve1[index].children.length > 0) {
this.Leve2 = this.Leve1[index].children
console.log(this.Leve2, 'Leve2');
console.log(this.Leve2, 'Leve2--------------------');
} else {
this.Leve2 = []
this.Leve3 = []
this.leve3store = []
}
this.clickCourseInfo(val)
},
leve2Click(val, index) {
this.leve2Index = index
@@ -230,26 +263,40 @@
}
this.leve3Index = null
// console.log(val,'三级点击');
this.clickCourseInfo(val)
if (this.Leve2[index].isLast == 0 && this.Leve2[index].children.length > 0) {
this.Leve3 = this.Leve2[index].children
} else {
this.Leve3 = []
this.leve3store = []
}
this.clickCourseInfo(val)
},
leve3Click(val, index) {
leve3Click(val, index,list) {
this.leve3Index = index
// console.log(val,'四级点击');
console.log(val,'四级点击');
if (this.leve2Index == null) {
this.leve2Index = 0
}
if (this.leve1Index == null) {
this.leve1Index = 0
}
this.clickCourseInfo(val)
// if(this.Leve3[index].isLast == 0){
// this.Leve3 = this.Leve2[index].children
// console.log('this.Leve3this.Leve3this.Leve3this.Leve3this.Leve3this.Leve3this.Leve3')
if(this.Leve3.length > 0){
this.leve3store = [...this.Leve3]
}else{
this.leve3store = [...list]
}
console.log(this.Leve3,'this.leve3++++++++++++++++++')
// this.Leve3
// uni.setStorage({
// key: 'leve3',
// data: this.Leve3,
// success: function () {
// // console.log('success');
// }
// });
this.clickCourseInfo(val)
},
formatRichText(html) { //控制图片大小
@@ -303,24 +350,29 @@
})
// console.log(this.Leve2,'Leve2');
if (this.Leve2[0].isLast == 0 && this.Leve2[0].children.length > 0) {
this.Leve3 = this.Leve2[0].children
this.Leve3.forEach((item, index) => {
if (item.id == this.tagId) {
this.leve3Index = index
}
})
} else {
this.Leve3 = []
// this.leve3store = []
}
} else {
this.Leve2 = []
this.Leve3 = []
this.leve3store = []
}
} else {
this.Leve1 = []
this.Leve2 = []
this.Leve3 = []
this.leve3store = []
}
// this.getCourseInfo(this.treeList[0].id)
@@ -354,18 +406,22 @@
if (this.courseInfo.mediaType == 1 && this.courseInfo.media != '') {
this.videoId = this.courseInfo.media
this.playAuth = await this.getVideoPath(this.courseInfo.media)
// this.getLive(this.playAuth)
console.log()
// this.videoData = {
// videoId: this.videoId,//阿里云视频id
// playAuth: this.videoUrl,//阿里云播放凭证
// }
this.getLive(this.playAuth)
} else {
// this.videoUrl = ''
this.poster = ''
// this.poster = ''
}
// console.log(id, 'id')
// console.log(this.leve3store, '----------Leve3----')
// uni.setStorage
let list = uni.getStorage({
key:'leve3'
})
if(list.length > 0){
this.Leve3 = list
}
console.log('----------新的Leve3----', this.Leve3)
} else {
this.courseInfo = {}
this.videoUrl = ''
@@ -394,10 +450,6 @@
'Content-Type': 'application/json'
},
})
// this.$http
// .post('sociology/course/checkVideo',{
// id: str
// })
.then(res => {
if (res.code == 0) {
// console.log(res, 'res');
@@ -423,20 +475,199 @@
};
</script>
<script module="renderScript" lang="renderjs">
import $ from 'jquery'
// import StaticADComponent from './staticadcomponent/index.js';
/**
* 静态广告组件
*/
export default {
/**
* 静态广告组件
*/
components: {
// MyComponent
},
mounted() {
// 在适合的生命周期通过script和link标签引入播放器sdk、css
console.log(this.options, '这是monted')
this.loadWebPlayerSDK()
this.loadComponent()
},
beforeDestroy() {
if (this.player) {
this.player.dispose()
this.player = null
}
},
data() {
return {
player: null,
curTime: null,
curStatus: null,
// currentTime:null,
}
},
watch: {
curTime(val) {
if (this.curTime !== null && this.curStatus !== null) {
this.$refs.videoContent1.click()
}
}
},
methods: {
handleClick(event, ownerInstance) {
console.log('event at line 165:', event)
// this.player.on('ready',function(){
// var status= this.player.fullscreenService.getIsFullScreen()
// console.log('status at line 403:', status)
// console.log('触发点击事件',status))
// })
ownerInstance.callMethod('getData')
},
emitData(event, ownerInstance) {
var that = this;
ownerInstance.callMethod('recordTime', {
time: that.curTime,
status: that.curStatus
})
},
changeVideoScreen(event, ownerInstance) {
var that = this;
// this.$emit('changeScreenLoading',true)
var status = this.player.fullscreenService.getIsFullScreen();
ownerInstance.callMethod('screenChange', {
status: status,
primary: status ? 'portrait' : 'landscape'
})
if (status) {
setTimeout(() => {
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
this.player.fullscreenService.cancelFullScreen();
// this.$emit('changeScreenLoading',false);
}, 100);
// this.player.setPlayerSize('100%','200px');
} else {
// this.player.setPlayerSize({
// w:"400px",
// height:'60%'
// });
// plus.screen.unlockOrientation();
this.player.fullscreenService.requestFullScreen();
setTimeout(() => {
// this.$emit('changeScreenLoading',false);
plus.screen.lockOrientation("landscape-primary");
}, 100);
}
},
methods: {
endEmitData(event, ownerInstance) {
var that = this;
ownerInstance.callMethod('handleEnd', )
},
getLive() {
//配置播放器
if (this.videoData.type == 1) {
var fullScreenButtonComponent = Aliplayer.Component({
/**
* 初始函数在new对象时调用
*
* @param {string} adAddress - 广告视频地址
* @param {string} toAddress - 广告链接地址
*/
init: function(status, toAddress) {
this.fullScreenStatus = status
// this.adAddress = adAddress;
// this.toAddress = toAddress;
this.$html = $('.fullScreenButton-container');
// this.$html.hide();
},
/**
* 创建广告Dom元素
*/
createEl: function(el) {
this.$html.find('.ad').attr('src', this.adAddress);
var $adWrapper = this.$html.find('.ad-wrapper');
$adWrapper.attr('href', this.toAddress);
$adWrapper.click(function() {
// Aliplayer.util.stopPropagation();
});
// this.$html.find('.close').click(function () {
// this.$html.hide();
// });
// $(el).find('.prism-controlbar').append(this.$html);
$(el).find('.prism-time-display').after(this.$html);
},
ready: function(player, e) {
// this.$html.hide()
},
/**
* 隐藏广告
*/
play: function(player, e) {
// this.$html.show();
},
/**
* 显示广告
*/
pause: function(player, e) {
// this.$html.show();
},
/**
* 隐藏广告
*/
playing: function(player, e) {
this.$html.show();
// this.$html.hide();
},
waiting: function(player, e) {
// this.$html.hide()
},
timeupdate: function(player, e) {},
error: function(player, e) {},
/**
* 显示广告
*/
ended: function(player, e) {
// this.$html.show();
}
});
console.log('this.currentVideoList at line 456111111111111111111111:', this.videoList)
var player = new Aliplayer({
id: "url-player-test",
"vid": this.videoData.videoId, // 必选参数,可以通过点播控制台(路径:媒资库>音/视频查询。示例1e067a2831b641db90d570b6480f****。
@@ -446,40 +677,251 @@ export default {
"EncryptType": 'AliyunVoDEncryption'
},
width: '100%', //容器的大小
height: '600rpx', //容器的大小
// videoWidth: '100vw', //容器的大小
// videoHeight: '100vh', //容器的大小
height: '200px', //容器的大小
playsinline: true,
controlBarVisibility: "click",
cover: "http://ehh-public-01.oss-cn-beijing.aliyuncs.com/wumenyishu-image/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20240606110049.jpg",
autoplay: false,
components: [
// {
// name: 'BulletScreenComponent',
// type: AliPlayerComponent.BulletScreenComponent,
// /** Descriptions of the scrolling text component parameters: text, style, bulletPosition
// * text: The scrolling text
// * style: The style of the scrolling text
// * bulletPosition: The position of the scrolling text. Valid values: 'top', 'bottom', and 'random'. The default is 'random'.
// */
// args: ['本课程版权归天津众妙之门科技有限公司所有,翻版必究!', {fontSize: '16px', color: 'red',}, 'random']
// },
{
name: 'adComponent',
type: fullScreenButtonComponent,
args: [
'http://101.201.146.165:8088/Pf-EH/statics/uploadFile/2024-05-10/b0f420c7-9178-41ad-9dd6-f59a64a6e190.png']
},
// {
// name: 'RotateMirrorComponent',
// type: AliPlayerComponent.RotateMirrorComponent
// },
],
skinLayout: [{
name: "bigPlayButton",
align: "blabs",
x: 30,
y: 80
},
{
name: "H5Loading",
align: "cc"
},
{
name: "errorDisplay",
align: "tlabs",
x: 0,
y: 0
},
{
name: "infoDisplay"
},
{
name: "tooltip",
align: "blabs",
x: 0,
y: 56
},
{
name: "thumbnail"
},
{
name: "controlBar",
align: "blabs",
x: 0,
y: 0,
children: [{
name: "progress",
align: "blabs",
x: 0,
y: 44
},
{
name: "playButton",
align: "tl",
x: 15,
y: 12
},
{
name: "timeDisplay",
align: "tl",
x: 10,
y: 7
},
{name: "fullScreenButton", align: "tr", x: 10, y: 12},
// {name:"subtitle", align:"tr",x:15, y:12},
{
name: "setting",
align: "tr",
x: 15,
y: 12
},
{
name: "prism-speed-selector",
align: "tr",
x: 15,
y: 12
},
{
name: "volume",
align: "tr",
x: 5,
y: 10
}
]
}
]
}, function(player) {
console.log('走吗')
});
this.player = player;
player.one('canplay', function() {
// console.log('canplay', this.player.tag);
player.tag.play();
});
this.$refs.videoContent.click()
var timer = setInterval(() => {
var that = this;
that.curTime = parseInt(this.player.getCurrentTime());
that.curStatus = this.player.getStatus()
}, 1000);
// player.on('ready',function(){
// player.fullscreenService.requestFullScreen()
// })
this.player.on('ended', function() {
console.log('that.curTime at line 242:', this.curTime)
console.log('that.curStatus at line 210:', this.curStatus)
this.$refs.videoContent2.click()
})
}
// player.setRotate(90)
//全屏播放
// player.one('canplay', function() {
// // console.log('canplay', this.player.tag);
// player.tag.play();
// });
},
receiveScreenType(newValue) {
console.log('newValue at line 427屏幕方向111111111111:', newValue)
},
receiveFirstTime(newValue, oldValue, ownerVm, vm) {
// //数据变化
console.log('newValue111', newValue)
console.log('vm4444', vm)
console.log('this.firstTime at line 215:', newValue)
if (this.player) {
this.player.seek(newValue);
}
},
receiveVideoList(newValue, oldValue, ownerVm, vm) {
// //数据变化
console.log('currentVideoListcurrentVideoListcurrentVideoList', newValue)
},
receiveMsg(newValue, oldValue, ownerVm, vm) {
//数据变化
console.log('newValue', newValue)
if(newValue.playAuth){
this.checkValue();
}
// console.log('oldValue', oldValue)
// console.log('ownerVm', ownerVm)
// console.log('vm', vm)
},
receiveWinWidth(newValue, oldValue, ownerVm, vm) {
//数据变化
console.log('newValue', newValue)
// console.log('oldValue', oldValue)
// console.log('ownerVm', ownerVm)
// console.log('vm', vm)
},
receiveWinHeight(newValue, oldValue, ownerVm, vm) {
//数据变化
console.log('newValue', newValue)
// console.log('oldValue', oldValue)
// console.log('ownerVm', ownerVm)
// console.log('vm', vm)
},
//监听获取播放凭证的方法
checkValue() {
console.log(this.videoId, this.videoData.playAuth, "1111888888")
// console.log(this.courseInfo,'this.courseInfo');
// if(this.courseInfo){
// if(this.courseInfo.mediaType != 1 || this.courseInfo.media = ''){
// console.log('不符合规则跳出');
// return
// }
// }
console.log(this.videoData, "1111888888")
if (!this.videoData.playAuth) {
// setTimeout(() => {
// this.checkValue();
// }, 2000);
setTimeout(() => {
this.checkValue();
}, 1000);
} else {
console.log('this.videoList at line 这是这只只是594:', this.currentVideoList)
this.getLive();
}
},
loadWebPlayerSDK() {
return new Promise((resolve, reject) => {
const s_tag = document.createElement('script'); // 引入播放器js
s_tag.type = 'text/javascript';
s_tag.src = 'https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.3/aliplayer-min.js';
s_tag.charset = 'utf-8';
s_tag.onload = () => {
this.checkValue();
const s_tag1 = document.createElement('script'); // 引入播放器js
s_tag1.type = 'text/javascript';
s_tag1.src =
'https://player.alicdn.com/aliplayer/presentation/js/aliplayercomponents.min.js';
s_tag1.charset = 'utf-8';
s_tag1.onload = () => {
// this.checkValue();
resolve();
}
document.body.appendChild(s_tag1);
}
document.body.appendChild(s_tag);
const l_tag = document.createElement('link'); // 引入播放器css
l_tag.rel = 'stylesheet';
l_tag.href =
@@ -491,22 +933,23 @@ export default {
});
},
loadComponent() {
return new Promise((resolve, reject) => {
const s_tag = document.createElement('script');
s_tag.type = 'text/javascript';
// 需要先下载组件 js 文件,放到项目 /static/ 目录下
// 下载地址https://github.com/aliyunvideo/AliyunPlayer_Web/blob/master/customComponents/dist/aliplayer-components/aliplayercomponents-1.0.9.min.js
s_tag.src = './utils/aliplayercomponents.min.js';
s_tag.charset = 'utf-8';
s_tag.onload = () => {
resolve();
}
document.body.appendChild(s_tag);
});
// return new Promise((resolve, reject) => {
// const s_tag = document.createElement('script');
// s_tag.type = 'text/javascript';
// // 需要先下载组件 js 文件,放到项目 /static/ 目录下
// // 下载地址https://github.com/aliyunvideo/AliyunPlayer_Web/blob/master/customComponents/dist/aliplayer-components/aliplayercomponents-1.0.9.min.js
// s_tag.src = '@/static/aliplayercomponents.js';
// s_tag.charset = 'utf-8';
// s_tag.onload = () => {
// resolve();
// }
// document.body.appendChild(s_tag);
// });
}
}
}
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';

View File

@@ -2,38 +2,43 @@
<view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar :title="pageTitle ? pageTitle : '课程中心'"></z-nav-bar>
<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; padding-right: 15px; height: 50px;"></u-tabs>
</view>
<view class="containerBg1">
<!-- <view class="containerBg"> -->
<view class="coursePart flexbox" v-if="tabList.length > 1">
<view :class="['item','flexbox',curId == item.id? 'active': '' ]" v-for="(item, index) in tabList"
:key="index" @click="clicklib(item,index)">
<!-- <u-icon v-if="item.isBuy == 0 && curId == item.id" name="lock" color="#258feb" size="28"></u-icon> -->
<!-- <u-icon v-if="item.isBuy == 0 && curId != item.id" name="lock" color="#fff" size="28"></u-icon> -->
<view class="">{{item.title}}</view>
<view class="newBox">
<view class="item flexbox" v-for="(item, index) in MyCourseList.list" :key="index" @click="onPageJump('/pages/course/courseDetail',item.id)">
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
<view class="imgcontainer">
<image :src="item.image" mode="aspectFit"></image>
</view>
<view class="buyItems">
<view class="txt555">
{{item.title}}
</view>
<view :class="['courseList',fold ? 'fold' : '']" v-if="courseList.length > 0">
<!-- 目录是否已经购买 -->
<!-- 0:普通 1超级 2医学 3国学 -->
<view class="endBox" v-if="tabList[curIndex].isBuy == 1 && userMsg.vip == '0'">
<view class="" >
<view class="flexbox" v-if="tabList[curIndex].startTime == null">
<text >当前目录还未开始学习</text><uni-tag type="warning" text="去学习" @click="goToLearn()"></uni-tag>
<view class="jianjie" v-html="item.content">
</view>
<view class="flexbox" v-else>
<text >课程观看有效期截止到{{tabList[curIndex].endTime}} </text><uni-tag type="primary" @click="goToLearn()" text="继续学习"></uni-tag>
<view class="tag-view">
<uni-tag v-if="item.level != 0" style="margin-right: 10rpx;" :text="item.level == 1 ? '初级':'高级'" type="primary" size="small" />
<uni-tag v-if="item.selective != 0 && item.selective == 1" style="margin-right: 10rpx;" text="必修" size="small" type="warning" />
<uni-tag v-if="item.selective != 0 && item.selective == 2" style="margin-right: 10rpx;" text="选修" size="small" type="success" />
</view>
<view class="btn_box">
<text>了解课程</text>
</view>
</view>
</view>
<view class="item" v-for="(item, index) in courseList" :key="index" @click="chooseChapter(item, index)">
<text>{{item.title}}</text>
<uni-tag v-if="item.isAudition == 1" style="margin-left: 10rpx;" :inverted="true" text="试听"
size="mini" type="primary" />
</view>
<u-divider v-show="MyCourseList.status == 2" text="已加载全部"></u-divider>
<u-divider v-show="MyCourseList.status == 3" text="暂无数据"></u-divider>
<u-divider v-show="MyCourseList.status == 1" text="加载中..."></u-divider>
</view>
<u-divider v-else text="暂无数据"></u-divider>
<view>
<u-back-top :scroll-top="scrollTop" bottom="150" :customStyle='bgiStyle'
@@ -61,6 +66,7 @@
export default {
data() {
return {
curTagId:0,
playData: {},
// fixed: false,
bgiStyle: {
@@ -82,12 +88,28 @@
},
scrollable: false,
pageTitle: null,
courseList: [],
fixed:false,
tabList: [{id:1, name:'我的课程'},{id:2, name:'在学习'},{id:3, name:'已过期'}], // 目录列表
curId: null,
curIndex: 0,
MyCourseList:{
list:[],
status:88,
page:1,
flag:false
},
LearningCourseList:{
list:[],
status:88,
page:1,
flag:false
},
ExpiredCourseList:{
list:[],
status:88,
page:1,
flag:false
}
};
},
@@ -99,10 +121,10 @@
// this.pageTitle = e.title
console.log(e, '传入分类id')
this.getUserInfo()
// this.courseId = e.id
// this.getCateList(this.courseId)
// this.getData(e.id)
// this.getSayList()
this.fatherClick()
this.getMyCourseList()
this.getLearningCourseList()
this.getExpiredCourseList()
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
@@ -123,10 +145,10 @@
},
onReachBottom() {
console.log('触底');
if (this.status != 2) {
this.pPage++
this.getSayList()
}
// if (this.status != 2) {
// this.pPage++
// this.getSayList()
// }
},
components: {
// musicPlay
@@ -136,6 +158,51 @@
},
//方法
methods: {
fatherClick(){},
getMyCourseList(){
this.MyCourseList.status = 1
if (!this.MyCourseList.flag) {
console.log('正在执行,未完成')
return
}
this.MyCourseList.flag = false
$http.request({
url: "medical/home/getMedicalCourseList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"id": id,
"limit": 12,
"page": this.MyCourseList.page
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.code == 0) {
if (res.courses.records.length > 0) {
var list = res.courses.records
this.courseList = this.MyCourseList.list.concat(list)
if (res.courses.pages > this.MyCourseList.page) {
this.MyCourseList.status = 0
} else {
this.MyCourseList.status = 2
}
}
else {
this.MyCourseList.status = 3 // 暂无数据
}
console.log('status', this.MyCourseList.status)
}
this.MyCourseList.flag = true
}).catch(e => {
console.log(e, '数据报错')
});
},
getLearningCourseList(){},
getExpiredCourseList(){},
getUserInfo() {
// 用户详情
// if (this.userInfo.id != undefined) {
@@ -160,7 +227,7 @@
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.tabsBox{background-color: #e4eefa;}
.flexbox {
display: flex;
}

View File

@@ -14,7 +14,7 @@
</view>
<view class="fourBox">
<view class="fourIcon flexbox" style="justify-content: space-around;">
<div class="item flexbox" @click="onPageJump()">
<div class="item flexbox" @click="onPageJump('/pages/course/myCourse')">
<image src="../../static/my_02.png" mode="aspectFit"></image>
<text>我的课程</text>
</div>

View File

@@ -357,6 +357,7 @@ export default {
},
//导航字体是否是白色颜色
isWhite() {
// console.log(whiteList,'this.navFontColor')
return whiteList.includes(this.navFontColor);
},
//右上角是否有两个按钮
@@ -404,9 +405,9 @@ export default {
let currentPages = getCurrentPages();
let pageLen = currentPages.length;
//判断是否是第一个页面如果是有设置back为true的页面将不显示返回箭头而显示返回首页按钮
if (pageLen == 1 && !mainPagePath.includes(currentPages[0].route)) {
this.firstPage = true;
}
// if (pageLen == 1 && !mainPagePath.includes(currentPages[0].route)) {
// this.firstPage = true;
// }
},
//方法
methods: {