Commit 75f36528 authored by 林文清's avatar 林文清

学习-页面调整

parent 741aa0dd
<template> <template>
<view class="study"> <view class="study">
<u-navbar <u-navbar :is-back="false" background="{background: transparent}" :border-bottom="false" :is-fixed="false">
:is-back="false"
background="{background: transparent}"
:border-bottom="false"
:is-fixed="false"
>
<text class="title-view">学习</text> <text class="title-view">学习</text>
</u-navbar> </u-navbar>
<image :src="bannerImage" mode="" class="banner"></image> <image :src="bannerImage" mode="" class="banner"></image>
<!-- <u-tabs :list="tabs" :is-scroll="false" :current="current" @change="change"></u-tabs> --> <!-- <u-tabs :list="tabs" :is-scroll="false" :current="current" @change="change"></u-tabs> -->
<view> <view>
<u-tabs-swiper bg-color="#F4F5F7" inactive-color="#999999" font-size="28" ref="uTabs" :list="tabs" :current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper> <u-tabs-swiper bg-color="#F4F5F7" inactive-color="#999999" font-size="28" ref="uTabs" :list="tabs"
:current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
</view> </view>
<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" style="height: 755rpx;"> <swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish"
style="height: 755rpx;">
<swiper-item class="swiper-item"> <swiper-item class="swiper-item">
<scroll-view scroll-y style="height:796rpx;width:100%;" @scrolltolower="onreachBottom"> <scroll-view scroll-y style="height:796rpx;width:100%;" @scrolltolower="onreachBottom">
<view class="standard" @click="goToPrint"> <view class="standard" @click="goToPrint">
...@@ -54,8 +51,11 @@ ...@@ -54,8 +51,11 @@
{{courselist.course.intro}} {{courselist.course.intro}}
</view> </view>
<view class="" style="display:flex;justify-content: space-between;"> <view class="" style="display:flex;justify-content: space-between;">
<u-line-progress active-color="#2979ff" :percent=courselist.learnedInfo.learnPercent style="width:54%;"></u-line-progress> <u-line-progress active-color="#2979ff"
<text v-text="(courselist.learnedInfo.isLearned) ?(courselist.learnedInfo.learnPercent==1)?'已完成':'继续':'未观看' "></text> :percent=courselist.learnedInfo.learnPercent style="width:54%;">
</u-line-progress>
<text
v-text="(courselist.learnedInfo.isLearned) ?(courselist.learnedInfo.learnPercent==1)?'已完成':'继续':'未观看' "></text>
</view> </view>
</view> </view>
</view> </view>
...@@ -69,7 +69,8 @@ ...@@ -69,7 +69,8 @@
快速学习,使用APP接单、抢单 快速学习,使用APP接单、抢单
</view> </view>
<view class="" style="display:flex;justify-content: space-between;"> <view class="" style="display:flex;justify-content: space-between;">
<u-line-progress active-color="#2979ff" :percent="30" style="width:54%;"></u-line-progress> <u-line-progress active-color="#2979ff" :percent="30" style="width:54%;">
</u-line-progress>
<text>继续</text> <text>继续</text>
</view> </view>
</view> </view>
...@@ -87,7 +88,8 @@ ...@@ -87,7 +88,8 @@
让你全面了解充电桩市场及服务规范 让你全面了解充电桩市场及服务规范
</view> </view>
<view class="" style="display:flex;justify-content: space-between;"> <view class="" style="display:flex;justify-content: space-between;">
<u-line-progress active-color="#2979ff" :percent="100" style="width:54%;"></u-line-progress> <u-line-progress active-color="#2979ff" :percent="100" style="width:54%;">
</u-line-progress>
<text>完成</text> <text>完成</text>
</view> </view>
</view> </view>
...@@ -162,12 +164,11 @@ ...@@ -162,12 +164,11 @@
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
msg: "赣南吴彦祖", msg: "赣南吴彦祖",
tabs: [ tabs: [{
{
name: "交付规范", name: "交付规范",
}, },
{ {
...@@ -194,9 +195,9 @@ export default { ...@@ -194,9 +195,9 @@ export default {
}; };
}, },
onLoad() { onLoad() {
this.getList(); // this.getList();
this.getCourseList(); // this.getCourseList();
this.getUserExamInfo(); // this.getUserExamInfo();
}, },
computed: { computed: {
bannerImage() { bannerImage() {
...@@ -292,6 +293,18 @@ export default { ...@@ -292,6 +293,18 @@ export default {
//tabs通知swiper切换 //tabs通知swiper切换
tabsChange(index) { tabsChange(index) {
this.swiperCurrent = index; this.swiperCurrent = index;
switch (index) {
case 1:
this.getList();
break;
case 2:
this.getCourseList();
console.log('重新加载学习进度');
break;
case 3:
this.getUserExamInfo();
break;
}
}, },
//swiper-item左右移动,通知tabs的滑块跟随移动 //swiper-item左右移动,通知tabs的滑块跟随移动
transition(e) { transition(e) {
...@@ -369,8 +382,7 @@ export default { ...@@ -369,8 +382,7 @@ export default {
let that = this; let that = this;
uni.request({ uni.request({
url: url: "http://192.168.1.22" +
"http://192.168.1.22" +
"/wxh-worker-rest/rest/exam" + "/wxh-worker-rest/rest/exam" +
"/serviceRule/userExamInfo/" + "/serviceRule/userExamInfo/" +
getApp().globalData.token + getApp().globalData.token +
...@@ -432,108 +444,114 @@ export default { ...@@ -432,108 +444,114 @@ export default {
}); });
}, },
}, },
}; };
</script> </script>
<style> <style>
.study { .study {
height: 100vh; height: 100vh;
background-color: #f4f5f7; background-color: #f4f5f7;
padding: 0rpx 30rpx 0 30rpx; padding: 0rpx 30rpx 0 30rpx;
} }
.title-view {
.title-view {
color: #333333; color: #333333;
font-weight: bold; font-weight: bold;
font-size: 40rpx; font-size: 40rpx;
} }
.banner { .banner {
width: 690rpx; width: 690rpx;
height: 240rpx; height: 240rpx;
/* margin-left: -15rpx; */ /* margin-left: -15rpx; */
} }
/* //交付规范 */ /* //交付规范 */
.standard { .standard {
width: 656rpx; width: 656rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
border-bottom: 1rpx solid #82848a; border-bottom: 1rpx solid #82848a;
padding: 0 34rpx; padding: 0 34rpx;
margin: 72rpx auto; margin: 72rpx auto;
} }
/* //培训通知 */ /* //培训通知 */
.notice { .notice {
border: #808080 solid 2rpx; border: #808080 solid 2rpx;
width: 100%; width: 100%;
height: 400rpx; height: 400rpx;
margin-top: 36rpx; margin-top: 36rpx;
overflow: hidden; overflow: hidden;
} }
.n-head { .n-head {
text-align: center; text-align: center;
margin: 32rpx 0; margin: 32rpx 0;
} }
.news {
} .news {}
/* //在线学习 */
.currency-class { /* //在线学习 */
.currency-class {
width: 100%; width: 100%;
background: #ffffff; background: #ffffff;
padding: 18rpx; padding: 18rpx;
margin-bottom: 11px; margin-bottom: 11px;
border-radius: 12rpx; border-radius: 12rpx;
} }
.title {
.title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
font-family: PingFang-SC-Bold, PingFang-SC; font-family: PingFang-SC-Bold, PingFang-SC;
} }
.class1 {
.class1 {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding-top: 22rpx; padding-top: 22rpx;
margin-top: 28rpx; margin-top: 28rpx;
border-top: 1rpx solid #808080; border-top: 1rpx solid #808080;
} }
.img { .img {
width: 201rpx; width: 201rpx;
height: 201rpx; height: 201rpx;
display: block; display: block;
margin-right: 0rpx; margin-right: 0rpx;
} }
.right { .right {
width: 428rpx; width: 428rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
} }
.intro {
.intro {
color: #9999a6; color: #9999a6;
} }
.tab {
.tab {
background: #fff; background: #fff;
height: 82rpx; height: 82rpx;
margin: 0 0; margin: 0 0;
} }
.text { .text {
margin: 0 40rpx; margin: 0 40rpx;
line-height: 82rpx; line-height: 82rpx;
color: #667eb5; color: #667eb5;
} }
.content { .content {
margin: 5px 0; margin: 5px 0;
height: 485rpx; height: 485rpx;
background: #fff; background: #fff;
} }
swiper { swiper {
height: 691rpx; height: 691rpx;
} }
</style> </style>
<template> <template>
<view class="learn-vedio" v-if="isShowVideo"> <view class="learn-vedio" v-if="isShowVideo">
<view class="uni-padding-wrap uni-common-mt"> <view class="uni-padding-wrap uni-common-mt">
<view><video <view><video object-fit="cover" class="course-video" id="courseVideo" :src="courseSrc"
object-fit="cover" :options="playerOptions" :playsinline="true" @play="playCourse" @error="videoErrorCallback"
class="course-video" @ready="playerReadied" @timeupdate="onPlayerTimeupdate($event)" controls></video></view>
id="courseVideo"
:src="courseSrc"
:options="playerOptions"
:playsinline="true"
@play="playCourse"
@error="videoErrorCallback"
@ready="playerReadied"
@timeupdate = "onPlayerTimeupdate($event)"
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">
<image style="width: 80rpx; height: 36rpx" :src="kcImage"></image> <image style="width: 80rpx; height: 36rpx" :src="kcImage"></image>
<text class="item-st-text">{{ <text class="item-st-text">{{ courseTitle.split(" ") ? courseTitle.split(" ")[0] : "" }}</text>
courseTitle.split(" ") ? courseTitle.split(" ")[0] : ""
}}</text>
</view> </view>
<view class="item-title">{{ <view class="item-title">{{ courseTitle.split(" ") ? courseTitle.split(" ")[1] : "" }}</view>
courseTitle.split(" ") ? courseTitle.split(" ")[1] : ""
}}</view>
</view> </view>
<view <view>接单操作须知有助你快速了解充电桩安装业务,提高接单效率,请认真查看及学习。</view>
>接单操作须知有助你快速了解充电桩安装业务,提高接单效率,请认真查看及学习。</view
>
</view> </view>
<view class="learn-view" v-if="courseId >= 0"> <view class="learn-view" v-if="courseId >= 0">
<view class="learn-view-title">视频内容介绍</view> <view class="learn-view-title">视频内容介绍</view>
...@@ -38,7 +21,10 @@ ...@@ -38,7 +21,10 @@
v-for="(item, key) in courseOutlines[courseId]" v-for="(item, key) in courseOutlines[courseId]"
:key="key" :key="key"
> --> > -->
<view class="learn-list-item">{{ item }}</view> <!-- <view class="learn-list-item">{{ item }}</view> -->
<view class="u-content">
<u-parse :html="CourseSectionlist.content"></u-parse>
</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -47,16 +33,15 @@ ...@@ -47,16 +33,15 @@
<view class="title"> <view class="title">
{{CourseSectionlist.name}} {{CourseSectionlist.name}}
</view> </view>
<view class="content" v-html="CourseSectionlist.content"> <view class="u-content">
{{CourseSectionlist.content}} <u-parse :html="CourseSectionlist.content"></u-parse>
</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
let app = getApp(); let app = getApp();
export default { export default {
data() { data() {
return { return {
courseId: "", courseId: "",
...@@ -65,24 +50,18 @@ export default { ...@@ -65,24 +50,18 @@ export default {
courseTitle: "", courseTitle: "",
courseDesc: "", courseDesc: "",
currentIndex: -1, // 第几个视频 currentIndex: -1, // 第几个视频
section_id:0, section_id: 0,
isShowVideo: false, isShowVideo: false,
CourseSectionlist: {},//节信息 CourseSectionlist: {}, //节信息
playerOptions : { playerOptions: {
playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度 playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
autoplay: false, //如果true,浏览器准备好时开始回放。 autoplay: true, //如果true,浏览器准备好时开始回放。
muted: false, // 默认情况下将会消除任何音频。 muted: false, // 默认情况下将会消除任何音频。
loop: false, // 导致视频一结束就重新开始。 loop: false, // 导致视频一结束就重新开始。
preload: 'auto', preload: 'auto',
language: 'zh-CN', language: 'zh-CN',
aspectRatio: '16:9', aspectRatio: '16:9',
fluid: true, fluid: true,
// sources: [{
// type: "",
// src: "" //url地址
// }],
// poster: "../../static/images/test.jpg", //你的封面地址
// width: document.documentElement.clientWidth,
notSupportedMessage: '此视频暂无法播放,请稍后再试', notSupportedMessage: '此视频暂无法播放,请稍后再试',
controlBar: { controlBar: {
timeDivider: true, timeDivider: true,
...@@ -93,9 +72,9 @@ export default { ...@@ -93,9 +72,9 @@ export default {
}, },
gklog: '', gklog: '',
videoTotalTime: 0, videoTotalTime: 0,
howTimeToUpdateLearnedStatus: 5,//设置几秒提交一次状态 howTimeToUpdateLearnedStatus: 5, //设置几秒提交一次状态
status: 1,//是否已学习默认1已学习 status: 1, //是否已学习默认1已学习
howLongIsLearned: this.videoTotalTime/2,//默认设置观看1/2就是已学 howLongIsLearned: this.videoTotalTime / 2, //默认设置观看1/2就是已学
}; };
}, },
computed: { computed: {
...@@ -129,15 +108,17 @@ export default { ...@@ -129,15 +108,17 @@ export default {
}, },
}, },
onLoad(e) { onLoad(e) {
this.getCourseSection({section_id:e.section_id}) this.getCourseSection({
section_id: e.section_id
})
}, },
onReady: function (res) { onReady: function(res) {
// #ifndef MP-ALIPAY // #ifndef MP-ALIPAY
this.videoContext = uni.createVideoContext("courseVideo"); this.videoContext = uni.createVideoContext("courseVideo");
// #endif // #endif
}, },
methods: { methods: {
onPlayerTimeupdate (player) { onPlayerTimeupdate(player) {
console.log('-----onplay----'); console.log('-----onplay----');
console.log(player); console.log(player);
let intCurrentTime = parseInt(player.detail.currentTime); let intCurrentTime = parseInt(player.detail.currentTime);
...@@ -145,13 +126,13 @@ export default { ...@@ -145,13 +126,13 @@ export default {
this.gklog = intCurrentTime; this.gklog = intCurrentTime;
console.log(' onPlayerTimeupdate!', this.gklog) console.log(' onPlayerTimeupdate!', this.gklog)
}, },
videoErrorCallback: function (e) { videoErrorCallback: function(e) {
uni.showModal({ uni.showModal({
content: e.target.errMsg, content: e.target.errMsg,
showCancel: false, showCancel: false,
}); });
}, },
getRandomColor: function () { getRandomColor: function() {
const rgb = []; const rgb = [];
for (let i = 0; i < 3; ++i) { for (let i = 0; i < 3; ++i) {
let color = Math.floor(Math.random() * 256).toString(16); let color = Math.floor(Math.random() * 256).toString(16);
...@@ -160,13 +141,13 @@ export default { ...@@ -160,13 +141,13 @@ export default {
} }
return "#" + rgb.join(""); 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)) {
return return
} }
this.changeCourseStatus(); this.changeCourseStatus();
}, },
playerReadied (player) { playerReadied(player) {
console.log('i go to playerReadied gklog:' + this.gklog) console.log('i go to playerReadied gklog:' + this.gklog)
player.currentTime(this.gklog) player.currentTime(this.gklog)
}, },
...@@ -202,7 +183,7 @@ export default { ...@@ -202,7 +183,7 @@ export default {
console.log(this.CourseSectionlist) console.log(this.CourseSectionlist)
let wareVal = this.CourseSectionlist.ware; let wareVal = this.CourseSectionlist.ware;
this.isShowVideo = wareVal == "0"; this.isShowVideo = wareVal == "0";
if(this.isShowVideo){ if (this.isShowVideo) {
let coureWareList = res.data.courseware; let coureWareList = res.data.courseware;
this.courseSrc = coureWareList[0].src; this.courseSrc = coureWareList[0].src;
this.videoTotalTime = parseInt(JSON.parse(coureWareList[0].info).time); this.videoTotalTime = parseInt(JSON.parse(coureWareList[0].info).time);
...@@ -210,6 +191,7 @@ export default { ...@@ -210,6 +191,7 @@ export default {
this.courseTitle = res.data.name; this.courseTitle = res.data.name;
this.courseDesc = res.data.content; this.courseDesc = res.data.content;
this.section_id = res.data.id; this.section_id = res.data.id;
this.section_content = res.data.content;
} }
} }
} }
...@@ -223,32 +205,31 @@ export default { ...@@ -223,32 +205,31 @@ export default {
}); });
}); });
}, },
updateLearnedStatus(nowLength) { updateLearnedStatus(nowTime) {
if(this.gklog != nowLength && nowLength%this.howTimeToUpdateLearnedStatus == 0){ if (this.gklog != nowTime && nowTime % this.howTimeToUpdateLearnedStatus == 0) {
if(nowLength < this.howLongIsLearned){ if (nowTime < this.howLongIsLearned) {
this.status = 0; this.status = 0;
}else{ } else {
this.status = 1; this.status = 1;
console.log('--已学习--'); console.log('--大于规定时间标记为已学习--');
} }
//大于
let param = { let param = {
section_id: this.section_id, section_id: this.section_id,
video_time: nowLength, video_time: nowTime,
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:' + nowLength); console.log('--' + this.howTimeToUpdateLearnedStatus + '更新一次观看状态--time:' + nowTime);
}); });
} }
} }
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.learn-vedio { .learn-vedio {
background-color: #f4f5f7; background-color: #f4f5f7;
position: absolute; position: absolute;
top: 0; top: 0;
...@@ -257,37 +238,37 @@ export default { ...@@ -257,37 +238,37 @@ export default {
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow-y:auto; overflow-y: auto;
} }
.course-video { .course-video {
width: 100%; width: 100%;
} }
.course-title { .course-title {
font-size: 36rpx; font-size: 36rpx;
font-weight: 700; font-weight: 700;
padding: 80rpx 60rpx 40rpx 60rpx; padding: 40rpx 40rpx 10rpx 40rpx;
} }
.title { .title {
font-weight: 700; font-weight: 700;
font-family: Medium,Helvetica Neue,Helvetica,Arial,sans-serif; font-family: Medium, Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 77rpx; font-size: 77rpx;
color: #333; color: #333;
padding: 80rpx 60rpx 40rpx 60rpx; padding: 80rpx 60rpx 40rpx 60rpx;
} }
.content { .content {
padding: 40rpx 30rpx; padding: 40rpx 30rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.course-desc { .course-desc {
margin-left: 60rpx; margin-left: 60rpx;
} }
.title-content { .title-content {
padding: 40rpx 30rpx; padding: 40rpx 30rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
background-color: #ffffff; background-color: #ffffff;
...@@ -307,6 +288,7 @@ export default { ...@@ -307,6 +288,7 @@ export default {
margin-right: 20rpx; margin-right: 20rpx;
line-height: 24rpx; line-height: 24rpx;
position: relative; position: relative;
.item-st-text { .item-st-text {
color: #ffffff; color: #ffffff;
position: absolute; position: absolute;
...@@ -322,19 +304,19 @@ export default { ...@@ -322,19 +304,19 @@ export default {
font-size: 44rpx; font-size: 44rpx;
font-weight: bold; font-weight: bold;
} }
} }
.item-content { .item-content {
display: flex; display: flex;
padding-bottom: 30rpx; padding-bottom: 30rpx;
} }
.item-title { .item-title {
color: #333333; color: #333333;
font-size: 28rpx; font-size: 28rpx;
} }
.learn-view { .learn-view {
background-color: #ffffff; background-color: #ffffff;
border-radius: 12rpx; border-radius: 12rpx;
padding: 38rpx 30rpx 30rpx 30rpx; padding: 38rpx 30rpx 30rpx 30rpx;
...@@ -347,6 +329,7 @@ export default { ...@@ -347,6 +329,7 @@ export default {
font-weight: bold; font-weight: bold;
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.learn-list { .learn-list {
.learn-list-item { .learn-list-item {
font-size: 28rpx; font-size: 28rpx;
...@@ -361,5 +344,11 @@ export default { ...@@ -361,5 +344,11 @@ export default {
width: 100%; width: 100%;
} }
} }
} }
.u-content {
// margin-top: 10rpx;
padding: 40rpx 30rpx;
margin-bottom: 20rpx;
}
</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