Commit 3920bcd9 authored by 林文清's avatar 林文清

update:学习-详情

parent 81d3cdb6
...@@ -12,8 +12,10 @@ let learnApiFun = function(vm){ ...@@ -12,8 +12,10 @@ let learnApiFun = function(vm){
let ChapterDetails = async (params = {}) => await vm.$u.get(collegeApiUrl+'/v1/chapter-sections',params); let ChapterDetails = async (params = {}) => await vm.$u.get(collegeApiUrl+'/v1/chapter-sections',params);
/* 获取课程节信息*/ /* 获取课程节信息*/
let CourseSection = async (params = {}) => await vm.$u.get(collegeApiUrl+'/v1/section-details',params); let CourseSection = async (params = {}) => await vm.$u.get(collegeApiUrl+'/v1/section-details',params);
/* 更新学习情况*/
let updateLearnCourses = async (params = {}) => await vm.$u.post(collegeApiUrl+'/v1/update-learn-courses',params);
const learnApi = { const learnApi = {
getTrainingNoticeList,CourseList,ChapterDetails,CourseSection getTrainingNoticeList,CourseList,ChapterDetails,CourseSection,updateLearnCourses
} }
return learnApi return learnApi
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</view> </view>
<view class="video" v-for="key in item.section" @click=details(key.id)> <view class="video" v-for="key in item.section" @click=details(key.id)>
<view class="video_1" > <view class="video_1" >
<view class="text" v-text="key.ware=='0'?'视频':'图文'"> <view class="text" v-text="wareType(key.ware)">
</view> </view>
<text>1-{{key.order}}</text> <text>1-{{key.order}}</text>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
methods: { methods: {
//获取章节详情 //获取章节详情
getCapterDetails() { getCapterDetails() {
console.log(1111111) console.log('获取章节详情')
this.$u.api this.$u.api
.ChapterDetails(this.params) .ChapterDetails(this.params)
.then((res) => { .then((res) => {
...@@ -105,6 +105,27 @@ ...@@ -105,6 +105,27 @@
uni.navigateTo({ uni.navigateTo({
url:"./section?section_id=" + id url:"./section?section_id=" + id
}) })
},
wareType(type){
let res = "";
switch (type) {
case "":
res = "图文";
break;
case "0":
case "0,1":
case "0,1,2":
res = "视频";
break;
case "1":
res = "ppt";
break;
case "2":
case "1,2":
res = "pdf";
break;
}
return res;
} }
} }
} }
......
<template> <template>
<view> <view class="learn-vedio" v-if="isShowVideo">
<view class="uni-padding-wrap uni-common-mt">
<view><video
object-fit="cover"
class="course-video"
id="courseVideo"
:src="courseSrc"
@play="playCourse"
@error="videoErrorCallback"
controls
></video
></view>
<view class="title-content">
<view class="item-content">
<view class="item-st">
<image style="width: 80rpx; height: 36rpx" :src="kcImage"></image>
<text class="item-st-text">{{
courseTitle.split(" ") ? courseTitle.split(" ")[0] : ""
}}</text>
</view>
<view class="item-title">{{
courseTitle.split(" ") ? courseTitle.split(" ")[1] : ""
}}</view>
</view>
<view
>接单操作须知有助你快速了解充电桩安装业务,提高接单效率,请认真查看及学习。</view
>
</view>
<view class="learn-view" v-if="courseId >= 0">
<view class="learn-view-title">视频内容介绍</view>
<!-- <view
class="learn-list"
v-for="(item, key) in courseOutlines[courseId]"
:key="key"
> -->
<view class="learn-list-item">{{ item }}</view>
</view>
</view>
</view>
<view v-else>
<view class="title"> <view class="title">
{{CourseSectionlist.name}} {{CourseSectionlist.name}}
</view> </view>
...@@ -7,52 +47,121 @@ ...@@ -7,52 +47,121 @@
{{CourseSectionlist.content}} {{CourseSectionlist.content}}
</view> </view>
</view> </view>
</view>
</template> </template>
<script> <script>
export default { let app = getApp();
export default {
data() { data() {
return { return {
CourseSectionlist:null, courseId: "",
section_id:{ courseStatus: 0,
section_id:0 courseSrc: "",
courseTitle: "",
courseDesc: "",
currentIndex: -1, // 第几个视频
section_id:0,
isShowVideo: false,
CourseSectionlist: {},//节信息
};
},
computed: {
courseOutlines() {
// 视频内容介绍
return {
1: [
"1、考核规则:接单及时率",
"2、考核规则:上门及时率",
"3、考核规则:安装完工率",
"4、考核规则:资料提交及时率",
"5、考核规则:安装完工率",
"6、考核规则:客户满意度",
],
2: ["1、必备材料4大类", "2、施工工具准备"],
3: [
"1、接线安装工艺标准",
"2、PVC、镀锌管电缆管明敷",
"3、电缆敷设的防火要求",
"4、电源点标识",
"5、配电箱接线及安装",
"6、管线敷设接头处理",
"7、充电桩内部接线",
"8、配电箱安装",
],
4: ["1、勘测环节录单要求", "2、安装环节录单要求"],
};
},
kcImage() {
return process.uniEnv.qn_base_url + "kc.png";
},
},
onLoad(e) {
this.courseSrc = 'https://qn-static.banshouhui.com/self-support/videoen.mp4';
this.courseTitle = '大吉大利';
this.courseDesc = '今晚吃鸡';
this.section_id = e.section_id
this.getCourseSection({section_id:e.section_id})
},
onReady: function (res) {
// #ifndef MP-ALIPAY
this.videoContext = uni.createVideoContext("courseVideo");
// #endif
},
methods: {
videoErrorCallback: function (e) {
uni.showModal({
content: e.target.errMsg,
showCancel: false,
});
},
getRandomColor: function () {
const rgb = [];
for (let i = 0; i < 3; ++i) {
let color = Math.floor(Math.random() * 256).toString(16);
color = color.length == 1 ? "0" + color : color;
rgb.push(color);
} }
return "#" + rgb.join("");
},
playCourse: function (e) {
if(this.courseStatus && (this.courseStatus == "1"||this.courseStatus == 1)) {
return
} }
this.changeCourseStatus();
}, },
onLoad(id) { changeCourseStatus() {
this.section_id.section_id = id.section_id let that = this;
this.getCourseSection() 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为空,请重新选择课程",
});
}
}, },
methods: { getCourseSection(param) {
getCourseSection() {
this.$u.api this.$u.api
.CourseSection(this.section_id) .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)
if (res.data.length < 5) { let wareVal = this.CourseSectionlist.ware;
//判断接口返回数据量小于请求数据量,则表示此为最后一页 this.isShowVideo = wareVal == "0";
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;
} }
} }
}) })
...@@ -66,20 +175,111 @@ ...@@ -66,20 +175,111 @@
this.page -= 5; this.page -= 5;
} }
}); });
},
}
} }
},
};
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
.title{ .learn-vedio {
text-align: center; background-color: #f4f5f7;
font-size: 45rpx; position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow-y:auto;
}
.course-video {
width: 100%;
}
.course-title {
font-size: 36rpx;
font-weight: 700; font-weight: 700;
margin: 24rpx; padding: 80rpx 60rpx 40rpx 60rpx;
}
.course-desc {
margin-left: 60rpx;
}
.title-content {
padding: 40rpx 30rpx;
margin-bottom: 20rpx;
background-color: #ffffff;
color: #999999;
font-size: 24rpx;
.item-content {
display: flex;
align-items: center;
}
.item-st {
width: 80rpx;
height: 36rpx;
padding-right: 2rpx;
text-align: center;
margin-right: 20rpx;
line-height: 24rpx;
position: relative;
.item-st-text {
color: #ffffff;
position: absolute;
font-size: 16rpx;
left: 20rpx;
top: 8rpx;
line-height: 28rpx;
}
}
.item-title {
color: #333333;
font-size: 44rpx;
font-weight: bold;
}
}
.item-content {
display: flex;
padding-bottom: 30rpx;
}
.item-title {
color: #333333;
font-size: 28rpx;
}
.learn-view {
background-color: #ffffff;
border-radius: 12rpx;
padding: 38rpx 30rpx 30rpx 30rpx;
margin-bottom: 20rpx;
font-size: 32rpx;
color: #333333;
.learn-view-title {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 10rpx;
}
.learn-list {
.learn-list-item {
font-size: 28rpx;
margin-top: 30rpx;
margin-bottom: 30rpx;
color: #333333;
}
.line-view {
background-color: #f4f5f7;
height: 2rpx;
width: 100%;
} }
.content{
font-size: 30rpx;
padding: 50rpx;
} }
}
</style> </style>
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