提交 3de7dbba authored 作者: lhh's avatar lhh

增加看课时间

上级 13d1edae
...@@ -10,7 +10,7 @@ import tool from '@tool' ...@@ -10,7 +10,7 @@ import tool from '@tool'
export default class CourseAction extends BaseACTION { export default class CourseAction extends BaseACTION {
/* 获取学期分类信息 */ /* 获取学期分类信息 */
getLearnFind () { getLearnFind() {
return Course.getLearnFind().then(data => { return Course.getLearnFind().then(data => {
data = data || [] data = data || []
let json = [{ val: '-1', name: this.getVueInstance().$t('action.courseAction.all') }] let json = [{ val: '-1', name: this.getVueInstance().$t('action.courseAction.all') }]
...@@ -27,7 +27,7 @@ export default class CourseAction extends BaseACTION { ...@@ -27,7 +27,7 @@ export default class CourseAction extends BaseACTION {
} }
/* 获取所有课程列表 - 选课广场 和 我的课程 共用同一个,通过 isMy判断 */ /* 获取所有课程列表 - 选课广场 和 我的课程 共用同一个,通过 isMy判断 */
getCourseList (isMy, param) { getCourseList(isMy, param) {
const _vIn = this.getVueInstance() const _vIn = this.getVueInstance()
/** /**
* 区别: * 区别:
...@@ -41,9 +41,14 @@ export default class CourseAction extends BaseACTION { ...@@ -41,9 +41,14 @@ export default class CourseAction extends BaseACTION {
const _cur = data[i].curriculum const _cur = data[i].curriculum
/* 课程类型 */ /* 课程类型 */
const _type = cur.course_type const _type = cur.course_type
const str1 = _type === 1 ? _vIn.$t('action.courseAction.mustLearn') const str1 =
: (_type === 2 ? _vIn.$t('action.courseAction.changeLearn') _type === 1
: (_type === 3 ? _vIn.$t('action.courseAction.repeatLearn') : '')) ? _vIn.$t('action.courseAction.mustLearn')
: _type === 2
? _vIn.$t('action.courseAction.changeLearn')
: _type === 3
? _vIn.$t('action.courseAction.repeatLearn')
: ''
json.push({ json.push({
id: cur.course_id, id: cur.course_id,
sid: cur.semester_id, sid: cur.semester_id,
...@@ -52,8 +57,12 @@ export default class CourseAction extends BaseACTION { ...@@ -52,8 +57,12 @@ export default class CourseAction extends BaseACTION {
arrTab: [str1, cur.semester_name], arrTab: [str1, cur.semester_name],
status: _cur.is_enabled ? _vIn.$t('action.courseAction.publish') : _vIn.$t('action.courseAction.noPublish'), status: _cur.is_enabled ? _vIn.$t('action.courseAction.publish') : _vIn.$t('action.courseAction.noPublish'),
time: cur.begin_date.split(' ')[0] + _vIn.$t('action.courseAction.to') + cur.end_date.split(' ')[0], time: cur.begin_date.split(' ')[0] + _vIn.$t('action.courseAction.to') + cur.end_date.split(' ')[0],
myStatus: cur.selected !== 0 ? (cur.score ? (_vIn.$t('action.courseAction.totalScore') + cur.score) : _vIn.$t('action.courseAction.alreadyChange')) myStatus:
: _vIn.$t('action.courseAction.noChange'), cur.selected !== 0
? cur.score
? _vIn.$t('action.courseAction.totalScore') + cur.score
: _vIn.$t('action.courseAction.alreadyChange')
: _vIn.$t('action.courseAction.noChange'),
progress: cur.video_progress, progress: cur.video_progress,
course_type: cur.course_type course_type: cur.course_type
}) })
...@@ -64,16 +73,21 @@ export default class CourseAction extends BaseACTION { ...@@ -64,16 +73,21 @@ export default class CourseAction extends BaseACTION {
} }
/* 获取某个课程详细信息 - 课程考核 和 课程讨论单独获取 */ /* 获取某个课程详细信息 - 课程考核 和 课程讨论单独获取 */
getCourseDetail (cid, sid) { getCourseDetail(cid, sid) {
const _vIn = this.getVueInstance() const _vIn = this.getVueInstance()
return Course.getCourseDetail(cid, sid).then(data => { return Course.getCourseDetail(cid, sid).then(data => {
const cur = data const cur = data
const _cur = cur.curriculum const _cur = cur.curriculum
/* 课程类型 */ /* 课程类型 */
const _type = cur.course_type const _type = cur.course_type
const str1 = _type === 1 ? _vIn.$t('action.courseAction.mustLearn') const str1 =
: (_type === 2 ? _vIn.$t('action.courseAction.changeLearn') _type === 1
: (_type === 3 ? _vIn.$t('action.courseAction.repeatLearn') : '')) ? _vIn.$t('action.courseAction.mustLearn')
: _type === 2
? _vIn.$t('action.courseAction.changeLearn')
: _type === 3
? _vIn.$t('action.courseAction.repeatLearn')
: ''
const json = { const json = {
headerInfo: { headerInfo: {
isStart: !!cur.selected, // 是否为开始学习按钮 或者 选课按钮 isStart: !!cur.selected, // 是否为开始学习按钮 或者 选课按钮
...@@ -105,7 +119,7 @@ export default class CourseAction extends BaseACTION { ...@@ -105,7 +119,7 @@ export default class CourseAction extends BaseACTION {
unit: item.lecturer_title || '' unit: item.lecturer_title || ''
}) })
} }
const findChapter = function (id, list) { const findChapter = function(id, list) {
for (const item of list) { for (const item of list) {
if (item.resource_id === id) { if (item.resource_id === id) {
return item return item
...@@ -140,12 +154,23 @@ export default class CourseAction extends BaseACTION { ...@@ -140,12 +154,23 @@ export default class CourseAction extends BaseACTION {
__.live.live_status = parseInt(__.live.live_status) __.live.live_status = parseInt(__.live.live_status)
let str = '' let str = ''
switch (__.live.live_status) { switch (__.live.live_status) {
case 1: str = _vIn.$t('live.notStarted'); break case 1:
case 2: str = _vIn.$t('live.liveStreaming'); break str = _vIn.$t('live.notStarted')
case 3: str = _vIn.$t('live.liveEnd'); break break
case 4: str = _vIn.$t('live.start'); break case 2:
case 5: str = _vIn.$t('live.liveEnd'); break str = _vIn.$t('live.liveStreaming')
default: str = _vIn.$t('live.notStarted') break
case 3:
str = _vIn.$t('live.liveEnd')
break
case 4:
str = _vIn.$t('live.start')
break
case 5:
str = _vIn.$t('live.liveEnd')
break
default:
str = _vIn.$t('live.notStarted')
} }
// 5分钟内显示“即将开始”,5~1小时内“N分钟后开始”,1~24小时内“N小时后开始”,1天以上“N天后开始”天就显示年月日 // 5分钟内显示“即将开始”,5~1小时内“N分钟后开始”,1~24小时内“N小时后开始”,1天以上“N天后开始”天就显示年月日
if (__.live.live_status === 1 && __.live.start_time) { if (__.live.live_status === 1 && __.live.start_time) {
...@@ -155,7 +180,10 @@ export default class CourseAction extends BaseACTION { ...@@ -155,7 +180,10 @@ export default class CourseAction extends BaseACTION {
} else if (time <= 1 * 60 * 60) { } else if (time <= 1 * 60 * 60) {
str = _vIn.$t('live.startInMinutes', { minutes: parseInt(time / 60) }) str = _vIn.$t('live.startInMinutes', { minutes: parseInt(time / 60) })
} else if (time <= 24 * 60 * 60) { } else if (time <= 24 * 60 * 60) {
str = _vIn.$t('live.startInHours', { h: parseInt(time / (60 * 60)), min: parseInt(time / 60 % 60) }) str = _vIn.$t('live.startInHours', {
h: parseInt(time / (60 * 60)),
min: parseInt((time / 60) % 60)
})
} else { } else {
str = _vIn.$t('live.startInDay', { day: parseInt(time / (24 * 60 * 60)) }) str = _vIn.$t('live.startInDay', { day: parseInt(time / (24 * 60 * 60)) })
} }
...@@ -246,7 +274,7 @@ export default class CourseAction extends BaseACTION { ...@@ -246,7 +274,7 @@ export default class CourseAction extends BaseACTION {
} }
/* 获取课程考核信息 */ /* 获取课程考核信息 */
getCourseAssess (cid, sid) { getCourseAssess(cid, sid) {
const _vIn = this.getVueInstance() const _vIn = this.getVueInstance()
return Course.getCourseAssess(cid, sid).then(data => { return Course.getCourseAssess(cid, sid).then(data => {
const cur = data const cur = data
...@@ -259,7 +287,7 @@ export default class CourseAction extends BaseACTION { ...@@ -259,7 +287,7 @@ export default class CourseAction extends BaseACTION {
tempArr.push({ tempArr.push({
name: __.title, name: __.title,
time: (__.duration && tool.convertTime.durationToTimeString(__.duration)) || '00:00', time: (__.duration && tool.convertTime.durationToTimeString(__.duration)) || '00:00',
progress: (__.progress && (__.progress + '%')) || '0%', progress: (__.progress && __.progress + '%') || '0%',
id: __.id id: __.id
}) })
} }
...@@ -305,7 +333,7 @@ export default class CourseAction extends BaseACTION { ...@@ -305,7 +333,7 @@ export default class CourseAction extends BaseACTION {
} }
/* 选课 */ /* 选课 */
selectCourse (cid, sid) { selectCourse(cid, sid) {
return Course.selectCourse(cid, sid).then(res => { return Course.selectCourse(cid, sid).then(res => {
// callback(res) // 可以不使用callback 因为使用then // callback(res) // 可以不使用callback 因为使用then
return res return res
...@@ -313,10 +341,17 @@ export default class CourseAction extends BaseACTION { ...@@ -313,10 +341,17 @@ export default class CourseAction extends BaseACTION {
} }
/* 退课 */ /* 退课 */
outSelectCourse (cid, sid) { outSelectCourse(cid, sid) {
return Course.outSelectCourse(cid, sid).then(res => { return Course.outSelectCourse(cid, sid).then(res => {
// callback(res) // 可以不使用callback 因为使用then // callback(res) // 可以不使用callback 因为使用then
return res return res
}) })
} }
/* 获取时间 */
getValidityTime() {
return Course.getValidityTime().then(res => {
return res
})
}
} }
...@@ -31,4 +31,8 @@ export default class CourseAPI extends BaseAPI { ...@@ -31,4 +31,8 @@ export default class CourseAPI extends BaseAPI {
* @param {[string]} cid * @param {[string]} cid
*/ */
outSelectCourse = (cid, sid) => this.post('/api/lms-ep/v2/education/courses/drop', { course_id: cid }) outSelectCourse = (cid, sid) => this.post('/api/lms-ep/v2/education/courses/drop', { course_id: cid })
/**
* 获取学期分类信息
*/
getValidityTime = () => this.get('/api/lms-ep/v2/education/course-validity-time')
} }
...@@ -10,14 +10,13 @@ ...@@ -10,14 +10,13 @@
<!-- <div class="con-title">{{ $t('pages.learn.course.title') }}</div> --> <!-- <div class="con-title">{{ $t('pages.learn.course.title') }}</div> -->
<div class="tab-box"> <div class="tab-box">
<template v-for="(item, index) in find"> <template v-for="(item, index) in find">
<div class="tap-box" :key="index"> <div class="tap-box">
<div class="name">{{ item.name }}</div> <div class="name">{{ item.name }}</div>
<ul> <ul>
<template v-for="(item1, index1) in item.arrItem"> <template v-for="(item1, index1) in item.arrItem">
<li <li
:class="['tab', item.selectIndex == index1 ? 'active' : '']" :class="['tab', item.selectIndex == index1 ? 'active' : '']"
@click="selFindSelect" @click="selFindSelect"
:key="index1"
:data-index="index1" :data-index="index1"
:data-i="index" :data-i="index"
:data-key="item.key" :data-key="item.key"
...@@ -28,6 +27,7 @@ ...@@ -28,6 +27,7 @@
</template> </template>
</ul> </ul>
</div> </div>
<div class="tips" style="margin-top: 20px;font-size: 16px;">您的课程有效期为:{{ time }},请在有效期内观看回放视频。</div>
</template> </template>
</div> </div>
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<div class="con-box" v-loading="loading"> <div class="con-box" v-loading="loading">
<ul class="course-list"> <ul class="course-list">
<template v-for="(item, index) in homeList"> <template v-for="(item, index) in homeList">
<li v-bind:key="index" class="item"> <li class="item">
<div class="left-pic"> <div class="left-pic">
<img :src="item.src" @click="goCourseContent(item)" v-if="item.src" /> <img :src="item.src" @click="goCourseContent(item)" v-if="item.src" />
<template v-else> <template v-else>
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<div class="title" @click="goCourseContent(item)">{{ item.title }}</div> <div class="title" @click="goCourseContent(item)">{{ item.title }}</div>
<div class="tags"> <div class="tags">
<template v-for="(item1, index) in item.arrTab"> <template v-for="(item1, index) in item.arrTab">
<span v-bind:key="index">{{ item1 }}</span> <span>{{ item1 }}</span>
</template> </template>
</div> </div>
<!-- <div class="time"> <!-- <div class="time">
...@@ -106,6 +106,7 @@ export default { ...@@ -106,6 +106,7 @@ export default {
data() { data() {
UserInfo = window.G.UserInfo.student_info || {} UserInfo = window.G.UserInfo.student_info || {}
return { return {
time: '',
userInfo: {}, userInfo: {},
filter: { filter: {
studyEarly: 'down', studyEarly: 'down',
...@@ -153,6 +154,11 @@ export default { ...@@ -153,6 +154,11 @@ export default {
// this.find[0].arrItem = data // this.find[0].arrItem = data
// }).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() }) // }).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
this.getAjaxList(true, this.$t('pages.learn.course.noFitCourseStr')) this.getAjaxList(true, this.$t('pages.learn.course.noFitCourseStr'))
cAction.Course.getValidityTime().then(res => {
if (res.code === 0) {
this.time = `${res.data['2']} - ${res.data['3']}`
}
})
}, },
destroyed() { destroyed() {
if (this.timeInterval) { if (this.timeInterval) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论