Commit 7e136524 authored by Damon's avatar Damon
parents 40dcf1e5 58d2a288
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
</u-navbar> </u-navbar>
<view class="mine-content"> <view class="mine-content">
<view class="header-view"> <view class="header-view">
<view :class="['head-image', {'has-image': avatar}]"> <view class="head-image">
<u-avatar :src="headImageUrl" :size="headSize" mode="circle"></u-avatar> <image :style="headImageStyle" :src="headImageUrl"></image>
</view> </view>
<view class="header-content"> <view class="header-content">
<view class="name-view" @click="handleClickName">{{name || "点击登录"}}</view> <view class="name-view" @click="handleClickName">{{name || "点击登录"}}</view>
...@@ -121,6 +121,9 @@ ...@@ -121,6 +121,9 @@
placeholderImage() { placeholderImage() {
return this.qnPath + 'touxiang.png' return this.qnPath + 'touxiang.png'
}, },
headImageStyle() {
return this.avatar ? 'width:136rpx; height:136rpx;border-radius:68rpx' : 'width:144rpx; height:144rpx;border-radius:72rpx'
},
headSize() { headSize() {
return this.avatar ? 136 : 144 return this.avatar ? 136 : 144
} }
...@@ -192,11 +195,9 @@ ...@@ -192,11 +195,9 @@
height: 144rpx; height: 144rpx;
background-color: #FFFFFF; background-color: #FFFFFF;
border-radius: 72rpx; border-radius: 72rpx;
display: flex;
&.has-image { align-items: center;
// border: 4rpx solid #FFFFFF; justify-content: center;
padding: 4rpx;
}
} }
.header-content { .header-content {
......
...@@ -411,7 +411,8 @@ export default { ...@@ -411,7 +411,8 @@ export default {
console.log( console.log(
"endTime:" + this.endTime, "endTime:" + this.endTime,
"everyTime:" + this.everyTime, "everyTime:" + this.everyTime,
"currentTime:" + this.currentTime "currentTime:" + this.currentTime,
"答案:" + this.userAnswerIds
); );
} else { } else {
clearTimeout(this.timer); clearTimeout(this.timer);
...@@ -563,7 +564,8 @@ export default { ...@@ -563,7 +564,8 @@ export default {
} else { } else {
// if(this.userAnswerIds.length == 1) // if(this.userAnswerIds.length == 1)
this.userAnswerIds = this.userAnswerIds =
item.id + "," + this.userAnswerIds; this.userAnswerIds + "," + item.id;
console.log(this.userAnswerIds, "答案答案");
} }
//*/ //*/
} else { } else {
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<view class="scroll_box"> <view class="scroll_box">
<scroll-view scroll-x @scroll="scroll" :scroll-left="scrollValue"> <scroll-view scroll-x @scroll="scroll" :scroll-left="scrollValue">
<view class="item_list" :class="{'item_list_active': item.isActive}" <view class="item_list" :class="{'item_list_active': item.isActive}"
v-for="(item, index) in sectionList" :key="index" @click="goNext(item, $event)"> v-for="(item, index) in sectionList" :key="index" @click="goNext(item)">
<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 }}
...@@ -93,13 +93,14 @@ ...@@ -93,13 +93,14 @@
}, },
gklog: '', gklog: '',
videoTotalTime: 0, videoTotalTime: 0,
howTimeToUpdateLearnedStatus: 10, //设置几秒提交一次状态 howTimeToUpdateLearnedStatus: 5, //设置几秒提交一次状态
status: 1, //是否已学习默认1已学习 status: 0, //是否已学习默认1已学习
isLearned: false, //默认设置观看1/2就是已学 isLearned: false, //默认设置观看1/2就是已学
old: { old: {
scrollTop: null scrollTop: null
}, },
scrollValue: 0 scrollValue: 0,
nowTime: 0
}; };
}, },
computed: { computed: {
...@@ -110,10 +111,10 @@ ...@@ -110,10 +111,10 @@
onLoad(e) { onLoad(e) {
this.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.getCapterDetails()
this.getSectionInfo({ this.getSectionInfo({
section_id: e.section_id section_id: e.section_id
}) })
this.getCapterDetails()
}, },
onReady: function(res) { onReady: function(res) {
this.videoContext = uni.createVideoContext("courseVideo"); this.videoContext = uni.createVideoContext("courseVideo");
...@@ -124,7 +125,10 @@ ...@@ -124,7 +125,10 @@
console.log(e) console.log(e)
this.old.scrollTop = e.detail.scrollTop this.old.scrollTop = e.detail.scrollTop
}, },
goNext(info, e) { goNext(info) {
if(this.status == 1){
console.log('已学');
}
//切换成下一个 //切换成下一个
this.getSectionInfo({ this.getSectionInfo({
section_id: info.id section_id: info.id
...@@ -170,6 +174,42 @@ ...@@ -170,6 +174,42 @@
playerReadied(player) { playerReadied(player) {
player.currentTime(this.gklog) player.currentTime(this.gklog)
}, },
//获取章节详情
getCapterDetails() {
let that = this
this.$u.api
.ChapterDetails(this.params)
.then((res) => {
if (res.code != 200) {
uni.showToast({
title: res.message,
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) => {
uni.showToast({
title: err,
icon: "none"
})
that.isLoadMore = false
if (that.params.start > 0) {
that.page -= 5
}
})
},
getSectionInfo(param) { getSectionInfo(param) {
this.$u.api this.$u.api
.CourseSection(param) .CourseSection(param)
...@@ -184,6 +224,7 @@ ...@@ -184,6 +224,7 @@
this.sectionInfo = res.data this.sectionInfo = res.data
console.log("----节信息----") console.log("----节信息----")
console.log(this.sectionInfo) console.log(this.sectionInfo)
this.nextSectionId = this.sectionInfo.nextSectionId
let wareVal = this.sectionInfo.ware let wareVal = this.sectionInfo.ware
this.courseTitle = res.data.name this.courseTitle = res.data.name
this.courseDesc = res.data.content.replace(/<p.*?>|<\/p>/ig, "") this.courseDesc = res.data.content.replace(/<p.*?>|<\/p>/ig, "")
...@@ -193,11 +234,10 @@ ...@@ -193,11 +234,10 @@
this.teacherImage = res.data.teachers[0].avatar this.teacherImage = res.data.teachers[0].avatar
this.teacherIntro = res.data.teachers[0].intro.replace(/<.*?>|<\/.*?>/ig, "") this.teacherIntro = res.data.teachers[0].intro.replace(/<.*?>|<\/.*?>/ig, "")
this.params.course_id = res.data.course_id this.params.course_id = res.data.course_id
this.nextSectionId = this.sectionInfo.nextSectionId
if (wareVal == "0") { if (wareVal == "0") {
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) - 1;
console.log('视频时长信息:' + this.videoTotalTime) console.log('视频时长信息:' + this.videoTotalTime)
} }
} }
...@@ -210,61 +250,27 @@ ...@@ -210,61 +250,27 @@
}) })
}, },
updateLearnedStatus(nowTime) { updateLearnedStatus(nowTime) {
if (this.gklog != nowTime && nowTime % this.howTimeToUpdateLearnedStatus == 0) {
let howLongIsLearned = parseInt(this.videoTotalTime / 2)
if (nowTime < howLongIsLearned) {
this.status = 0
} else if (this.isLearned) {
return
} else {
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) => {}).catch((err) => { nowTime = parseInt(nowTime);
console.log(err) if(nowTime == this.nowTime){
}); return
}
},
//获取章节详情
getCapterDetails() {
let that = this
this.$u.api
.ChapterDetails(this.params)
.then((res) => {
if (res.code != 200) {
uni.showToast({
title: res.message,
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() this.nowTime = nowTime;
if(this.status == 1 || nowTime < 5){
return
} }
}) if(nowTime == this.videoTotalTime){
.catch((err) => { param.status = this.status = 1
uni.showToast({ }else if(nowTime % this.howTimeToUpdateLearnedStatus != 0){
title: err, return
icon: "none"
})
that.isLoadMore = false
if (that.params.start > 0) {
that.page -= 5
} }
}) this.$u.api.updateLearnCourses(param).then((res) => {}).catch((err) => {
console.log(err)
});
}, },
}, },
} }
......
...@@ -104,12 +104,15 @@ ...@@ -104,12 +104,15 @@
}, },
onLoad(e) {}, onLoad(e) {},
onShow() { onShow() {
/** 测试提了bug:ID1001079【首页-入驻-在线签约】:输入好各个字段信息,切换到其他APP再切换回来,会把已填的信息自动清空
不知道这一段当初为什么加,就屏蔽了
const refs = this.$refs const refs = this.$refs
this.$nextTick(() => { this.$nextTick(() => {
if (refs['radio'] && refs['radio'].length > 0) { if (refs['radio'] && refs['radio'].length > 0) {
refs['radio'][0].setRadioCheckedStatus() refs['radio'][0].setRadioCheckedStatus()
} }
}) })
*/
this.startCounting() this.startCounting()
this.getBaseInfo() this.getBaseInfo()
......
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