Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
x-learn
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
x-learn
Commits
31001612
提交
31001612
authored
10月 21, 2021
作者:
lihuihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 提交提示修改
上级
fe34fc16
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
53 行增加
和
7 行删除
+53
-7
index.vue
src/pages/exam/courseExam/chapter/index.vue
+28
-6
index.vue
src/pages/exam/testExam/exam/index.vue
+25
-1
没有找到文件。
src/pages/exam/courseExam/chapter/index.vue
浏览文件 @
31001612
...
@@ -43,7 +43,23 @@ export default {
...
@@ -43,7 +43,23 @@ export default {
},
},
// 提交答案
// 提交答案
handleSubmit
(
data
)
{
handleSubmit
(
data
)
{
const
params
=
this
.
genSubmitData
(
data
)
const
params
=
this
.
genSubmitData
(
data
).
params
const
answerNum
=
this
.
genSubmitData
(
data
).
answerNum
if
(
answerNum
!==
0
)
{
this
.
$confirm
(
`您还有
${
answerNum
}
道题没有作答`
,
'请确认'
,
{
confirmButtonText
:
'继续作答'
,
cancelButtonText
:
'确认提交'
,
type
:
'warning'
})
.
then
(()
=>
{})
.
catch
(()
=>
{
this
.
submitApi
(
params
)
})
}
else
{
this
.
submitApi
(
params
)
}
},
submitApi
(
params
)
{
api
.
setCourseCache
(
Object
.
assign
(
params
,
{
status
:
1
})).
then
(
res
=>
{
api
.
setCourseCache
(
Object
.
assign
(
params
,
{
status
:
1
})).
then
(
res
=>
{
this
.
$router
.
replace
({
this
.
$router
.
replace
({
path
:
'/course/chapter/result'
,
path
:
'/course/chapter/result'
,
...
@@ -54,18 +70,24 @@ export default {
...
@@ -54,18 +70,24 @@ export default {
// 组装提交数据
// 组装提交数据
genSubmitData
(
questionGroups
)
{
genSubmitData
(
questionGroups
)
{
const
answers
=
{}
const
answers
=
{}
let
answerNum
=
0
questionGroups
.
forEach
(
group
=>
{
questionGroups
.
forEach
(
group
=>
{
if
(
!
answers
[
group
.
question_item_id
])
{
if
(
!
answers
[
group
.
question_item_id
])
answers
[
group
.
question_item_id
]
=
{}
answers
[
group
.
question_item_id
]
=
{}
}
group
.
question_list
.
forEach
(
item
=>
{
group
.
question_list
.
forEach
(
item
=>
{
answers
[
item
.
question_item_id
][
item
.
id
]
=
{
if
(
!
item
.
user_answer
.
length
)
{
answerNum
++
}
answers
[
group
.
question_item_id
][
item
.
id
]
=
{
sign
:
item
.
sign
?
item
.
sign
:
false
,
sign
:
item
.
sign
?
item
.
sign
:
false
,
answers
:
item
.
user_answer
answers
:
item
.
user_answer
}
}
})
})
})
})
return
{
type
:
1
,
sheet_id
:
this
.
data
.
id
,
status
:
0
,
answers
:
JSON
.
stringify
(
answers
),
duration
:
0
}
const
data
=
{
params
:
{
type
:
1
,
sheet_id
:
this
.
data
.
id
,
status
:
0
,
answers
:
JSON
.
stringify
(
answers
),
duration
:
0
},
answerNum
:
answerNum
}
return
data
}
}
}
}
}
}
...
...
src/pages/exam/testExam/exam/index.vue
浏览文件 @
31001612
...
@@ -53,6 +53,7 @@ export default {
...
@@ -53,6 +53,7 @@ export default {
const
isSubmited
=
[
'1'
,
'2'
].
includes
(
this
.
data
.
status
)
const
isSubmited
=
[
'1'
,
'2'
].
includes
(
this
.
data
.
status
)
// 缓存答题
// 缓存答题
if
(
!
isSubmited
)
{
if
(
!
isSubmited
)
{
clearInterval
(
this
.
cacheAnswerTime
)
this
.
cacheAnswerTime
=
setInterval
(()
=>
{
this
.
cacheAnswerTime
=
setInterval
(()
=>
{
this
.
submitExam
(
0
)
this
.
submitExam
(
0
)
},
3000
)
},
3000
)
...
@@ -68,20 +69,43 @@ export default {
...
@@ -68,20 +69,43 @@ export default {
const
refData
=
this
.
$refs
.
exam
const
refData
=
this
.
$refs
.
exam
const
id
=
this
.
data
.
id
const
id
=
this
.
data
.
id
const
answer
=
{}
const
answer
=
{}
let
answerNum
=
0
refData
.
questionGroups
.
forEach
(
item
=>
{
refData
.
questionGroups
.
forEach
(
item
=>
{
if
(
!
answer
[
item
.
question_item_id
])
answer
[
item
.
question_item_id
]
=
{}
if
(
!
answer
[
item
.
question_item_id
])
answer
[
item
.
question_item_id
]
=
{}
item
.
question_list
.
forEach
(
cItem
=>
{
item
.
question_list
.
forEach
(
cItem
=>
{
if
(
!
cItem
.
user_answer
.
length
)
{
answerNum
++
}
answer
[
item
.
question_item_id
][
cItem
.
id
]
=
{
answer
[
item
.
question_item_id
][
cItem
.
id
]
=
{
sign
:
cItem
.
sign
?
cItem
.
sign
:
false
,
sign
:
cItem
.
sign
?
cItem
.
sign
:
false
,
answer
:
cItem
.
user_answer
answer
:
cItem
.
user_answer
}
}
})
})
})
})
if
(
isCache
)
{
if
(
answerNum
!==
0
)
{
this
.
$confirm
(
`您还有
${
answerNum
}
道题没有作答`
,
'请确认'
,
{
confirmButtonText
:
'继续作答'
,
cancelButtonText
:
'确认提交'
,
type
:
'warning'
}).
then
(()
=>
{
}).
catch
(()
=>
{
this
.
submitApi
(
id
,
isCache
,
answer
,
refData
.
duration
)
})
}
else
{
this
.
submitApi
(
id
,
isCache
,
answer
,
refData
.
duration
)
}
}
else
{
this
.
submitApi
(
id
,
isCache
,
answer
,
refData
.
duration
)
}
console
.
log
(
answerNum
,
'num'
)
},
submitApi
(
id
,
isCache
,
answer
,
duration
)
{
const
param
=
{
const
param
=
{
sheet_id
:
id
,
sheet_id
:
id
,
status
:
isCache
!==
0
?
1
:
0
,
// 0缓存,1提交
status
:
isCache
!==
0
?
1
:
0
,
// 0缓存,1提交
answers
:
JSON
.
stringify
(
answer
),
answers
:
JSON
.
stringify
(
answer
),
duration
:
refData
.
duration
duration
:
duration
}
}
api
.
setCache
(
param
).
then
(
response
=>
{
api
.
setCache
(
param
).
then
(
response
=>
{
if
(
isCache
)
{
if
(
isCache
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论