Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
x-learn
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
x-learn
Commits
57533d8e
提交
57533d8e
authored
11月 07, 2020
作者:
lihuihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
开发考试
上级
0c43d6fc
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
88 行增加
和
119 行删除
+88
-119
answerCard.vue
src/components/exam/answerCard.vue
+36
-28
question.vue
src/components/exam/question.vue
+32
-71
main.js
src/main.js
+2
-0
index.vue
src/pages/testExam/exam/index.vue
+18
-20
没有找到文件。
src/components/exam/answerCard.vue
浏览文件 @
57533d8e
...
@@ -20,30 +20,7 @@
...
@@ -20,30 +20,7 @@
<
li
<
li
:
key
=
"cItem.q_order + '-' + cIndex"
:
key
=
"cItem.q_order + '-' + cIndex"
@
click
=
"goQuestion(cItem.q_order)"
@
click
=
"goQuestion(cItem.q_order)"
:
class
=
"questionParams.questionIndex + 1 === cItem.q_order
:
class
=
"isClass(cItem)"
? questionParams.answerRecord[item.question_item_id]
? questionParams.answerRecord[item.question_item_id][cItem.id]
? questionParams.answerRecord[item.question_item_id][cItem.id].answer.length !== 0
? questionParams.answerRecord[item.question_item_id][cItem.id].sign
? 'stu1 stu2 stu3'
: 'stu1 stu2'
: questionParams.answerRecord[item.question_item_id][cItem.id].sign
? 'stu2 stu3'
: 'stu2'
: 'stu2'
: 'stu2'
: questionParams.answerRecord[item.question_item_id]
? questionParams.answerRecord[item.question_item_id][cItem.id]
? questionParams.answerRecord[item.question_item_id][cItem.id].answer.length !== 0
? questionParams.answerRecord[item.question_item_id][cItem.id].sign
? 'stu1 stu3'
: 'stu1'
: questionParams.answerRecord[item.question_item_id][cItem.id].sign
? 'stu3'
: ''
: ''
: ''
"
>
{{
cItem
.
q_order
}}
<
/li
>
>
{{
cItem
.
q_order
}}
<
/li
>
<
/template
>
<
/template
>
<
/ul
>
<
/ul
>
...
@@ -97,22 +74,53 @@ export default {
...
@@ -97,22 +74,53 @@ export default {
info
:
{
type
:
Object
,
default
:
()
=>
{
}
}
info
:
{
type
:
Object
,
default
:
()
=>
{
}
}
}
,
}
,
mounted
()
{
mounted
()
{
// Bus.$on('monitoringChanges', target =>
{
this
.
msgCenter
.
$on
(
'monitoringChanges'
,
this
.
monitoringChanges
)
// this.$forceUpdate()
//
}
)
}
,
}
,
computed
:
{
computed
:
{
changeQuestionIndex
()
{
changeQuestionIndex
()
{
return
this
.
questionParams
.
questionIndex
return
this
.
questionParams
.
answerRecord
}
,
isClass
()
{
return
(
cItem
)
=>
{
const
currentAnswer
=
this
.
questionParams
.
answerRecord
[
cItem
.
question_item_id
]
return
this
.
questionParams
.
questionIndex
+
1
===
cItem
.
q_order
?
currentAnswer
?
currentAnswer
[
cItem
.
id
]
?
currentAnswer
[
cItem
.
id
].
answer
.
length
!==
0
?
currentAnswer
[
cItem
.
id
].
sign
?
'stu1 stu2 stu3'
:
'stu1 stu2'
:
currentAnswer
[
cItem
.
id
].
sign
?
'stu2 stu3'
:
'stu2'
:
'stu2'
:
'stu2'
:
currentAnswer
?
currentAnswer
[
cItem
.
id
]
?
currentAnswer
[
cItem
.
id
].
answer
.
length
!==
0
?
currentAnswer
[
cItem
.
id
].
sign
?
'stu1 stu3'
:
'stu1'
:
currentAnswer
[
cItem
.
id
].
sign
?
'stu3'
:
''
:
''
:
''
}
}
}
}
,
}
,
methods
:
{
methods
:
{
monitoringChanges
()
{
console
.
log
(
this
.
questionParams
.
answerRecord
)
this
.
$forceUpdate
()
}
,
goQuestion
(
n
)
{
goQuestion
(
n
)
{
this
.
questionParams
.
questionIndex
=
n
-
1
this
.
questionParams
.
questionIndex
=
n
-
1
}
}
}
,
}
,
watch
:
{
watch
:
{
changeQuestionIndex
(
newV
,
oldV
)
{
changeQuestionIndex
(
newV
,
oldV
)
{
console
.
log
(
111
)
this
.
$forceUpdate
()
this
.
$forceUpdate
()
}
}
}
}
...
...
src/components/exam/question.vue
浏览文件 @
57533d8e
...
@@ -37,33 +37,37 @@
...
@@ -37,33 +37,37 @@
<div
class=
"case-que"
>
<div
class=
"case-que"
>
<div
class=
"stem"
v-html=
"questionData.common_content"
></div>
<div
class=
"stem"
v-html=
"questionData.common_content"
></div>
<ul
class=
"topics"
:style=
"
{height: contentHeight - 60 + 'px'}">
<ul
class=
"topics"
:style=
"
{height: contentHeight - 60 + 'px'}">
<template
v-for=
"(item, index) in questionData.list"
>
<template
v-for=
"item in questionData.list"
>
<li
:key=
"'type5' + index"
>
<template
v-if=
"questionData.group_id === item[0].group_id"
>
<div
class=
"title"
>
<template
v-for=
"(listItem, index) in item"
>
<div
class=
"num"
>
{{
item
.
q_order
}}
.
</div><div
class=
"des"
v-html=
"item.content"
></div>
<li
:key=
"'type5' + index"
>
</div>
<div
class=
"title"
>
<ul
:class=
"item.type == 2 ? 'check-option' : 'radio-option'"
>
<!-- radio-option check-option -->
<div
class=
"num"
>
{{
questionData
.
q_order
}}
.
</div><div
class=
"des"
v-html=
"listItem.question_content"
></div>
<template
v-if=
"item.options"
>
</div>
<template
v-for=
"(items, cIndex) in item.options"
>
<ul
:class=
"questionData.answer_count > 1 ? 'check-option' : 'radio-option'"
>
<!-- radio-option check-option -->
<li
<template
v-if=
"listItem.id === questionData.id"
>
:id=
"items.id"
<template
v-for=
"(opt, oIndex) in listItem.question_options"
>
:key=
"'c' + cIndex"
<li
@
click=
"changeOptions(item.type, questionData.question_item_id, questionData.id, items.id)"
:id=
"opt.id"
:class=
"questionParams.answerRecord[questionData.question_item_id]
:key=
"'c' + oIndex"
? questionParams.answerRecord[questionData.question_item_id][questionData.id]
@
click=
"changeOptions(questionData.answer_count > 1 ? 2 : 1, questionData.question_item_id, questionData.id, opt.id)"
? questionParams.answerRecord[questionData.question_item_id][questionData.id].answer.find(id =>
{ return id === items.id })
:class=
"questionParams.answerRecord[questionData.question_item_id]
? 'active'
? questionParams.answerRecord[questionData.question_item_id][questionData.id]
: ''
? questionParams.answerRecord[questionData.question_item_id][questionData.id].answer.find(id =>
{ return id === opt.id })
: ''
? 'active'
: ''"
: ''
>
: ''
<div
class=
"icon"
></div>
: ''"
<div
class=
"txt"
>
{{
items
.
option
}}
</div>
>
</li>
<div
class=
"icon"
></div>
</
template
>
<div
class=
"txt"
>
{{
opt
.
option
}}
</div>
</template>
</li>
</ul>
</
template
>
</li>
</template>
</ul>
</li>
</template>
</template>
</template>
</template>
</ul>
</ul>
</div>
</div>
...
@@ -87,52 +91,8 @@ export default {
...
@@ -87,52 +91,8 @@ export default {
this
.
questionData
=
this
.
questionParams
.
question
this
.
questionData
=
this
.
questionParams
.
question
},
},
mounted
()
{
mounted
()
{
// this.questionData = this.questionParams.question
// console.log(this.questionParams, '=====111')
// this.dataCombined()
},
},
methods
:
{
methods
:
{
// 重组数据
dataCombined
()
{
// this.questionParams.question.question_items.map((item, index) => {
// if (parseInt(item.question_item_type) === 5) {
// item.question_list.map(cItem => {
// const currentItem = cItem.list.find(items => { return items.q_order === this.questionParams.questionIndex + 1 })
// if (currentItem) {
// this.questionData = {}
// this.questionData.common_content = cItem.common_content
// this.questionData.list = cItem.list.map(k => {
// if (k.q_order === this.questionParams.questionIndex + 1) {
// this.questionData.id = k.id
// this.questionData.q_order = k.q_order
// typeof k.options === 'string' && (k.options = JSON.parse(k.options))
// return k
// } else {
// return {
// content: k.content,
// q_order: k.q_order
// }
// }
// })
// const key = ['question_item_id', 'question_item_title', 'question_item_type']
// key.map(k => {
// this.questionData[k] = item[k]
// })
// }
// })
// } else {
// const currentItem = item.question_list.find(items => { return items.q_order === this.questionParams.questionIndex + 1 })
// if (currentItem) {
// this.questionData = currentItem
// const key = ['question_item_id', 'question_item_title', 'question_item_type']
// key.map(k => {
// this.questionData[k] = item[k]
// })
// typeof this.questionData.options === 'string' && (this.questionData.options = JSON.parse(currentItem.options))
// }
// }
// })
},
// 选项选择
// 选项选择
changeOptions
(
type
,
pId
,
cId
,
optId
)
{
changeOptions
(
type
,
pId
,
cId
,
optId
)
{
if
(
parseInt
(
type
)
!==
2
)
{
if
(
parseInt
(
type
)
!==
2
)
{
...
@@ -171,6 +131,7 @@ export default {
...
@@ -171,6 +131,7 @@ export default {
}
}
}
}
}
}
this
.
msgCenter
.
$emit
(
'monitoringChanges'
)
// Bus.$emit('monitoringChanges')
// Bus.$emit('monitoringChanges')
this
.
$forceUpdate
()
this
.
$forceUpdate
()
},
},
...
...
src/main.js
浏览文件 @
57533d8e
...
@@ -16,6 +16,8 @@ router.beforeEach((to, from, next) => {
...
@@ -16,6 +16,8 @@ router.beforeEach((to, from, next) => {
next
()
next
()
})
})
Vue
.
prototype
.
msgCenter
=
new
Vue
()
new
Vue
({
new
Vue
({
store
,
store
,
router
,
router
,
...
...
src/pages/testExam/exam/index.vue
浏览文件 @
57533d8e
...
@@ -151,7 +151,7 @@ export default {
...
@@ -151,7 +151,7 @@ export default {
}
else
{
}
else
{
this
.
questionParams
.
questionIndex
+
1
!==
this
.
questionParams
.
question
.
total_question_count
&&
(
this
.
questionParams
.
questionIndex
++
)
this
.
questionParams
.
questionIndex
+
1
!==
this
.
questionParams
.
question
.
total_question_count
&&
(
this
.
questionParams
.
questionIndex
++
)
}
}
this
.
set
Data
()
this
.
change
Data
()
},
},
getTopic
()
{
getTopic
()
{
const
param
=
{
const
param
=
{
...
@@ -163,16 +163,15 @@ export default {
...
@@ -163,16 +163,15 @@ export default {
.
then
(
response
=>
{
.
then
(
response
=>
{
const
data
=
JSON
.
parse
(
response
.
data
)
const
data
=
JSON
.
parse
(
response
.
data
)
this
.
beforeChangeData
=
data
.
sheet
this
.
beforeChangeData
=
data
.
sheet
this
.
afterChangeData
=
this
.
addNumber
(
data
.
sheet
.
questions
.
question_items
)
this
.
afterChangeData
=
this
.
setData
(
data
.
sheet
.
questions
.
question_items
)
this
.
questionParams
.
card
=
this
.
addNumber
(
data
.
sheet
.
questions
.
question_items
)
this
.
questionParams
.
card
=
this
.
setData
(
data
.
sheet
.
questions
.
question_items
)
console
.
log
(
this
.
afterChangeData
,
'===1'
)
this
.
changeData
()
this
.
setData
()
})
})
.
finally
(()
=>
{
.
finally
(()
=>
{
// this.loaded = true
// this.loaded = true
})
})
},
},
addNumber
(
data
)
{
setData
(
data
)
{
let
countNum
=
0
let
countNum
=
0
const
type
=
{
const
type
=
{
1
:
'单选题'
,
1
:
'单选题'
,
...
@@ -194,8 +193,10 @@ export default {
...
@@ -194,8 +193,10 @@ export default {
total_question_count
:
this
.
beforeChangeData
.
questions
.
total_question_count
total_question_count
:
this
.
beforeChangeData
.
questions
.
total_question_count
}
}
if
(
parseInt
(
item
.
question_type
)
===
5
)
{
if
(
parseInt
(
item
.
question_type
)
===
5
)
{
data
.
common_content
=
cItem
.
common_content
data
.
group_id
=
cItem
.
group_id
data
.
group_id
=
cItem
.
group_id
data
.
list
=
this
.
mergeData
(
item
.
question_list
,
'answer_count'
)
data
.
list
=
this
.
mergeData
(
item
.
question_list
,
'group_id'
)
data
.
answer_count
=
cItem
.
answer_count
}
}
return
data
return
data
})
})
...
@@ -206,28 +207,25 @@ export default {
...
@@ -206,28 +207,25 @@ export default {
const
_arr
=
[]
const
_arr
=
[]
let
_t
=
[]
let
_t
=
[]
let
_tmp
=
null
let
_tmp
=
null
if
(
arr
.
length
)
{
arr
.
length
&&
(
_tmp
=
arr
[
0
][
str
])
_tmp
=
arr
[
0
][
str
]
}
for
(
const
i
in
arr
)
{
for
(
const
i
in
arr
)
{
if
(
arr
[
i
][
str
]
===
_tmp
)
{
arr
[
i
][
str
]
===
_tmp
_t
.
push
(
arr
[
i
])
?
_t
.
push
(
arr
[
i
])
}
else
{
:
(()
=>
{
_tmp
=
arr
[
i
][
str
]
_tmp
=
arr
[
i
][
str
]
_arr
.
push
(
_t
)
_arr
.
push
(
_t
)
_t
=
[
arr
[
i
]]
_t
=
[
arr
[
i
]]
}
})()
}
}
_arr
.
push
(
_t
)
_arr
.
push
(
_t
)
return
_arr
return
_arr
},
},
set
Data
()
{
change
Data
()
{
this
.
afterChangeData
.
map
(
item
=>
{
this
.
afterChangeData
.
map
(
item
=>
{
item
.
map
(
cItem
=>
{
item
.
map
(
cItem
=>
{
cItem
.
q_order
===
this
.
questionParams
.
questionIndex
+
1
&&
(
this
.
questionParams
.
question
=
cItem
)
cItem
.
q_order
===
this
.
questionParams
.
questionIndex
+
1
&&
(
this
.
questionParams
.
question
=
cItem
)
})
})
})
})
console
.
log
(
this
.
questionParams
.
question
)
},
},
getCache
()
{
getCache
()
{
// action.Exam.getCache(this.$route.params.examId).then(res => {
// action.Exam.getCache(this.$route.params.examId).then(res => {
...
@@ -249,7 +247,7 @@ export default {
...
@@ -249,7 +247,7 @@ export default {
},
},
watch
:
{
watch
:
{
changeQuestionIndex
(
newV
,
oldV
)
{
changeQuestionIndex
(
newV
,
oldV
)
{
this
.
set
Data
()
this
.
change
Data
()
}
}
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论