Commit 402b5adf authored by 林文清's avatar 林文清

update:学习模块

parent 5633249e
......@@ -94,14 +94,14 @@
"path": "news-details",
"style": {
"navigationBarTitleText": "",
"navigationStyle":"default"
"navigationStyle":"custom"
}
},
{
"path":"section",
"style" :{
"navigationBarTitleText": "",
"navigationStyle":"default"
"navigationStyle":"custom"
}
},
{
......
This diff is collapsed.
<template>
<view>
<view>
<u-navbar
back-icon-color="#000000"
:background="background"
title-color="#000000"
:border-bottom="false">
</u-navbar>
<view class="title">
{{ title }}
</view>
......@@ -25,7 +31,7 @@
that.body = data.body;
})
this.$u.mpShare.path = ''
},
},
}
</script>
......
<template>
<view class="">
<view class="learn-vedio" v-if="isShowVideo">
<u-navbar
back-icon-color="#000000"
:background="background"
title-color="#000000"
:border-bottom="false">
</u-navbar>
<view class="uni-padding-wrap uni-common-mt">
<view><video object-fit="cover" class="course-video" id="courseVideo" :src="courseSrc"
:options="playerOptions" :playsinline="true" @play="playCourse" @error="videoErrorCallback"
......@@ -137,9 +143,9 @@
},
gklog: '',
videoTotalTime: 0,
howTimeToUpdateLearnedStatus: 5, //设置几秒提交一次状态
howTimeToUpdateLearnedStatus: 10, //设置几秒提交一次状态
status: 1, //是否已学习默认1已学习
howLongIsLearned: this.videoTotalTime / 2, //默认设置观看1/2就是已学
isLearned: false, //默认设置观看1/2就是已学
};
},
computed: {
......@@ -185,19 +191,21 @@
this.videoContext = uni.createVideoContext("courseVideo");
// #endif
},
onUnload() {
wx.reLaunch({
url: '/pages/index/learn?tabs=2'
});
},
methods: {
goNext(info) {
uni.navigateTo({
url: "./section?section_id=" + info.id + "&course_id=" + info.course_id
url: "/pages/learn/section?section_id=" + info.id + "&course_id=" + info.course_id
});
},
onPlayerTimeupdate(player) {
console.log('-----onplay----');
console.log(player);
let intCurrentTime = parseInt(player.detail.currentTime);
this.updateLearnedStatus(intCurrentTime);
this.gklog = intCurrentTime;
console.log(' onPlayerTimeupdate!', this.gklog)
},
videoErrorCallback: function(e) {
uni.showModal({
......@@ -220,7 +228,6 @@
}
},
playerReadied(player) {
console.log('i go to playerReadied gklog:' + this.gklog)
player.currentTime(this.gklog)
},
getCourseSection(param) {
......@@ -240,7 +247,7 @@
this.section_content = res.data.content;
this.teacher.name = res.data.teachers[0].name;
this.teacherImage = res.data.teachers[0].avatar;
this.teacherIntro = res.data.teachers[0].intro.replace(/<p.*?>|<\/p>/ig, "");
this.teacherIntro = res.data.teachers[0].intro.replace(/<.*?>|<\/.*?>/ig, "");
this.params.course_id = res.data.course_id;
if (this.isShowVideo) {
let coureWareList = res.data.courseware;
......@@ -254,8 +261,6 @@
}
})
.catch((err) => {
console.log('--------settttt---------');
console.log(err);
uni.showToast({
title: err,
icon: "none",
......@@ -272,10 +277,7 @@
status: 1,
};
this.$u.api.updateLearnCourses(param).then((res) => {
// console.log('--' + this.howTimeToUpdateLearnedStatus + '更新一次观看状态--time:' + nowTime);
}).catch((err) => {
console.log('--------updateLearnedStatusForText---------');
console.log(err);
uni.showToast({
title: err,
icon: "none",
......@@ -284,11 +286,13 @@
},
updateLearnedStatus(nowTime) {
if (this.gklog != nowTime && nowTime % this.howTimeToUpdateLearnedStatus == 0) {
if (nowTime < this.howLongIsLearned) {
let howLongIsLearned = parseInt(this.videoTotalTime / 2);
if (nowTime < howLongIsLearned) {
this.status = 0;
} else if(this.isLearned){
return;
} else {
this.status = 1;
console.log('--大于规定时间标记为已学习--');
}
let param = {
......@@ -297,20 +301,13 @@
status: this.status,
};
this.$u.api.updateLearnCourses(param).then((res) => {
console.log('--' + this.howTimeToUpdateLearnedStatus + '更新一次观看状态--time:' + nowTime);
}).catch((err) => {
console.log('--------updateLearnedStatus---------');
console.log(err);
uni.showToast({
title: err,
icon: "none",
});
});
}
},
//获取章节详情
getCapterDetails() {
console.log('获取章节详情')
this.$u.api
.ChapterDetails(this.params)
.then((res) => {
......@@ -325,8 +322,6 @@
this.list[i].isActive = this.active_section_id == this.list[i].id ? true :
false;
}
console.log('--select-list--')
console.log(this.list)
}
} else {
//接口请求失败的处理
......@@ -493,7 +488,7 @@
}
.color-teacher {
color: #999999;
color: #000000;
}
.catalogue {
......
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