Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
study
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Damon
study
Commits
bbda57b4
Commit
bbda57b4
authored
Jul 16, 2021
by
Damon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 答题模式切换&&倒计时
parent
176a8ba0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
28 deletions
+90
-28
index.vue
src/components/swiper-limited-load/index.vue
+9
-2
answer.vue
src/pages/learn/answer.vue
+81
-26
No files found.
src/components/swiper-limited-load/index.vue
View file @
bbda57b4
...
...
@@ -9,8 +9,7 @@
>
<swiper-item
v-for=
"(item, index) in swiperList"
:key=
"index"
>
<view
class=
"u-flex subject"
>
<view
class=
"type"
>
{{
type
[
item
.
type
-
1
]
}}
</view>
<view
class=
"title"
>
{{
item
.
title
}}
</view>
<view
class=
"title"
><text>
{{
type
[
item
.
type
-
1
]
}}
</text>
{{
item
.
title
}}
</view>
<view
class=
"content"
>
<answer-sheet
ref=
"answerSheet"
...
...
@@ -239,6 +238,14 @@ export default {
font-weight
:
bold
;
width
:
100%
;
text-align
:
left
;
text
{
background
:
#9EA5BB
;
color
:
#fff
;
padding
:
8rpx
20rpx
;
margin-right
:
10rpx
;
font-size
:
20rpx
;
border-radius
:
50rpx
;
}
}
.content
,
.explain
,
.btn
{
width
:
100%
;
...
...
src/pages/learn/answer.vue
View file @
bbda57b4
...
...
@@ -8,15 +8,25 @@
title=
"答题"
title-bold
></u-navbar>
<view
class=
"head"
>
<view
class=
"u-flex tab"
v-if=
"type === 1"
>
<view
:class=
"['tab-list',
{'active': model === 1}]" @click="changeModel(1)">答题模式
</view>
<view
:class=
"['tab-list',
{'active': model === 2}]" @click="changeModel(2)">学习模式
</view>
</view>
<view
class=
"u-flex count-down"
v-if=
"type === 2"
>
<view>
倒计时:
<u-count-down
:timestamp=
"timestamp"
bg-color=
""
:show-hours=
"false"
></u-count-down></view>
</view>
</view>
<view
class=
"swiper"
>
<swiper-limited-load
<swiper-limited-load
ref=
"swiper"
:swiperHeight=
"500"
:swiperDuration=
"swiperDuration"
:list=
"list"
:current=
"current"
@
answerChange=
"answerChange"
@
change=
"swiperChange"
>
@
change=
"swiperChange"
>
</swiper-limited-load>
</view>
<view
class=
"u-flex u-row-around bottom"
>
...
...
@@ -39,12 +49,21 @@
</view>
<answer-operation-tips
:show
.
sync=
"show"
/>
<answer-complete-pop
:numberList=
"[1, 2, 3]"
type=
"fail"
:visible
.
sync=
"visible"
@
cancel=
"visible = false"
@
submit=
"submit"
>
</answer-complete-pop>
</view>
</
template
>
<
script
>
import
swiperLimitedLoad
from
'@/components/swiper-limited-load/index.vue'
import
answerOperationTips
from
'@/components/answer-operation-tips/index.vue'
import
answerCompletePop
from
'@/components/answer-complete-pop/index.vue'
const
NO_PREV_PAGE
=
-
1
const
NO_NEXT_PAGE
=
-
2
...
...
@@ -52,24 +71,25 @@ const app = getApp()
export
default
{
components
:
{
swiperLimitedLoad
,
answerOperationTips
answerOperationTips
,
answerCompletePop
,
},
data
()
{
return
{
visible
:
false
,
show
:
false
,
type
:
1
,
dataLength
:
0
,
index
:
0
,
lists
:
[]
,
answerList
:
[]
,
// 1 练习 2 考试
type
:
1
,
// 1 答题模式 2 学习模式
model
:
1
,
timestamp
:
60
*
60
,
list
:
[],
current
:
0
,
currentIndex
:
0
,
swiperDuration
:
"0"
swiperDuration
:
'0'
,
}
},
computed
:
{
},
computed
:
{},
created
()
{
const
lists
=
[
{
...
...
@@ -86,13 +106,15 @@ export default {
},
],
answer
:
'A'
,
explain
:
'极性电介质在外电场作用下,由偶极子分子的转向形成的极化称为偶极子式极化。'
,
explain
:
'极性电介质在外电场作用下,由偶极子分子的转向形成的极化称为偶极子式极化。'
,
index
:
0
,
rightKey
:
[
'A'
]
rightKey
:
[
'A'
]
,
},
{
type
:
2
,
title
:
'空气间隙的操作冲击击穿电压数值大小不仅与间隙距离、电极形状、电极极性有关,而且与操作冲击电压波的波前时间的长短有关。'
,
title
:
'空气间隙的操作冲击击穿电压数值大小不仅与间隙距离、电极形状、电极极性有关,而且与操作冲击电压波的波前时间的长短有关。'
,
answerList
:
[
{
sort
:
'A'
,
...
...
@@ -104,9 +126,10 @@ export default {
},
],
answer
:
'B'
,
explain
:
'极性电介质在外电场作用下,由偶极子分子的转向形成的极化称为偶极子式极化。'
,
explain
:
'极性电介质在外电场作用下,由偶极子分子的转向形成的极化称为偶极子式极化。'
,
index
:
1
,
rightKey
:
[
'B'
]
rightKey
:
[
'B'
]
,
},
{
type
:
3
,
...
...
@@ -130,10 +153,11 @@ export default {
},
],
answer
:
'B,C'
,
explain
:
'双臂电桥是在单臂电桥的基础上增加特殊机构,以消除测试时连接线和接线柱接触电阻对测量结果的影响。'
,
explain
:
'双臂电桥是在单臂电桥的基础上增加特殊机构,以消除测试时连接线和接线柱接触电阻对测量结果的影响。'
,
index
:
2
,
rightKey
:
[
'B'
,
'C'
]
}
rightKey
:
[
'B'
,
'C'
],
}
,
]
this
.
requestQuestionInfo
(
lists
)
...
...
@@ -144,36 +168,41 @@ export default {
this
.
list
=
lists
setTimeout
(()
=>
{
// 比如上次答到了第20题
this
.
$refs
.
swiper
.
init
(
0
)
;
this
.
$refs
.
swiper
.
init
(
0
)
// 初始化后再把动画弄出来,否则初始的current不是0,界面会自动跳动到当前位置,体验不太好
this
.
swiperDuration
=
'250'
// 全局记一下list, 答题卡页暂时就直接用了
app
.
globalData
.
questionList
=
lists
},
1000
)
},
swiperChange
(
e
)
{
let
current
=
e
.
current
this
.
currentIndex
=
current
if
(
current
==
NO_PREV_PAGE
)
{
uni
.
showToast
({
title
:
"已经是第一题了"
,
icon
:
"none"
title
:
'已经是第一题了'
,
icon
:
'none'
,
})
return
}
if
(
current
==
NO_NEXT_PAGE
)
{
uni
.
showModal
({
title
:
"提示"
,
content
:
"您已经答完所有题,是否退出?"
,
title
:
'提示'
,
content
:
'您已经答完所有题,是否退出?'
,
})
return
}
},
changeModel
(
i
)
{
this
.
model
=
i
},
answerChange
(
e
)
{
console
.
log
(
"e"
,
e
)
console
.
log
(
'e'
,
e
)
},
submit
()
{
console
.
log
(
"提前交卷"
)
}
},
}
...
...
@@ -186,6 +215,32 @@ export default {
background-image
:
linear-gradient
(
to
top
,
#f8fafd
0%
,
#e9f3ff
50%
);
background-size
:
100%
520rpx
;
background-repeat
:
no-repeat
;
.head
{
width
:
100%
;
flex
:
1
;
.tab
{
margin
:
10rpx
auto
;
border
:
2rpx
solid
#2953FF
;
border-radius
:
10rpx
;
width
:
300rpx
;
.tab-list
{
flex
:
1
;
padding
:
10rpx
25rpx
;
font-size
:
24rpx
;
color
:
#191C27
;
}
.active
{
background
:
#2953FF
;
color
:
#fff
;
}
}
.count-down
{
color
:
#5A6073
;
font-size
:
32rpx
;
margin
:
10rpx
auto
;
width
:
230rpx
;
}
}
.swiper
{
width
:
100%
;
flex
:
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment