Commit 80cdc868 authored by 林文清's avatar 林文清

学习视频详情,少了个view标签

parent b062d88b
<template> <template>
<view class="learn-vedio" v-if="isShowVideo"> <view class="">
<view class="uni-padding-wrap uni-common-mt"> <view class="learn-vedio" v-if="isShowVideo">
<view><video object-fit="cover" class="course-video" id="courseVideo" :src="courseSrc" <view class="uni-padding-wrap uni-common-mt">
:options="playerOptions" :playsinline="true" @play="playCourse" @error="videoErrorCallback" <view><video object-fit="cover" class="course-video" id="courseVideo" :src="courseSrc"
@ready="playerReadied" @timeupdate="onPlayerTimeupdate($event)" controls></video></view> :options="playerOptions" :playsinline="true" @play="playCourse" @error="videoErrorCallback"
<view class="title-content"> @ready="playerReadied" @timeupdate="onPlayerTimeupdate($event)" controls></video></view>
<view class="item-content"> <view class="title-content">
<view class="item-st"> <view class="item-content">
<image style="width: 80rpx; height: 36rpx" :src="kcImage"></image> <view class="item-st">
<text class="item-st-text">5课时</text> <image style="width: 80rpx; height: 36rpx" :src="kcImage"></image>
</view> <text class="item-st-text">5课时</text>
<view class="item-title">服务规范</view>
</view>
<view>接单操作须知有助你快速了解充电桩安装业务,提高接单效率,请认真查看及学习。</view>
</view>
<view class="learn-view" v-if="courseId >= 0">
<view class="learn-view-title">课程讲师</view>
<view class="" style="padding-top: 30rpx;display: flex;padding-left: 30rpx;">
<u-avatar :style="{'width':'100rpx', 'height':'100rpx'}" :src="teacher.avatar" mode="circle"></u-avatar>
<view style="height:120rpx;font-size: 30rpx;padding-left:30rpx;">
<view class="" style="display: flex;font-size: 32rpx;">
<view class="" style="font-size: 32rpx;font-weight: bold;">{{ teacher.name }}</view>
<view class="" style="font-size: 24rpx;margin-left: 30rpx;margin-top: 6rpx;">课程讲师</view>
</view> </view>
<view class="" style="font-size: 24rpx;margin-top: 30rpx;">反正这里就是放老师的简介,只是写啥我也不知道,反正就是写很厉害的简介啦</view> <view class="item-title">服务规范</view>
</view> </view>
<view>接单操作须知有助你快速了解充电桩安装业务,提高接单效率,请认真查看及学习。</view>
</view> </view>
<view class="learn-view" v-if="courseId >= 0">
<view class="learn-view-title">目录</view> <view class="learn-view-title">课程讲师</view>
<view class="" style="display: flex;overflow: auto;padding-top: 30rpx;padding-bottom: 30rpx;"> <view class="" style="padding-top: 30rpx;display: flex;padding-left: 30rpx;">
<view v-for="(item, index) in list" :key="index"> <u-avatar :style="{'width':'100rpx', 'height':'100rpx'}" :src="teacher.avatar" mode="circle"></u-avatar>
<view @click="goNext(item.id)" class="list-cell list-default" :class="{'list-default-active': item.isActive}" style="width:280rpx;height:150rpx;margin-left: 20rpx;padding: 20rpx;border-radius: 12rpx;"> <view style="height:120rpx;font-size: 30rpx;padding-left:30rpx;">
<view class="" style="font-size: 24rpx;">{{ item.title }}</view> <view class="" style="display: flex;font-size: 32rpx;">
<view class="" style="font-size: 26rpx;margin-top: 16rpx;"> <view class="" style="font-size: 32rpx;font-weight: bold;">{{ teacher.name }}</view>
{{ item.intro }} <view class="" style="font-size: 24rpx;margin-left: 30rpx;margin-top: 6rpx;">课程讲师</view>
</view> </view>
<view class="" style="font-size: 24rpx;margin-top: 30rpx;">反正这里就是放老师的简介,只是写啥我也不知道,反正就是写很厉害的简介啦</view>
</view> </view>
</view>
<view class="learn-view-title">目录</view>
<view class="" style="display: flex;overflow: auto;padding-top: 30rpx;padding-bottom: 30rpx;">
<view v-for="(item, index) in list" :key="index">
<view @click="goNext(item.id)" class="list-cell list-default" :class="{'list-default-active': item.isActive}" style="width:280rpx;height:150rpx;margin-left: 20rpx;padding: 20rpx;border-radius: 12rpx;">
<view class="" style="font-size: 24rpx;">{{ item.title }}</view>
<view class="" style="font-size: 26rpx;margin-top: 16rpx;">
{{ item.intro }}
</view>
</view>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
</view>
<view v-else> <view v-else>
<view class="title"> <view class="title">
{{CourseSectionlist.name}} {{CourseSectionlist.name}}
</view> </view>
<view class="u-content"> <view class="u-content">
<u-parse :html="CourseSectionlist.content"></u-parse> <u-parse :html="CourseSectionlist.content"></u-parse>
</view> </view>
</view> </view>
</view>
</template> </template>
<script> <script>
let app = getApp(); let app = getApp();
export default { export default {
data() { data() {
return { return {
courseId: "", courseId: "",
courseStatus: 0, courseStatus: 0,
courseSrc: "", courseSrc: "",
courseTitle: "", courseTitle: "",
courseDesc: "", courseDesc: "",
currentIndex: -1, // 第几个视频 currentIndex: -1, // 第几个视频
section_id: 0, section_id: 0,
isShowVideo: false, isShowVideo: false,
CourseSectionlist: {name: '', content: ''}, //节信息 CourseSectionlist: {name: '', content: ''}, //节信息
list: [ list: [
{'title': '第一节', 'intro': '考核规则1:接单及 时率', 'isActive': true}, {'title': '第一节', 'intro': '考核规则1:接单及 时率', 'isActive': true, "id": 288},
{'title': '第二节', 'intro': '考核规则1:接单及 时率', 'isActive': false}, {'title': '第二节', 'intro': '考核规则1:接单及 时率', 'isActive': false, "id": 288},
{'title': '第三节', 'intro': '考核规则1:接单及 时率', 'isActive': false}, {'title': '第三节', 'intro': '考核规则1:接单及 时率', 'isActive': false, "id": 288},
{'title': '第四节', 'intro': '考核规则1:接单及 时率', 'isActive': false}, {'title': '第四节', 'intro': '考核规则1:接单及 时率', 'isActive': false, "id": 288},
{'title': '第五节', 'intro': '考核规则1:接单及 时率', 'isActive':false}, {'title': '第五节', 'intro': '考核规则1:接单及 时率', 'isActive':false, "id": 288},
], ],
teacher: { teacher: {
name: "", name: "",
avatar: "" avatar: ""
}, },
playerOptions: { playerOptions: {
playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度 playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
autoplay: true, //如果true,浏览器准备好时开始回放。 autoplay: true, //如果true,浏览器准备好时开始回放。
muted: false, // 默认情况下将会消除任何音频。 muted: false, // 默认情况下将会消除任何音频。
loop: false, // 导致视频一结束就重新开始。 loop: false, // 导致视频一结束就重新开始。
preload: 'auto', preload: 'auto',
language: 'zh-CN', language: 'zh-CN',
aspectRatio: '16:9', aspectRatio: '16:9',
fluid: true, fluid: true,
notSupportedMessage: '此视频暂无法播放,请稍后再试', notSupportedMessage: '此视频暂无法播放,请稍后再试',
controlBar: { controlBar: {
timeDivider: true, timeDivider: true,
durationDisplay: true, durationDisplay: true,
remainingTimeDisplay: false, remainingTimeDisplay: false,
fullscreenToggle: true //全屏按钮 fullscreenToggle: true //全屏按钮
} }
}, },
gklog: '', params:{
videoTotalTime: 0, course_id:0,
howTimeToUpdateLearnedStatus: 5, //设置几秒提交一次状态 },
status: 1, //是否已学习默认1已学习 gklog: '',
howLongIsLearned: this.videoTotalTime / 2, //默认设置观看1/2就是已学 videoTotalTime: 0,
}; howTimeToUpdateLearnedStatus: 5, //设置几秒提交一次状态
}, status: 1, //是否已学习默认1已学习
computed: { howLongIsLearned: this.videoTotalTime / 2, //默认设置观看1/2就是已学
courseOutlines() { };
// 视频内容介绍 },
return { computed: {
1: [ courseOutlines() {
"1、考核规则:接单及时率", // 视频内容介绍
"2、考核规则:上门及时率", return {
"3、考核规则:安装完工率", 1: [
"4、考核规则:资料提交及时率", "1、考核规则:接单及时率",
"5、考核规则:安装完工率", "2、考核规则:上门及时率",
"6、考核规则:客户满意度", "3、考核规则:安装完工率",
], "4、考核规则:资料提交及时率",
2: ["1、必备材料4大类", "2、施工工具准备"], "5、考核规则:安装完工率",
3: [ "6、考核规则:客户满意度",
"1、接线安装工艺标准", ],
"2、PVC、镀锌管电缆管明敷", 2: ["1、必备材料4大类", "2、施工工具准备"],
"3、电缆敷设的防火要求", 3: [
"4、电源点标识", "1、接线安装工艺标准",
"5、配电箱接线及安装", "2、PVC、镀锌管电缆管明敷",
"6、管线敷设接头处理", "3、电缆敷设的防火要求",
"7、充电桩内部接线", "4、电源点标识",
"8、配电箱安装", "5、配电箱接线及安装",
], "6、管线敷设接头处理",
4: ["1、勘测环节录单要求", "2、安装环节录单要求"], "7、充电桩内部接线",
}; "8、配电箱安装",
}, ],
kcImage() { 4: ["1、勘测环节录单要求", "2、安装环节录单要求"],
return process.uniEnv.qn_base_url + "kc.png"; };
}, },
}, kcImage() {
onLoad(e) { return process.uniEnv.qn_base_url + "kc.png";
this.getCourseSection({ },
section_id: e.section_id },
}) onLoad(e) {
}, this.getCourseSection({
onReady: function(res) { section_id: e.section_id
// #ifndef MP-ALIPAY })
this.videoContext = uni.createVideoContext("courseVideo"); this.getCapterDetails();
// #endif },
}, onReady: function(res) {
methods: { // #ifndef MP-ALIPAY
this.videoContext = uni.createVideoContext("courseVideo");
// #endif
},
methods: {
goNext(id){ goNext(id){
uni.navigateTo({ uni.navigateTo({
url: "./section?section_id=" + id, url: "./section?section_id=" + id,
}); });
}, },
onPlayerTimeupdate(player) { onPlayerTimeupdate(player) {
console.log('-----onplay----'); console.log('-----onplay----');
console.log(player); console.log(player);
let intCurrentTime = parseInt(player.detail.currentTime); let intCurrentTime = parseInt(player.detail.currentTime);
this.updateLearnedStatus(intCurrentTime); this.updateLearnedStatus(intCurrentTime);
this.gklog = intCurrentTime; this.gklog = intCurrentTime;
console.log(' onPlayerTimeupdate!', this.gklog) console.log(' onPlayerTimeupdate!', this.gklog)
}, },
videoErrorCallback: function(e) { videoErrorCallback: function(e) {
uni.showModal({ uni.showModal({
content: e.target.errMsg, content: e.target.errMsg,
showCancel: false, showCancel: false,
}); });
}, },
getRandomColor: function() { getRandomColor: function() {
const rgb = []; const rgb = [];
for (let i = 0; i < 3; ++i) { for (let i = 0; i < 3; ++i) {
let color = Math.floor(Math.random() * 256).toString(16); let color = Math.floor(Math.random() * 256).toString(16);
color = color.length == 1 ? "0" + color : color; color = color.length == 1 ? "0" + color : color;
rgb.push(color); rgb.push(color);
} }
return "#" + rgb.join(""); return "#" + rgb.join("");
}, },
playCourse: function(e) { playCourse: function(e) {
if (this.courseStatus && (this.courseStatus == "1" || this.courseStatus == 1)) { if (this.courseStatus && (this.courseStatus == "1" || this.courseStatus == 1)) {
return return
} }
}, },
playerReadied(player) { playerReadied(player) {
console.log('i go to playerReadied gklog:' + this.gklog) console.log('i go to playerReadied gklog:' + this.gklog)
player.currentTime(this.gklog) player.currentTime(this.gklog)
}, },
getCourseSection(param) { getCourseSection(param) {
this.$u.api this.$u.api
.CourseSection(param) .CourseSection(param)
.then((res) => { .then((res) => {
if (res.code == 200) { if (res.code == 200) {
if (res.data) { if (res.data) {
this.CourseSectionlist = res.data; this.CourseSectionlist = res.data;
console.log("--------") console.log("--------")
console.log(this.CourseSectionlist) console.log(this.CourseSectionlist)
let wareVal = this.CourseSectionlist.ware; let wareVal = this.CourseSectionlist.ware;
this.isShowVideo = wareVal == "0"; this.isShowVideo = wareVal == "0";
this.courseTitle = res.data.name; this.courseTitle = res.data.name;
this.courseDesc = res.data.content; this.courseDesc = res.data.content;
this.section_id = res.data.id; this.section_id = res.data.id;
this.section_content = res.data.content; this.section_content = res.data.content;
this.teacher.name = res.data.teachers[0].name; this.teacher.name = res.data.teachers[0].name;
this.teacher.avatar = res.data.teachers[0].avatar; this.teacher.avatar = res.data.teachers[0].avatar;
if (this.isShowVideo) { this.param.course_id = res.data.course_id;
let coureWareList = res.data.courseware; if (this.isShowVideo) {
this.courseSrc = coureWareList[0].src; let coureWareList = res.data.courseware;
this.videoTotalTime = parseInt(JSON.parse(coureWareList[0].info).time); this.courseSrc = coureWareList[0].src;
console.log('视频时长信息:' + this.videoTotalTime); this.videoTotalTime = parseInt(JSON.parse(coureWareList[0].info).time);
}else{ console.log('视频时长信息:' + this.videoTotalTime);
this.updateLearnedStatusForText(); }else{
} this.updateLearnedStatusForText();
} }
} }
}) }
.catch((err) => { })
console.log('--------settttt---------'); .catch((err) => {
console.log(err); console.log('--------settttt---------');
uni.showToast({ console.log(err);
title: err, uni.showToast({
icon: "none", title: err,
}); icon: "none",
}); });
}, });
updateLearnedStatusForText() { },
if (this.isShowVideo) { updateLearnedStatusForText() {
return false; if (this.isShowVideo) {
} return false;
let param = { }
section_id: this.section_id, let param = {
video_time: 0, section_id: this.section_id,
status: 1, video_time: 0,
}; status: 1,
this.$u.api.updateLearnCourses(param).then((res) => { };
// console.log('--' + this.howTimeToUpdateLearnedStatus + '更新一次观看状态--time:' + nowTime); this.$u.api.updateLearnCourses(param).then((res) => {
}).catch((err) => { // console.log('--' + this.howTimeToUpdateLearnedStatus + '更新一次观看状态--time:' + nowTime);
console.log('--------updateLearnedStatusForText---------'); }).catch((err) => {
console.log(err); console.log('--------updateLearnedStatusForText---------');
uni.showToast({ console.log(err);
title: err, uni.showToast({
icon: "none", title: err,
}); icon: "none",
}); });
}, });
updateLearnedStatus(nowTime) { },
if (this.gklog != nowTime && nowTime % this.howTimeToUpdateLearnedStatus == 0) { updateLearnedStatus(nowTime) {
if (nowTime < this.howLongIsLearned) { if (this.gklog != nowTime && nowTime % this.howTimeToUpdateLearnedStatus == 0) {
this.status = 0; if (nowTime < this.howLongIsLearned) {
} else { this.status = 0;
this.status = 1; } else {
console.log('--大于规定时间标记为已学习--'); this.status = 1;
} console.log('--大于规定时间标记为已学习--');
}
let param = { let param = {
section_id: this.section_id, section_id: this.section_id,
video_time: nowTime, video_time: nowTime,
status: this.status, status: this.status,
}; };
this.$u.api.updateLearnCourses(param).then((res) => { this.$u.api.updateLearnCourses(param).then((res) => {
console.log('--' + this.howTimeToUpdateLearnedStatus + '更新一次观看状态--time:' + nowTime); console.log('--' + this.howTimeToUpdateLearnedStatus + '更新一次观看状态--time:' + nowTime);
}).catch((err) => { }).catch((err) => {
console.log('--------updateLearnedStatus---------'); console.log('--------updateLearnedStatus---------');
console.log(err); console.log(err);
uni.showToast({ uni.showToast({
title: err, title: err,
icon: "none", icon: "none",
}); });
}); });
} }
} },
}, //获取章节详情
}; getCapterDetails() {
console.log('获取章节详情')
this.$u.api
.ChapterDetails(this.params)
.then((res) => {
if (res.code == 200) {
if (res.data) {
debugger
this.list = this.list.concat(res.data);
console.log(this.list)
}
} else {
//接口请求失败的处理
uni.showToast({
title: res.message,
icon: "none"
});
}
})
.catch((err) => {
uni.showToast({
title: err,
icon: "none",
});
this.isLoadMore = false;
if (this.params.start > 0) {
this.page -= 5;
}
});
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.learn-vedio { .learn-vedio {
background-color: #f4f5f7; background-color: #f4f5f7;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow-y: auto; overflow-y: auto;
} }
.course-video { .course-video {
width: 100%; width: 100%;
} }
.course-title { .course-title {
font-size: 36rpx; font-size: 36rpx;
font-weight: 700; font-weight: 700;
padding: 40rpx 40rpx 10rpx 40rpx; padding: 40rpx 40rpx 10rpx 40rpx;
} }
.title { .title {
font-weight: 700; font-weight: 700;
font-family: Medium, Helvetica Neue, Helvetica, Arial, sans-serif; font-family: Medium, Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 77rpx; font-size: 77rpx;
color: #333; color: #333;
padding: 80rpx 60rpx 40rpx 60rpx; padding: 80rpx 60rpx 40rpx 60rpx;
} }
.content { .content {
padding: 40rpx 30rpx; padding: 40rpx 30rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.course-desc { .course-desc {
margin-left: 60rpx; margin-left: 60rpx;
} }
.title-content { .title-content {
padding: 40rpx 30rpx; padding: 40rpx 30rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
background-color: #ffffff; background-color: #ffffff;
color: #999999; color: #999999;
font-size: 24rpx; font-size: 24rpx;
.item-content { .item-content {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.item-st { .item-st {
width: 80rpx; width: 80rpx;
height: 36rpx; height: 36rpx;
padding-right: 2rpx; padding-right: 2rpx;
text-align: center; text-align: center;
margin-right: 20rpx; margin-right: 20rpx;
line-height: 24rpx; line-height: 24rpx;
position: relative; position: relative;
.item-st-text { .item-st-text {
color: #ffffff; color: #ffffff;
position: absolute; position: absolute;
font-size: 16rpx; font-size: 16rpx;
left: 20rpx; left: 20rpx;
top: 8rpx; top: 8rpx;
line-height: 28rpx; line-height: 28rpx;
} }
} }
.item-title { .item-title {
color: #333333; color: #333333;
font-size: 44rpx; font-size: 44rpx;
font-weight: bold; font-weight: bold;
} }
} }
.item-content { .item-content {
display: flex; display: flex;
padding-bottom: 30rpx; padding-bottom: 30rpx;
} }
.item-title { .item-title {
color: #333333; color: #333333;
font-size: 28rpx; font-size: 28rpx;
} }
.learn-view { .learn-view {
background-color: #ffffff; background-color: #ffffff;
border-radius: 12rpx; border-radius: 12rpx;
// padding: 38rpx 30rpx 30rpx 30rpx; // padding: 38rpx 30rpx 30rpx 30rpx;
// margin-bottom: 20rpx; // margin-bottom: 20rpx;
font-size: 32rpx; font-size: 32rpx;
color: #333333; color: #333333;
.learn-view-title { .learn-view-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
margin-bottom: 10rpx; margin-bottom: 10rpx;
padding-top: 30rpx; padding-top: 30rpx;
margin-left: 30rpx; margin-left: 30rpx;
} }
.learn-list { .learn-list {
.learn-list-item { .learn-list-item {
font-size: 28rpx; font-size: 28rpx;
margin-top: 30rpx; margin-top: 30rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
color: #333333; color: #333333;
} }
.line-view { .line-view {
background-color: #f4f5f7; background-color: #f4f5f7;
height: 2rpx; height: 2rpx;
width: 100%; width: 100%;
} }
} }
} }
.u-content { .u-content {
// margin-top: 10rpx; // margin-top: 10rpx;
padding: 40rpx 30rpx; padding: 40rpx 30rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.list-default { .list-default {
background-color: #F4F5F7; background-color: #F4F5F7;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment