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

update:学习模块

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