Merge branch 'xie'

This commit is contained in:
@fawn-nine
2024-06-21 11:26:11 +08:00
12 changed files with 1276 additions and 834 deletions

179
components/tagTree.vue Normal file
View File

@@ -0,0 +1,179 @@
<template>
<view>
<uni-drawer ref="showRight" mode="right" :width="320" @change="changeD($event,'showRight')">
<view class="close">
<view class="zhan" style="width: 100%;"></view>
<u-icon name="close" @click="closeDrawer('showRight')" color="#2979ff" size="28"></u-icon>
</view>
<view class="proTitle">
<text>请选择课程分类</text>
</view>
<uni-collapse accordion v-if="treeList.length > 0" @change="collapseChange">
<uni-collapse-item v-for="(item, index) in treeList" :key="index" :title="item.title"
:show-animation="true">
<view class="content">
<!-- <text class="text">{{item.title}}</text> -->
<view class="sub1List">
<view class="item leve2" @click.stop="clickCourseInfo(item)">
<text class="textss"> 本目录下全部课程</text>
</view>
<view :class="['item', 'leve2']"
v-for="(item1, index1) in item.children" :key="index1"
@click.stop="clickCourseInfo(item1)">
<text class="textss"> {{item1.title}}</text>
<view class="sub2List" v-if="item1.children">
<view :class="['item', 'leve3']"
v-for="(item2, index2) in item1.children" :key="index2"
@click.stop="clickCourseInfo(item2)">
<text class="textss">{{item2.title}}</text>
<view class="sub3List" v-if="item2.children">
<view :class="['item', 'leve4']"
v-for="(item3, index3) in item2.children" :key="index3"
@click.stop="clickCourseInfo(item3)">
<text class="textss">{{item3.title}}33</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
</uni-drawer>
</view>
</template>
<script>
export default {
name:"tagTree",
// props:['treeList'],
data() {
return {
treeList:[]
};
},methods:{
showDrawer(e) {
this.$refs[e].open()
// this.videoContext.pause()
// this.showTemp = true
console.log('打开抽屉')
},
getData() {
this.$http
.post('medical/home/getCourseMedicalTree')
.then(res => {
if (res.code == 0 && res.labels.length > 0) {
this.treeList = res.labels
} else {
this.treeList = []
}
this.showDrawer('showRight')
}).catch(e => {
console.log(e, '报错')
uni.showToast({
title:"获取课程分类失败",
icon:"none"
})
});
},
clickCourseInfo(val){
this.$emit('clickCourseInfo',val)
this.closeDrawer('showRight')
},
closeDrawer(e) {
this.$refs[e].close()
},
changeD(e, type) {
// console.log((type === 'showRight' ? '左窗口' : '右窗口') + (e ? '打开' : '关闭'));
this[type] = e
if (!e) {
console.log('关闭弹窗')
}
},
collapseChange(e) {
// console.log(e, '折叠面板点击');
// if (e) {
// this.tagId = this.treeList[e].id
// }
},
}
}
</script>
<style lang="scss" scoped>
.sub1List {
background-color: #f7f7f7;
// padding-left: 20rpx;
}
.content {
.item {
background-color: #fff;
line-height: 80rpx;
font-size: 26rpx;
color: #497387;
// border-bottom: 1px solid #dae8f0;
text {
padding-left: 20rpx;
}
.item:last-child {
border-bottom: 0;
}
}
.item.active {
// background-color: #aed1ec;
color: #fff;
background-image: linear-gradient(90deg, #258feb 0%, #00e1ec 100%) !important;
}
.textss {
display: inline-block;
width: 100%;
border-bottom: 1px solid #ebeef5;
}
.leve2 {
.textss {
padding-left: 20rpx;
}
}
.leve2 {
.textss {
padding-left: 40rpx;
}
}
.leve3 {
.textss {
padding-left: 60rpx;
}
}
.leve4 {
.textss {
padding-left: 80rpx;
}
}
}
.proTitle {
text-align: center;
padding: 20rpx 0;
margin-top: 60rpx;
// margin-bottom: 20rpx;
color: #666;
font-size: 26rpx;
}
.close {
display: flex;
justify-content: right;
padding-top: 60rpx;
padding-right: 20px;
}
</style>

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",
@@ -371,13 +371,13 @@
"navigationBarTitleText": "总课程说明"
}
},
{
"path": "pages/course/illustrate",
"style": {
"navigationBarTitleText": "课程说明",
"enablePullDownRefresh": true
}
},
// {
// "path": "pages/course/illustrate",
// "style": {
// "navigationBarTitleText": "课程说明",
// "enablePullDownRefresh": true
// }
// },
{
"path": "pages/course/outline",
"style": {

View File

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

View File

@@ -21,7 +21,10 @@
<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;" v-if="courseInfo.mediaType == 2 && courseInfo.media != ''">
@@ -29,18 +32,18 @@
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="videoTemp" v-show="showTemp">
<u-icon name="play-circle" color="#fff" size="40" @click="clickToPlay"></u-icon>
<image src="../../static/video.jpg" mode="aspectFit"></image>
</view> -->
<!-- <view class="" v-if="!showTemp"> -->
<!-- <video ref="myVideo" id="myVideo" poster="../../static/videoF.jpg" src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4"
enable-danmu danmu-btn controls @ended="playEnd"></video> -->
<!-- </view> -->
<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>
</view>
<div class="fullScreenButton-container">
<div
:class="`prism-fullscreen-btn ${isFullScreen ? 'fullscreen' : ''}`"
@tap="renderScript.changeVideoScreen"
></div>
</div>
<rich-text v-if="courseInfo.content" class="content"
:nodes="formatRichText(courseInfo.content)"></rich-text>
<!-- <text>超强树选择器树组件树插件无限级联树单选树多选树自定义样式树树形选择 </text> -->
@@ -65,10 +68,15 @@
export default {
data() {
return {
isFullScreen: false,
playData: {},
Leve1:[],
Leve2:[],
Leve3:[],
options: {}, //上个页面获取的视频参数视频id
playAuth: "", //播放凭证
videoId: "", //阿里云视频id
videoData: {}, //阿里云视频其他参数
accordionVal: '',
// extraIcon:{
// color: '#4cd964',
@@ -104,10 +112,10 @@
poster:'../../static/videoF.jpg', //封面图
audioPoster:'../../static/logo.png',
current: {
poster: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/music-a.png',
name: '致爱丽丝',
author: '暂无',
src: 'https://web-ext-storage.dcloud.net.cn/uni-app/ForElise.mp3',
// poster: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/music-a.png',
// name: '致爱丽丝',
// author: '暂无',
// src: 'https://web-ext-storage.dcloud.net.cn/uni-app/ForElise.mp3',
},
audioAction: {
method: 'pause'
@@ -156,6 +164,20 @@
},
//方法
methods: {
getLive(playAuthsss) {
//playAuth 是播放凭证 通过后端自己根据api去获取返回时不知道为什么结束会带有 = 有时候甚至是2个 所以要截取等号 不然不能播放
var playAuth = this.playAuth.replace(/=/g, "");
// var playAuth = playAuthsss
this.videoData = {
// ...res.video,//视频其他信息
type: 1,
videoId: this.videoId, //阿里云视频id
playAuth: playAuth, //阿里云播放凭证
};
console.log('得到播放凭证')
this.playAuth = playAuth;
this.$forceUpdate();
},
tabChange(e){
console.log(e,'e');
let _index = e.index
@@ -166,18 +188,21 @@
this.leve3Index = null
if(this.treeList[_index].isLast == 0 && this.treeList[_index].children.length > 0){
this.Leve1 = this.treeList[_index].children
if(this.Leve1[0].isLast == 0 && this.Leve1[0].children.length > 0){
this.Leve2 = this.Leve1[0].children
// console.log(this.Leve2,'Leve2');
if(this.Leve2[0].isLast == 0 && this.Leve2[0].children.length > 0){
this.Leve3 = this.Leve2[0].children
}else{
this.Leve3 = []
}
}else{
this.Leve2 = []
this.Leve3 = []
}
this.Leve2 = []
this.Leve3 = []
// if(this.Leve1[0].isLast == 0 && this.Leve1[0].children.length > 0){
// this.Leve2 = this.Leve1[0].children
// this.Leve3 = []
// // console.log(this.Leve2,'Leve2');
// if(this.Leve2[0].isLast == 0 && this.Leve2[0].children.length > 0){
// this.Leve3 = this.Leve2[0].children
// }else{
// this.Leve3 = []
// }
// }else{
// this.Leve2 = []
// this.Leve3 = []
// }
}else{
this.Leve1 = []
@@ -193,7 +218,8 @@
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');
this.Leve3 = []
}else{
this.Leve2 = []
this.Leve3 = []
@@ -250,23 +276,51 @@
.post('medical/home/getCourseMedicalTree')
.then(res => {
if (res.code == 0 && res.labels.length > 0) {
this.tabList = []
this.tabList = []
this.treeList = res.labels
if(this.treeList[0].isLast == 0 && this.treeList[0].children.length > 0){
this.Leve1 = this.treeList[0].children
if(this.Leve1[0].isLast == 0 && this.Leve1[0].children.length > 0){
this.Leve2 = this.Leve1[0].children
// console.log(this.Leve2,'Leve2');
if(this.Leve2[0].isLast == 0 && this.Leve2[0].children.length > 0){
this.Leve3 = this.Leve2[0].children
if(this.tagId && this.pid){
res.labels.forEach((item, index) => {
this.tabList.push({
id: item.id,
name: item.title
})
if (item.id == this.pid) {
this.curTagIndex = index
console.log(this.curTagIndex)
}
})
this.getCourseInfo(this.tagId)
}else{
this.curTagIndex = 0
this.leve1Index = null
this.getCourseInfo(this.treeList[0].id)
}
// this.treeList = res.labels
if(this.treeList[this.curTagIndex].isLast == 0 && this.treeList[this.curTagIndex].children.length > 0){
this.Leve1 = this.treeList[this.curTagIndex].children
if(this.tagId){
this.Leve1.forEach((item, index) => {
if (item.id == this.tagId) {
this.leve1Index = index
}
})
if(this.Leve1[this.leve1Index].isLast == 0 && this.Leve1[this.leve1Index].children.length > 0){
this.Leve2 = this.Leve1[this.leve1Index].children
// console.log(this.Leve2,'Leve2');
// if(this.Leve2[0].isLast == 0 && this.Leve2[0].children.length > 0){
// this.Leve3 = this.Leve2[0].children
// }else{
// this.Leve3 = []
// }
}else{
this.Leve2 = []
this.Leve3 = []
}
}else{
this.leve1Index = null
this.Leve2 = []
this.Leve3 = []
}
}
}else{
this.Leve1 = []
this.Leve2 = []
@@ -275,12 +329,13 @@
res.labels.forEach( item => {
this.tabList.push({id:item.id, name: item.title})
})
this.getCourseInfo(this.treeList[0].id)
// /this.getCourseInfo(this.treeList[0].id)
// console.log(this.treeList[0].id,'+++++')
// this.showDrawer('showRight')
} else {
this.treeList = []
}
}).catch(e => {
console.log(e, '报错')
});
@@ -297,16 +352,15 @@
'Content-Type': 'application/json'
},
})
.then(res => {
.then(async res => {
if (res.code == 0 && res.course.id) {
this.courseInfo = res.course
this.courseTitle = this.courseInfo.title + '课程说明'
this.curId = id
if(this.courseInfo.mediaType == 1 && this.courseInfo.media != ''){
this.videoUrl = this.courseInfo.media
// this.poster = this.videoUrl +
// "?x-oss-process=video/snapshot,t_0,f_jpg"
// this.getVideoPath(this.courseInfo.media)
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)
}else{
// this.videoUrl = ''
this.poster = ''
@@ -328,10 +382,11 @@
});
},
// 获得播放地址
getVideoPath(str){
console.log(str,'str');
$http.request({
url: "sociology/course/checkVideo",
async getVideoPath(str) {
// console.log(str, 'str');
let path = ''
await $http.request({
url: "medical/course/checkVideoByMD",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
id: str
@@ -340,15 +395,15 @@
'Content-Type': 'application/json'
},
})
// this.$http
// .post('sociology/course/checkVideo',{
// id: str
// })
.then(res => {
console.log(res,'res');
if (res.code == 0) {
// console.log(res, 'res');
path = res.playAuth
}
}).catch(e => {
console.log(e,'获取视频播放地址错误');
console.log(e, '获取视频播放地址错误');
})
return path
},
clickCourseInfo(item) {
this.getCourseInfo(item.id)
@@ -364,6 +419,503 @@
},
};
</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);
}
},
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****。
"playauth": this.videoData.playAuth, // 必选参数参数值可通过调用GetVideoPlayAuth接口获取。
"encryptType": 1, // 必选参数当播放私有加密流时需要设置本参数值为1。其它情况无需设置。
"playConfig": {
"EncryptType": 'AliyunVoDEncryption'
},
width: '100%', //容器的大小
// 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) {
});
this.player = player;
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.videoData, "1111888888")
if (!this.videoData) {
// if (!this.videoData.playAuth) {
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 = () => {
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 =
'https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.3/skins/default/aliplayer-min.css';
document.body.appendChild(l_tag);
});
},
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 = '@/static/aliplayercomponents.js';
// s_tag.charset = 'utf-8';
// s_tag.onload = () => {
// resolve();
// }
// document.body.appendChild(s_tag);
// });
}
}
}
</script>
<style>
.fullScreenButton-container {
color: #fff;
float: right;
height: 35px;
margin-top: 6px;
margin-right: 5px;
display: flex;
align-items: center;
position: relative;
i {
color: #fff;
display: inline-block;
font-size: 22px;
display: block;
margin-top: 7px;
cursor: pointer;
& + i {
margin-left: 3px;
}
@media (min-width: 768px) {
&:hover + .player-tooltip {
display: block;
}
}
}}
</style>
<style lang="scss" scoped>
@import '@/style/mixin.scss';

View File

@@ -1,699 +0,0 @@
<template>
<view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar :title="courseInfo.id ? courseTitle : '课程说明'">
<!-- <uni-icons type="bars" class="topRight" slot="right" @click="showDrawer('showRight')" size="22"></uni-icons> -->
</z-nav-bar>
<view class="" style="background: #55aaff;">
<u-tabs :class="['tabList']" @click="tabChange" :current="curTagIndex" :activeStyle="activeStyle"
:scrollable="scrollable" lineColor="#ef9f00" :list="tabList" :inactiveStyle="{
color: '#fff', }" itemStyle="padding-left: 15px; padding-right: 15px; height: 50px;"></u-tabs>
</view>
<view class="tabLeve1 subItem flexbox" v-if="Leve1.length > 0">
<text :class="[leve1Index == index ? 'cur' : '']" v-for="(item, index) in Leve1" :key="index"
@click="leve1Click(item, index)">{{item.title}}</text>
</view>
<view class="tabLeve2 subItem flexbox" v-if="Leve2.length > 0">
<text :class="[leve2Index == index ? 'cur' : '']" v-for="(item, index) in Leve2" :key="index"
@click="leve2Click(item, index)">{{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="infoBox" v-if="courseInfo.id">
<uni-section :title="courseTitle" type="line" titleFontSize="16px">
<view class="audio" style="margin-bottom: 20rpx;"
v-if="courseInfo.mediaType == 2 && courseInfo.media != ''">
<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" >
<div ref="videoContent" @tap="renderScript.handleClick" id="url-player-test"
: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> -->
</uni-section>
</view>
</view>
<z-navigation></z-navigation>
<!-- <music-play :playData="playData"></music-play> -->
</view>
</template>
<script>
// import musicPlay from '@/components/music.vue'
import $http from '@/config/requestConfig.js';
var clear;
import {
mapState
} from 'vuex';
export default {
data() {
return {
playData: {},
Leve1: [],
Leve2: [],
Leve3: [],
accordionVal: '',
options: {},//上个页面获取的视频参数视频id
playAuth: "", //播放凭证
videoId: "", //阿里云视频id
videoData: {}, //阿里云视频其他参数
// extraIcon:{
// color: '#4cd964',
// size: '100',
// }
scrollable: true,
treeList: [],
tagId: null,
pid: null,
bgiStyle: {
background: '#fff'
},
curTagIndex: null,
leve1Index: null,
leve2Index: null,
leve3Index: null,
iconStyle: {
fontSize: '40rpx',
fontWeight: 'bold',
color: '#258feb',
},
tabList: [
],
activeStyle: {
color: '#fff',
fontWeight: 'bold',
padding: '20rpx',
transform: 'scale(1.2)',
backgroundColor: '#ef9f00'
},
courseInfo: {},
poster: '../../static/videoF.jpg', //封面图
audioPoster: '../../static/logo.png',
current: {
poster: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/music-a.png',
name: '致爱丽丝',
author: '暂无',
src: 'https://web-ext-storage.dcloud.net.cn/uni-app/ForElise.mp3',
},
audioAction: {
method: 'pause'
},
curId: null,
courseTitle: '',
showTemp: true,
videoContext: null,
videoUrl: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4'
};
},
//第一次加载
onLoad(e) {
// 隐藏原生的tabbar
uni.hideTabBar();
this.pid = e.pid
this.tagId = e.id
console.log(e, '------')
this.videoContext = uni.createVideoContext('myVideo')
},
computed: {
...mapState(['userInfo']),
videoHTML() {
return `<video class="video-box" poster="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" src="${this.videoUrl}" enable-danmu danmu-btn controls style="width:100%;height:320rpx"></video>`
}
},
//页面显示
onShow() {
// 隐藏原生的tabbar
uni.hideTabBar();
this.getData()
this.getCourseInfo(this.tagId)
},
onUnload() {
// #ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); // 清除横屏
// #endif
this.showTemp = true
this.videoContext = null
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
},
components: {
// musicPlay
},
created() {
// this.getLive();//获取播放凭证
},
//方法
methods: {
// 获取数据
getLive(playAuthsss) {
//playAuth 是播放凭证 通过后端自己根据api去获取返回时不知道为什么结束会带有 = 有时候甚至是2个 所以要截取等号 不然不能播放
var playAuth = this.playAuth.replace(/=/g, "");
// var playAuth = playAuthsss
this.videoData = {
// ...res.video,//视频其他信息
videoId: this.videoId,//阿里云视频id
playAuth: this.playAuth,//阿里云播放凭证
};
console.log('到这')
this.playAuth = playAuth;
this.$forceUpdate();
},
tabChange(e) {
console.log(e, 'e');
let _index = e.index
this.clickCourseInfo(this.treeList[_index])
this.curTagIndex = _index
this.leve1Index = null
this.leve2Index = null
this.leve3Index = null
if (this.treeList[_index].isLast == 0 && this.treeList[_index].children.length > 0) {
this.Leve1 = this.treeList[_index].children
if (this.Leve1[0].isLast == 0 && this.Leve1[0].children.length > 0) {
this.Leve2 = this.Leve1[0].children
// console.log(this.Leve2,'Leve2');
if (this.Leve2[0].isLast == 0 && this.Leve2[0].children.length > 0) {
this.Leve3 = this.Leve2[0].children
} else {
this.Leve3 = []
}
} else {
this.Leve2 = []
this.Leve3 = []
}
} else {
this.Leve1 = []
this.Leve2 = []
this.Leve3 = []
}
},
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');
} else {
this.Leve2 = []
this.Leve3 = []
}
},
leve2Click(val, index) {
this.leve2Index = index
if (this.leve1Index == null) {
this.leve1Index = 0
}
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 = []
}
},
leve3Click(val, index) {
this.leve3Index = index
// 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
// }
},
formatRichText(html) { //控制图片大小
let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
return match;
});
newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) {
match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi,
'max-width:100%;');
return match;
});
newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi,
'<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
return newContent;
},
getData() {
this.$http
.post('medical/home/getCourseMedicalTree')
.then(res => {
if (res.code == 0 && res.labels.length > 0) {
this.tabList = []
res.labels.forEach((item, index) => {
this.tabList.push({
id: item.id,
name: item.title
})
if (item.id == this.pid) {
this.curTagIndex = index
console.log(this.curTagIndex)
}
})
this.treeList = res.labels
if (this.treeList[this.curTagIndex].isLast == 0 && this.treeList[this.curTagIndex].children
.length > 0) {
this.Leve1 = this.treeList[this.curTagIndex].children
this.Leve1.forEach((item, index) => {
if (item.id == this.tagId) {
this.leve1Index = index
}
})
if (this.Leve1[0].isLast == 0 && this.Leve1[0].children.length > 0) {
this.Leve2 = this.Leve1[0].children
this.Leve2.forEach((item, index) => {
if (item.id == this.tagId) {
this.leve2Index = index
}
})
// 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 = []
}
} else {
this.Leve2 = []
this.Leve3 = []
}
} else {
this.Leve1 = []
this.Leve2 = []
this.Leve3 = []
}
// this.getCourseInfo(this.treeList[0].id)
// console.log(this.treeList[0].id,'+++++')
// this.showDrawer('showRight')
} else {
this.curTagIndex = 0
this.treeList = []
}
}).catch(e => {
console.log(e, '报错')
});
},
// 获取课程详情
getCourseInfo(id) {
$http.request({
url: "medical/home/getCourseMedicalDetail",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
id: id
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(async res => {
if (res.code == 0 && res.course.id) {
this.courseInfo = res.course
this.courseTitle = this.courseInfo.title + '课程说明'
this.curId = id
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,//阿里云播放凭证
// }
} else {
// this.videoUrl = ''
this.poster = ''
}
// console.log(id, 'id')
} else {
this.courseInfo = {}
this.videoUrl = ''
this.poster = ''
}
}).catch(e => {
this.courseInfo = {}
this.courseTitle = ''
this.curId = null
this.poster = ''
this.videoUrl = ''
console.log(e, '课程详情报错')
});
},
// 获得播放地址
async getVideoPath(str) {
// console.log(str, 'str');
let path = ''
await $http.request({
url: "medical/course/checkVideoByMD",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
id: str
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
// this.$http
// .post('sociology/course/checkVideo',{
// id: str
// })
.then(res => {
if (res.code == 0) {
// console.log(res, 'res');
path = res.playAuth
}
}).catch(e => {
console.log(e, '获取视频播放地址错误');
})
return path
},
clickCourseInfo(item) {
this.getCourseInfo(item.id)
},
playEnd() {
this.showTemp = true
},
clickToPlay() {
this.showTemp = false
this.videoContext.play()
}
},
};
</script>
<script module="renderScript" lang="renderjs">
export default {
mounted() {
// 在适合的生命周期通过script和link标签引入播放器sdk、css
this.loadWebPlayerSDK()
},
data() {
return {
player: null,
}
},
methods: {
getLive() {
//配置播放器
var player = new Aliplayer({
id: "url-player-test",
"vid": this.videoData.videoId, // 必选参数,可以通过点播控制台(路径:媒资库>音/视频查询。示例1e067a2831b641db90d570b6480f****。
"playauth": this.videoData.playAuth, // 必选参数参数值可通过调用GetVideoPlayAuth接口获取。
"encryptType": 1, // 必选参数当播放私有加密流时需要设置本参数值为1。其它情况无需设置。
"playConfig": {
"EncryptType": 'AliyunVoDEncryption'
},
width: '100%', //容器的大小
height: '600rpx', //容器的大小
}, function(player) {
console.log('走吗')
});
this.player = player;
player.one('canplay', function() {
// console.log('canplay', this.player.tag);
player.tag.play();
});
},
//监听获取播放凭证的方法
checkValue() {
console.log(this.videoId, this.videoData.playAuth, "1111888888")
if (!this.videoData.playAuth) {
// setTimeout(() => {
// this.checkValue();
// }, 2000);
} else {
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();
resolve();
}
document.body.appendChild(s_tag);
const l_tag = document.createElement('link'); // 引入播放器css
l_tag.rel = 'stylesheet';
l_tag.href =
'https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.3/skins/default/aliplayer-min.css';
document.body.appendChild(l_tag);
});
},
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);
});
}
}
}
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
::v-deep .containerBg {
.uni-audio-default {
width: 100% !important;
}
#myVideo {
width: 100% !important;
}
video {
width: 100% !important;
}
}
.flexbox {
display: flex;
}
.subItem {
background-color: #ebeef5;
padding: 10rpx;
flex-wrap: wrap;
justify-content: start;
text {
display: inline-block;
width: calc(25% - 8rpx);
text-align: center;
border-radius: 10rpx;
color: #258feb;
padding: 10rpx 20rpx;
border: 1px solid #258feb;
margin: 6rpx 0;
font-size: 26rpx;
margin-right: 10rpx;
}
text:last-child {
margin-right: 0 !important;
}
.cur {
background: #258feb;
display: inline-block;
color: #fff;
border-radius: 10rpx;
padding: 10rpx 20rpx;
}
}
.close {
display: flex;
justify-content: right;
padding-top: 60rpx;
padding-right: 20px;
}
.infoBox {
padding: 20rpx;
font-size: 26rpx;
}
// .leve2{background-color: #71a5ff; }
// .leve3{background-color: #9bbeff; }
// .leve4{background-color: #b6d0ff; }
.containerBg {
// background-color: $containerColor;
background-color: #fff;
padding: 0 20rpx;
min-height: calc(100vh - 270rpx);
}
.uni-collapse-item__title-text {
font-size: 30rpx;
}
.videoTemp {
position: relative;
.u-icon {
position: absolute;
z-index: 2;
left: calc(50% - 40rpx);
top: calc(50% - 40rpx);
}
image {
width: 100%;
}
}
.videoTemp:before {
content: '';
display: block;
width: 100%;
position: absolute;
left: 0;
top: 0;
height: 100%;
background-color: rgba(0, 0, 0, .5);
z-index: 1;
}
.proTitle {
text-align: center;
padding: 20rpx 0;
margin-top: 60rpx;
// margin-bottom: 20rpx;
color: #666;
font-size: 26rpx;
}
.sub1List {
background-color: #f7f7f7;
// padding-left: 20rpx;
}
.content {
.item {
background-color: #fff;
line-height: 80rpx;
font-size: 26rpx;
color: #497387;
// border-bottom: 1px solid #dae8f0;
text {
padding-left: 20rpx;
}
.item:last-child {
border-bottom: 0;
}
}
.item.active {
// background-color: #aed1ec;
color: #fff;
background-image: linear-gradient(90deg, #258feb 0%, #00e1ec 100%) !important;
}
.textss {
display: inline-block;
width: 100%;
border-bottom: 1px solid #ebeef5;
}
.leve2 {
.textss {
padding-left: 20rpx;
}
}
.leve2 {
.textss {
padding-left: 40rpx;
}
}
.leve3 {
.textss {
padding-left: 60rpx;
}
}
.leve4 {
.textss {
padding-left: 80rpx;
}
}
}
// .textss:last-child{
// border-bottom: 0;
// }
.topRight {
margin-right: 20rpx;
font-size: 28rpx;
display: flex;
}
audio {
width: 100% !important;
}
</style>

View File

@@ -2,7 +2,7 @@
<view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar :title="pageTitle"><view class="curseSet" slot="right" @click="shuomingPage('/pages/course/illustrate',tagId,pid)"><uni-icons type="info" size="24"></uni-icons> 课程说明</view></z-nav-bar>
<z-nav-bar :title="pageTitle"><view class="curseSet" slot="right" @click="shuomingPage('/pages/course/courseSet',tagId,pid)"><uni-icons type="info" size="24"></uni-icons> 课程说明</view></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"

View File

@@ -2,54 +2,76 @@
<view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar :title="pageTitle ? pageTitle : '课程中心'"></z-nav-bar>
<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>
</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>
<view class="flexbox" v-else>
<text >课程观看有效期截止到{{tabList[curIndex].endTime}} </text><uni-tag type="primary" @click="goToLearn()" text="继续学习"></uni-tag>
</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>
</view>
<u-divider v-else text="暂无数据"></u-divider>
<view>
<u-back-top :scroll-top="scrollTop" bottom="150" :customStyle='bgiStyle'
:iconStyle="iconStyle"></u-back-top>
</view>
<!-- </view> -->
<!-- 评论弹出 -->
<public-module></public-module>
<z-navigation></z-navigation>
<!-- <music-play :playData="playData"></music-play> -->
<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="search" style="margin-top: 20rpx;">
<u-search placeholder="请输入课程名" @clear="clear" v-model="searchValue"
@search="search" @custom="search"></u-search>
</view>
<uni-section class="mb-10" title="课程列表" type="line">
<template v-slot:right>
<u-icon name="grid" color="#2979ff" size="28" @click="showDrawer"></u-icon>
</template>
</uni-section>
<!-- <view class="containerBg"> -->
<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="jianjie" v-html="item.content">
</view>
<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>
<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>
<view>
<u-back-top :scroll-top="scrollTop" bottom="150" :customStyle='bgiStyle'
:iconStyle="iconStyle"></u-back-top>
</view>
<!-- </view> -->
<!-- 评论弹出 -->
<public-module></public-module>
<tree-list ref="treeList" v-if="treeListVisible" @clickCourseInfo="clickCourseInfo"></tree-list>
<z-navigation></z-navigation>
<!-- <music-play :playData="playData"></music-play> -->
</view>
</view>
</template>
<script>
// import musicPlay from '@/components/music.vue'
import treeList from '@/components/tagTree.vue'
import commentsList from '@/components/commentsList.vue'
import emojiList1 from '../../bkhumor-emojiplus/emoji/biaoqin.js'
import emotion from '@/bkhumor-emojiplus/components/bkhumor-emojiplus/bkhumor-emojiplus.vue';
@@ -61,7 +83,9 @@
export default {
data() {
return {
playData: {},
curTagId: 0,
playData: {},
searchValue:'',
// fixed: false,
bgiStyle: {
background: '#fff'
@@ -70,7 +94,7 @@
fontSize: '40rpx',
fontWeight: 'bold',
color: '#258feb',
},
},
userMsg: {}, // 用户信息
scrollTop: 0,
activeStyle: {
@@ -82,13 +106,40 @@
},
scrollable: false,
pageTitle: null,
courseList: [],
tabList: [{id:1, name:'我的课程'},{id:2, name:'在学习'},{id:3, name:'已过期'}], // 目录列表
fixed: false,
medicalId:'',
tabList: [{
id: 1,
name: '我的课程'
}, {
id: 2,
name: '我收藏的'
}, {
id: 3,
name: '已过期'
}], // 目录列表
curId: null,
curIndex: 0,
treeListVisible:false,
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 +150,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,19 +174,165 @@
},
onReachBottom() {
console.log('触底');
if (this.status != 2) {
this.pPage++
this.getSayList()
if (this.curTagId == 0) {
if(this.MyCourseList.status != 2){
}
}else if(this.curTagId == 1){
}else if(this.curTagId == 2){
}
},
components: {
// musicPlay
emotion,
treeList
// commentsList
},
//方法
methods: {
search(res){
console.log('点了搜索')
},
cancel(res){},
clear(){
this.searchValue = ''
},
clickCourseInfo(val){
console.log(val,'选择的分类数据');
if(val && val.id){
this.medicalId = val.id
}
},
fatherClick(e) {
console.log(e,'tabitem')
},
showDrawer(){
this.treeListVisible = true
this.$nextTick( ()=> {
this.$refs['treeList'].getData()
})
},
getMyCourseList() {
this.MyCourseList.status = 1
if (this.MyCourseList.flag) {
console.log('正在执行,未完成')
return
}
this.MyCourseList.flag = false
$http.request({
url: "medical/course/getUserCourseBuy",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"limit": 10,
"title": this.searchValue,
"medicalId": this.medicalId,
"page": this.MyCourseList.page
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.code == 0) {
if (res.courseList.records.length > 0) {
var list = res.courseList.records
this.MyCourseList.list = this.MyCourseList.list.concat(list)
if (res.courseList.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() {
if (!this.pObj.pFlag) {
return
}
this.pObj.pFlag = false
this.pObj.status = 1
$http.request({
url: "common/taihuWelfare/getTaihuWelfareProductList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"page": this.pObj.page,
"limit": 14
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
if (res.code == 0) {
if (res.page.records.length > 0) {
var _list = res.page.records
this.productList = this.productList.concat(_list)
if (res.page.pages > this.pObj.page) {
this.pObj.status = 88
} else {
// 加载完毕
this.pObj.status = 2
}
} else {
this.pObj.status = 3
}
}
this.pObj.pFlag = true
}).catch(e => {
console.log(e, '商品列表')
this.pObj.status = 88
this.pObj.pFlag = true
});
},
getExpiredCourseList() {
if (!this.pObj.pFlag) {
return
}
this.pObj.pFlag = false
this.pObj.status = 1
$http.request({
url: "common/taihuWelfare/getTaihuWelfareProductList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"page": this.pObj.page,
"limit": 14
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
if (res.code == 0) {
if (res.page.records.length > 0) {
var _list = res.page.records
this.productList = this.productList.concat(_list)
if (res.page.pages > this.pObj.page) {
this.pObj.status = 88
} else {
// 加载完毕
this.pObj.status = 2
}
} else {
this.pObj.status = 3
}
}
this.pObj.pFlag = true
}).catch(e => {
console.log(e, '商品列表')
this.pObj.status = 88
this.pObj.pFlag = true
});
},
getUserInfo() {
// 用户详情
// if (this.userInfo.id != undefined) {
@@ -146,20 +343,110 @@
});
// }
},
// 跳转
onPageJump(url,id) {
onPageJump(url, id) {
uni.navigateTo({
url: `${url}?id=${id}`
});
},
},
};
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.search{background-color: $containerColor; padding: 10rpx; }
.containerBg1{padding:0 10px;}
.containerBg {
background-color: $containerColor;
padding: 0 20rpx;
}
.curseSet{margin-right: 20rpx; font-size: 28rpx; display: flex; align-items: center;}
.fixed {
position: fixed;
z-index: 1; width: 100%; background-color: #fff;
}
.newBox {
.item {
margin-bottom: 20rpx;
background-color: #fff;
border-radius: 20rpx;
@include ptop_bottm(10px);
@include pleft_right(10px);
@include mshadow(10px, 1) .imgcontainer {
display: block;
width: 110rpx;
margin-right: 20rpx;
// background-size: cover;
// background-position: center;
height: 200rpx;
flex-grow: 1;
// @include ptop_bottm(10px);
overflow: hidden;
// @include pleft_right(10px);
image {
width: 100%;
height: 200rpx;
}
}
.btn_box{ text-align: right;
text{
border-radius: 20rpx;
padding: 3px 5px; @include theme("btn_bg");
font-size: 28rpx; color: #fff;
}
}
.buyItems {
width: 60%;
}
.jianjie {
margin-top: 10rpx;
font-size: 24rpx;
@include bov();
color: #9c9c9c;
}
.txt555 {
font-size: 30rpx;
color: #000;
@include bov()
}
}
}
.subCate {
padding-top:10px;
padding-bottom: 10px;
.item {
font-size: 26rpx;
background-color: #fff;
border-radius: 10px;
color: #333;
margin-right: 16rpx;
padding: 14rpx 30rpx;
}
.item:last-child() {
margin-right: 0;
}
.item.active {
background-color: $themeColor;
color: #fff;
}
}
.tabList {
text-align: center;
}
.flexbox {
display: flex;
@@ -168,4 +455,45 @@
.imgcontainer {
background-color: $imgBg;
}
.box {
// background-color: #fff;
min-height: calc(100vh - 270rpx);
}
.learnBox {
// background-color: #fff;
margin-top: 10px;
.learn {
flex-wrap: wrap;
justify-content: space-between;
margin-top: 20rpx;
.item {
width: 48%;
margin-bottom: 16px;
overflow: hidden;
image {
width: 100%;
height: 200rpx;
}
.txt555 {
display: block;
text-align: center;
height: 40rpx;
width: 100%;
line-height: 40rpx;
@include bov(1);
margin-top: 10rpx;
font-size: 24rpx;
}
}
}
}
</style>

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>
@@ -198,7 +198,24 @@
<view>
<u-back-top :scroll-top="scrollTop" bottom="60" :customStyle='bgiStyle' :iconStyle="iconStyle"></u-back-top>
</view>
<view class="appJump ">
<view class="everhealth item flexbox" @click="appjumpfun('nuttyreading')">
<view class="img">
<image src="@/static/f40x40.png" mode="widthFix"></image>
</view>
<view class="text">
<text>疯子读书</text>
</view>
</view>
<view class="zmzm item flexbox" @click="appjumpfun('zmzm')">
<view class="img">
<image src="@/static/40x40.png" mode="widthFix"></image>
</view>
<view class="text">
<text>众妙之门</text>
</view>
</view>
</view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-navigation></z-navigation>
@@ -593,7 +610,58 @@
url: '../bookShop/bookShopType?type=' + e
});
},
appjumpfun(name){
let bagName = ''
let schemes = ''
if(name == 'zmzm'){
bagName = 'com.cn.zmzm'
schemes = 'zmzm'
}
if(name == 'nuttyreading'){
bagName = 'com.cn.nuttyreading'
schemes = 'nuttyreading'
}
// if(name == 'everhealth'){
if (plus.os.name == "Android") { //安卓
if (plus.runtime.isApplicationExist({ //查看安卓系统手机有没有下载这款app
pname: bagName, //B款app云打包的包名
})) { //安装了app
plus.runtime.launchApplication({ //打开app
pname: bagName, //B款app云打包的包名
extra: {
url: `${schemes}://${bagName}` //B款app配置的schemes+云打包的包名
},
function(e) {
console.log("Open system default browser failed: " + e.message);
}
})
}
else { //未安装app
plus.runtime.openURL(`https://a.app.qq.com/o/simple.jsp?pkgname=${bagName}`, function(res) {
//进入后台小哥哥给我的应用宝下载链接,让你们后台给你
//这链接会判断你手机是ios还是AndroidAndroid进入应用宝下载app
//跟下面的是一个链接
console.log(res);
});
}
} else if (plus.os.name == "iOS") { //苹果
//因为ios查不到B款app在ios系统手机里面其实下载了也是检测不到所以就不检测了
//直接打开B款appB款app没有的话会进入回调报错我们在回调去打开下载链接
plus.runtime.launchApplication({
action: "${schemes}://"
}, function(e) {
plus.runtime.openURL(`https://a.app.qq.com/o/simple.jsp?pkgname=${bagName}`, function(res) {
//进入后台小哥哥给我的appStore下载app链接让你们后台给你
//这链接会判断你手机是ios还是Androidios进入应用宝下载app
//跟上面的是一个链接
console.log(res);
});
});
// }
}
},
// 三个列表跳页
onBookMore(e) {
uni.navigateTo({
@@ -609,6 +677,19 @@
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.appJump{position: fixed; right: 0; top: 8%; z-index: 1;
.item{background: rgba(255, 255, 255, .6); margin-bottom: 20rpx; border: 1px solid #fff;
align-items: center; padding-right: 10rpx;
overflow: hidden; border-radius: 50rpx 0 0 50rpx;
text{font-size: 20rpx;}
.img{
// width: 60rpx; height: 60rpx;
padding: 6rpx; overflow: hidden;
image{width: 36rpx; height: 36rpx; border-radius: 100%;}
}
}
}
.newsBox {
justify-content: space-between;

BIN
static/40x40.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
static/f40x40.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

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: {