Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
transport-show-h5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
transport-show-h5
Commits
a911af89
提交
a911af89
authored
8月 26, 2020
作者:
lihuihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
错题,收藏题,总做题逻辑修改
上级
d8cde625
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
225 行增加
和
74 行删除
+225
-74
answerCard.vue
src/pages/my/answerCard.vue
+10
-6
collectQuestions.vue
src/pages/my/collectQuestions.vue
+1
-0
errorQuestionList.vue
src/pages/my/errorQuestionList.vue
+1
-4
questionsDetails.vue
src/pages/my/questionsDetails.vue
+212
-64
questionsList.vue
src/pages/my/questionsList.vue
+1
-0
没有找到文件。
src/pages/my/answerCard.vue
浏览文件 @
a911af89
...
...
@@ -15,10 +15,10 @@
<div
class=
"circle active2"
></div>
<div
class=
"txt"
>
错误
</div>
</li>
<li>
<
!--
<
li>
<div
class=
"circle active3"
></div>
<div
class=
"txt"
>
未答
</div>
</li>
</li>
-->
</ul>
</div>
<div
class=
"question"
>
...
...
@@ -33,10 +33,11 @@
</
template
>
</ul>
<van-empty
description=
"暂无内容"
v-if=
"dataList.length == 0"
/>
<div
class=
"tips"
v-if=
"$route.query.type == 3"
>
未做试题剩余{{unDo}}题
</div>
</div>
</div>
</div>
<div
class=
"clear-btn"
>
<div
class=
"clear-btn"
v-if=
"this.$route.query.type != 3"
>
<div
class=
"btn"
@
click=
"clearQuestion"
>
清空记录,重新答题
</div>
</div>
<div
class=
"exam_submit"
v-if=
"isPopShow"
>
...
...
@@ -63,6 +64,7 @@ export default {
},
data
()
{
return
{
unDo
:
0
,
questionType
:
{
1
:
'单选题'
,
2
:
'多选题'
,
...
...
@@ -76,12 +78,13 @@ export default {
methods
:
{
clearQuestion
()
{
const
param
=
{
type
:
this
.
$route
.
query
.
type
,
type
:
this
.
$route
.
query
.
type
===
3
,
question_type
:
this
.
$route
.
query
.
questionType
,
clear
:
1
}
api
.
cacheQuestion
(
param
).
then
(
res
=>
{
Toast
(
'清空成功'
)
window
.
localStorage
.
cachequestion
=
JSON
.
stringify
([])
this
.
initData
()
})
},
...
...
@@ -103,9 +106,10 @@ export default {
duration
:
5000
,
loadingType
:
'spinner'
})
api
.
getAllQuestion
({
type
:
this
.
$route
.
query
.
type
,
question_type
:
this
.
$route
.
query
.
questionType
})
api
.
getAllQuestion
({
type
:
parseInt
(
this
.
$route
.
query
.
type
)
===
3
?
0
:
this
.
$route
.
query
.
type
,
question_type
:
this
.
$route
.
query
.
questionType
})
.
then
(
res
=>
{
this
.
dataList
=
res
this
.
dataList
=
res
.
list
this
.
unDo
=
res
.
un_do
Toast
.
clear
()
})
.
catch
(()
=>
{
...
...
src/pages/my/collectQuestions.vue
浏览文件 @
a911af89
...
...
@@ -197,6 +197,7 @@ export default {
let
num
=
1
pageCount
.
indexOf
(
'.'
)
===
-
1
?
num
=
pageCount
:
num
=
parseInt
(
pageCount
)
+
1
window
.
localStorage
.
myQuestionDetileId
=
id
window
.
localStorage
.
cachequestion
=
JSON
.
stringify
([])
this
.
$router
.
push
({
path
:
'/my/questionsDetails'
,
query
:
{
...
...
src/pages/my/errorQuestionList.vue
浏览文件 @
a911af89
...
...
@@ -6,10 +6,6 @@
<div
class=
"num"
>
{{
question
.
errorTotal
}}
</div>
<div
class=
"txt"
>
错题总数
</div>
</div>
<!--
<div
:class=
"activeClass == '1' ? 'right btn active' : 'right btn'"
@
click=
"tab('1')"
>
<div
class=
"num"
>
{{
question
.
total
}}
</div>
<div
class=
"txt"
>
做题总数
</div>
</div>
-->
</div>
<div
class=
"exam-con"
>
<div
class=
"sele"
@
click=
"screen.isShow = true"
>
...
...
@@ -207,6 +203,7 @@ export default {
let
num
=
1
pageCount
.
indexOf
(
'.'
)
===
-
1
?
num
=
pageCount
:
num
=
parseInt
(
pageCount
)
+
1
window
.
localStorage
.
myQuestionDetileId
=
id
window
.
localStorage
.
cachequestion
=
JSON
.
stringify
([])
this
.
$router
.
push
({
path
:
'/my/questionsDetails'
,
query
:
{
...
...
src/pages/my/questionsDetails.vue
浏览文件 @
a911af89
...
...
@@ -9,7 +9,7 @@
<div
class=
"tool-box"
>
<div
class=
"time"
>
{{
item
.
sheet_time
}}
</div>
<div
class=
"tool-all"
>
<div
class=
"tag-box"
@
click=
"goAnswerCard"
v-if=
"$route.query.type != 3"
>
<div
class=
"tag-box"
@
click=
"goAnswerCard"
>
<span
style=
"margin-right:.4rem"
>
答题卡
</span>
</div>
<div
v-if=
"$route.query.type != 2"
:class=
"item.is_collection ? 'icon1 active' : 'icon1'"
@
click=
"collectQuestion(item.question_id)"
></div>
...
...
@@ -25,65 +25,149 @@
<div
class=
"topic"
v-html=
"item.question_content"
></div>
<ul
class=
"option"
>
<template
v-for=
"(opt, optIndex) in item.question_options"
>
<li
v-if=
"$route.query.type != 3"
:key=
"opt.id"
@
click=
"selectOptions(item, opt)"
:class=
"item.user_answer.length != 0 && item.question_answer.find(id =>
{ return id === opt.id })
? 'active2'
: item.user_answer.find(id => { return id === opt.id })
? 'active'
: ''"
>
<van-icon
class=
"icon"
name=
"checked"
v-if=
"item.user_answer.length != 0 && item.question_answer.find(id =>
{ return id === opt.id })"/>
<div>
<span
v-if=
"!(item.user_answer.length != 0 && item.question_answer.find(id =>
{ return id === opt.id }))">
{{
A_Z
[
optIndex
]
}}
.
</span>
{{
opt
.
option
}}
<template
v-if=
"$route.query.type != 3"
>
<template
v-if=
"item.question_type == 2 || item.question_type == 5 && item.answer_count > 1"
>
<li
:key=
"opt.id"
@
click=
"selectOptions(item, opt)"
:class=
"findData(item, 'isSelect') && item.user_answer.length && item.question_answer.find(id =>
{ return id === opt.id })
? 'active2'
: cacheOption.find(cItem => {
return cItem.answer.find(aItem => { return aItem == opt.id })
})
? 'active'
: ''"
>
<van-icon
class=
"icon"
name=
"checked"
v-if=
"findData(item, 'isSelect') && item.question_answer.find(id =>
{ return id === opt.id })"/>
<div>
<span
v-if=
"!(findData(item, 'isSelect') && item.question_answer.find(id =>
{ return id === opt.id }))">
{{
A_Z
[
optIndex
]
}}
.
</span>
{{
opt
.
option
}}
</div>
</li>
</
template
>
<
template
v-else
>
<li
:key=
"opt.id"
@
click=
"selectOptions(item, opt)"
:class=
"cacheOption.find(id =>
{ return id.id === item.question_id })
&&
item.question_answer.find(id => { return id === opt.id })
? 'active2'
: cacheOption.find(cItem => {
return cItem.answer.find(aItem => { return aItem == opt.id })
})
? 'active'
: ''"
>
<van-icon
class=
"icon"
name=
"checked"
v-if=
"cacheOption.find(id =>
{ return id.id === item.question_id })
&&
item.question_answer.find(id => { return id === opt.id })"/>
<div>
<span
v-if=
"!(cacheOption.find(id =>
{ return id.id === item.question_id })
&&
item.question_answer.find(id => { return id === opt.id }))">
{{
A_Z
[
optIndex
]
}}
.
</span>
{{
opt
.
option
}}
</div>
</li>
</
template
>
</template>
<
template
v-else
>
<li
:key=
"opt.id+'=-='"
@
click=
"selectOptions(item, opt)"
:class=
"item.question_answer.find(id =>
{ return id === opt.id })
? 'active2'
: item.user_answer.find(id => { return id === opt.id })
? 'active'
: ''"
>
<van-icon
class=
"icon"
name=
"checked"
v-if=
"item.user_answer.length != 0 && item.question_answer.find(id =>
{ return id === opt.id })"/>
<div>
<span
v-if=
"!(item.question_answer.find(id =>
{ return id === opt.id }))">
{{
A_Z
[
optIndex
]
}}
.
</span>
{{
opt
.
option
}}
</div>
</li>
</
template
>
</template>
</ul>
<div
class=
"com-btn"
@
click=
"confirmSelect(item)"
v-if=
"$route.query.type != 3 && (item.question_type == 2 || item.question_type == 5 && item.answer_count > 1)"
>
确认答案
</div>
<
template
v-if=
"$route.query.type != 3"
>
<template
v-if=
"item.question_type == 2 || item.question_type == 5 && item.answer_count > 1"
>
<div
class=
"analy"
v-show=
"findData(item, 'isSelect') && item.user_answer.length"
>
<div
class=
"tit"
>
答案解析
</div>
<div
class=
"txt"
>
正确答案:
<span>
{{
item
.
question_answer
.
map
((
i
,
index
)
=>
{
return
A_Z
[
item
.
question_options
.
findIndex
(
id
=>
{
return
id
.
id
===
i
}
)]
}
).
toString
().
replace
(
new
RegExp
(
','
,
'g'
),
''
)
}}
<
/span
>
<
/div
>
<
div
class
=
"txt"
>
您的答案:
<
span
>
{{
findData
(
item
,
'answer'
).
map
((
i
,
index
)
=>
{
return
A_Z
[
item
.
question_options
.
findIndex
(
id
=>
{
return
id
.
id
===
i
}
)]
}
).
toString
().
replace
(
new
RegExp
(
','
,
'g'
),
''
)
}}
<
/span
>
<
/div
>
<
div
class
=
"exp"
>
<
p
class
=
"name"
>
解析:
<
/p
>
<
p
class
=
"nr"
v
-
html
=
"item.question_analysis"
><
/p
>
<
/div
>
</li>
<li
v-else
:key=
"opt.id+'=-='"
@
click=
"selectOptions(item, opt)"
:class=
"item.question_answer.find(id =>
{ return id === opt.id })
? 'active2'
: item.user_answer.find(id => { return id === opt.id })
? 'active'
: ''"
>
<van-icon
class=
"icon"
name=
"checked"
v-if=
"item.user_answer.length != 0 && item.question_answer.find(id =>
{ return id === opt.id })"/>
<div>
<span
v-if=
"!(item.question_answer.find(id =>
{ return id === opt.id }))">
{{
A_Z
[
optIndex
]
}}
.
</span>
{{
opt
.
option
}}
<
/div
>
</li>
<
/template
>
</ul>
<div
class=
"analy"
v-show=
"isAnalysis || item.user_answer.length != 0"
>
<div
class=
"tit"
>
答案解析
</div>
<div
class=
"txt"
>
正确答案:
<span>
{{
item.question_answer.map((i, index) => {
return A_Z[item.question_options.findIndex(id => { return id.id === i })]
}).toString().replace(new RegExp(',', 'g'), '')
}}
</span>
</div>
<div
class=
"txt"
>
您的答案:
<span>
{{
item.user_answer.map((i, index) => {
return A_Z[item.question_options.findIndex(id => { return id.id === i })]
}).toString().replace(new RegExp(',', 'g'), '')
}}
</span>
</div>
<div
class=
"exp"
>
<p
class=
"name"
>
解析:
</p>
<p
class=
"nr"
v-html=
"item.question_analysis"
></p>
<
template
v
-
else
>
<
div
class
=
"analy"
v
-
show
=
"isAnalysis || cacheOption.find(id => { return id.id === item.question_id
}
)"
>
<
div
class
=
"tit"
>
答案解析
<
/div
>
<
div
class
=
"txt"
>
正确答案:
<
span
>
{{
item
.
question_answer
.
map
((
i
,
index
)
=>
{
return
A_Z
[
item
.
question_options
.
findIndex
(
id
=>
{
return
id
.
id
===
i
}
)]
}
).
toString
().
replace
(
new
RegExp
(
','
,
'g'
),
''
)
}}
<
/span
>
<
/div
>
<
div
class
=
"txt"
>
您的答案:
<
span
>
{{
item
.
user_answer
.
map
((
i
,
index
)
=>
{
return
A_Z
[
item
.
question_options
.
findIndex
(
id
=>
{
return
id
.
id
===
i
}
)]
}
).
toString
().
replace
(
new
RegExp
(
','
,
'g'
),
''
)
}}
<
/span
>
<
/div
>
<
div
class
=
"exp"
>
<
p
class
=
"name"
>
解析:
<
/p
>
<
p
class
=
"nr"
v
-
html
=
"item.question_analysis"
><
/p
>
<
/div
>
<
/div
>
<
/template
>
<
/template
>
<
template
v
-
else
>
<
div
class
=
"analy"
>
<
div
class
=
"tit"
>
答案解析
<
/div
>
<
div
class
=
"txt"
>
正确答案:
<
span
>
{{
item
.
question_answer
.
map
((
i
,
index
)
=>
{
return
A_Z
[
item
.
question_options
.
findIndex
(
id
=>
{
return
id
.
id
===
i
}
)]
}
).
toString
().
replace
(
new
RegExp
(
','
,
'g'
),
''
)
}}
<
/span
>
<
/div
>
<
div
class
=
"txt"
>
您的答案:
<
span
>
{{
item
.
user_answer
.
map
((
i
,
index
)
=>
{
return
A_Z
[
item
.
question_options
.
findIndex
(
id
=>
{
return
id
.
id
===
i
}
)]
}
).
toString
().
replace
(
new
RegExp
(
','
,
'g'
),
''
)
}}
<
/span
>
<
/div
>
<
div
class
=
"exp"
>
<
p
class
=
"name"
>
解析:
<
/p
>
<
p
class
=
"nr"
v
-
html
=
"item.question_analysis"
><
/p
>
<
/div
>
<
/div
>
</
div
>
<
/
template
>
<
/swiper-slide
>
<
/template
>
<
/swiper
>
...
...
@@ -110,6 +194,7 @@ import { Swiper, SwiperSlide, directive } from 'vue-awesome-swiper'
import
'swiper/css/swiper.css'
export
default
{
beforeDestroy
()
{
// window.localStorage.isCache = false
clearInterval
(
this
.
cacheTime
)
}
,
metaInfo
()
{
...
...
@@ -133,6 +218,8 @@ export default {
data
()
{
const
_this
=
this
return
{
storageCheckOption
:
[],
cacheOption
:
[],
isBtnShow
:
{
currentPage
:
1
,
pageCount
:
1
...
...
@@ -173,6 +260,7 @@ export default {
}
_this
.
isBtnShow
.
currentPage
=
item
.
num
_this
.
sildesHeightCount
()
_this
.
cacheOption
=
JSON
.
parse
(
window
.
localStorage
.
cachequestion
)
}
,
500
)
}
,
slideChangeTransitionStart
:
function
()
{
...
...
@@ -202,6 +290,15 @@ export default {
computed
:
{
swiper
()
{
return
this
.
$refs
.
mySwiper
.
$swiper
}
,
findData
()
{
return
function
(
item
,
callValue
)
{
const
data
=
this
.
cacheOption
.
find
(
id
=>
{
return
id
.
id
===
item
.
question_id
}
)
if
(
data
)
{
return
data
[
callValue
]
||
(
false
)
}
return
callValue
===
'answer'
?
[]
:
false
}
}
}
,
methods
:
{
...
...
@@ -310,6 +407,7 @@ export default {
}
}
,
switchPages
()
{
document
.
scrollingElement
.
scrollTop
=
0
const
qId
=
this
.
swiper
.
slides
[
this
.
swiper
.
activeIndex
].
attributes
[
'data-id'
].
nodeValue
window
.
localStorage
.
myQuestionDetileId
=
qId
const
itemNum
=
this
.
questionData
.
list
.
find
(
item
=>
{
return
item
.
question_id
===
qId
}
)
...
...
@@ -332,18 +430,57 @@ export default {
this
.
swiper
.
slides
[
this
.
swiper
.
activeIndex
].
style
.
paddingBottom
=
'1.2rem'
}
}
,
confirmSelect
(
item
)
{
// 后台缓存
this
.
cacheList
[
item
.
question_id
]
=
this
.
storageCheckOption
const
data
=
this
.
cacheOption
.
find
(
d
=>
{
return
d
.
id
===
item
.
question_id
}
)
data
.
isSelect
=
true
window
.
localStorage
.
cachequestion
=
JSON
.
stringify
(
this
.
cacheOption
)
}
,
// 选择选项
selectOptions
(
item
,
opt
)
{
if
(
parseInt
(
this
.
$route
.
query
.
type
)
!
==
3
)
{
this
.
isAnalysis
=
tru
e
if
(
parseInt
(
item
.
question_type
)
===
1
||
parseInt
(
item
.
question_type
)
===
6
||
(
parseInt
(
item
.
question_type
)
===
5
&&
item
.
answer_count
===
1
))
{
item
.
user_answer
=
[
opt
.
id
]
}
else
{
const
fIndex
=
item
.
user_answer
.
findIndex
(
id
=>
{
return
id
===
opt
.
id
})
fIndex
===
-
1
?
item
.
user_answer
.
push
(
opt
.
id
)
:
item
.
user_answer
.
splice
(
fIndex
,
1
)
if
(
parseInt
(
this
.
$route
.
query
.
type
)
=
==
3
)
{
return
fals
e
}
if
(
parseInt
(
item
.
question_type
)
===
1
||
parseInt
(
item
.
question_type
)
===
6
||
(
parseInt
(
item
.
question_type
)
===
5
&&
item
.
answer_count
===
1
))
{
const
datas
=
this
.
cacheOption
.
find
(
data
=>
{
return
data
.
id
===
item
.
question_id
}
)
if
(
datas
)
{
return
false
}
item
.
isSelect
=
true
// 后台缓存
item
.
user_answer
=
[
opt
.
id
]
// 前端缓存
datas
?
datas
.
answer
=
[
opt
.
id
]
:
this
.
cacheOption
.
push
({
id
:
item
.
question_id
,
answer
:
[
opt
.
id
],
isSelect
:
false
}
)
this
.
cacheList
[
item
.
question_id
]
=
item
.
user_answer
this
.
sildesHeightCount
()
window
.
localStorage
.
cachequestion
=
JSON
.
stringify
(
this
.
cacheOption
)
}
else
{
const
datas
=
this
.
cacheOption
.
find
(
d
=>
{
return
d
.
id
===
item
.
question_id
}
)
if
(
datas
)
{
if
(
datas
.
isSelect
)
{
return
false
}
}
const
stotageInde
=
this
.
storageCheckOption
.
findIndex
(
i
=>
{
return
i
===
opt
.
id
}
)
stotageInde
===
-
1
?
this
.
storageCheckOption
.
push
(
opt
.
id
)
:
this
.
storageCheckOption
.
splice
(
stotageInde
,
1
)
// 后台缓存
const
fIndex
=
item
.
user_answer
.
findIndex
(
id
=>
{
return
id
===
opt
.
id
}
)
fIndex
===
-
1
?
item
.
user_answer
.
push
(
opt
.
id
)
:
item
.
user_answer
.
splice
(
fIndex
,
1
)
// 前端缓存
if
(
!
datas
)
{
this
.
cacheOption
.
push
({
id
:
item
.
question_id
,
answer
:
[
opt
.
id
],
isSelect
:
false
}
)
}
else
{
const
index
=
datas
.
answer
.
findIndex
(
d
=>
{
return
d
===
opt
.
id
}
)
index
===
-
1
?
datas
.
answer
.
push
(
opt
.
id
)
:
datas
.
answer
.
splice
(
index
,
1
)
}
}
}
,
// 初始化数据 || 翻页请求数据
...
...
@@ -748,4 +885,15 @@ export default {
}
}
}
.
com
-
btn
{
width
:
6.7
rem
;
height
:.
7
rem
;
background
:
rgba
(
244
,
120
,
133
,
1
);
border
-
radius
:.
12
rem
;
margin
:
0
auto
;
text
-
align
:
center
;
line
-
height
:
.
7
rem
;
font
-
size
:
.
3
rem
;
color
:
#
fff
;
}
<
/style
>
src/pages/my/questionsList.vue
浏览文件 @
a911af89
...
...
@@ -208,6 +208,7 @@ export default {
let
num
=
1
pageCount
.
indexOf
(
'.'
)
===
-
1
?
num
=
pageCount
:
num
=
parseInt
(
pageCount
)
+
1
window
.
localStorage
.
myQuestionDetileId
=
id
window
.
localStorage
.
cachequestion
=
JSON
.
stringify
([])
this
.
$router
.
push
({
path
:
'/my/questionsDetails'
,
query
:
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论