Commit a7fd455c authored by 刘用法's avatar 刘用法
parents e6d0dadc 0b6ac51f
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
<swiper-item @touchmove.stop.prevent="stopTouchMove" v-show="current == 1"> <swiper-item @touchmove.stop.prevent="stopTouchMove" v-show="current == 1">
<scroll-view scroll-y style="height:100%;width:100%;" @scrolltolower="onreachBottom" <scroll-view scroll-y style="height:100%;width:100%;" @scrolltolower="onReachBottom"
scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered" scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered"
:refresher-threshold="100" @refresherpulling="onPulling" @refresherrefresh="onRefresh" :refresher-threshold="100" @refresherpulling="onPulling" @refresherrefresh="onRefresh"
@refresherrestore="onRestore" @refresherabort="onAbort"> @refresherrestore="onRestore" @refresherabort="onAbort">
...@@ -153,26 +153,6 @@ ...@@ -153,26 +153,6 @@
</view> </view>
</view> </view>
</view> </view>
<!-- <view class="title u-margin-top-30 u-margin-bottom-30">技能认证</view>
<view class="currency-class">
<view class="class1" @click="aaa(2)">
<image class="img" :src="examList[2].pic" mode=""></image>
<view class="right">
<view class="u-font-32 font-bold">
{{ examList[2].title }}
</view>
<view class="u-font-24">
{{ examList[2].desc }}
</view>
<view class="u-font-24" style="display:flex;justify-content: space-between;">
<text class="font-color-999999">{{ examList[2].condition }}</text>
<text class="font-default-exam-color"
:class="{'font-active-color':examList[2].isComplete}">
{{ examList[2].status }}</text>
</view>
</view>
</view>
</view> -->
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
</swiper> </swiper>
...@@ -184,6 +164,7 @@ ...@@ -184,6 +164,7 @@
"dev": [{ "dev": [{
"title": "服务规范", "title": "服务规范",
"desc": "为用户提供更好服务,自己赚更多钱", "desc": "为用户提供更好服务,自己赚更多钱",
"pic": process.uniEnv.qn_base_url + "fwgf-3x.png",
"percent": 0, "percent": 0,
"status": "", "status": "",
"id": 173, "id": 173,
...@@ -192,6 +173,7 @@ ...@@ -192,6 +173,7 @@
{ {
"title": "接单规范", "title": "接单规范",
"desc": "快速学习,使用APP 接单、抢单", "desc": "快速学习,使用APP 接单、抢单",
"pic": process.uniEnv.qn_base_url + "jdgf-3x.png",
"percent": 0, "percent": 0,
"status": "", "status": "",
"id": 173, "id": 173,
...@@ -200,6 +182,7 @@ ...@@ -200,6 +182,7 @@
{ {
"title": "从0-1学习充电桩安装服务", "title": "从0-1学习充电桩安装服务",
"desc": "让你全面了解充电桩市场及服务规范", "desc": "让你全面了解充电桩市场及服务规范",
"pic": process.uniEnv.qn_base_url + "cdz-3x.png",
"percent": 0, "percent": 0,
"status": "", "status": "",
"id": 173, "id": 173,
...@@ -209,6 +192,7 @@ ...@@ -209,6 +192,7 @@
"test": [{ "test": [{
"title": "服务规范", "title": "服务规范",
"desc": "为用户提供更好服务,自己赚更多钱", "desc": "为用户提供更好服务,自己赚更多钱",
"pic": process.uniEnv.qn_base_url + "fwgf-3x.png",
"percent": 0, "percent": 0,
"status": "", "status": "",
"id": 150, "id": 150,
...@@ -217,6 +201,7 @@ ...@@ -217,6 +201,7 @@
{ {
"title": "接单规范", "title": "接单规范",
"desc": "快速学习,使用APP 接单、抢单", "desc": "快速学习,使用APP 接单、抢单",
"pic": process.uniEnv.qn_base_url + "jdgf-3x.png",
"percent": 0, "percent": 0,
"status": "", "status": "",
"id": 149, "id": 149,
...@@ -225,6 +210,7 @@ ...@@ -225,6 +210,7 @@
{ {
"title": "从0-1学习充电桩安装服务", "title": "从0-1学习充电桩安装服务",
"desc": "让你全面了解充电桩市场及服务规范", "desc": "让你全面了解充电桩市场及服务规范",
"pic": process.uniEnv.qn_base_url + "cdz-3x.png",
"percent": 0, "percent": 0,
"status": "", "status": "",
"id": 151, "id": 151,
...@@ -234,6 +220,7 @@ ...@@ -234,6 +220,7 @@
"prod": [{ "prod": [{
"title": "服务规范", "title": "服务规范",
"desc": "为用户提供更好服务,自己赚更多钱", "desc": "为用户提供更好服务,自己赚更多钱",
"pic": process.uniEnv.qn_base_url + "fwgf-3x.png",
"percent": 0, "percent": 0,
"status": "", "status": "",
"sectionId": "" "sectionId": ""
...@@ -241,6 +228,7 @@ ...@@ -241,6 +228,7 @@
{ {
"title": "接单规范", "title": "接单规范",
"desc": "快速学习,使用APP 接单、抢单", "desc": "快速学习,使用APP 接单、抢单",
"pic": process.uniEnv.qn_base_url + "jdgf-3x.png",
"percent": 0, "percent": 0,
"status": "", "status": "",
"sectionId": "" "sectionId": ""
...@@ -248,6 +236,7 @@ ...@@ -248,6 +236,7 @@
{ {
"title": "从0-1学习充电桩安装服务", "title": "从0-1学习充电桩安装服务",
"desc": "让你全面了解充电桩市场及服务规范", "desc": "让你全面了解充电桩市场及服务规范",
"pic": process.uniEnv.qn_base_url + "cdz-3x.png",
"percent": 0, "percent": 0,
"status": "", "status": "",
"sectionId": "" "sectionId": ""
...@@ -261,7 +250,7 @@ ...@@ -261,7 +250,7 @@
desc: '通过本认证,是接单的必要条件', desc: '通过本认证,是接单的必要条件',
condition: '随机20题,及格20题', condition: '随机20题,及格20题',
status: '', status: '',
pic: process.uniEnv.qn_base_url + "fwgf-e-3x.png", pic: process.uniEnv.qn_base_url + "fwgf-3x.png",
id: 2, id: 2,
examId: '', examId: '',
examStatus: '', examStatus: '',
...@@ -327,13 +316,12 @@ ...@@ -327,13 +316,12 @@
] ]
} }
let env = process.uniEnv.node_env; let env = process.uniEnv.node_env;
let courseListJson = json. [env]; let courseListJson = json.[env];
let examListJson = examJson[env]; let examListJson = examJson[env];
export default { export default {
data() { data() {
return { return {
msg: "赣南吴彦祖",
tabs: [{ tabs: [{
name: "交付规范", name: "交付规范",
}, },
...@@ -362,7 +350,7 @@ ...@@ -362,7 +350,7 @@
desc: courseListJson[0].desc, desc: courseListJson[0].desc,
percent: courseListJson[0].percent, percent: courseListJson[0].percent,
status: courseListJson[0].status, status: courseListJson[0].status,
pic: process.uniEnv.qn_base_url + "fwgf-3x.png", pic: courseListJson[0].pic,
id: courseListJson[0].id, id: courseListJson[0].id,
sectionId: courseListJson[0].sectionId sectionId: courseListJson[0].sectionId
}, },
...@@ -371,7 +359,7 @@ ...@@ -371,7 +359,7 @@
desc: courseListJson[1].desc, desc: courseListJson[1].desc,
percent: courseListJson[1].percent, percent: courseListJson[1].percent,
status: courseListJson[1].status, status: courseListJson[1].status,
pic: process.uniEnv.qn_base_url + "jdgf-3x.png", pic: courseListJson[1].pic,
id: courseListJson[1].id, id: courseListJson[1].id,
sectionId: courseListJson[1].sectionId sectionId: courseListJson[1].sectionId
}, },
...@@ -380,7 +368,7 @@ ...@@ -380,7 +368,7 @@
desc: courseListJson[2].desc, desc: courseListJson[2].desc,
percent: courseListJson[2].percent, percent: courseListJson[2].percent,
status: courseListJson[2].status, status: courseListJson[2].status,
pic: process.uniEnv.qn_base_url + "cdz-3x.png", pic: courseListJson[2].pic,
id: courseListJson[2].id, id: courseListJson[2].id,
sectionId: courseListJson[2].sectionId, sectionId: courseListJson[2].sectionId,
} }
...@@ -407,18 +395,6 @@ ...@@ -407,18 +395,6 @@
examStatus: examListJson[1].examStatus, examStatus: examListJson[1].examStatus,
isComplete: examListJson[1].isComplete isComplete: examListJson[1].isComplete
} }
// ,
// {
// title: '从0-1学习充电桩安装服务',
// desc: '通过本认证后,可接充电桩业务单',
// condition: '随机30题,及格25题',
// status: '',
// pic: process.uniEnv.qn_base_url + "kecehng1@3x.png",
// id: 2,
// examId: '',
// examStatus: '',
// isComplete: false
// }
], ],
loadStatus: "loading", loadStatus: "loading",
isLoadMore: false, isLoadMore: false,
...@@ -427,10 +403,7 @@ ...@@ -427,10 +403,7 @@
isReflesh: true, isReflesh: true,
triggered: false, triggered: false,
_freshing: false, _freshing: false,
new:{
isTopReflesh:false
} }
};
}, },
onLoad(param) { onLoad(param) {
var that = this; var that = this;
...@@ -478,17 +451,36 @@ ...@@ -478,17 +451,36 @@
onAbort() { onAbort() {
console.log("onAbort"); console.log("onAbort");
}, },
//scroll-view到底部加载更多
onReachBottom() {
//上拉触底函数
if (!this.isLoadMore) {
this.isLoadMore = true;
this.params.start += 5;
if (this.loadStatus !== "nomore") {
this.getNoticeList();
}
}
},
stopTouchMove() { stopTouchMove() {
return false; return false;
}, },
getList() { getNoticeList() {
let that = this; let that = this;
this.$u.api this.$u.api
.getTrainingNoticeList(this.params) .getTrainingNoticeList(this.params)
.then((res) => { .then((res) => {
that.stopPull(); that.stopPull();
that.timeFormat(); if(res.code != 200){
if (res.code == 200) { uni.showToast({
title: res.message,
icon: "none",
});
that.isLoadMore = false;
if (that.params.start > 0) {
that.page -= 5;
}
}
if (res.data) { if (res.data) {
let length = res.data.length; let length = res.data.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
...@@ -496,29 +488,13 @@ ...@@ -496,29 +488,13 @@
'yyyy.MM.dd hh:mm'); 'yyyy.MM.dd hh:mm');
} }
that.list = that.list.concat(res.data); that.list = that.list.concat(res.data);
if (res.data.length < 5) {
//判断接口返回数据量小于请求数据量,则表示此为最后一页
that.isLoadMore = true;
that.loadStatus = "nomore";
} else {
that.isLoadMore = false;
} }
} else { if(res.data.length >= 5){
that.isLoadMore = false;
}else{
that.isLoadMore = true; that.isLoadMore = true;
that.loadStatus = "nomore"; that.loadStatus = "nomore";
} }
} else {
//接口请求失败的处理
uni.showToast({
title: res.message,
icon: "none",
});
that.isLoadMore = false;
if (that.params.start > 0) {
that.page -= 5;
}
}
}) })
.catch((err) => { .catch((err) => {
uni.showToast({ uni.showToast({
...@@ -570,14 +546,18 @@ ...@@ -570,14 +546,18 @@
this.$u.api this.$u.api
.CourseList(param) .CourseList(param)
.then((res) => { .then((res) => {
if (res.code == 200) { if (res.code != 200) {
uni.showToast({
title: res.message,
icon: "none",
});
}
if (res.data) { if (res.data) {
res.data.learnedInfo.learnPercent *= 100; res.data.learnedInfo.learnPercent *= 100;
this.courselist[i].status = this.getTypeName(res.data.learnedInfo.learnPercent); this.courselist[i].status = this.getTypeName(res.data.learnedInfo.learnPercent);
this.courselist[i].percent = res.data.learnedInfo.learnPercent; this.courselist[i].percent = res.data.learnedInfo.learnPercent;
this.courselist[i].sectionId = res.data.learnedInfo.nextLearnedSectionId; this.courselist[i].sectionId = res.data.learnedInfo.nextLearnedSectionId;
} }
}
}) })
.catch((err) => { .catch((err) => {
uni.showToast({ uni.showToast({
...@@ -605,7 +585,7 @@ ...@@ -605,7 +585,7 @@
loadNews() { loadNews() {
this.params.start = 0; this.params.start = 0;
this.list = []; this.list = [];
this.getList(); this.getNoticeList();
}, },
animationfinish(e) { animationfinish(e) {
let current = e.detail.current; let current = e.detail.current;
...@@ -613,20 +593,6 @@ ...@@ -613,20 +593,6 @@
this.swiperCurrent = current; this.swiperCurrent = current;
this.current = current; this.current = current;
}, },
//scroll-view到底部加载更多
onreachBottom() {
//上拉触底函数
if (!this.isLoadMore) {
this.isLoadMore = true;
this.params.start += 5;
if (this.loadStatus !== "nomore") {
this.getList();
}
}
},
refleshNews() {
this.loadNews()
},
//跳转到拍照小程序首页 //跳转到拍照小程序首页
goToPrint() { goToPrint() {
console.log("111111"); console.log("111111");
...@@ -655,7 +621,13 @@ ...@@ -655,7 +621,13 @@
this.$u.api this.$u.api
.getExamResult(examId) .getExamResult(examId)
.then((res) => { .then((res) => {
if (res.code == 200) { if(res.code != 200){
console.log('getUserExamInfo 200 err');
uni.showToast({
icon: "none",
title: '获取考试信息失败',
});
}
this.examList[i].examId = res.data.id; this.examList[i].examId = res.data.id;
this.examList[i].examStatus = res.data.examStatus; //i;// this.examList[i].examStatus = res.data.examStatus; //i;//
let examResult = res.data.examLevelResult; let examResult = res.data.examLevelResult;
...@@ -676,14 +648,6 @@ ...@@ -676,14 +648,6 @@
if (res.data.examStatus == 0) { if (res.data.examStatus == 0) {
console.log("examStatus " + i + " 0"); console.log("examStatus " + i + " 0");
that.userExamId = res.data.id; that.userExamId = res.data.id;
// that.getNext();
}
} else {
console.log('getUserExamInfo 200 err');
uni.showToast({
icon: "none",
title: '获取考试信息失败',
});
} }
}) })
.catch((err) => { .catch((err) => {
...@@ -909,7 +873,7 @@ ...@@ -909,7 +873,7 @@
} }
swiper { swiper {
height: 65vh; height: 70vh;
} }
.line-percent { .line-percent {
...@@ -985,18 +949,20 @@ ...@@ -985,18 +949,20 @@
.notice-bottom { .notice-bottom {
margin-top: 20rpx; margin-top: 20rpx;
display: flex; display: block;
position: relative;
} }
.notice-bottom-left { .notice-bottom-left {
font-size: 24rpx; font-size: 24rpx;
color: #999999; color: #999999;
float: left;
} }
.notice-bottom-right { .notice-bottom-right {
margin-left: 330rpx;
font-size: 24rpx; font-size: 24rpx;
color: #2272FF; color: #2272FF;
float: right;
} }
.bofang { .bofang {
......
<template> <template>
<view class=""> <view class="">
<view class="learn-vedio" v-if="isShowVideo"> <view class="learn-vedio">
<u-navbar <u-navbar back-icon-color="#000000" :background="background" title-color="#000000" :border-bottom="false">
back-icon-color="#000000"
:background="background"
title-color="#000000"
:border-bottom="false">
</u-navbar> </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"
@ready="playerReadied" @timeupdate="onPlayerTimeupdate($event)" autoplay="true" controls></video></view> @ready="playerReadied" @timeupdate="onPlayerTimeupdate($event)" autoplay="true"
controls></video></view>
<view class="title-content"> <view class="title-content">
<view class="item-content"> <view class="item-content">
<view class="item-st"> <view class="item-st">
...@@ -26,7 +23,7 @@ ...@@ -26,7 +23,7 @@
<view class="" style="padding-top: 30rpx;display: flex;padding-left: 30rpx;"> <view class="" style="padding-top: 30rpx;display: flex;padding-left: 30rpx;">
<u-avatar :style="{'width':'100rpx', 'height':'100rpx'}" :src="teacherImage" mode="circle"> <u-avatar :style="{'width':'100rpx', 'height':'100rpx'}" :src="teacherImage" mode="circle">
</u-avatar> </u-avatar>
<view style="height:120rpx;font-size: 30rpx;padding-left:30rpx;"> <view style="height:120rpx;font-size: 30rpx;padding-left:30rpx;padding-right: 30rpx;">
<view class="" style="display: flex;font-size: 32rpx;"> <view class="" style="display: flex;font-size: 32rpx;">
<view class="" style="font-size: 32rpx;font-weight: bold;">{{ teacher.name }}</view> <view class="" style="font-size: 32rpx;font-weight: bold;">{{ teacher.name }}</view>
<view class="" <view class=""
...@@ -36,40 +33,29 @@ ...@@ -36,40 +33,29 @@
<view class="" style="font-size: 24rpx;margin-top: 30rpx;">{{ teacherIntro }}</view> <view class="" style="font-size: 24rpx;margin-top: 30rpx;">{{ teacherIntro }}</view>
</view> </view>
</view> </view>
<view class="learn-view-title">目录</view> <view class="learn-view-title">目录</view>
<view class="catalogue"> <view class="scroll_box">
<view v-for="(item, index) in list" :key="index"> <scroll-view scroll-x @scroll="scroll" :scroll-left="scrollValue">
<view @click="goNext(item)" class="list-cell list-default" <view class="item_list" :class="{'item_list_active': item.isActive}"
:class="{'list-default-active': item.isActive}" v-for="(item, index) in sectionList" :key="index" @click="goNext(item, $event)">
style="width:280rpx;height:150rpx;margin-left: 20rpx;padding: 20rpx;border-radius: 12rpx;">
<view class="" style="font-size: 24rpx;">{{ item.title }}</view> <view class="" style="font-size: 24rpx;">{{ item.title }}</view>
<view class="" style="font-size: 26rpx;margin-top: 16rpx;"> <view class="" style="font-size: 26rpx;margin-top: 16rpx;">
{{ item.intro }} {{ item.intro }}
</view> </view>
</view> </view>
</scroll-view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view v-else>
<view class="title">
{{CourseSectionlist.name}}
</view>
<view class="u-content">
<u-parse :html="CourseSectionlist.content"></u-parse>
</view>
</view>
</view>
</template> </template>
<script> <script>
let app = getApp();
export default { export default {
data() { data() {
return { return {
nextSectionId: null,
teacherImage: process.uniEnv.qn_base_url + "avatar.gif", teacherImage: process.uniEnv.qn_base_url + "avatar.gif",
courseId: "", courseId: "",
courseStatus: 0, courseStatus: 0,
...@@ -77,45 +63,9 @@ ...@@ -77,45 +63,9 @@
courseTitle: "", courseTitle: "",
courseDesc: "", courseDesc: "",
courseTotal: null, courseTotal: null,
currentIndex: -1, // 第几个视频
section_id: 0, section_id: 0,
active_section_id: 0, sectionInfo: {}, //节信息
isShowVideo: false, sectionList: [],
CourseSectionlist: {
name: '',
content: ''
}, //节信息
list: [{
'title': '第1节',
'intro': '考核规则1:接单及 时率',
'isActive': true,
"id": null
},
{
'title': '第2节',
'intro': '考核规则1:接单及 时率',
'isActive': false,
"id": null
},
{
'title': '第3节',
'intro': '考核规则1:接单及 时率',
'isActive': false,
"id": null
},
{
'title': '第4节',
'intro': '考核规则1:接单及 时率',
'isActive': false,
"id": null
},
{
'title': '第5节',
'intro': '考核规则1:接单及 时率',
'isActive': false,
"id": null
},
],
teacher: { teacher: {
name: "", name: "",
avatar: "" avatar: ""
...@@ -146,81 +96,71 @@ ...@@ -146,81 +96,71 @@
howTimeToUpdateLearnedStatus: 10, //设置几秒提交一次状态 howTimeToUpdateLearnedStatus: 10, //设置几秒提交一次状态
status: 1, //是否已学习默认1已学习 status: 1, //是否已学习默认1已学习
isLearned: false, //默认设置观看1/2就是已学 isLearned: false, //默认设置观看1/2就是已学
}; old: {
scrollTop: null
}, },
computed: { scrollValue: 0
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、安装环节录单要求"],
}; };
}, },
computed: {
kcImage() { kcImage() {
return process.uniEnv.qn_base_url + "kc.png"; return process.uniEnv.qn_base_url + "kc.png";
}, },
}, },
onLoad(e) { onLoad(e) {
this.active_section_id = e.section_id; this.section_id = e.section_id
this.params.course_id = e.course_id; this.params.course_id = e.course_id
this.getCourseSection({ this.getSectionInfo({
section_id: e.section_id section_id: e.section_id
}) })
this.getCapterDetails(); this.getCapterDetails()
}, },
onReady: function(res) { onReady: function(res) {
// #ifndef MP-ALIPAY
this.videoContext = uni.createVideoContext("courseVideo"); this.videoContext = uni.createVideoContext("courseVideo");
// #endif
},
onUnload() {
wx.reLaunch({
url: '/pages/index/learn?tabs=2'
});
}, },
methods: { methods: {
goNext(info) { scroll: function(e) {
uni.navigateTo({ console.log('--scroll--')
url: "/pages/learn/section?section_id=" + info.id + "&course_id=" + info.course_id console.log(e)
}); this.old.scrollTop = e.detail.scrollTop
},
goNext(info, e) {
//切换成下一个
this.getSectionInfo({
section_id: info.id
})
this.section_id = info.id;
//底部激活样式切换
this.changeActiveAction()
},
changeActiveAction() {
// debugger
let activeKey = 0
// debugger
for (let i in this.sectionList) {
this.sectionList[i].isActive = this.section_id == this.sectionList[i].id ? true : false;
if(this.sectionList[i].isActive){
activeKey = i
}
}
if(activeKey > 1){
this.scrollValue = (activeKey - 1) * 150
}else{
this.scrollValue = 0
}
console.log('--移动距离--')
console.log(this.scrollValue)
}, },
onPlayerTimeupdate(player) { onPlayerTimeupdate(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
}, },
videoErrorCallback: function(e) { videoErrorCallback: function(e) {
uni.showModal({ uni.showModal({
content: e.target.errMsg, content: e.target.errMsg,
showCancel: false, 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) { playCourse: function(e) {
if (this.courseStatus && (this.courseStatus == "1" || this.courseStatus == 1)) { if (this.courseStatus && (this.courseStatus == "1" || this.courseStatus == 1)) {
...@@ -230,120 +170,104 @@ ...@@ -230,120 +170,104 @@
playerReadied(player) { playerReadied(player) {
player.currentTime(this.gklog) player.currentTime(this.gklog)
}, },
getCourseSection(param) { getSectionInfo(param) {
this.$u.api this.$u.api
.CourseSection(param) .CourseSection(param)
.then((res) => { .then((res) => {
if (res.code == 200) { if (res.code != 200) {
if (res.data) { uni.showToast({
this.CourseSectionlist = res.data; title: res.message,
console.log("--------") icon: "none"
console.log(this.CourseSectionlist) });
let wareVal = this.CourseSectionlist.ware;
this.isShowVideo = wareVal == "0";
this.courseTitle = res.data.name;
this.courseDesc = res.data.content.replace(/<p.*?>|<\/p>/ig, "");
this.section_id = res.data.id;
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(/<.*?>|<\/.*?>/ig, "");
this.params.course_id = res.data.course_id;
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);
} else {
this.updateLearnedStatusForText();
} }
if (res.data) {
this.sectionInfo = res.data
console.log("----节信息----")
console.log(this.sectionInfo)
let wareVal = this.sectionInfo.ware
this.courseTitle = res.data.name
this.courseDesc = res.data.content.replace(/<p.*?>|<\/p>/ig, "")
this.section_id = res.data.id
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(/<.*?>|<\/.*?>/ig, "")
this.params.course_id = res.data.course_id
this.nextSectionId = this.sectionInfo.nextSectionId
if (wareVal == "0") {
let coureWareList = res.data.courseware
this.courseSrc = coureWareList[0].src
this.videoTotalTime = parseInt(JSON.parse(coureWareList[0].info).time)
console.log('视频时长信息:' + this.videoTotalTime)
} }
} }
}) })
.catch((err) => { .catch((err) => {
uni.showToast({ uni.showToast({
title: err, title: err,
icon: "none", icon: "none"
}); })
}); })
},
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) => {
}).catch((err) => {
uni.showToast({
title: err,
icon: "none",
});
});
}, },
updateLearnedStatus(nowTime) { updateLearnedStatus(nowTime) {
if (this.gklog != nowTime && nowTime % this.howTimeToUpdateLearnedStatus == 0) { if (this.gklog != nowTime && nowTime % this.howTimeToUpdateLearnedStatus == 0) {
let howLongIsLearned = parseInt(this.videoTotalTime / 2); let howLongIsLearned = parseInt(this.videoTotalTime / 2)
if (nowTime < howLongIsLearned) { if (nowTime < howLongIsLearned) {
this.status = 0; this.status = 0
} else if(this.isLearned){ } else if (this.isLearned) {
return; return
} else { } else {
this.status = 1; this.status = 1
} }
let param = { let param = {
section_id: this.section_id, section_id: this.section_id,
video_time: nowTime, video_time: nowTime,
status: this.status, status: this.status
}; };
this.$u.api.updateLearnCourses(param).then((res) => { this.$u.api.updateLearnCourses(param).then((res) => {}).catch((err) => {
}).catch((err) => { console.log(err)
console.log(err);
}); });
} }
}, },
//获取章节详情 //获取章节详情
getCapterDetails() { getCapterDetails() {
let that = this
this.$u.api this.$u.api
.ChapterDetails(this.params) .ChapterDetails(this.params)
.then((res) => { .then((res) => {
if (res.code == 200) { if (res.code != 200) {
if (res.data) {
this.list = res.data[0].section;
this.courseTotal = this.list.length;
let length = this.list.length;
for (let i = 0; i < length; i++) {
this.list[i].title = "第" + (i + 1) + "节";
this.list[i].intro = this.list[i].name;
this.list[i].isActive = this.active_section_id == this.list[i].id ? true :
false;
}
}
} else {
//接口请求失败的处理
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
icon: "none" icon: "none"
}); })
}
if (res.data) {
that.sectionList = res.data[0].section
that.courseTotal = that.sectionList.length
let length = that.sectionList.length
for (let i = 0; i < length; i++) {
that.sectionList[i].title = "第" + (i + 1) + "节"
that.sectionList[i].intro = that.sectionList[i].name
that.sectionList[i].isActive = that.section_id == that.sectionList[i].id
? true : false
}
this.changeActiveAction()
} }
}) })
.catch((err) => { .catch((err) => {
uni.showToast({ uni.showToast({
title: err, title: err,
icon: "none", icon: "none"
}); })
this.isLoadMore = false; that.isLoadMore = false
if (this.params.start > 0) { if (that.params.start > 0) {
this.page -= 5; that.page -= 5
} }
}); })
}, },
}, },
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -498,4 +422,60 @@ ...@@ -498,4 +422,60 @@
padding-bottom: 30rpx; padding-bottom: 30rpx;
padding-right: 30rpx; padding-right: 30rpx;
} }
.scroll-view_H {
width: 500rpx;
height: 100rpx;
.scroll-view-item_H {
width: 100rpx;
height: 100rpx;
}
.uni-bg-red {
background-color: red;
}
.uni-bg-green {
background-color: green;
}
.uni-bg-blue {
background-color: blue;
}
}
.scroll_box {
width: 100%;
height: 150rpx;
overflow: hidden;
// padding: 20rpx;
padding-left: 20rpx;
background: #fff;
white-space: nowrap;
// border: 1px solid red;
}
.scroll_box scroll-view {
height: 100%;
width: auto;
overflow: hidden;
}
.item_list {
width: 280rpx;
height: 150rpx;
margin-right: 23rpx;
display: inline-block;
background-color: #F4F5F7;
border-radius: 12rpx;
padding: 20rpx;
}
.item_list_active {
background-color: #ffffff;
color: #2272FF;
border: 2rpx solid #2272FF;
box-sizing: border-box;
}
</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