Commit ec909279 authored by 林文清's avatar 林文清

在线学习

parent e8dea083
......@@ -7,7 +7,7 @@ let learnApiFun = function(vm){
let getTrainingNoticeList = async (params = {}) => await vm.$u.get(ucenterApiUrl+'/v1/notice/list', params);
/* 获取学习视频基本信息 */
let CourseList = async (params = {}) => await vm.$u.get(collegeApiUrl+'/v1/course-details?course_id=173',params);
let CourseList = async (params = {}) => await vm.$u.get(collegeApiUrl+'/v1/course-details',params);
/* 获取章节详情 */
let ChapterDetails = async (params = {}) => await vm.$u.get(collegeApiUrl+'/v1/chapter-sections',params);
/* 获取课程节信息*/
......
......@@ -12,6 +12,7 @@ const globalUrl = process.uniEnv || {}
const install = (Vue, vm) => {
let systemApiUrl = globalUrl.systemUrl.apiUrl
let ucenterApiUrl = globalUrl.ucenterUrl.apiUrl
let xueApiUrl = globalUrl.ucenterUrl.xueUrl
function toLoginPage(){
const app = getApp()
......@@ -48,7 +49,7 @@ const install = (Vue, vm) => {
config.url += '?access-token=' + token
}
}
if(config.url.indexOf(ucenterApiUrl)>-1){
if(config.url.indexOf(ucenterApiUrl)>-1 || config.url.indexOf(xueApiUrl)>-1){
// php端增加header Authorization
config.header['Authorization'] = token
}
......
......@@ -40,57 +40,57 @@
<view class="top">
<view class="currency-class">
<view class="title">通用课程</view>
<view class="class1" @click=ccc(173)>
<image class="img" :src=courselist.course.preview_pic mode=""></image>
<view class="class1" @click=ccc(courselist[0].id)>
<image class="img" :src=courselist[0].pic mode=""></image>
<view class="right">
<view class="">
{{courselist.course.name}}
{{ courselist[0].title }}
</view>
<view class="intro" v-html="courselist.course.intro">
{{courselist.course.intro}}
<view class="intro">
{{ courselist[0].desc }}
</view>
<view class="" style="display:flex;justify-content: space-between;">
<u-line-progress active-color="#2979ff"
:percent=courselist.learnedInfo.learnPercent style="width:54%;">
:percent=courselist[0].percent style="width:54%;">
</u-line-progress>
<text
v-text="(courselist.learnedInfo.isLearned) ?(courselist.learnedInfo.learnPercent==1)?'已完成':'继续':'未观看' "></text>
<text v-text="courselist[0].status"></text>
</view>
</view>
</view>
<view class="class1">
<image class="img" src="../../static/logo.png" mode=""></image>
<view class="class1" @click=ccc(courselist[1].id)>
<image class="img" :src=courselist[1].pic mode=""></image>
<view class="right">
<view class="">
接单操作
{{ courselist[1].title }}
</view>
<view class="">
快速学习,使用APP接单、抢单
{{ courselist[1].desc }}
</view>
<view class="" style="display:flex;justify-content: space-between;">
<u-line-progress active-color="#2979ff" :percent="30" style="width:54%;">
<u-line-progress active-color="#2979ff"
:percent="courselist[1].percent" style="width:54%;">
</u-line-progress>
<text>继续</text>
<text v-text="courselist[1].status"></text>
</view>
</view>
</view>
</view>
<view class="currency-class">
<view class="title">技能课程</view>
<view class="class1">
<image class="img" src="../../static/logo.png" mode=""></image>
<view class="class1" @click=ccc(courselist[2].id)>
<image class="img" :src=courselist[2].pic mode=""></image>
<view class="right">
<view class="">
从0-1学习充电桩安装服务
{{ courselist[2].title }}
</view>
<view class="">
让你全面了解充电桩市场及服务规范
{{ courselist[2].desc }}
</view>
<view class="" style="display:flex;justify-content: space-between;">
<u-line-progress active-color="#2979ff" :percent="100" style="width:54%;">
<u-line-progress active-color="#2979ff"
:percent="courselist[2].percent" style="width:54%;">
</u-line-progress>
<text>完成</text>
<text v-text="courselist[2].status"></text>
</view>
</view>
</view>
......@@ -187,7 +187,31 @@
start: 0,
},
list: [],
courselist: null,
courselist: [{
title: '服务规范',
desc: '为用户提供更好服务,自己赚更多钱',
percent: 0,
status: '',
pic: 'http://deimg.c.xixia.cc/preview/f5/e7/0e/Pbm9Q3V5ymTn8VeK0521.png',
id: 173
},
{
title: '接单操作',
desc: '快速学习,使用APP 接单、抢单',
percent: 0,
status: '',
pic: 'http://deimg.c.xixia.cc/preview/f5/e7/0e/Pbm9Q3V5ymTn8VeK0521.png',
id: 173
},
{
title: '从0-1学习充电桩安装服务',
desc: '让你全面了解充电桩市场及服务规范',
percent: 0,
status: '',
pic: 'http://deimg.c.xixia.cc/preview/f5/e7/0e/Pbm9Q3V5ymTn8VeK0521.png',
id: 173
}
],
loadStatus: "loading", //加载样式:loadMore-加载前样式,loading-加载加载中样式,nomore-没有数据样式
isLoadMore: false, //是否加载中
course_id: "course_id_=173",
......@@ -246,36 +270,29 @@
}
});
},
getTypeName(percent){
if(percent == 0){
return '未开始';
}else if(percent == '100'){
return '已完成';
}else{
return '继续';
}
},
//在线学习通用课程信息
getCourseList() {
this.$u.api
.CourseList()
let courseLength = this.courselist.length;
for(let i = 0;i < courseLength; i++){
let param = {
course_id: this.courselist[i].id
};
this.$u.api
.CourseList(param)
.then((res) => {
if (res.code == 200) {
if (res.data) {
this.courselist = res.data;
console.log("--------");
console.log(this.courselist);
if (res.data.length < 5) {
//判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true;
this.loadStatus = "nomore";
} else {
this.isLoadMore = false;
}
} else {
this.isLoadMore = true;
this.loadStatus = "nomore";
}
} else {
//接口请求失败的处理
uni.showToast({
title: res.message,
icon: "none",
});
this.isLoadMore = false;
if (this.params.start > 0) {
this.page -= 5;
this.courselist[i].status = this.getTypeName(res.data.learnedInfo.learnPercent);
this.courselist[i].percent = res.data.learnedInfo.learnPercent;
}
}
})
......@@ -284,17 +301,16 @@
title: err,
icon: "none",
});
this.isLoadMore = false;
if (this.params.start > 0) {
this.page -= 5;
}
});
});
}
},
//tabs通知swiper切换
tabsChange(index) {
this.swiperCurrent = index;
switch (index) {
case 1:
this.params.start = 0;
this.list = [];
this.getList();
break;
case 2:
......
......@@ -52,7 +52,7 @@
currentIndex: -1, // 第几个视频
section_id: 0,
isShowVideo: false,
CourseSectionlist: {}, //节信息
CourseSectionlist: {name: '', content: ''}, //节信息
playerOptions: {
playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
autoplay: true, //如果true,浏览器准备好时开始回放。
......@@ -145,33 +145,11 @@
if (this.courseStatus && (this.courseStatus == "1" || this.courseStatus == 1)) {
return
}
this.changeCourseStatus();
},
playerReadied(player) {
console.log('i go to playerReadied gklog:' + this.gklog)
player.currentTime(this.gklog)
},
changeCourseStatus() {
let that = this;
if (that.courseId) {
that.$u.api
.saveCourseRate({
courseId: that.courseId,
})
.then((res) => {
if (res.code !== 200) {
uni.showToast({
icon: "none",
title: "更新课程状态失败",
});
}
});
} else {
uni.showToast({
title: "课程ID为空,请重新选择课程",
});
}
},
getCourseSection(param) {
this.$u.api
.CourseSection(param)
......@@ -183,15 +161,17 @@
console.log(this.CourseSectionlist)
let wareVal = this.CourseSectionlist.ware;
this.isShowVideo = wareVal == "0";
this.courseTitle = res.data.name;
this.courseDesc = res.data.content;
this.section_id = res.data.id;
this.section_content = res.data.content;
if (this.isShowVideo) {
let coureWareList = res.data.courseware;
this.courseSrc = coureWareList[0].src;
this.videoTotalTime = parseInt(JSON.parse(coureWareList[0].info).time);
console.log('视频时长信息:' + this.videoTotalTime);
this.courseTitle = res.data.name;
this.courseDesc = res.data.content;
this.section_id = res.data.id;
this.section_content = res.data.content;
}else{
this.updateLearnedStatusForText();
}
}
}
......@@ -205,6 +185,26 @@
});
});
},
updateLearnedStatusForText() {
if (this.isShowVideo) {
return false;
}
let param = {
section_id: this.section_id,
video_time: 0,
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",
});
});
},
updateLearnedStatus(nowTime) {
if (this.gklog != nowTime && nowTime % this.howTimeToUpdateLearnedStatus == 0) {
if (nowTime < this.howLongIsLearned) {
......@@ -221,6 +221,13 @@
};
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",
});
});
}
}
......@@ -345,7 +352,7 @@
}
}
}
.u-content {
// margin-top: 10rpx;
padding: 40rpx 30rpx;
......
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