Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online-pc
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online-pc
Commits
a6fb699d
提交
a6fb699d
authored
4月 28, 2021
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
升级V3接口
上级
76e6d010
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
147 行增加
和
104 行删除
+147
-104
CourseAction.js
src/action/CourseAction.js
+1
-1
course.js
src/api/course.js
+1
-1
course_api.js
src/api/course_api.js
+1
-1
api.js
src/modules/viewer/api.js
+10
-2
chapterRead.vue
src/modules/viewer/components/read/chapterRead.vue
+23
-7
chapterTest.vue
src/modules/viewer/components/work/chapterTest.vue
+27
-41
chapterWork.vue
src/modules/viewer/components/work/chapterWork.vue
+32
-49
index.vue
src/modules/viewer/components/work/index.vue
+52
-2
没有找到文件。
src/action/CourseAction.js
浏览文件 @
a6fb699d
...
@@ -40,7 +40,7 @@ export default class CourseAction extends BaseACTION {
...
@@ -40,7 +40,7 @@ export default class CourseAction extends BaseACTION {
const
cur
=
data
[
i
]
const
cur
=
data
[
i
]
const
_cur
=
data
[
i
].
curriculum
const
_cur
=
data
[
i
].
curriculum
/* 课程类型 */
/* 课程类型 */
const
_type
=
cur
.
course_type
const
_type
=
parseInt
(
cur
.
course_type
)
const
str1
=
_type
===
1
?
_vIn
.
$t
(
'action.courseAction.mustLearn'
)
const
str1
=
_type
===
1
?
_vIn
.
$t
(
'action.courseAction.mustLearn'
)
:
(
_type
===
2
?
_vIn
.
$t
(
'action.courseAction.changeLearn'
)
:
(
_type
===
2
?
_vIn
.
$t
(
'action.courseAction.changeLearn'
)
:
(
_type
===
3
?
_vIn
.
$t
(
'action.courseAction.repeatLearn'
)
:
''
))
:
(
_type
===
3
?
_vIn
.
$t
(
'action.courseAction.repeatLearn'
)
:
''
))
...
...
src/api/course.js
浏览文件 @
a6fb699d
...
@@ -8,7 +8,7 @@ const httpRequest = new BaseAPI(webConf)
...
@@ -8,7 +8,7 @@ const httpRequest = new BaseAPI(webConf)
* @param {string} courseId 课程ID
* @param {string} courseId 课程ID
*/
*/
export
function
getCourse
(
semesterId
,
courseId
)
{
export
function
getCourse
(
semesterId
,
courseId
)
{
return
httpRequest
.
get
(
`/api/lms/v
2
/education/courses/
${
semesterId
}
/
${
courseId
}
`
)
return
httpRequest
.
get
(
`/api/lms/v
3
/education/courses/
${
semesterId
}
/
${
courseId
}
`
)
}
}
/**
/**
...
...
src/api/course_api.js
浏览文件 @
a6fb699d
...
@@ -10,7 +10,7 @@ export default class CourseAPI extends BaseAPI {
...
@@ -10,7 +10,7 @@ export default class CourseAPI extends BaseAPI {
* @param {[string]} isMy
* @param {[string]} isMy
* @param {[object]} param
* @param {[object]} param
*/
*/
getCourseList
=
(
isMy
,
param
)
=>
this
.
get
(
'/api/lms/v
2
/education/courses'
+
(
isMy
?
'/my'
:
''
),
param
)
getCourseList
=
(
isMy
,
param
)
=>
this
.
get
(
'/api/lms/v
3
/education/courses'
+
(
isMy
?
'/my'
:
''
),
param
)
/**
/**
* 获取某个课程详细信息 - 课程考核 和 课程讨论单独获取
* 获取某个课程详细信息 - 课程考核 和 课程讨论单独获取
* @param {[string]} id
* @param {[string]} id
...
...
src/modules/viewer/api.js
浏览文件 @
a6fb699d
...
@@ -8,7 +8,7 @@ const httpRequest = new BaseAPI(webConf)
...
@@ -8,7 +8,7 @@ const httpRequest = new BaseAPI(webConf)
* @param {string} courseId 课程ID
* @param {string} courseId 课程ID
*/
*/
export
function
getCourse
(
semesterId
,
courseId
)
{
export
function
getCourse
(
semesterId
,
courseId
)
{
return
httpRequest
.
get
(
`/api/lms/v
2
/education/courses/
${
semesterId
}
/
${
courseId
}
`
)
return
httpRequest
.
get
(
`/api/lms/v
3
/education/courses/
${
semesterId
}
/
${
courseId
}
`
)
}
}
/**
/**
...
@@ -53,6 +53,14 @@ export function updateChapterVideoProgress(params) {
...
@@ -53,6 +53,14 @@ export function updateChapterVideoProgress(params) {
return
httpRequest
.
get
(
'/api/lms/v2/analytics/upload-video'
,
params
)
return
httpRequest
.
get
(
'/api/lms/v2/analytics/upload-video'
,
params
)
}
}
/**
* 获取章节阅读资料
* @param {string} resourseId 章节的资源ID
*/
export
function
getChapterReading
(
resourseId
)
{
return
httpRequest
.
get
(
`/api/lms/v3/education/reading/
${
resourseId
}
`
)
}
/**
/**
* 获取章节作业
* 获取章节作业
* @param {string} semesterId 学期ID
* @param {string} semesterId 学期ID
...
@@ -60,7 +68,7 @@ export function updateChapterVideoProgress(params) {
...
@@ -60,7 +68,7 @@ export function updateChapterVideoProgress(params) {
* @param {string} resourseId 章节的资源ID
* @param {string} resourseId 章节的资源ID
*/
*/
export
function
getChapterHomework
(
semesterId
,
courseId
,
resourseId
)
{
export
function
getChapterHomework
(
semesterId
,
courseId
,
resourseId
)
{
return
httpRequest
.
get
(
`/api/lms/v
2
/education/homeworks/
${
semesterId
}
/
${
courseId
}
/
${
resourseId
}
`
)
return
httpRequest
.
get
(
`/api/lms/v
3
/education/homeworks/
${
semesterId
}
/
${
courseId
}
/
${
resourseId
}
`
)
}
}
/**
/**
...
...
src/modules/viewer/components/read/chapterRead.vue
浏览文件 @
a6fb699d
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
// components
// components
import
Container
from
'../common/container.vue'
import
Container
from
'../common/container.vue'
import
FileList
from
'./fileList.vue'
import
FileList
from
'./fileList.vue'
import
*
as
api
from
'../../api'
// 章节阅读资料
// 章节阅读资料
export
default
{
export
default
{
...
@@ -30,15 +31,30 @@ export default {
...
@@ -30,15 +31,30 @@ export default {
}
}
}
}
},
},
data
()
{
return
{
files
:
[]
}
},
computed
:
{
computed
:
{
files
()
{
// 资源ID
const
reading
=
this
.
chapter
.
reading
resourceId
()
{
const
file
=
{
return
this
.
chapter
.
resource_id
file_name
:
reading
.
reading_content
,
file_url
:
reading
.
reading_attachment
}
return
[
file
]
}
}
},
methods
:
{
getChapterReading
()
{
api
.
getChapterReading
(
this
.
resourceId
).
then
(
response
=>
{
const
file
=
{
file_name
:
response
.
reading_content
,
file_url
:
response
.
reading_attachment
}
this
.
files
=
[
file
]
})
}
},
beforeMount
()
{
this
.
getChapterReading
()
}
}
}
}
</
script
>
</
script
>
src/modules/viewer/components/work/chapterTest.vue
浏览文件 @
a6fb699d
...
@@ -39,12 +39,8 @@ export default {
...
@@ -39,12 +39,8 @@ export default {
components
:
{
Container
,
ExamItem
},
components
:
{
Container
,
ExamItem
},
props
:
{
props
:
{
// 当前选中的章节
// 当前选中的章节
chapter
:
{
chapter
:
{
type
:
Object
,
default
:
()
=>
({})
},
type
:
Object
,
homework
:
{
type
:
Object
,
default
:
()
=>
({})
}
default
()
{
return
{}
}
}
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -57,11 +53,16 @@ export default {
...
@@ -57,11 +53,16 @@ export default {
}
}
},
},
watch
:
{
watch
:
{
chapter
:
{
homework
:
{
immediate
:
true
,
immediate
:
true
,
handler
(
data
)
{
handler
(
data
)
{
if
(
!
this
.
questions
.
length
)
{
const
{
questions
=
[],
answer
=
{}
}
=
data
this
.
questions
=
data
.
homework
?
this
.
genQuestions
(
data
.
homework
.
questions
)
:
[]
this
.
detail
=
answer
this
.
questions
=
this
.
genQuestions
(
questions
)
// 答案处理
const
parseAnswers
=
answer
.
work_contents
?
JSON
.
parse
(
answer
.
work_contents
)
:
[]
if
(
parseAnswers
&&
parseAnswers
.
length
)
{
this
.
setAnswers
(
parseAnswers
)
}
}
}
}
}
}
...
@@ -99,34 +100,6 @@ export default {
...
@@ -99,34 +100,6 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
// 获取测试答题详情
getDetail
()
{
this
.
loading
=
true
api
.
getChapterHomework
(
this
.
sid
,
this
.
cid
,
this
.
resourceId
)
.
then
(
response
=>
{
this
.
detail
=
Array
.
isArray
(
response
)
?
null
:
response
if
(
this
.
detail
)
{
const
parseAnswers
=
JSON
.
parse
(
this
.
detail
.
work_contents
)
// 设置答案
this
.
questions
=
this
.
questions
.
map
(
item
=>
{
const
found
=
parseAnswers
.
find
(
answer
=>
answer
.
question_id
===
item
.
id
)
if
(
found
)
{
const
selectedIds
=
found
.
options
.
reduce
((
result
,
item
)
=>
{
item
.
selected
&&
result
.
push
(
item
.
id
)
return
result
},
[])
item
.
user_answer
=
item
.
question_type
===
2
?
selectedIds
:
selectedIds
[
0
]
}
return
item
})
this
.
questions
=
this
.
genQuestions
(
this
.
questions
)
}
})
.
finally
(()
=>
{
this
.
loading
=
false
})
},
// 组装问题数据
// 组装问题数据
genQuestions
(
list
)
{
genQuestions
(
list
)
{
if
(
!
list
)
{
if
(
!
list
)
{
...
@@ -165,6 +138,22 @@ export default {
...
@@ -165,6 +138,22 @@ export default {
)
)
})
})
},
},
// 设置答案
setAnswers
(
parseAnswers
)
{
this
.
questions
=
this
.
questions
.
map
(
item
=>
{
const
found
=
parseAnswers
.
find
(
answer
=>
answer
.
question_id
===
item
.
id
)
if
(
found
)
{
const
selectedIds
=
found
.
options
.
reduce
((
result
,
item
)
=>
{
item
.
selected
&&
result
.
push
(
item
.
id
)
return
result
},
[])
item
.
user_answer
=
item
.
question_type
===
2
?
selectedIds
:
selectedIds
[
0
]
}
return
item
})
// 重新组装
this
.
questions
=
this
.
genQuestions
(
this
.
questions
)
},
// 提交校验
// 提交校验
checkSubmit
()
{
checkSubmit
()
{
const
questions
=
this
.
questions
const
questions
=
this
.
questions
...
@@ -245,7 +234,7 @@ export default {
...
@@ -245,7 +234,7 @@ export default {
.
sbumitChapterHomework
(
params
)
.
sbumitChapterHomework
(
params
)
.
then
(
response
=>
{
.
then
(
response
=>
{
if
(
response
.
status
)
{
if
(
response
.
status
)
{
this
.
getDetail
(
)
this
.
$emit
(
'update'
)
}
else
{
}
else
{
this
.
$message
.
error
(
response
.
data
.
error
)
this
.
$message
.
error
(
response
.
data
.
error
)
}
}
...
@@ -257,9 +246,6 @@ export default {
...
@@ -257,9 +246,6 @@ export default {
this
.
submitLoading
=
false
this
.
submitLoading
=
false
})
})
}
}
},
beforeMount
()
{
this
.
getDetail
()
}
}
}
}
</
script
>
</
script
>
...
...
src/modules/viewer/components/work/chapterWork.vue
浏览文件 @
a6fb699d
...
@@ -89,7 +89,7 @@
...
@@ -89,7 +89,7 @@
<
chapter
-
work
-
comment
<
chapter
-
work
-
comment
:
endDate
=
"commentEndDate"
:
endDate
=
"commentEndDate"
:
status
=
"detail.status2"
:
status
=
"detail.status2"
@
update
=
"getDetail
"
v
-
on
=
"$listeners
"
v
-
if
=
"showComment"
v
-
if
=
"showComment"
id
=
"comment"
id
=
"comment"
/>
/>
...
@@ -132,19 +132,10 @@ export default {
...
@@ -132,19 +132,10 @@ export default {
components
:
{
Container
,
ExamItem
,
ChapterWorkComment
}
,
components
:
{
Container
,
ExamItem
,
ChapterWorkComment
}
,
props
:
{
props
:
{
// 当前选中的
// 当前选中的
chapter
:
{
chapter
:
{
type
:
Object
,
default
:
()
=>
({
}
)
}
,
type
:
Object
,
default
()
{
return
{
}
}
}
,
// 课程详情接口返回的数据
// 课程详情接口返回的数据
data
:
{
data
:
{
type
:
Object
,
default
:
()
=>
({
}
)
}
,
type
:
Object
,
homework
:
{
type
:
Object
,
default
:
()
=>
({
}
)
}
default
()
{
return
{
}
}
}
}
,
}
,
data
()
{
data
()
{
return
{
return
{
...
@@ -167,11 +158,22 @@ export default {
...
@@ -167,11 +158,22 @@ export default {
}
}
}
,
}
,
watch
:
{
watch
:
{
chapter
:
{
homework
:
{
immediate
:
true
,
immediate
:
true
,
handler
(
data
)
{
handler
(
data
)
{
if
(
!
this
.
questions
.
length
)
{
const
{
questions
=
[],
answer
=
{
}
}
=
data
this
.
questions
=
data
.
homework
?
this
.
genQuestions
(
data
.
homework
.
questions
)
:
[]
this
.
questions
=
this
.
genQuestions
(
questions
)
this
.
detail
=
Array
.
isArray
(
answer
)
?
{
}
:
answer
if
(
(
this
.
detail
.
status
===
1
||
this
.
detail
.
status2
===
1
)
&&
!
([
-
1
,
-
2
].
includes
(
this
.
detail
.
status
)
||
[
-
1
,
-
2
].
includes
(
this
.
detail
.
status2
))
)
{
this
.
dialogVisible
=
true
}
// 答案处理
const
parseAnswers
=
answer
.
work_contents
?
JSON
.
parse
(
answer
.
work_contents
)
:
[]
if
(
parseAnswers
&&
parseAnswers
.
length
)
{
this
.
setAnswers
(
parseAnswers
)
}
}
}
}
}
}
...
@@ -251,37 +253,6 @@ export default {
...
@@ -251,37 +253,6 @@ export default {
this
.
commentEndDate
=
response
.
comment_end
this
.
commentEndDate
=
response
.
comment_end
}
)
}
)
}
,
}
,
// 获取详情
getDetail
()
{
this
.
loading
=
true
api
.
getChapterHomework
(
this
.
sid
,
this
.
cid
,
this
.
resourceId
)
.
then
(
response
=>
{
this
.
detail
=
Array
.
isArray
(
response
)
?
{
}
:
response
if
(
(
this
.
detail
.
status
===
1
||
this
.
detail
.
status2
===
1
)
&&
!
([
-
1
,
-
2
].
includes
(
this
.
detail
.
status
)
||
[
-
1
,
-
2
].
includes
(
this
.
detail
.
status2
))
)
{
this
.
dialogVisible
=
true
}
if
(
this
.
detail
.
id
)
{
const
parseAnswers
=
JSON
.
parse
(
this
.
detail
.
work_contents
)
// 设置答案
this
.
questions
=
this
.
questions
.
map
(
item
=>
{
const
found
=
parseAnswers
.
find
(
answer
=>
answer
.
question_id
===
item
.
id
)
if
(
found
)
{
item
.
user_answer
=
found
.
descreption
item
.
attachments
=
found
.
file_url
}
return
item
}
)
this
.
questions
=
this
.
genQuestions
(
this
.
questions
)
}
}
)
.
finally
(()
=>
{
this
.
loading
=
false
}
)
}
,
// 组装问题数据
// 组装问题数据
genQuestions
(
list
)
{
genQuestions
(
list
)
{
if
(
!
list
)
{
if
(
!
list
)
{
...
@@ -320,6 +291,19 @@ export default {
...
@@ -320,6 +291,19 @@ export default {
)
)
}
)
}
)
}
,
}
,
// 设置答案
setAnswers
(
parseAnswers
)
{
this
.
questions
=
this
.
questions
.
map
(
item
=>
{
const
found
=
parseAnswers
.
find
(
answer
=>
answer
.
question_id
===
item
.
id
)
if
(
found
)
{
item
.
user_answer
=
found
.
descreption
item
.
attachments
=
found
.
file_url
}
return
item
}
)
// 重新组装数据
this
.
questions
=
this
.
genQuestions
(
this
.
questions
)
}
,
// 提交校验
// 提交校验
checkSubmit
()
{
checkSubmit
()
{
let
result
=
true
let
result
=
true
...
@@ -385,7 +369,7 @@ export default {
...
@@ -385,7 +369,7 @@ export default {
.
then
(
response
=>
{
.
then
(
response
=>
{
if
(
response
.
status
)
{
if
(
response
.
status
)
{
this
.
$message
.
success
(
this
.
$t
(
'viewerWork.examSubmitSuccess'
))
this
.
$message
.
success
(
this
.
$t
(
'viewerWork.examSubmitSuccess'
))
this
.
getDetail
(
)
this
.
$emit
(
'update'
)
}
else
{
}
else
{
this
.
$message
.
error
(
response
.
data
.
error
)
this
.
$message
.
error
(
response
.
data
.
error
)
}
}
...
@@ -410,7 +394,6 @@ export default {
...
@@ -410,7 +394,6 @@ export default {
}
}
}
,
}
,
beforeMount
()
{
beforeMount
()
{
this
.
getDetail
()
this
.
getDeadline
()
this
.
getDeadline
()
}
}
}
}
...
...
src/modules/viewer/components/work/index.vue
浏览文件 @
a6fb699d
<
template
>
<
template
>
<component
:is=
"currentCompoent"
:chapter=
"chapter"
:data=
"data"
v-bind=
"$attrs"
v-on=
"$listeners"
v-if=
"chapter"
/>
<component
:is=
"currentCompoent"
:chapter=
"chapter"
:data=
"data"
:homework=
"homework"
@
update=
"getHomework"
v-bind=
"$attrs"
v-on=
"$listeners"
v-if=
"chapter"
v-loading=
"loading"
/>
</
template
>
</
template
>
<
script
>
<
script
>
// componets
// componets
import
ChapterWork
from
'./chapterWork.vue'
import
ChapterWork
from
'./chapterWork.vue'
import
ChapterTest
from
'./chapterTest.vue'
import
ChapterTest
from
'./chapterTest.vue'
import
*
as
api
from
'../../api'
export
default
{
export
default
{
name
:
'ViewerWork'
,
name
:
'ViewerWork'
,
...
@@ -26,15 +37,54 @@ export default {
...
@@ -26,15 +37,54 @@ export default {
}
}
}
}
},
},
data
()
{
return
{
loading
:
false
,
homework
:
{}
}
},
computed
:
{
computed
:
{
currentCompoent
()
{
currentCompoent
()
{
const
componentNames
=
{
const
componentNames
=
{
1
:
'ChapterTest'
,
// 课后测验
1
:
'ChapterTest'
,
// 课后测验
2
:
'ChapterWork'
// 作业
2
:
'ChapterWork'
// 作业
}
}
const
homework
=
this
.
chapter
.
homework
const
homework
=
this
.
homework
return
homework
?
componentNames
[
homework
.
work_type
]
:
''
return
homework
?
componentNames
[
homework
.
work_type
]
:
''
},
// 学期ID
sid
()
{
return
this
.
$route
.
params
.
sid
},
// 课程ID
cid
()
{
return
this
.
$route
.
params
.
cid
},
// 当前页面的ID
pid
()
{
return
this
.
$route
.
params
.
id
},
// 资源ID
resourceId
()
{
return
this
.
chapter
.
resource_id
}
},
methods
:
{
getHomework
()
{
this
.
loading
=
true
api
.
getChapterHomework
(
this
.
sid
,
this
.
cid
,
this
.
resourceId
)
.
then
(
response
=>
{
const
{
answer
,
question
}
=
response
this
.
homework
=
{
answer
,
...
question
}
})
.
finally
(()
=>
{
this
.
loading
=
false
})
}
}
},
beforeMount
()
{
this
.
getHomework
()
}
}
}
}
</
script
>
</
script
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论