记录上次播放视频

This commit is contained in:
2024-07-03 14:11:29 +08:00
parent 60d2c82b34
commit df49321b07
3 changed files with 391 additions and 302 deletions

View File

@@ -1,21 +1,22 @@
<template> <template>
<view class="container" style="background-color: #000; position: relative"> <view class="container" style="background-color: #000; position: relative">
<!-- <u-icon <!-- <u-icon
@click="goBack" @click="goBack"
name="arrow-left" name="arrow-left"
color="#258feb" color="#3ab3ae"
size="20" size="20"
:style="`display: inline-block; position: absolute; top: ${ :style="`display: inline-block; position: absolute; top: ${
statusBarHeight + 2 statusBarHeight + 2
}px; left: ${10}px;z-index: 999;`" }px; left: ${10}px;z-index: 999;`"
></u-icon>--> ></u-icon>-->
<view style="width: 100%; height: 200px" v-if="currentVideo.type == 1"> <view style="width: 100%; height: 200px">
<div class="" style="background-color: #000" ref="videoContent" @tap="renderScript.handleClick" <div class="" style="background-color: #000" ref="videoContent" @tap="renderScript.handleClick"
id="url-player-test" :videoData="videoData" :winWidth="winWidth" :winHeight="winHeight" id="url-player-test" :videoData="videoData" :winWidth="winWidth" :winHeight="winHeight"
:currentVideoList="currentVideoList" :firstTime="firstTime" :change:videoData="renderScript.receiveMsg" :currentVideoList="currentVideoList" :firstTime="firstTime" :isfresh="isfresh"
:change:winWidth="renderScript.receiveWinWidth" :change:winHeight="renderScript.receiveWinHeight" :change:videoData="renderScript.receiveMsg" :change:winWidth="renderScript.receiveWinWidth"
:change:firstTime="renderScript.receiveFirstTime" :change:winHeight="renderScript.receiveWinHeight" :change:firstTime="renderScript.receiveFirstTime"
:change:currentVideoList="renderScript.receiveVideoList"></div> :change:isfresh="renderScript.receiveIsfresh" :change:currentVideoList="renderScript.receiveVideoList">
</div>
<div @tap="renderScript.emitData" ref="videoContent1" v-show="false"> <div @tap="renderScript.emitData" ref="videoContent1" v-show="false">
直接调用renderjs中的emitData的方法,传递当前播放时长 直接调用renderjs中的emitData的方法,传递当前播放时长
</div> </div>
@@ -26,36 +27,24 @@
<div class="fullScreenButton-container"> <div class="fullScreenButton-container">
<div :class="`prism-fullscreen-btn ${isFullScreen ? 'fullscreen' : ''}`" <div :class="`prism-fullscreen-btn ${isFullScreen ? 'fullscreen' : ''}`"
@tap="renderScript.changeVideoScreen"></div> @tap="renderScript.changeVideoScreen"></div>
<!-- <div class="beisuBtn" id="beisuBtn" @tap="renderScript.changeSpeed">倍速</div> -->
<!-- <img class=" iconfont icon-list" src="../../../../static/icon/cate_bg.png" style="width: 60px;height: 10px;"></img> --> <!-- <img class=" iconfont icon-list" src="../../../../static/icon/cate_bg.png" style="width: 60px;height: 10px;"></img> -->
</div> </div>
<!-- <div class="beisuBtn" id="beisuBtn" @tap="renderScript.changeSpeed">倍速</div> -->
</view>
<view style="width: 100%; height: 200px; position: relative" v-else>
<video @timeupdate="videoTimeUpdateEvent($event)" ref="videos" style="width: 100%; height: 100%" autoplay
id="videoId" object-fit="contain" class="video-box" :src="videoUrl"
:poster="`${videoUrl}?x-oss-process=video/snapshot,t_${1},f_jpg`" @play="playVideo">
<cover-view style="position: absolute; top: 10px; z-index: 80">
<cover-view class="returnBack" @click="goBack">
<uni-icons type="back" size="26" color="#fff"></uni-icons>
<text class="txt">返回</text>
</cover-view>
</cover-view>
<!-- <cover-view v-if="isFullScreen && isControl">
<view class="right_title">
<view class="returnBack" @click="quitScreen">
<uni-icons type="back" size="26" color="#fff"></uni-icons>
<text class="txt">返回</text>
</view>
<view class="right_handle">
<uni-icons type="star" size="30" color="#fff"></uni-icons>
<uni-icons type="redo-filled" size="30" color="#fff"></uni-icons>
</view>
</view>
</cover-view> -->
</video>
</view> </view>
<!-- <view style="width: 100%; height: 200px; position: relative" v-else>
<video
@timeupdate="videoTimeUpdateEvent($event)"
ref="videos"
style="width: 100%; height: 100%"
autoplay
id="videoId"
object-fit="contain"
class="video-box"
:src="videoUrl"
:poster="`${videoUrl}?x-oss-process=video/snapshot,t_${1},f_jpg`"
@play="playVideo"
>
</video>
</view> -->
</view> </view>
</template> </template>
<script> <script>
@@ -72,6 +61,7 @@
return { return {
//当前是否是全屏模式 //当前是否是全屏模式
isFullScreen: false, isFullScreen: false,
isfresh: false,
isControl: true, isControl: true,
timer: null, timer: null,
videoTitle: "", videoTitle: "",
@@ -142,7 +132,7 @@
if (this.currentTime) { if (this.currentTime) {
that.setVideoTime(); that.setVideoTime();
} }
}, 60000 * 10); }, 60000);
}, },
methods: { methods: {
@@ -173,22 +163,19 @@
}, },
// 播放进度改变 // 播放进度改变
videoTimeUpdateEvent(e) { videoTimeUpdateEvent(e) {
console.log("e at line 78:", e);
this.playTime = parseInt(e.detail.currentTime); this.playTime = parseInt(e.detail.currentTime);
this.currentTime = parseInt(e.detail.currentTime);
console.log("实时播放时长:", e.detail.currentTime);
this.allTime = parseInt(e.detail.duration); this.allTime = parseInt(e.detail.duration);
console.log("视频播放时长", this.playTime, "视频总时长", this.allTime); // console.log("视频播放时长", this.playTime, "视频总时长", this.allTime);
this.recordTime({ this.recordTime({
time: this.playTime, time: this.playTime,
}); });
}, },
async init(data) { async init(data) {
// uni.getSystemInfo({ this.isfresh = true;
// success(res) {
// var winWidth = res.screenWidth;
// var winHeight = res.screenHeight;
// var statusBarHeight = res.statusBarHeight;
console.log("at line 59:", "是否先走这里"); console.log("at line 59:", "是否先走这里");
if (uni.getStorageSync("videoOssList")) { if (uni.getStorageSync("videoOssList")) {
this.videoList = JSON.parse(uni.getStorageSync("videoOssList")); this.videoList = JSON.parse(uni.getStorageSync("videoOssList"));
@@ -201,20 +188,16 @@
if (this.currentTime) { if (this.currentTime) {
await that.setVideoTime(); await that.setVideoTime();
} }
}, 60000 * 10); }, 60000);
await this.getLive(); await this.getLive();
}, },
getData(data) { async getData(data) {
console.log(
"data at line 这是接口拿回来的时长11111111111111111111:",
this.videoData.userCourseVideoPositionEntity
);
if (!this.isSetFirstTime) { if (!this.isSetFirstTime) {
var netWork = this.videoData.userCourseVideoPositionEntity ? var netWork = this.videoData.userCourseVideoPositionEntity ?
this.videoData.userCourseVideoPositionEntity.position : this.videoData.userCourseVideoPositionEntity.position :
0; 0;
var list = JSON.parse(uni.getStorageSync("videoOssList")); var list = JSON.parse(uni.getStorageSync("videoOssList"));
console.log("这是获取接口 设置的起始时长", netWork);
var index = list.findIndex((e) => e.id == this.videoData.id); var index = list.findIndex((e) => e.id == this.videoData.id);
if (netWork) { if (netWork) {
@@ -231,35 +214,32 @@
this.firstTime = 0; this.firstTime = 0;
} }
} }
this.currentTime = this.firstTime;
console.log(this.firstTime, "这是第一次播放时长222");
await this.setVideoTime();
uni.setStorageSync("videoOssList", JSON.stringify(list)); uni.setStorageSync("videoOssList", JSON.stringify(list));
console.log(
"list at line 这是设置完第一次初始值9777777777777777777770:",
list
);
if (this.currentVideo.type == 0 || this.currentVideo.type == 2) { if (this.currentVideo.type == 0 || this.currentVideo.type == 2) {
this.playVideo(); await this.playVideo();
} }
console.log(this.firstTime, "1111111111111111111111"); console.log(this.firstTime, "这是第一次播放时长");
this.isSetFirstTime = true; this.isSetFirstTime = true;
} }
}, },
playVideo(e) { async playVideo(e) {
this.videoContext = uni.createVideoContext("videoId", this); this.videoContext = uni.createVideoContext("videoId", this);
this.videoContext.seek(this.firstTime); this.videoContext.seek(this.firstTime);
// this.videoContext.requestFullScreen(); // this.videoContext.requestFullScreen();
}, },
recordTime(data) { recordTime(data) {
this.currentTime = data.time; this.currentTime = data.time;
console.log("data at line 54:", data);
var list = []; var list = [];
if (uni.getStorageSync("videoOssList")) { if (uni.getStorageSync("videoOssList")) {
list = JSON.parse(uni.getStorageSync("videoOssList")); list = JSON.parse(uni.getStorageSync("videoOssList"));
} }
console.log("list at line 56:", list);
console.log("点击后设置播放时长的方法list at line 65:", list);
var index = list.findIndex((e) => e.id == this.videoData.id); var index = list.findIndex((e) => e.id == this.videoData.id);
if (list.length > 0 && index >= 0) { if (list.length > 0 && index >= 0) {
list[index] = { list[index] = {
@@ -280,6 +260,7 @@
}, },
// 获取数据 // 获取数据
getLive() { getLive() {
this.isfresh = false;
var data = { var data = {
...this.options, ...this.options,
}; };
@@ -295,7 +276,6 @@
}, },
}) })
.then((res) => { .then((res) => {
console.log("res at line 252111111111111111111111111111:", res);
if (this.currentVideo.type == 1) { if (this.currentVideo.type == 1) {
var playAuth = res.video.playAuth.replace(/=/g, ""); var playAuth = res.video.playAuth.replace(/=/g, "");
this.videoData = { this.videoData = {
@@ -305,13 +285,17 @@
}; };
this.playAuth = playAuth; this.playAuth = playAuth;
} else { } else {
this.videoData = res.video;
this.videoData = {
...res.video,
playAuth: new Date().getTime()
};
this.videoUrl = this.videoUrl =
// "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/taiHuClass/" + // "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/taiHuClass/" +
res.video.videoUrl; res.video.videoUrl;
this.$nextTick(async () => { // this.$nextTick(async () => {
await this.getData(); // await this.getData();
}); // });
} }
this.$forceUpdate(); this.$forceUpdate();
@@ -319,23 +303,21 @@
}, },
async handleEnd() { async handleEnd() {
var list = JSON.parse(JSON.stringify(uni.getStorageSync("videoOssList"))); var list = JSON.parse(JSON.stringify(uni.getStorageSync("videoOssList")));
var data = list.find((e) => e.id == this.videoData.id); var data = list.find((e) => e.id == this.videoData.id);
this.currentTime = data.time; this.currentTime = data.time;
console.log('this.currentTime at line 这是结束的时候掉的存储视频:', this.currentTime)
await this.setVideoTime(); await this.setVideoTime();
this.timer = null; this.timer = null;
}, },
setVideoTime(time) { setVideoTime(time) {
console.log("是否走了存储视屏," + this.videoData.id, this.currentTime, );
var data = { var data = {
videoId: this.videoData.id, videoId: this.videoData.id,
position: this.currentTime, //秒数 position: this.currentTime, //秒数
}; };
console.log("data at line =存储视频时长接口:", data);
$http $http
.request({ .request({
// url: "book/buyOrder/buySave",
url: `sociology/course/saveCoursePosition`, url: `sociology/course/saveCoursePosition`,
method: "Post", // POST、GET、PUT、DELETE具体说明查看官方文档 method: "Post", // POST、GET、PUT、DELETE具体说明查看官方文档
data, data,
@@ -345,8 +327,7 @@
}, },
}) })
.then((res) => { .then((res) => {
console.log("res at line 185:", res); console.log('存储视屏时长接口返回信息', res)
// console.log("data at line 5911111:", this.videoData);
this.$forceUpdate(); this.$forceUpdate();
}); });
}, },
@@ -401,6 +382,7 @@
curTime(val) { curTime(val) {
console.log('val at line 这是真正的时长:', val)
if (this.curTime !== null && this.curStatus !== null) { if (this.curTime !== null && this.curStatus !== null) {
this.$refs.videoContent1.click() this.$refs.videoContent1.click()
} }
@@ -433,17 +415,33 @@
var that = this; var that = this;
// this.$emit('changeScreenLoading',true) // this.$emit('changeScreenLoading',true)
var status = this.player.fullscreenService.getIsFullScreen(); var status = this.player.fullscreenService.getIsFullScreen();
ownerInstance.callMethod('screenChange', { ownerInstance.callMethod('screenChange', {
status: status, status: status,
primary: status ? 'portrait' : 'landscape' primary: status ? 'portrait' : 'landscape'
}) })
if (status) { if (status) {
setTimeout(() => { setTimeout(() => {
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏 plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
this.player.fullscreenService.cancelFullScreen(); this.player.fullscreenService.cancelFullScreen();
// this.$emit('changeScreenLoading',false); // this.$emit('changeScreenLoading',false);
}, 100); }, 100);
// this.player.setPlayerSize('100%','200px'); // this.player.setPlayerSize('100%','200px');
} else { } else {
// this.player.setPlayerSize({ // this.player.setPlayerSize({
@@ -457,239 +455,260 @@
plus.screen.lockOrientation("landscape-primary"); plus.screen.lockOrientation("landscape-primary");
}, 100); }, 100);
} }
}, },
changeSpeed(event, ownerInstance){
console.log('点击了');
},
endEmitData(event, ownerInstance) { endEmitData(event, ownerInstance) {
var that = this; var that = this;
ownerInstance.callMethod('handleEnd', ) ownerInstance.callMethod('handleEnd', )
}, },
getLive() { getLive() {
if (this.videoData.type == 1) {
var fullScreenButtonComponent = Aliplayer.Component({
/**
* 初始函数在new对象时调用
*
* @param {string} adAddress - 广告视频地址
* @param {string} toAddress - 广告链接地址
*/
init: function(status, toAddress) {
this.fullScreenStatus = status var fullScreenButtonComponent = Aliplayer.Component({
// this.adAddress = adAddress; /**
// this.toAddress = toAddress; * 初始函数在new对象时调用
*
* @param {string} adAddress - 广告视频地址
* @param {string} toAddress - 广告链接地址
*/
init: function(status, toAddress) {
this.$html = $('.fullScreenButton-container'); this.fullScreenStatus = status
// this.$html.hide(); // this.adAddress = adAddress;
}, // this.toAddress = toAddress;
/** this.$html = $('.fullScreenButton-container');
* 创建广告Dom元素 // this.$html.hide();
*/ },
createEl: function(el) {
/**
* 创建广告Dom元素
*/
createEl: function(el) {
this.$html.find('.ad').attr('src', this.adAddress); this.$html.find('.ad').attr('src', this.adAddress);
var $adWrapper = this.$html.find('.ad-wrapper'); var $adWrapper = this.$html.find('.ad-wrapper');
$adWrapper.attr('href', this.toAddress); $adWrapper.attr('href', this.toAddress);
$adWrapper.click(function() { $adWrapper.click(function() {
// Aliplayer.util.stopPropagation(); // Aliplayer.util.stopPropagation();
}); });
// this.$html.find('.close').click(function () { // this.$html.find('.close').click(function () {
// this.$html.hide(); // this.$html.hide();
// }); // });
// $(el).find('.prism-controlbar').append(this.$html); // $(el).find('.prism-controlbar').append(this.$html);
$(el).find('.prism-time-display').after(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 playerOptions = {
id: "url-player-test",
"vid": this.videoData
.videoId, // 必选参数,可以通过点播控制台(路径:媒资库>音/视频查询。示例1e067a2831b641db90d570b6480f****。
width: '100%', //容器的大小
// videoWidth: '100vw', //容器的大小
// videoHeight: '100vh', //容器的大小
height: '100%', //容器的大小
playsinline: true,
controlBarVisibility: "click",
cover: "",
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'
]
}, },
ready: function(player, e) { {
// this.$html.hide() name: 'RateComponent',
type: AliPlayerComponent.RateComponent
}, },
/**
* 隐藏广告
*/ // {
play: function(player, e) { // name: 'RotateMirrorComponent',
// this.$html.show(); // type: AliPlayerComponent.RotateMirrorComponent
// },
],
skinLayout: [{
name: "bigPlayButton",
align: "blabs",
x: 30,
y: 80
}, },
/** {
* 显示广告 name: "H5Loading",
*/ align: "cc"
pause: function(player, e) {
// this.$html.show();
}, },
/** {
* 隐藏广告 name: "errorDisplay",
*/ align: "tlabs",
playing: function(player, e) { x: 0,
this.$html.show(); y: 0
// this.$html.hide();
}, },
waiting: function(player, e) { {
// this.$html.hide() name: "infoDisplay"
}, },
timeupdate: function(player, e) {}, {
error: function(player, e) {}, name: "tooltip",
/** align: "blabs",
* 显示广告 x: 0,
*/ y: 56
ended: function(player, e) { },
// this.$html.show(); {
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
}
]
} }
}); ]
console.log('this.currentVideoList at line 456111111111111111111111:', this.videoList) }
var player = new Aliplayer({
id: "url-player-test",
"vid": this.videoData if (this.videoData.type == 1) {
.videoId, // 必选参数,可以通过点播控制台(路径:媒资库>音/视频查询。示例1e067a2831b641db90d570b6480f****。 playerOptions = {
...playerOptions,
"playauth": this.videoData.playAuth, // 必选参数参数值可通过调用GetVideoPlayAuth接口获取。 "playauth": this.videoData.playAuth, // 必选参数参数值可通过调用GetVideoPlayAuth接口获取。
"encryptType": 1, // 必选参数当播放私有加密流时需要设置本参数值为1。其它情况无需设置。 "encryptType": 1, // 必选参数当播放私有加密流时需要设置本参数值为1。其它情况无需设置。
"playConfig": { "playConfig": {
"EncryptType": 'AliyunVoDEncryption' "EncryptType": 'AliyunVoDEncryption'
}, }
width: '100%', //容器的大小 }
// videoWidth: '100vw', //容器的大小
// videoHeight: '100vh', //容器的大小
height: '100%', //容器的大小
playsinline: true,
controlBarVisibility: "click",
cover: "",
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: 'RateComponent',
type: AliPlayerComponent.RateComponent
},
// { } else {
// name: 'RotateMirrorComponent', playerOptions = {
// type: AliPlayerComponent.RotateMirrorComponent ...playerOptions,
// }, source: this.videoData.videoUrl
}
],
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()
})
} }
var player = new Aliplayer(playerOptions, 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.setRotate(90)
@@ -705,9 +724,54 @@
}, },
showPreview(e) {
console.log('e at line 56:', e)
let conimg = e.target.dataset.nodes;
let imgs = conimg.match(/<img[^>]+>/g); //选择节点中的img
console.log('imgs at line 59:', imgs)
let imgList = [];
//遍历img标签的src里面的内容放在定义的数组imgList中
for (var j = 0; j < imgs.length; j++) {
imgs[j].replace(/<img[^>]*src=['"]([^'"]+)[^>]*>/gi, function(match, capture) {
imgList.push(capture)
})
}
console.log('imgList.push at line 64:', imgList)
//最后一步就是所有图片放在预览的方法previewImage中就可以了
// uni.previewImage({
// current: imgList,
// urls: imgList,
// })
uni.previewImage({
urls: imgList,
longPressActions: {
itemList: ['很抱歉,暂不支持保存图片到本地'],
success: function(res) {
// console.log(res,'+++++')
}
}
});
},
receiveScreenType(newValue) { receiveScreenType(newValue) {
console.log('newValue at line 427屏幕方向111111111111:', newValue) console.log('newValue at line 427屏幕方向111111111111:', newValue)
},
async receiveIsfresh(newValue) {
if (newValue) {
if (this.player) {
this.timer = null;
await this.setVideoTime();
this.player.dispose();
// this.player.seek(newValue);
}
}
console.log('newValue at line 427屏幕方向111111111111:', newValue)
}, },
receiveFirstTime(newValue, oldValue, ownerVm, vm) { receiveFirstTime(newValue, oldValue, ownerVm, vm) {
// //数据变化 // //数据变化
@@ -755,7 +819,7 @@
}, },
checkValue() { checkValue() {
console.log(this.videoId, this.authId, "1111888888") console.log(this.videoId, this.authId, "1111888888")
if (!this.videoData.playAuth || !this.currentVideoList) { if ((!this.videoData.playAuth || !this.currentVideoList)) {
setTimeout(() => { setTimeout(() => {
this.checkValue(); this.checkValue();
}, 1000); }, 1000);
@@ -931,7 +995,6 @@
} }
} }
.playlist-content { .playlist-content {
position: absolute; position: absolute;
right: 0; right: 0;

View File

@@ -3,11 +3,7 @@
<!-- 公共组件-每个页面必须引入 --> <!-- 公共组件-每个页面必须引入 -->
<public-module></public-module> <public-module></public-module>
<template v-show="!screenLoading"> <template v-show="!screenLoading">
<z-nav-bar <z-nav-bar bgColor="#333" fontColor="#fff" title="教学内容"></z-nav-bar>
bgColor="#333"
fontColor="#fff"
title="教学内容"
></z-nav-bar>
<view <view
class="contentBox curriculum_box" class="contentBox curriculum_box"
@@ -49,11 +45,13 @@
>视频教学</view >视频教学</view
> >
<view class="scroll-view-item"> <view class="scroll-view-item">
<view style="padding: 20rpx; font-size: 26rpx;"> <view style="padding: 20rpx; font-size: 26rpx">
课程{{options.navTitle}} 课程{{ options.navTitle }}
</view> </view>
<view style="padding: 20rpx; margin-bottom: 40rpx; font-size: 26rpx;"> <view
章节{{ curriculumData.title }} style="padding: 20rpx; margin-bottom: 40rpx; font-size: 26rpx"
>
章节{{ curriculumData.title }}
</view> </view>
<common-curriculum-video <common-curriculum-video
v-if="videoArray && videoArray.length > 0" v-if="videoArray && videoArray.length > 0"
@@ -421,9 +419,21 @@ export default {
}, },
changeVideo(data) { changeVideo(data) {
console.log("data at line 370:", data); console.log("data at line 370:", data);
this.currentVideo = data; if (data.id != this.currentVideo.id) {
this.initVideo(); // handleEnd
this.isOpenMp3 = false; this.$refs.commonVideo.setVideoTime();
setTimeout(() => {
this.currentVideo = data;
this.initVideo();
this.isOpenMp3 = false;
}, 500);
} else {
this.currentVideo = data;
this.initVideo();
this.isOpenMp3 = false;
}
console.log("data at line 380111111111111111111:", data.type); console.log("data at line 380111111111111111111:", data.type);
// var mynavData = JSON.stringify(data); // 这里转换成 字符串 // var mynavData = JSON.stringify(data); // 这里转换成 字符串
@@ -517,6 +527,19 @@ export default {
.then(async (res) => { .then(async (res) => {
that.curriculumData = res.data.detail; that.curriculumData = res.data.detail;
that.videoArray = res.data.videos; that.videoArray = res.data.videos;
console.log(
"that.videoArray at line 这是关联的视频519:",
res.data.current
);
var isHaveHistorySeekVideo = that.videoArray.findIndex(
(e) => e.id == res.data.current
);
console.log(
"isHaveHistorySeekVideo at line 522:",
isHaveHistorySeekVideo
);
that.currentCateIndex =
isHaveHistorySeekVideo != -1 ? isHaveHistorySeekVideo : 0;
if (that.videoArray.length > 0) { if (that.videoArray.length > 0) {
this.currentVideo = that.videoArray[that.currentCateIndex]; this.currentVideo = that.videoArray[that.currentCateIndex];
this.initVideo(); this.initVideo();

View File

@@ -679,7 +679,10 @@ export default {
args: [ args: [
'http://101.201.146.165:8088/Pf-EH/statics/uploadFile/2024-05-10/b0f420c7-9178-41ad-9dd6-f59a64a6e190.png'] 'http://101.201.146.165:8088/Pf-EH/statics/uploadFile/2024-05-10/b0f420c7-9178-41ad-9dd6-f59a64a6e190.png']
}, },
{
name: 'RateComponent',
type: AliPlayerComponent.RateComponent
},
// { // {