commit
This commit is contained in:
@@ -1,161 +0,0 @@
|
||||
<!--#
|
||||
layout("/mobile/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
|
||||
#app {
|
||||
background: #FFFFFF;
|
||||
}
|
||||
|
||||
.topTitle {
|
||||
font-size: 16px;
|
||||
padding: 10px 16px;
|
||||
}
|
||||
|
||||
.list-card {
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.list-item {
|
||||
max-width: calc(100% - 100px);
|
||||
}
|
||||
|
||||
.list-item > div {
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.newest-video, .nav-button {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
|
||||
<m-page-loading v-if="mLoading"></m-page-loading>
|
||||
<van-nav-bar
|
||||
title="视频资料"
|
||||
left-arrow
|
||||
placeholder
|
||||
fixed
|
||||
@click-left="window.history.back()"
|
||||
></van-nav-bar>
|
||||
|
||||
<div class="newest-video">
|
||||
<h4>{{typeName}}</h4>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="nav-button">
|
||||
<van-button type="info" :plain="pageForm.searchType !== 'new'" size="small" @click="searchTypeClick('new')">
|
||||
最新视频
|
||||
</van-button>
|
||||
<van-button type="info" :plain="pageForm.searchType !== 'most'" size="small" @click="searchTypeClick('most')">
|
||||
播放最多
|
||||
</van-button>
|
||||
<van-button type="info" :plain="pageForm.searchType !== null" size="small" @click="searchTypeClick(null)">全部
|
||||
</van-button>
|
||||
</div>
|
||||
|
||||
<van-divider></van-divider>
|
||||
|
||||
<div style="margin: 20px auto 0 auto;position: relative">
|
||||
<van-list v-model="loading"
|
||||
:finished="finished"
|
||||
:finished-text="tableData.length>0?'没有更多了':''"
|
||||
:immediate-check="false"
|
||||
@load="pageData">
|
||||
<div v-for="o in tableData" class="list-card" @click="goVideoPage(o)">
|
||||
<div style="display: flex;padding-bottom: 10px" class="van-hairline--bottom">
|
||||
<van-image
|
||||
style="margin-right: 10px"
|
||||
width="90"
|
||||
height="90"
|
||||
:src="FILE_DOMAIN+'/fileStreamPreview?id='+o.cover"
|
||||
></van-image>
|
||||
<div class="list-item">
|
||||
<div style="font-size: 14px">{{o.title}}</div>
|
||||
<div class="van-ellipsis" style="color: darkgray;font-size: 13px">
|
||||
{{removeHTMLTag(o.description)}}
|
||||
</div>
|
||||
<div>
|
||||
<van-tag plain type="primary">{{o.videoCount}}个视频</van-tag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</van-list>
|
||||
</div>
|
||||
|
||||
<van-empty v-if="mLoading==false&&tableData.length==0" class="custom-image" image="/none.svg"
|
||||
description="暂无数据">
|
||||
</van-empty>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
<!--#include("/platform/trainEdu/include/include.js"){}#-->
|
||||
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [mobileMixins],
|
||||
data() {
|
||||
return {
|
||||
typeName: null,
|
||||
videoTypeList: [],
|
||||
pageForm: {
|
||||
searchType: null
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async pageData() {
|
||||
this.mLoading = true
|
||||
const {data} = await $.get('/mobile/trainEducation/getAlbumList', this.pageForm)
|
||||
setTimeout(() => {
|
||||
this.tableData = this.tableData.concat(data.list)
|
||||
if (this.tableData.length === data.totalCount) {
|
||||
this.finished = true
|
||||
} else {
|
||||
this.pageForm.pageNumber++
|
||||
}
|
||||
this.mLoading = false
|
||||
this.pageForm.totalCount = data.totalCount
|
||||
}, 300)
|
||||
},
|
||||
searchTypeClick(val) {
|
||||
this.pageForm.searchType = val
|
||||
this.pageForm.pageNumber = 1
|
||||
this.tableData = []
|
||||
this.pageData()
|
||||
},
|
||||
doSearch() {
|
||||
this.pageForm.pageNumber = 1
|
||||
this.tableData = []
|
||||
this.pageData()
|
||||
},
|
||||
goVideoPage(item) {
|
||||
window.location.href = '/mobile/trainEducation/videoPage?id=' + item.id
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.videoTypeList = await getVideoType()
|
||||
const typeId = this.GetQueryString("id")
|
||||
const type = this.videoTypeList.find(v => parseInt(v.id) === parseInt(typeId))
|
||||
this.typeName = type.typeName
|
||||
if (typeId) {
|
||||
this.$set(this.pageForm, 'typeId', typeId)
|
||||
await this.pageData()
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -1,124 +0,0 @@
|
||||
<!--#
|
||||
layout("/mobile/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
#app {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.newest-video {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.list-card {
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.list-item {
|
||||
max-width: calc(100% - 100px);
|
||||
}
|
||||
|
||||
.list-item > div {
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<van-nav-bar
|
||||
title="培训教育"
|
||||
left-arrow
|
||||
placeholder
|
||||
fixed
|
||||
@click-left="history.back()"
|
||||
></van-nav-bar>
|
||||
|
||||
<van-swiper>
|
||||
<van-swiper-item>
|
||||
<van-image
|
||||
fit="contain"
|
||||
:src="topImg" alt="">
|
||||
</van-image>
|
||||
</van-swiper-item>
|
||||
</van-swiper>
|
||||
|
||||
<van-grid :column-num="3" :border="false">
|
||||
<van-grid-item v-for="item in videoTypeList"
|
||||
:url="'/mobile/trainEducation/AlbumList?id=' + item.id"
|
||||
:key="item.id"
|
||||
:icon="FILE_DOMAIN+'/fileStreamPreview?id='+item.icon"
|
||||
:text="item.typeName"></van-grid-item>
|
||||
</van-grid>
|
||||
|
||||
<div style="height: 5px;background-color: #f6f7f9"></div>
|
||||
|
||||
<div class="newest-video">
|
||||
<h4>最新视频</h4>
|
||||
</div>
|
||||
|
||||
<div v-for="o in tableData" class="list-card" @click="goVideoPage(o)">
|
||||
<div style="display: flex;padding-bottom: 10px" class="van-hairline--bottom">
|
||||
<van-image
|
||||
style="margin-right: 10px"
|
||||
width="90"
|
||||
height="90"
|
||||
:src="FILE_DOMAIN+'/fileStreamPreview?id='+o.cover"
|
||||
></van-image>
|
||||
<div class="list-item">
|
||||
<div style="font-size: 14px">{{o.title}}</div>
|
||||
<div class="van-ellipsis" style="color: darkgray;font-size: 13px">
|
||||
{{removeHTMLTag(o.description)}}
|
||||
</div>
|
||||
<div>
|
||||
<van-tag plain type="primary">{{o.videoCount}}个视频</van-tag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
<!--#include("/platform/trainEdu/include/include.js"){}#-->
|
||||
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [mobileMixins],
|
||||
data() {
|
||||
return {
|
||||
videoTypeList: [],
|
||||
topImg: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fbpic.588ku.com%2Fback_pic%2F05%2F55%2F78%2F725b1593ced0c43.jpg&refer=http%3A%2F%2Fbpic.588ku.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1642838257&t=cce87815db1b5e740bce9dc9357c7eaa'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goVideoPage(item) {
|
||||
window.location.href = '/mobile/trainEducation/videoPage?id=' + item.id
|
||||
},
|
||||
async getNewVideo() {
|
||||
this.tableData = []
|
||||
const {data} = await $.get('/mobile/trainEducation/getNewestVideo')
|
||||
this.tableData.push(data)
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
const videoTypeList = await getVideoType()
|
||||
if (videoTypeList.length > 0) {
|
||||
videoTypeList.map(v => {
|
||||
if (v.files) {
|
||||
v.icon = JSON.parse(v.files)[0].id
|
||||
}
|
||||
})
|
||||
}
|
||||
this.videoTypeList = videoTypeList
|
||||
await this.getNewVideo()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -1,301 +0,0 @@
|
||||
<!--#
|
||||
layout("/mobile/platform.html"){
|
||||
#-->
|
||||
|
||||
<script src="https://cdn-go.cn/cdn/vod-js-sdk-v6/latest/vod-js-sdk-v6.js"></script>
|
||||
<link href="https://web.sdk.qcloud.com/player/tcplayer/release/v4.3.0/tcplayer.min.css" rel="stylesheet"/>
|
||||
<!--如果需要在 Chrome 和 Firefox 等现代浏览器中通过 H5 播放 HLS 格式的视频,需要在 tcplayer.vx.x.x.min.js 之前引入 hls.min.x.xx.xm.js。-->
|
||||
<script src="https://web.sdk.qcloud.com/player/tcplayer/release/v4.3.0/libs/hls.min.0.13.2m.js"></script>
|
||||
<!--播放器脚本文件-->
|
||||
<script src="https://web.sdk.qcloud.com/player/tcplayer/release/v4.3.0/tcplayer.v4.3.0.min.js"></script>
|
||||
|
||||
<style>
|
||||
#app {
|
||||
background: #FFFFFF;
|
||||
}
|
||||
|
||||
.video-container {
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
#player-container-id {
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.van-tabs__wrap {
|
||||
border-bottom: 1px solid #ebedf0;
|
||||
}
|
||||
|
||||
.van-tabs__content {
|
||||
}
|
||||
|
||||
.album-description img {
|
||||
background-size: contain;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.video-list .van-cell__value {
|
||||
width: 50px;
|
||||
flex: unset;
|
||||
}
|
||||
|
||||
.video-list .van-cell__title {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.descriptionCell .van-cell__title {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.descriptionCell p {
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<van-nav-bar
|
||||
title=""
|
||||
left-arrow
|
||||
placeholder
|
||||
fixed
|
||||
@click-left="window.history.back()"
|
||||
></van-nav-bar>
|
||||
|
||||
<div class="video-container">
|
||||
<video v-if="isPlay" id="player-container-id" preload="auto" playsinline
|
||||
webkit-playsinline>
|
||||
</video>
|
||||
|
||||
<van-image
|
||||
v-else
|
||||
style="width: 100%;height: 100%"
|
||||
:src="FILE_DOMAIN+'/fileStreamPreview?id='+albumInfo.cover"
|
||||
></van-image>
|
||||
|
||||
</div>
|
||||
|
||||
<van-tabs v-model="tabIndex" sticky>
|
||||
<van-tab title="介绍">
|
||||
<div style="height: 5px;background-color: #f6f7f9"></div>
|
||||
|
||||
<div style="padding: 16px">
|
||||
{{albumInfo.title}}
|
||||
</div>
|
||||
|
||||
<div style="height: 5px;background-color: #f6f7f9"></div>
|
||||
|
||||
<van-cell class="descriptionCell">
|
||||
<template #title>
|
||||
<div style="font-size: 14px">课程介绍</div>
|
||||
</template>
|
||||
<template #label>
|
||||
<div class="album-description" v-html="albumInfo.description"></div>
|
||||
</template>
|
||||
</van-cell>
|
||||
|
||||
</van-tab>
|
||||
<van-tab title="目录">
|
||||
<div style="height: 5px;background-color: #f6f7f9"></div>
|
||||
|
||||
<van-cell-group class="video-list">
|
||||
<van-cell v-for="(o,i) in videoList" @click="playVideo(o)">
|
||||
<template #title>
|
||||
<van-tag plain type="primary" style="margin-right: 10px">视频</van-tag>
|
||||
<span style="margin-right: 10px">
|
||||
{{i+1}}.
|
||||
</span>
|
||||
<span>
|
||||
{{o.title}}
|
||||
</span>
|
||||
</template>
|
||||
<template #label>
|
||||
{{getWatchStatus(o)}}
|
||||
</template>
|
||||
<template>
|
||||
<span v-if="o.id === currentVideo.id">
|
||||
播放中
|
||||
</span>
|
||||
</template>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
</van-tab>
|
||||
<!-- <van-tab title="评价">-->
|
||||
<!-- <div style="height: 5px;background-color: #f6f7f9"></div>-->
|
||||
<!-- <van-cell title="我的评价">-->
|
||||
<!-- <template>-->
|
||||
<!-- <van-rate v-model="myComment.level" icon="like" void-icon="like-o"></van-rate>-->
|
||||
<!-- </template>-->
|
||||
<!-- </van-cell>-->
|
||||
<!-- </van-tab>-->
|
||||
</van-tabs>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
let player = null
|
||||
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [mobileMixins],
|
||||
data() {
|
||||
return {
|
||||
typeName: null,
|
||||
videoTypeList: [],
|
||||
albumId: null,
|
||||
albumInfo: {},
|
||||
videoList: [],
|
||||
tabIndex: 0,
|
||||
currentVideo: {},
|
||||
myComment: {},
|
||||
watchRecordList: [],
|
||||
lastTime: 0,
|
||||
isPlay: false
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getVideoInfo() {
|
||||
const {data} = await $.get('/mobile/trainEducation/getVideoList', {albumId: this.albumId})
|
||||
this.videoList = data
|
||||
|
||||
},
|
||||
async getAlbumInfo() {
|
||||
const {data} = await $.get('/mobile/trainEducation/getAlbumInfo', {id: this.albumId})
|
||||
this.albumInfo = data
|
||||
},
|
||||
//播放视频
|
||||
async playVideo(o) {
|
||||
this.isPlay = true
|
||||
this.currentVideo = o
|
||||
|
||||
this.$nextTick(()=>{
|
||||
if (!player) {
|
||||
player = TCPlayer('player-container-id', {})
|
||||
}
|
||||
player.src(o.mediaUrl)
|
||||
})
|
||||
|
||||
|
||||
// await this.addWatchRecord()
|
||||
await this.getMyWatchRecord()
|
||||
|
||||
//接着上次继续看
|
||||
const v = this.watchRecordList.find(v => v.videoId === o.id)
|
||||
if (v) {
|
||||
this.lastTime = v.watchDuration
|
||||
setTimeout(() => {
|
||||
player.currentTime(v.watchDuration)
|
||||
})
|
||||
} else {
|
||||
player.currentTime(0)
|
||||
await this.addWatchRecord()
|
||||
await this.getMyWatchRecord()
|
||||
}
|
||||
|
||||
// player.play()
|
||||
this.playPause()
|
||||
this.playEnd()
|
||||
this.playTimeUpdate()
|
||||
this.playSeeked()
|
||||
},
|
||||
|
||||
//快进 快退
|
||||
playSeeked() {
|
||||
player.on('seeked', () => {
|
||||
this.lastTime = player.currentTime()
|
||||
this.addWatchRecord()
|
||||
})
|
||||
},
|
||||
playTimeUpdate() {
|
||||
this.lastTime = player.currentTime()
|
||||
player.on('timeupdate', () => {
|
||||
const nowTime = player.currentTime()
|
||||
if (nowTime - this.lastTime > 5) {
|
||||
this.lastTime = nowTime
|
||||
this.addWatchRecord()
|
||||
}
|
||||
})
|
||||
},
|
||||
playPause() {
|
||||
player.on('pause', () => {
|
||||
this.addWatchRecord()
|
||||
})
|
||||
},
|
||||
|
||||
playEnd() {
|
||||
player.on('ended', () => {
|
||||
this.addWatchRecord()
|
||||
this.getMyWatchRecord()
|
||||
const currentIndex = this.videoList.findIndex(v => v.id === this.currentVideo.id)
|
||||
const nextVideo = this.videoList[currentIndex + 1]
|
||||
if (nextVideo) {
|
||||
this.playVideo(nextVideo)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
//播放记录
|
||||
async addWatchRecord() {
|
||||
// if (player.currentTime() < 2) {
|
||||
// return
|
||||
// }
|
||||
const params = {
|
||||
videoId: this.currentVideo.id,
|
||||
currentTime: parseInt(player.currentTime()),
|
||||
albumId: this.currentVideo.albumId
|
||||
}
|
||||
await $.post('/mobile/trainEducation/addWatchRecord', params)
|
||||
},
|
||||
//监听页面关闭 隐藏
|
||||
watchPage() {
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
if (document.visibilityState === 'hidden') {
|
||||
if (player && this.currentVideo) {
|
||||
this.addWatchRecord()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
async getMyWatchRecord() {
|
||||
const {data} = await $.get('/mobile/trainEducation/getMyWatchRecord')
|
||||
this.watchRecordList = data
|
||||
},
|
||||
getWatchStatus(video) {
|
||||
const v = this.watchRecordList.find(v => v.videoId === video.id)
|
||||
if (!v) {
|
||||
return '学习进度:还未开始学习'
|
||||
}
|
||||
if (v.videoId === this.currentVideo.id) {
|
||||
return '学习进度:正在学习中'
|
||||
}
|
||||
const percentage = (parseInt((v.watchDuration / (video.fileDuration - 1)).toFixed(2) * 100)) + "%"
|
||||
return "学习进度:" + percentage
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.watchPage()
|
||||
const id = this.GetQueryString("id")
|
||||
if (id) {
|
||||
this.albumId = id
|
||||
this.getAlbumInfo()
|
||||
this.getVideoInfo()
|
||||
this.getMyWatchRecord()
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user