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

学习-页面调整

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