Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online-pc
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online-pc
Commits
c881112f
提交
c881112f
authored
12月 08, 2020
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
课后作业接口调整
上级
7a46c699
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
33 行增加
和
78 行删除
+33
-78
api.js
src/modules/viewer/api.js
+16
-37
chapterTest.vue
src/modules/viewer/components/work/chapterTest.vue
+1
-1
chapterWork.vue
src/modules/viewer/components/work/chapterWork.vue
+16
-40
没有找到文件。
src/modules/viewer/api.js
浏览文件 @
c881112f
...
...
@@ -8,9 +8,7 @@ const httpRequest = new BaseAPI(webConf)
* @param {string} courseId 课程ID
*/
export
function
getCourse
(
semesterId
,
courseId
)
{
return
httpRequest
.
get
(
`/api/lms/v2/education/courses/
${
courseId
}
`
)
return
httpRequest
.
get
(
`/api/lms/v2/education/courses/
${
courseId
}
`
)
}
/**
...
...
@@ -44,10 +42,7 @@ export function getChapterVideoAliyun(vid) {
* @param {Object} params
*/
export
function
getChapterVideoProgress
(
semesterId
,
resourseId
,
params
)
{
return
httpRequest
.
get
(
`/api/lms/v2/education/video/
${
resourseId
}
/device`
,
params
)
return
httpRequest
.
get
(
`/api/lms/v2/education/video/
${
resourseId
}
/device`
,
params
)
}
/**
...
...
@@ -62,12 +57,11 @@ export function updateChapterVideoProgress(params) {
* 获取章节作业
* @param {string} semesterId 学期ID
* @param {string} courseId 课程ID
* @param {string} chapterId 章节ID
* @param {string} resourseId 章节的资源ID
*/
export
function
getChapterHomework
(
semesterId
,
courseId
,
resourseId
)
{
return
httpRequest
.
get
(
`/api/lms/v2/education/homeworks/
${
courseId
}
/
${
resourseId
}
`
)
export
function
getChapterHomework
(
semesterId
,
courseId
,
chapterId
,
resourseId
)
{
return
httpRequest
.
get
(
`/api/lms/v2/education/homeworks/
${
courseId
}
/
${
chapterId
}
/
${
resourseId
}
`
)
}
/**
...
...
@@ -77,9 +71,7 @@ export function getChapterHomework(semesterId, courseId, resourseId) {
* @param {string} chapterId 章节ID
*/
export
function
getChapterHomeworkDeadline
(
semesterId
,
courseId
,
chapterId
)
{
return
httpRequest
.
get
(
`/api/lms/v2/education/homeworks/
${
courseId
}
/
${
chapterId
}
/deadline`
)
return
httpRequest
.
get
(
`/api/lms/v2/education/homeworks/
${
courseId
}
/
${
chapterId
}
/deadline`
)
}
/**
...
...
@@ -106,9 +98,7 @@ export function uploadFile(data) {
* @param {string} courseId 课程ID
*/
export
function
getCourseWork
(
semesterId
,
courseId
)
{
return
httpRequest
.
get
(
`/api/lms/v2/education/courses/
${
courseId
}
/essay`
)
return
httpRequest
.
get
(
`/api/lms/v2/education/courses/
${
courseId
}
/essay`
)
}
/**
...
...
@@ -117,11 +107,9 @@ export function getCourseWork(semesterId, courseId) {
* @param {string} courseId 课程ID
*/
export
function
updateCourseWork
(
semesterId
,
courseId
,
data
)
{
return
httpRequest
.
post
(
`/api/lms/v2/education/courses/
${
courseId
}
/essay`
,
data
,
{
headers
:
{
'Content-Type'
:
'multipart/form-data'
}
}
)
return
httpRequest
.
post
(
`/api/lms/v2/education/courses/
${
courseId
}
/essay`
,
data
,
{
headers
:
{
'Content-Type'
:
'multipart/form-data'
}
})
}
/**
...
...
@@ -130,9 +118,7 @@ export function updateCourseWork(semesterId, courseId, data) {
* @param {string} courseId 课程ID
*/
export
function
getCourseExam
(
semesterId
,
courseId
)
{
return
httpRequest
.
get
(
`/api/lms/v2/education/
${
courseId
}
/examination`
)
return
httpRequest
.
get
(
`/api/lms/v2/education/
${
courseId
}
/examination`
)
}
/**
...
...
@@ -142,9 +128,7 @@ export function getCourseExam(semesterId, courseId) {
* @param {string} examId 试题ID
*/
export
function
getCourseExamStatus
(
semesterId
,
courseId
,
examId
)
{
return
httpRequest
.
get
(
`/api/lms/v2/education/
${
courseId
}
/examination/
${
examId
}
/status`
)
return
httpRequest
.
get
(
`/api/lms/v2/education/
${
courseId
}
/examination/
${
examId
}
/status`
)
}
/**
...
...
@@ -154,11 +138,9 @@ export function getCourseExamStatus(semesterId, courseId, examId) {
* @param {string} examId 试题ID
*/
export
function
submitCourseExam
(
semesterId
,
courseId
,
examId
,
data
)
{
return
httpRequest
.
post
(
`/api/lms/v2/education/
${
courseId
}
/examination/
${
examId
}
/sheet`
,
data
,
{
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
}
}
)
return
httpRequest
.
post
(
`/api/lms/v2/education/
${
courseId
}
/examination/
${
examId
}
/sheet`
,
data
,
{
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
}
})
}
/**
...
...
@@ -168,8 +150,5 @@ export function submitCourseExam(semesterId, courseId, examId, data) {
* @param {string} examId 试题ID
*/
export
function
getCourseExamResult
(
semesterId
,
courseId
,
examId
,
params
)
{
return
httpRequest
.
get
(
`/api/lms/v2/education/
${
courseId
}
/examination/
${
examId
}
/sheet`
,
params
)
return
httpRequest
.
get
(
`/api/lms/v2/education/
${
courseId
}
/examination/
${
examId
}
/sheet`
,
params
)
}
src/modules/viewer/components/work/chapterTest.vue
浏览文件 @
c881112f
...
...
@@ -101,7 +101,7 @@ export default {
getDetail
()
{
this
.
loading
=
true
api
.
getChapterHomework
(
this
.
sid
,
this
.
cid
,
this
.
resourceId
)
.
getChapterHomework
(
this
.
sid
,
this
.
cid
,
this
.
pid
,
this
.
resourceId
)
.
then
(
response
=>
{
this
.
detail
=
Array
.
isArray
(
response
)
?
null
:
response
if
(
this
.
detail
)
{
...
...
src/modules/viewer/components/work/chapterWork.vue
浏览文件 @
c881112f
...
...
@@ -13,7 +13,7 @@
></exam-item>
</el-form>
</div>
<p
style=
"color:
red;
"
v-if=
"deadline"
>
请于截止日期
{{
deadline
}}
前提交
</p>
<p
style=
"color:
red
"
v-if=
"deadline"
>
请于截止日期
{{
deadline
}}
前提交
</p>
<!-- 驳回状态 -->
<template
v-if=
"detail && detail.status === 1"
>
<div
class=
"work-bottom"
>
...
...
@@ -54,12 +54,7 @@
</
template
>
<
template
v-else-if=
"detail.created_time"
>
<p
class=
"help"
>
已于
{{
detail
.
created_time
}}
提交,等待老师批改中。
</p>
<template
v-if=
"
detail.updated_time &&
detail.updated_time !== detail.created_time
"
>
<template
v-if=
"detail.updated_time && detail.updated_time !== detail.created_time"
>
<p
class=
"help"
>
最近提交时间:
{{
detail
.
updated_time
}}
</p>
</
template
>
</template>
...
...
@@ -67,12 +62,9 @@
</div>
<div
class=
"buttons"
>
<el-tooltip
content=
"在获老师批改之前,可以多次提交,将以最后一次提交为准"
placement=
"right"
>
<el-button
type=
"primary"
:disabled=
"disabled || !isWorkTime"
:loading=
"submitLoading"
@
click=
"onSubmit"
>
{{ submitText }}
</el-button>
<el-button
type=
"primary"
:disabled=
"disabled || !isWorkTime"
:loading=
"submitLoading"
@
click=
"onSubmit"
>
{{
submitText
}}
</el-button>
</el-tooltip>
</div>
</template>
...
...
@@ -124,9 +116,7 @@ export default {
chapter
:
{
immediate
:
true
,
handler
(
data
)
{
this
.
questions
=
data
.
homework
?
this
.
genQuenstions
(
data
.
homework
.
questions
)
:
[]
this
.
questions
=
data
.
homework
?
this
.
genQuenstions
(
data
.
homework
.
questions
)
:
[]
}
}
},
...
...
@@ -169,17 +159,15 @@ export default {
methods
:
{
// 获取作业截止时间
getDeadline
()
{
api
.
getChapterHomeworkDeadline
(
this
.
sid
,
this
.
cid
,
this
.
pid
)
.
then
(
response
=>
{
this
.
deadline
=
response
.
dead_line
})
api
.
getChapterHomeworkDeadline
(
this
.
sid
,
this
.
cid
,
this
.
pid
).
then
(
response
=>
{
this
.
deadline
=
response
.
dead_line
})
},
// 获取详情
getDetail
()
{
this
.
loading
=
true
api
.
getChapterHomework
(
this
.
sid
,
this
.
cid
,
this
.
resourceId
)
.
getChapterHomework
(
this
.
sid
,
this
.
cid
,
this
.
pid
,
this
.
resourceId
)
.
then
(
response
=>
{
this
.
detail
=
Array
.
isArray
(
response
)
?
null
:
response
if
(
this
.
detail
)
{
...
...
@@ -188,9 +176,7 @@ export default {
const
parseAnswers
=
JSON
.
parse
(
this
.
detail
.
work_contents
)
// 设置答案
this
.
questions
=
this
.
questions
.
map
(
item
=>
{
const
found
=
parseAnswers
.
find
(
answer
=>
answer
.
question_id
===
item
.
id
)
const
found
=
parseAnswers
.
find
(
answer
=>
answer
.
question_id
===
item
.
id
)
if
(
found
)
{
item
.
user_answer
=
found
.
descreption
item
.
attachments
=
found
.
file_url
...
...
@@ -226,9 +212,7 @@ export default {
temp
=
{
formModel
:
{
id
:
item
.
id
,
user_answer
:
item
.
user_answer
?
Base64
.
decode
(
item
.
user_answer
)
:
''
,
user_answer
:
item
.
user_answer
?
Base64
.
decode
(
item
.
user_answer
)
:
''
,
attachments
:
item
.
attachments
||
''
}
}
...
...
@@ -238,9 +222,7 @@ export default {
item
,
{
content
:
item
.
question_content
,
options
:
item
.
question_options
?
JSON
.
parse
(
item
.
question_options
)
:
[]
options
:
item
.
question_options
?
JSON
.
parse
(
item
.
question_options
)
:
[]
},
temp
)
...
...
@@ -262,23 +244,17 @@ export default {
// 校验
if
(
!
this
.
checkSubmit
())
{
this
.
messageInstance
&&
this
.
messageInstance
.
close
()
this
.
messageInstance
=
this
.
$message
.
error
(
'答题内容不能为空,请检查并输入内容'
)
this
.
messageInstance
=
this
.
$message
.
error
(
'答题内容不能为空,请检查并输入内容'
)
return
}
// 计算答题时间
const
duration
=
Math
.
floor
(
(
new
Date
().
getTime
()
-
this
.
startTime
)
/
1000
)
const
duration
=
Math
.
floor
((
new
Date
().
getTime
()
-
this
.
startTime
)
/
1000
)
// 提交的答案数据
const
answers
=
this
.
questions
.
map
(
item
=>
{
return
{
question_id
:
item
.
id
,
descreption
:
item
.
question_type
===
3
?
Base64
.
encode
(
item
.
formModel
.
user_answer
)
:
item
.
formModel
.
user_answer
,
item
.
question_type
===
3
?
Base64
.
encode
(
item
.
formModel
.
user_answer
)
:
item
.
formModel
.
user_answer
,
file_url
:
item
.
formModel
.
attachments
,
is_encoded
:
1
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论