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="title"> <view class="uni-padding-wrap uni-common-mt">
{{CourseSectionlist.name}} <view><video
</view> object-fit="cover"
<view class="content" v-html="CourseSectionlist.content"> class="course-video"
{{CourseSectionlist.content}} id="courseVideo"
</view> :src="courseSrc"
</view> @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">
{{CourseSectionlist.name}}
</view>
<view class="content" v-html="CourseSectionlist.content">
{{CourseSectionlist.content}}
</view>
</view>
</view>
</template> </template>
<script> <script>
export default { let app = getApp();
data() { export default {
return { data() {
CourseSectionlist:null, return {
section_id:{ courseId: "",
section_id:0 courseStatus: 0,
} courseSrc: "",
} courseTitle: "",
}, courseDesc: "",
onLoad(id) { currentIndex: -1, // 第几个视频
this.section_id.section_id = id.section_id section_id:0,
this.getCourseSection() isShowVideo: false,
}, CourseSectionlist: {},//节信息
methods: { };
getCourseSection() { },
this.$u.api computed: {
.CourseSection(this.section_id) courseOutlines() {
.then((res) => { // 视频内容介绍
if (res.code == 200) { return {
if (res.data) { 1: [
this.CourseSectionlist = res.data; "1、考核规则:接单及时率",
console.log("--------") "2、考核规则:上门及时率",
console.log(this.CourseSectionlist) "3、考核规则:安装完工率",
if (res.data.length < 5) { "4、考核规则:资料提交及时率",
//判断接口返回数据量小于请求数据量,则表示此为最后一页 "5、考核规则:安装完工率",
this.isLoadMore = true; "6、考核规则:客户满意度",
this.loadStatus = "nomore"; ],
} else { 2: ["1、必备材料4大类", "2、施工工具准备"],
this.isLoadMore = false; 3: [
} "1、接线安装工艺标准",
} else { "2、PVC、镀锌管电缆管明敷",
this.isLoadMore = true; "3、电缆敷设的防火要求",
this.loadStatus = "nomore"; "4、电源点标识",
} "5、配电箱接线及安装",
} else { "6、管线敷设接头处理",
//接口请求失败的处理 "7、充电桩内部接线",
uni.showToast({ "8、配电箱安装",
title: res.message, ],
icon: "none" 4: ["1、勘测环节录单要求", "2、安装环节录单要求"],
}); };
this.isLoadMore = false; },
if (this.params.start > 0) { kcImage() {
this.page -= 5; return process.uniEnv.qn_base_url + "kc.png";
} },
} },
}) onLoad(e) {
.catch((err) => { this.courseSrc = 'https://qn-static.banshouhui.com/self-support/videoen.mp4';
uni.showToast({ this.courseTitle = '大吉大利';
title: err, this.courseDesc = '今晚吃鸡';
icon: "none", this.section_id = e.section_id
}); this.getCourseSection({section_id:e.section_id})
this.isLoadMore = false; },
if (this.params.start > 0) { onReady: function (res) {
this.page -= 5; // #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();
},
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)
.then((res) => {
if (res.code == 200) {
if (res.data) {
this.CourseSectionlist = res.data;
console.log("--------")
console.log(this.CourseSectionlist)
let wareVal = this.CourseSectionlist.ware;
this.isShowVideo = wareVal == "0";
}
}
})
.catch((err) => {
uni.showToast({
title: err,
icon: "none",
});
this.isLoadMore = false;
if (this.params.start > 0) {
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;
font-weight: 700; top: 0;
margin: 24rpx; left: 0;
} width: 100%;
.content{ height: 100%;
font-size: 30rpx; display: flex;
padding: 50rpx; flex-direction: column;
} overflow-y:auto;
}
.course-video {
width: 100%;
}
.course-title {
font-size: 36rpx;
font-weight: 700;
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%;
}
}
}
</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