测试版

This commit is contained in:
liuyuan
2025-03-05 15:16:45 +08:00
parent 8dbdce6d3f
commit 9accfddbe5
3849 changed files with 365801 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<template>
<view style="background-color: #000;"></view>
</template>
<script>
export default {
data() {
return {
}
},
onLoad(options) {
plus.screen.lockOrientation("portrait-primary");
uni.navigateBack({
delta:1
})
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,799 @@
<template>
<view class="commonPageBox commonDetailPage" style="background-color: #fff">
<template v-show="!screenLoading">
<z-nav-bar title="教学内容"></z-nav-bar>
<view
class="contentBox curriculum_box"
:style="`height:calc(100% - ${60 + statusBarHeight}px !important;${
isFullScreen ? 'background:#000' : ''
}`"
>
<view
:style="`background:#000;height:200px;`"
v-if="videoArray.length > 0"
>
<common-video
:isfresh="isfresh"
v-if="isfresh"
:secondCountDown="secondCountDown"
@handleFresh="handleFresh"
@changeScreen="changeScreen"
@changeScreenLoading="changeScreenLoading"
ref="commonVideo"
:currentVideoId="currentVideoId"
:currentVideoIndex="currentVideoIndex"
:curriculumData="{...curriculumData,curriculumImgUrl:options.curriculumImgUrl}"
>
</common-video>
<view style="color: #fff"></view>
</view>
<scroll-view
scroll-y="true"
class="scroll-Y"
>
<view class="" style="padding: 20rpx; font-size: 34rpx; color: #333"
>课程{{ options.navTitle }}
</view>
<view style="padding: 20rpx; margin-bottom: 40rpx">
章节 {{ curriculumData.title }}
</view>
<view
v-if="videoArray.length > 0"
class="PM_font"
style="padding: 20rpx; font-size: 40rpx; color: #294a97"
>视频教学</view
>
<view class="scroll-view-item">
<common-curriculum-video
v-if="videoArray.length > 0"
:detailInfo="curriculumData"
:currentVideo="currentVideo"
:dataList="videoArray"
@open="changeVideo"
>
</common-curriculum-video>
</view>
<view
class="PM_font"
style="padding: 20rpx; font-size: 40rpx; color: #333"
>文章简介</view
>
<view class="scroll-view-item" style="padding-bottom: 80rpx;">
<common-rich-detail :detailInfo="{ ...curriculumData, title: '' }">
<image
v-if="curriculumData.imgUrl"
@click="previewImage(curriculumData.imgUrl)"
:src="curriculumData.imgUrl"
mode="widthFix"
class="headImage"
></image>
</common-rich-detail>
</view>
</scroll-view>
<p class="aui-text-danger">
本课程版权归天津众妙之门科技有限公司所有翻版必究!
</p>
</view>
</template>
<view
style="
background-color: red;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
"
v-show="screenLoading"
>
</view>
</view>
</template>
<script>
import courseDescription from "@/pages/component/commonComponents/list";
import curriculumMp3 from "./mp3Detail.vue";
import $http from "@/config/requestConfig.js";
import { mapState } from "vuex";
export default {
components: {
courseDescription, //课程说明
curriculumMp3, //mp3
},
data() {
return {
secondCountDown: 10,
isFullScreen: false,
screenLoading: false,
isfresh: false,
currentCateIndex: 0,
currentVideo: {},
videoList: {},
isOpenMp3: false,
praise: "",
reward: "",
commentLst: [],
correlationiList: [
],
options: {},
videoArrayHW: [],
videoArray: [],
relatedCoursesList: [], //相关课程
medicalCasesList: [], //相关医案
curriculumData: {},
curriculumInfo: {},
fdButtonStyle: {
width: "120rpx",
"border-color": "#000",
color: "#000",
float: "right",
"margin-right": "20rpx",
"margin-left": "30rpx",
},
modalInfo: {},
show: false,
playData: {},
taiHuClassInfo: {},
searchValue: "",
ordersTabs: [
{
name: "视频教学",
type: "1",
},
{
name: "文章简介",
type: "2",
},
], // 一级分类标题1
cateList: [], // 一级分类标题1
twoCateList: [], // 二级分类标题
dataList: [], // 方剂标题
allDataList: [], // 方剂标题
currentStatusIndex: 0, // 当前选中的一级分类
curTwoCateIndex: 0, // 当前选中的二级分类
searchList: [], // 搜索结果数组
showSearchList: false,
userMes: {}, // 用户信息
searchDisable: false, // 搜索不可用
limitShow: false,
limitTitle: "提示",
limitContent: "",
scrollViewHeight: 0,
urlList: {
detail: "sociology/course/getCourseCatalogueChapterDetail",
checkVideo: "sociology/course/checkVideo",
curriculumInfo: "app/phone.do?getCourseInfo",
},
currentVideoId: null,
currentVideoIndex: null,
currentSelectVideoId: null,
currentSelectVideo: {},
};
},
onLoad(options) {
this.options = options;
this.getCourseDescriptionData();
this.screenLoading = false;
this.currentCateIndex = 0;
},
onHide() {},
onShow() {},
computed: {
...mapState(["userInfo"]),
},
watch: {
currentVideoId() {
this.currentVideoIndex = this.videoArray.findIndex(
(e) => e.id == this.currentVideoId
)
},
},
methods: {
changeScreenLoading(status) {
this.screenLoading = status;
},
changeScreen(status) {
this.isFullScreen = status;
},
ordersTabCLi(data) {
console.log("i at line 312:", data);
this.currentCateIndex = data.index;
this.$forceUpdate();
},
handleFresh(status) {
this.isfresh = status;
this.$forceUpdate();
},
changeVideo(data) {
if (data.id != this.currentVideo.id) {
this.isfresh = false;
this.$nextTick(() => {
this.currentVideo = data;
this.currentVideoId = data.id;
this.isfresh = true;
});
}
},
hancleModalCancel() {
this.show = false;
},
handleClickMore(v, i, status) {
this.$set(this.correlationiList[i], "isOpen", status);
},
hancleModalConfirm() {
var data = {
values: {
customerType: "D",
token: uni.getStorageSync("token"),
customerOid: uni.getStorageSync("customerOid"),
...this.taiHuClassInfo,
},
};
},
//课程详情
gotoDetail(v) {
uni.navigateTo({
url: `/pages/curriculum/order/detail?navTitle=${v.title}&title=${v.title}&oid=${v.oid}`,
});
},
//相关课程
goCourseDescription(v) {
uni.navigateTo({
url: `/pages/curriculum/order/index?navTitle=${v.title}&title=${v.title}&id=${v.id}`,
});
},
async getCourseDescriptionData() {
this.isfresh = false;
var data = {
id: this.options.id,
load: false,
};
var that = this;
$http.request({
url: that.urlList.detail,
method: "POST",
data,
header: {
"Content-Type": "application/json",
},
})
.then(async (res) => {
that.curriculumData = res.data.detail;
that.videoArray = res.data.videos;
if (that.videoArray.length > 0) {
that.currentVideo = that.videoArray[0];
that.currentVideoId = that.videoArray[0].id;
that.isfresh = true;
}
});
},
getPriceData() {
var that = this;
setTimeout(() => {
that.$nextTick(() => {
that.$refs.priceDetail.getData();
});
}, 100);
},
// 检查是有权限使用搜索功能
checkDisable() {},
// 获取用户详情
getUserInfo() {
// 用户详情
if (this.userInfo.id != undefined) {
this.$http.post("book/user/info/" + this.userInfo.id).then((res) => {
this.userMes = res.user;
this.getCateList();
});
}
},
async handleselectCate(item, index) {
this.dataList = [];
var data = [];
var that = this;
this.$http
.post(this.urlList.curriculumInfo, {
customerType: "D",
token: uni.getStorageSync("token"),
customerOid: uni.getStorageSync("customerOid"),
oid: item.coid,
})
.then(async (res) => {
that.curriculumInfo = res.obj;
that.dataList = res.obj.courseList;
});
this.searchValue = "";
this.searchList = [];
this.showSearchList = false;
return data;
},
async setOneCateIndex(item, index) {
this.allDataList = [];
var that = this;
this.currentStatusIndex = index;
this.searchValue = "";
this.searchList = [];
this.showSearchList = false;
this.$nextTick(async () => {
await that.getCourseDescriptionData();
this.$forceUpdate();
});
},
transformData(inputData) {
const result = {};
inputData.forEach((item) => {
const { letter } = item;
if (!result[letter]) {
result[letter] = [];
}
result[letter].push(item);
});
return result;
},
getCateList(id) {
id ? "" : (id = 0);
this.twoCateList = [];
this.curTwoCateIndex = 0;
},
// 放大图片
previewImage(url) {
uni.previewImage({
urls: [url],
longPressActions: {
itemList: ["很抱歉,暂不支持保存图片到本地"],
success: function (res) {
},
},
});
},
},
onBackPress() {
// #ifdef APP-PLUS
plus.key.hideSoftKeybord();
// #endif
},
};
</script>
<style lang="scss" scoped>
@import "@/static/mixin.scss";
.searchList {
.item {
font-size: 28rpx;
padding: 20rpx;
border-bottom: 1px solid #dadbde;
}
}
.scroll-view_H {
background-color: #fff;
white-space: nowrap;
padding: 10rpx;
}
.contentBox {
height: 100vh;
.statusList {
padding: 10rpx;
box-sizing: border-box;
justify-content: space-between;
text {
text-align: center;
display: inline-block;
width: 32%;
padding: 20rpx 0;
font-size: 34rpx;
border-radius: 10rpx;
}
.cur {
background-color: $themeColor;
color: #fff;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
}
.twoCateList {
font-size: 28rpx;
margin-top: 20rpx;
.grid-text {
padding: 10rpx 0rpx;
text-align: center;
}
.cur {
color: $themeColor;
}
// .u-grid-list{border: 0.5px solid #dadbde;}
}
.dataList {
font-size: 26rpx;
// margin-top: 20rpx;
// padding: 32rpx 0rpx;
border-radius: 10rpx;
background-color: #f8f9fa;
box-sizing: border-box;
.JFtitleItem {
background-color: #ffffff;
padding: 20rpx 10rpx;
width: 100%;
border-bottom: 0.5px solid #f8f9fa;
}
.wmzhimg {
width: 220rpx;
height: 220rpx;
}
}
}
.search_box {
margin: 0 auto;
overflow: hidden;
align-items: center;
width: calc(100% - 10px);
margin-top: 20rpx;
margin-bottom: 20rpx;
.search {
height: 56upx;
display: flex;
width: 86%;
margin: 0 auto;
align-items: center;
padding: 0upx 40upx;
background-color: #fff;
border-radius: 20upx;
box-shadow: 0 0px 10px 1px $themeColor;
}
.prompt {
color: #838383;
font-size: 24rpx;
}
.icon_search {
background-image: url("@/static/icon/map_ic_search.png");
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
width: 36upx;
height: 36upx;
margin-right: 20upx;
}
}
.flexbox {
display: flex;
}
.uni-modal .uni-modal__bd {
text-align: left;
}
.limiTy {
font-size: 28rpx;
line-height: 46rpx;
}
.chImage {
height: 100rpx;
}
.dataList {
height: 100%;
}
.titleList2 {
height: calc(100% - 150rpx);
}
.priceDetail {
height: calc(100% - 180rpx) !important;
padding: 0rpx 0;
box-sizing: border-box;
}
.componentPage {
height: calc(100% - 90rpx) !important;
}
.dateReminder {
width: 100%;
font-size: 24rpx;
text-align: right;
line-height: 40rpx;
}
.fdButtonBox {
border: 1rpx solid $themeColor;
background-color: $themeColor;
color: #fff;
// width: 100%;
float: right;
padding: 4rpx 14rpx;
font-size: 24rpx;
font-weight: 500;
line-height: 30rpx;
border-radius: 10rpx;
box-sizing: border-box;
// margin-top: 20rpx;
// display: flex;
// align-items: center;
}
.headImage {
// height: 400rpx !important;
}
.commonDetailPage {
}
.curriulum_box {
margin-top: 20rpx;
width: 100%;
.curriulum_title_box {
display: flex;
align-items: center;
margin-bottom: 20rpx;
background-color: #fff;
.curriulum_title {
width: calc(100% - 80rpx);
font-size: 32rpx;
line-height: 40rpx;
padding: 20rpx;
box-sizing: border-box;
}
}
}
/deep/.titleItem {
// width: calc(100% - 120rpx) !important;
}
/deep/.scroll-view-item:nth-child(2n-1) {
background-color: transparent !important;
}
.dataList {
height: auto !important;
}
.small_class_teaching_box {
width: 100%;
margin-top: 20rpx;
background: #b7e0e2;
.small_class_teaching_top {
padding: 20rpx 20rpx 0 10rpx;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
// background: #EDFCF7;
color: #8f8e8e;
// box-shadow: 0px 0px 6rpx 0px #E9DCCC;
.icon1 {
width: 50rpx;
height: 50rpx;
}
.small_class_teaching_top_left {
display: flex;
align-items: center;
color: #018f89;
font-family: MicrosoftYaHei;
}
}
.small_class_teaching_content {
margin-top: 20rpx;
// background: #EDFCF7;
padding-bottom: 10rpx;
.top {
padding: 20rpx 20rpx;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 4rpx solid #fff;
.top_item {
width: 23%;
font-family: PangMenZhengDaoBiaoTiTiMianFeiBan;
font-weight: normal;
font-size: 34rpx;
color: #018f89;
line-height: 80rpx;
background: #cef8ea;
text-align: center;
border-radius: 10rpx;
box-shadow: 0px 0px 6rpx 0px #e9dccc;
}
}
.schedule {
width: 100%;
overflow: hidden;
padding: 20rpx 20rpx;
box-sizing: border-box;
align-items: center;
color: #018f89;
font-family: MicrosoftYaHei;
.icon_box {
width: 100%;
display: flex;
align-items: center;
margin-bottom: 0rpx;
.icon1 {
width: 50rpx;
height: 50rpx;
margin-right: 10rpx;
}
}
.progress_box {
width: 100%;
display: flex;
align-items: center;
position: relative;
.progress_icon {
width: calc(100% - 240rpx);
}
.icon1 {
width: 60rpx;
height: 60rpx;
margin: 0 20rpx;
}
.icon2 {
width: 140rpx;
height: 100rpx;
position: absolute;
right: 0;
// margin-top: -20rpx;
}
}
}
}
}
.related_courses_box {
background-color: #fff;
.small_class_teaching_content {
padding: 10rpx 20rpx;
box-sizing: border-box;
}
}
.related_courses_name {
display: inline-block;
width: calc(100% - 150rpx) !important;
.aui-text-danger {
display: inline-block;
float: right;
}
}
.curriculum_box {
.curriculum_title {
padding: 20rpx 40rpx 0;
font-size: 38rpx;
line-height: 66rpx;
font-weight: bold;
text-align: center;
box-sizing: border-box;
margin-bottom: 20rpx;
}
}
.aui-text-danger{
width:100%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
position: fixed;
bottom: 0rpx;
background: #fff;
}
.curriculum_content {
background-color: #fff;
padding-bottom: 40rpx;
.richDetail {
height: auto !important;
margin-bottom: 20rpx;
}
}
.dianzan_box {
width: calc(100% - 80rpx);
margin: 0 auto;
padding: 20rpx 20rpx;
color: #6e6e6e;
font-weight: 600;
text-align: justify;
background: #f4fffb;
border-radius: 10rpx;
box-shadow: 0px 0px 6rpx 0px #e9dccc;
}
.dashang_box {
color: #ff5521;
background: #fff7f4;
box-shadow: 0px 0px 6rpx 0px rgba(255, 85, 33, 0.4);
}
.correlation_box {
background-color: #fff;
padding-bottom: 40rpx;
.title {
font-family: PangMenZhengDaoBiaoTiTiMianFeiBan;
font-weight: normal;
font-size: 40rpx;
color: #018f89;
}
.more {
font-size: 24rpx;
}
.close {
text-align: center;
color: #b0b0b0;
line-height: 40rpx;
margin-top: 10rpx;
// padding-bottom: 30rpx;
display: flex;
align-items: center;
justify-content: center;
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,367 @@
<template>
<view
class="container commonPageBox commonDetailPage"
style="position: relative; height: auto"
>
<video
@timeupdate="videoTimeUpdateEvent($event)"
ref="videos"
style="width: 100%; height: 60rpx"
autoplay
id="videoId"
controls
:show-progress="true"
:show-fullscreen-btn="false"
object-fit="contain"
class="video-box"
:src="videoUrl"
:poster="`${videoUrl}?x-oss-process=video/snapshot,t_${1},f_jpg`"
@play="playVideo"
></video>
<!-- 倍速 -->
<view class="play-rate" @click="videoPlayRate" v-if="showRate">{{ playbackRate }}x</view>
<!-- 倍速菜单 -->
<ul class="play-rate-menu" :style="{ height: height }" v-if="showRateMenu">
<li
v-for="item in playbackRates"
:key="item"
:class="[{ activeRate: playbackRate === item }, 'play-rate-item']"
@click="changePlayRate(item)"
>
{{ item }}x
</li>
</ul>
</view>
</template>
<script>
import courseDescription from "@/pages/component/commonComponents/list";
import $http from "@/config/requestConfig.js";
import { mapState } from "vuex";
export default {
components: {
courseDescription, //课程说明
},
data() {
return {
playbackRate: 1, // 初始播放速率
showRateMenu: false, //显示播放速率
speedState: 1,
timer: null,
videoUrl: "",
currentTime: 0,
firstTime: 0,
options: {},
videoData: {},
isSetFirstTime: false,
currentVideoTime: "", //初始播放时长(秒)
urlList: {
detail: "sociology/course/getCourseCatalogueChapterDetail",
curriculumInfo: "app/phone.do?getCourseInfo",
},
};
},
async onUnload() {
this.timer = null;
// #ifdef APP-PLUS
uni.navigateTo({
url: "/pages/curriculum/order/back",
});
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
// #endif
await this.setVideoTime();
},
onLoad(options) {
},
onHide() {
},
computed: {
...mapState(["userInfo"]),
},
methods: {
// 显示倍速
videoPlayRate() {
this.showRateMenu = true
},
// 点击倍速
changePlayRate(rate) {
this.playbackRate = rate
this.videoPlayer.playbackRate(rate)
this.showRateMenu = false
this.hideControls()
},
// 创建倍速按钮
createPlayRateDOM() {
const playRateDom = document.createElement('div')
playRateDom.className = 'full-play-rate'
playRateDom.innerText = `${this.playbackRate}x`
playRateDom.onclick = () => {
const playRateMenuDom = document.querySelector('.full-play-rate-menu')
playRateMenuDom.style.display = 'block'
}
return playRateDom
},
// 创建倍速菜单
createPlayRateMenuDom() {
const playRateMenuDom = document.createElement('ul')
playRateMenuDom.className = `play-rate-menu full-play-rate-menu`
playRateMenuDom.style.height = this.windowWidth + 'px'
playRateMenuDom.style.display = 'none'
let liStr = ''
this.playbackRates.forEach((item) => {
liStr += `
<li class="${this.playbackRate === item ? 'activeRate' : ''} play-rate-item full-play-rate-item">
${item}x
</li>
`
})
playRateMenuDom.innerHTML = liStr
return playRateMenuDom
},
handleSetSpeedRate(rate) {
console.log("rate at line 125:", rate);
let videoContext = uni.createVideoContext("videoId");
videoContext.playbackRate(rate);
speedRate.value = rate;
},
init(options) {
this.options = JSON.parse(options.data);
this.getLive();
this.timer = setInterval(() => {
var that = this;
if (this.currentTime) {
that.setVideoTime();
}
}, 60000 * 10);
},
// 播放进度改变
videoTimeUpdateEvent(e) {
console.log("e at line 78:", e);
this.playTime = parseInt(e.detail.currentTime);
this.allTime = parseInt(e.detail.duration);
this.recordTime({
time: this.playTime,
});
},
recordTime(data) {
this.currentTime = data.time;
console.log("data at line 54:", data);
var list = [];
if (uni.getStorageSync("videoList")) {
list = JSON.parse(uni.getStorageSync("videoList"));
}
console.log("点击后设置播放时长的方法list at line 65:", list);
var index = list.findIndex((e) => e.id == this.videoData.id);
if (list.length > 0 && index >= 0) {
list[index] = {
...this.videoData,
time: data.time,
};
} else {
list.push({
...this.videoData,
time: data.time,
});
}
uni.setStorageSync("videoList", JSON.stringify(list));
},
//是否全屏
fullscreenchange(e) {
if (!e.target.fullScreen) {
uni.navigateBack({
delta: 1,
});
}
},
getData(data) {
if (!this.isSetFirstTime) {
var netWork = this.videoData.userCourseVideoPositionEntity
? this.videoData.userCourseVideoPositionEntity.position
: 0;
var list = [];
if (uni.getStorageSync("videoList")) {
list = JSON.parse(uni.getStorageSync("videoList"));
}
var index = list.findIndex((e) => e.id == this.videoData.id);
if (netWork) {
if (index >= 0) {
this.firstTime =
list[index].time > netWork ? list[index].time : netWork;
} else {
this.firstTime = netWork ? netWork : 0;
}
} else {
if (index >= 0) {
this.firstTime = list[index].time ? list[index].time : 0;
} else {
this.firstTime = 0;
}
}
uni.setStorageSync("videoList", JSON.stringify(list));
this.playVideo();
this.isSetFirstTime = true;
}
},
setVideoTime(time) {
var data = {
videoId: this.videoData.id,
position: this.currentTime, //秒数
};
$http
.request({
url: `sociology/course/saveCoursePosition`,
method: "Post",
data,
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
this.$forceUpdate();
});
},
playVideo(e) {
this.videoContext = uni.createVideoContext("videoId", this);
this.videoContext.seek(this.firstTime);
},
async getLive() {
var data = {
...this.options,
};
console.log("data at line 57:", data);
$http
.request({
url: `sociology/course/checkVideo`,
method: "Post",
data,
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
console.log("res at line 252:", res);
this.videoData = res.video;
this.videoUrl =
res.video.videoUrl;
this.$nextTick(async () => {
await this.getData();
});
this.$forceUpdate();
});
},
openVideo(data) {
var mynavData = JSON.stringify(data); // 这里转换成 字符串
if (data.type == 0) {
//视频云点播
uni.navigateTo({
url: `/pages/curriculum/order/videoDetail?data=${mynavData}`,
});
} else if (data.type == 1) {
uni.navigateTo({
url: `/pages/curriculum/order/videoDetailOss?data=${mynavData}`,
});
}
},
hancleModalCancel() {
this.show = false;
},
handleClickMore(v, i, status) {
this.$set(this.correlationiList[i], "isOpen", status);
},
hancleModalConfirm() {
var data = {
values: {
customerType: "D",
token: uni.getStorageSync("token"),
customerOid: uni.getStorageSync("customerOid"),
...this.taiHuClassInfo,
},
};
},
},
onBackPress() {
// #ifdef APP-PLUS
plus.key.hideSoftKeybord();
// #endif
},
};
</script>
<style lang="scss" scoped>
.video-box {
position: relative;
}
.image_box {
background-color: red;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.speed {
position: absolute;
right: 20rpx;
top: 16rpx;
.doubleSpeed {
color: #fff;
font-size: 14rpx;
background-color: rgba(0, 0, 0, 0.6);
padding: 4rpx 6rpx;
}
}
// 倍速的蒙版
.speedModal {
background-color: rgba(0, 0, 0, 0.7);
}
.speedNumBox {
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
background-color: #2c2c2c;
width: 120rpx;
position: absolute;
right: 0rpx;
top: 0;
.number {
width: 120rpx;
font-weight: 700;
font-size: 14rpx;
padding: 18rpx 0;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
.active {
color: red;
}
.noActive {
color: #fff;
}
}
</style>

View File

@@ -0,0 +1,94 @@
<template>
<div>
<div class="fb tc f20 linheight40">1111</div>
<!-- 视频形式的任务 -->
<div class="taskinfo">
<div id="player-con" style="height: 800px;"></div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
videoTitle: "",
authId:
"eyJTZWN1cml0eVRva2VuIjoiQ0FJUzFBTjFxNkZ0NUIyeWZTaklyNWVFRWNudzNPZEF3N0dUY1ZiVGluTWhiZGx1bzdicXB6ejJJSHBLZVhkdUFlQVhzL28wbW1oWjcvWVlsck1xRmNjWkdoQ2NOSkF2dnNVT29GditKcExGc3QySjZyOEpqc1VDbytjdWswZXBzdlhKYXNEVkVmbDJFNVhFTWlJUi8wMGU2TC8rY2lyWXBUWEhWYlNDbFo5Z2FQa09Rd0M4ZGtBb0xkeEtKd3hrMnQxNFVtWFdPYVNDUHdMU2htUEJMVXhtdldnR2wyUnp1NHV5M3ZPZDVoZlpwMXI4eE80YXhlTDBQb1AyVjgxbExacGxlc3FwM0k0U2M3YmFnaFpVNGdscjhxbHg3c3BCNVN5Vmt0eVdHVWhKL3phTElvaXQ3TnBqZmlCMGVvUUFQb3BGcC9YNmp2QWF3UExVbTliWXhncGhCOFIrWGo3RFpZYXV4N0d6ZW9XVE84MCthS3p3TmxuVXo5bUxMZU9WaVE0L1ptOEJQdzQ0RUxoSWFGMElVRXh6RVcrRmV2TC9wZ21RUGwvK0ZKTG9pdjltamNCSHFIeno1c2VQS2xTMVJMR1U3RDBWSUpkVWJUbHpiVUJMZ3pLNUl2NWJMVmNTS3dJK1YreVBNYXgzYlFGRHI1M3ZzVGJiWHpaYjBtcHR1UG56ZHdKNFRXYnJna2VVdFB0a3BtbDlEUHd1MndOQ0o5K24zRzg5S0NnL1BlcnBGUVBjTkFVNXBYc1R6UDdrcHF2YUtLWHRjWXM4MFY0NVVndUtwQUgyS2poclprQ2ZxNk5sQnhQMmxNcTVQbzNPOGMwSWVHTWFnQUZZUjM0ZGY2aWdud3p2TTNaeUdxdWtxcmdmMXM4SHRiYnBvWldJSEhKd2t1OHJlMTg5dnlKMmdSQmRyWmJkd2NFVjhiUEZNYithWTVWTm5MOUZGSk85N0FrQitCZGk0ZktrN0VpNXdMVCs2Q29XUEZZOXZaajZJR3BIdERxY21scW1FS09FVHNlZkxnWXNzbDAzb0lzMFdvRlYzc2RPeDl3MDR2Q3Y3YlZQVFNBQSIsIkF1dGhJbmZvIjoie1wiQ0lcIjpcIkpVb25xR25CR242cU5YRjgyMzE1b25YRlRyUExoL0l3THVrSERNbEhBVEk2a0EyYmgyell1VENRa0VUVWNWZjhcIixcIkNhbGxlclwiOlwiNkxxRjRSdUk3S0Z1aDhVN3lQajBUNWZQMSs5d2FUdWNCT3Urd0ZHUEc5TT1cIixcIkV4cGlyZVRpbWVcIjpcIjIwMjQtMDQtMjNUMTA6NDU6NTJaXCIsXCJNZWRpYUlkXCI6XCI2ZjhlYzhkMDhjZDM3MWVkYmZlNDA3NjRhMGZkMDEwMlwiLFwiUGxheURvbWFpblwiOlwidmlkZW8udGFpaHVtZWQuY29tXCIsXCJTaWduYXR1cmVcIjpcIndnSExCMytZNzEvSXZJQ1lOQmdPUm8xbUhVRT1cIn0iLCJWaWRlb01ldGEiOnsiU3RhdHVzIjoiTm9ybWFsIiwiVmlkZW9JZCI6IjZmOGVjOGQwOGNkMzcxZWRiZmU0MDc2NGEwZmQwMTAyIiwiVGl0bGUiOiLnrKzkuInorrLvvJrkuInmsJTkuYvnuqoiLCJDb3ZlclVSTCI6Imh0dHBzOi8vdmlkZW8udGFpaHVtZWQuY29tLzZmOGVjOGQwOGNkMzcxZWRiZmU0MDc2NGEwZmQwMTAyL3NuYXBzaG90cy9lNTM5ZmJjNzFhNzk0ZGFkYmI3MzUyZjBhMjU5YjNmYy0wMDAwNS5qcGciLCJEdXJhdGlvbiI6Nzk4LjM3Mn0sIkFjY2Vzc0tleUlkIjoiU1RTLk5UMVpzRDE4YXRzeHNwYm5zdGFWQkxzQUUiLCJQbGF5RG9tYWluIjoidmlkZW8udGFpaHVtZWQuY29tIiwiQWNjZXNzS2V5U2VjcmV0IjoiR3NVMUhiaXZiNEpaY3ZLREppNkdQWlRjUlQyWmhqR21ONnBNUFdSQmVGOUciLCJSZWdpb24iOiJjbi1zaGFuZ2hhaSIsIkN1c3RvbWVySWQiOjE2MDQ3NDAxMzc4OTE5MDd9",
videoId: "6f8ec8d08cd371edbfe40764a0fd0102"
};
},
// //页面显示
mounted() {
const link = document.createElement("link");
link.rel = "stylesheet";
link.href =
"https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.1/skins/default/aliplayer-min.css";
document.head.appendChild(link);
const script = document.createElement("script");
// view 层的页面运行在 www 根目录,其相对路径相对于 www 计算
script.src =
"https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.1/aliplayer-min.js";
document.head.appendChild(script);
this.getLive();
},
methods: {
// 获取数据
getLive() {
let player = new Aliplayer(
{
id: "player-con",
vid: this.videoId, // 必选参数,可以通过点播控制台(路径:媒资库>音/视频查询。示例1e067a2831b641db90d570b6480f****。
playauth: this.authId, // 必选参数参数值可通过调用GetVideoPlayAuth接口获取。
encryptType: 1, // 必选参数当播放私有加密流时需要设置本参数值为1。其它情况无需设置。
playConfig: {
EncryptType: "AliyunVoDEncryption"
}, // 当您输出的M3U8流中含有其他非私有加密流时需要指定此参数。
width: "100%"
},
function(player) {
console.log("The player is created");
}
);
}
},
created() {
}
};
</script>
<script>
export default {
//页面显示
mounted() {
// 动态引入较大类库避免影响页面展示
},
methods: {
receiveMsg(newValue, oldValue, ownerVm, vm) {
},
checkValue() {
console.log(this.authId, "1111");
if (!this.authId) {
setTimeout(() => {
this.checkValue();
}, 1000);
} else {
this.getLive();
}
}
// 阿里云播放
}
};
</script>
<style scoped>
#myVideo {
width: 100%;
}
</style>

View File

@@ -0,0 +1,250 @@
<template>
<view class="container commonPageBox commonDetailPage" style="position: relative;">
<video
@fullscreenchange="fullscreenchange"
@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>
</template>
<script>
import courseDescription from "@/pages/component/commonComponents/list";
import $http from "@/config/requestConfig.js";
import { mapState } from "vuex";
export default {
components: {
courseDescription, //课程说明
},
data() {
return {
timer: null,
videoUrl: "",
currentTime: 0,
firstTime: 0,
options: {},
videoData: {},
isSetFirstTime: false,
currentVideoTime: "", //初始播放时长(秒)
urlList: {
detail: "sociology/course/getCourseCatalogueChapterDetail",
curriculumInfo: "app/phone.do?getCourseInfo",
},
};
},
async onUnload() {
this.timer = null;
// #ifdef APP-PLUS
uni.navigateTo({
url: "/pages/curriculum/order/back",
});
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
// #endif
await this.setVideoTime();
},
onLoad(options) {
// #ifdef APP-PLUS
plus.screen.lockOrientation("landscape-primary");
// #endif
this.options = JSON.parse(options.data);
this.getLive();
this.timer = setInterval(() => {
var that = this;
if (this.currentTime) {
that.setVideoTime();
}
}, 60000 * 10);
},
computed: {
...mapState(["userInfo"]),
},
methods: {
// 播放进度改变
videoTimeUpdateEvent(e) {
console.log("e at line 78:", e);
this.playTime = parseInt(e.detail.currentTime);
this.allTime = parseInt(e.detail.duration);
this.recordTime({
time: this.playTime,
});
},
recordTime(data) {
this.currentTime = data.time;
console.log("data at line 54:", data);
var list = [];
if (uni.getStorageSync("videoList")) {
list = JSON.parse(uni.getStorageSync("videoList"));
}
var index = list.findIndex((e) => e.id == this.videoData.id);
if (list.length > 0 && index >= 0) {
list[index] = {
...this.videoData,
time: data.time,
};
} else {
list.push({
...this.videoData,
time: data.time,
});
}
uni.setStorageSync("videoList", JSON.stringify(list));
},
//是否全屏
fullscreenchange(e) {
if (!e.target.fullScreen) {
uni.navigateBack({
delta: 1,
});
}
},
getData(data) {
if (!this.isSetFirstTime) {
var netWork = this.videoData.userCourseVideoPositionEntity
? this.videoData.userCourseVideoPositionEntity.position
: 0;
var list = [];
if (uni.getStorageSync("videoList")) {
list = JSON.parse(uni.getStorageSync("videoList"));
}
var index = list.findIndex((e) => e.id == this.videoData.id);
if (netWork) {
if (index >= 0) {
this.firstTime =
list[index].time > netWork ? list[index].time : netWork;
} else {
this.firstTime = netWork ? netWork : 0;
}
} else {
if (index >= 0) {
this.firstTime = list[index].time ? list[index].time : 0;
} else {
this.firstTime = 0;
}
}
uni.setStorageSync("videoList", JSON.stringify(list));
this.playVideo();
this.isSetFirstTime = true;
}
},
setVideoTime(time) {
var data = {
videoId: this.videoData.id,
position: this.currentTime, //秒数
};
$http
.request({
url: `sociology/course/saveCoursePosition`,
method: "Post",
data,
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
this.$forceUpdate();
});
},
playVideo(e) {
this.videoContext = uni.createVideoContext("videoId", this);
this.videoContext.seek(this.firstTime);
this.videoContext.requestFullScreen();
},
async getLive() {
var data = {
...this.options,
};
$http
.request({
url: `sociology/course/checkVideo`,
method: "Post",
data,
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
console.log("res at line 252:", res);
this.videoData = res.video;
this.videoUrl =
res.video.videoUrl;
this.$nextTick(async () => {
await this.getData();
});
this.$forceUpdate();
});
},
openVideo(data) {
var mynavData = JSON.stringify(data); // 这里转换成 字符串
if (data.type == 0) {
//视频云点播
uni.navigateTo({
url: `/pages/curriculum/order/videoDetail?data=${mynavData}`,
});
} else if (data.type == 1) {
uni.navigateTo({
url: `/pages/curriculum/order/videoDetailOss?data=${mynavData}`,
});
}
},
hancleModalCancel() {
this.show = false;
},
handleClickMore(v, i, status) {
console.log("i at line 357:", i);
this.$set(this.correlationiList[i], "isOpen", status);
},
hancleModalConfirm() {
var data = {
values: {
customerType: "D",
token: uni.getStorageSync("token"),
customerOid: uni.getStorageSync("customerOid"),
...this.taiHuClassInfo,
},
};
}
},
onBackPress() {
// #ifdef APP-PLUS
plus.key.hideSoftKeybord();
// #endif
},
};
</script>
<style lang="scss" scoped>
.video-box{
position: relative;
}
.image_box{
background-color: red;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
</style>

View File

@@ -0,0 +1,339 @@
<template>
<view class="container" style="background-color: #000; position: relative">
<u-icon
@click="goBack"
name="arrow-left"
color="#3ab3ae"
size="40"
:style="`display: inline-block; position: absolute; top: ${
statusBarHeight + 6
}px; left: ${10}px;z-index: 999;`"
></u-icon>
<div
style="background-color: #000"
ref="videoContent"
@tap="renderScript.handleClick"
id="url-player-test"
:videoData="videoData"
:firstTime="firstTime"
:change:videoData="renderScript.receiveMsg"
:change:firstTime="renderScript.receiveFirstTime"
></div>
<div @tap="renderScript.emitData" ref="videoContent1" v-show="false">
直接调用renderjs中的emitData的方法,传递当前播放时长
</div>
<div @tap="renderScript.endEmitData" ref="videoContent2" v-show="false">
监听结束方法记录播放时长
</div>
</view>
</template>
<script>
import $http from "@/config/requestConfig.js";
import { mapState, mapMutations } from "vuex";
export default {
data() {
return {
timer: null,
videoTitle: "",
videoList: [],
firstTime: 0,
options: {},
playAuth: "",
currentTime: "",
videoId: "",
videoData: {},
isSetFirstTime: false,
screenType: null,
};
},
computed: {
...mapState(["videoOssList"]),
},
// //页面显示
mounted() {},
async onUnload() {
uni.navigateTo({
url: "/pages/curriculum/order/curriculum/back",
});
// #ifdef APP-PLUS
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
// #endif
this.timer = null;
await this.setVideoTime();
this.player.dispose();
},
//第一次加载
onLoad(options) {
console.log(options, "这是传参");
// #ifdef APP-PLUS
setTimeout(() => {
plus.screen.unlockOrientation();
plus.screen.lockOrientation("landscape-primary");
}, 10);
// #endif
if (uni.getStorageSync("videoOssList")) {
this.videoList = JSON.parse(uni.getStorageSync("videoOssList"));
}
this.options = JSON.parse(options.data);
this.videoId = this.options.video;
this.timer = setInterval(() => {
var that = this;
if (this.currentTime) {
that.setVideoTime();
}
}, 60000 * 10);
},
methods: {
getData(data) {
if (!this.isSetFirstTime) {
var netWork = this.videoData.userCourseVideoPositionEntity
? this.videoData.userCourseVideoPositionEntity.position
: 0;
var list = JSON.parse(uni.getStorageSync("videoOssList"));
var index = list.findIndex((e) => e.id == this.videoData.id);
if (netWork) {
if (index >= 0) {
this.firstTime =
list[index].time > netWork ? list[index].time : netWork;
} else {
this.firstTime = netWork ? netWork : 0;
}
} else {
if (index >= 0) {
this.firstTime = list[index].time ? list[index].time : 0;
} else {
this.firstTime = 0;
}
}
uni.setStorageSync("videoOssList", JSON.stringify(list));
this.isSetFirstTime = true;
}
},
recordTime(data) {
this.currentTime = data.time;
var list = [];
if (uni.getStorageSync("videoOssList")) {
list = JSON.parse(uni.getStorageSync("videoOssList"));
}
var index = list.findIndex((e) => e.id == this.videoData.id);
if (list.length > 0 && index >= 0) {
list[index] = {
...this.videoData,
time: data.time,
};
} else {
list.push({
...this.videoData,
time: data.time,
});
}
uni.setStorageSync("videoOssList", JSON.stringify(list));
},
// 获取数据
getLive() {
var data = {
...this.options,
};
$http
.request({
url: `sociology/course/checkVideo`,
method: "Post",
data,
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
var playAuth = res.video.playAuth.replace(/=/g, "");
this.videoData = {
...res.video,
videoId: res.video.video,
playAuth: playAuth,
};
this.playAuth = playAuth;
this.$forceUpdate();
});
},
async handleEnd() {
var list = JSON.parse(JSON.stringify(uni.getStorageSync("videoOssList")));
var data = list.find((e) => e.id == this.videoData.id);
this.currentTime = data.time;
await this.setVideoTime();
this.timer = null;
},
setVideoTime(time) {
var data = {
videoId: this.videoData.id,
position: this.currentTime, //秒数
}
$http
.request({
url: `sociology/course/saveCoursePosition`,
method: "Post",
data,
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
this.$forceUpdate();
});
},
changePlayerTime(player) {
player.seek(this.firstTime);
},
goBack() {
uni.navigateBack({
delta: 1,
});
},
},
created() {
this.getLive();
},
};
</script>
<script module="renderScript" lang="renderjs">
export default {
mounted() {
this.loadWebPlayerSDK()
},
data() {
return {
player: null,
curTime: null,
curStatus: null
}
},
watch: {
curTime(val) {
if (this.curTime !== null && this.curStatus !== null) {
this.$refs.videoContent1.click()
}
}
},
methods: {
handleClick(event, ownerInstance) {
ownerInstance.callMethod('getData')
},
emitData(event, ownerInstance) {
var that = this;
ownerInstance.callMethod('recordTime', {
time: that.curTime,
status: that.curStatus
})
},
endEmitData(event, ownerInstance) {
ownerInstance.callMethod('handleEnd', )
},
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: '100%', //容器的大小
}, function(player) {});
this.player = player;
//全屏播放
player.one('canplay', function() {
player.tag.play();
});
this.$refs.videoContent.click()
var timer = setInterval(() => {
var that = this;
that.curTime = parseInt(this.player.getCurrentTime());
that.curStatus = this.player.getStatus()
}, 1000);
this.player.on('ended', function() {
this.$refs.videoContent2.click()
})
},
receiveFirstTime(newValue, oldValue, ownerVm, vm) {
if (this.player) {
this.player.seek(newValue);
}
},
checkValue() {
if (!this.videoData.playAuth) {
setTimeout(() => {
this.checkValue();
}, 1000);
} 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 = './static/aliplayercomponents-1.0.9.min.js';
s_tag.charset = 'utf-8';
s_tag.onload = () => {
resolve();
}
document.body.appendChild(s_tag);
});
}
}
}
</script>
<style>
.container {
width: 100vw;
height: 100vh;
}
</style>