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
8c2078a8
Commit
8c2078a8
authored
Jul 20, 2021
by
Facius
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-v1.0.0' of
https://git.banshouhui.com/wuzhenzhe/study
into dev-v1.0.0
parents
6963461c
badc483b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
650 additions
and
142 deletions
+650
-142
index.vue
src/components/swiper-limited-load/index.vue
+10
-5
pages.json
src/pages.json
+33
-0
answer.vue
src/pages/learn/answer.vue
+66
-136
answerBackup.vue
src/pages/learn/answerBackup.vue
+376
-0
detail.vue
src/pages/search/detail.vue
+32
-0
index.vue
src/pages/search/index.vue
+131
-0
index.js
src/store/index.js
+2
-1
No files found.
src/components/swiper-limited-load/index.vue
View file @
8c2078a8
...
@@ -9,13 +9,14 @@
...
@@ -9,13 +9,14 @@
>
>
<swiper-item
v-for=
"(item, index) in swiperList"
:key=
"index"
>
<swiper-item
v-for=
"(item, index) in swiperList"
:key=
"index"
>
<view
class=
"u-flex subject"
>
<view
class=
"u-flex subject"
>
<view
class=
"title"
><text>
{{
titleType
[
item
.
type
-
1
]
}}
</text>
{{
item
.
title
}}
</view>
<view
class=
"title"
v-if=
"item.title"
><text>
{{
titleType
[
item
.
type
-
1
]
}}
</text>
{{
item
.
title
}}
</view>
<view
class=
"content"
>
<view
class=
"content"
>
<answer-sheet
<answer-sheet
ref=
"answerSheet"
ref=
"answerSheet"
:answerList=
"item.answerList"
:answerList=
"item.answerList"
:rightKey=
"item.rightKey"
:rightKey=
"item.rightKey"
:multiple=
"item.type === 3"
:multiple=
"item.type === 3"
:submitStatus=
"item.submitStatus"
@
change=
"answerChange"
@
change=
"answerChange"
></answer-sheet>
></answer-sheet>
</view>
</view>
...
@@ -132,7 +133,6 @@ export default {
...
@@ -132,7 +133,6 @@ export default {
swiperChange
:
function
(
e
)
{
swiperChange
:
function
(
e
)
{
let
current
=
e
.
detail
.
current
let
current
=
e
.
detail
.
current
let
lastIndex
=
this
.
swiperIndex
let
lastIndex
=
this
.
swiperIndex
console
.
log
(
"本次:"
+
current
+
"上次:"
+
lastIndex
)
let
currentItem
=
this
.
swiperList
[
current
]
let
currentItem
=
this
.
swiperList
[
current
]
let
info
=
{}
let
info
=
{}
info
.
source
=
e
.
detail
.
source
info
.
source
=
e
.
detail
.
source
...
@@ -145,7 +145,10 @@ export default {
...
@@ -145,7 +145,10 @@ export default {
if
(
currentItem
==
null
)
{
if
(
currentItem
==
null
)
{
info
.
current
=
NO_NEXT_PAGE
info
.
current
=
NO_NEXT_PAGE
this
.
$emit
(
"change"
,
info
)
this
.
$emit
(
"change"
,
info
)
this
.
swiperCurrent
=
lastIndex
-
1
this
.
$nextTick
(()
=>
{
this
.
swiperCurrent
=
lastIndex
this
.
swiperCurrent
=
lastIndex
})
return
return
}
}
this
.
$set
(
this
.
swiperList
,
this
.
getNextSwiperChangeIndex
(
current
),
this
.
getNextSwiperNeedItem
(
currentItem
,
this
.
list
))
this
.
$set
(
this
.
swiperList
,
this
.
getNextSwiperChangeIndex
(
current
),
this
.
getNextSwiperNeedItem
(
currentItem
,
this
.
list
))
...
@@ -159,7 +162,10 @@ export default {
...
@@ -159,7 +162,10 @@ export default {
if
(
currentItem
==
null
)
{
if
(
currentItem
==
null
)
{
info
.
current
=
NO_PREV_PAGE
info
.
current
=
NO_PREV_PAGE
this
.
$emit
(
"change"
,
info
)
this
.
$emit
(
"change"
,
info
)
this
.
swiperCurrent
=
lastIndex
+
1
this
.
$nextTick
(()
=>
{
this
.
swiperCurrent
=
lastIndex
this
.
swiperCurrent
=
lastIndex
})
return
return
}
}
this
.
$set
(
this
.
swiperList
,
this
.
getLastSwiperChangeIndex
(
current
),
this
.
getLastSwiperNeedItem
(
currentItem
,
this
.
list
))
this
.
$set
(
this
.
swiperList
,
this
.
getLastSwiperChangeIndex
(
current
),
this
.
getLastSwiperNeedItem
(
currentItem
,
this
.
list
))
...
@@ -182,7 +188,6 @@ export default {
...
@@ -182,7 +188,6 @@ export default {
swiperList
[
current
]
=
currentItem
swiperList
[
current
]
=
currentItem
swiperList
[
this
.
getLastSwiperChangeIndex
(
current
)]
=
this
.
getLastSwiperNeedItem
(
currentItem
,
list
)
swiperList
[
this
.
getLastSwiperChangeIndex
(
current
)]
=
this
.
getLastSwiperNeedItem
(
currentItem
,
list
)
swiperList
[
this
.
getNextSwiperChangeIndex
(
current
)]
=
this
.
getNextSwiperNeedItem
(
currentItem
,
list
)
swiperList
[
this
.
getNextSwiperChangeIndex
(
current
)]
=
this
.
getNextSwiperNeedItem
(
currentItem
,
list
)
console
.
log
(
"初始化swiperList"
,
swiperList
)
return
swiperList
;
return
swiperList
;
},
},
/**
/**
...
...
src/pages.json
View file @
8c2078a8
...
@@ -45,6 +45,29 @@
...
@@ -45,6 +45,29 @@
}
}
]
]
},
},
{
"root"
:
"pages/search"
,
"pages"
:
[
{
"path"
:
"index"
,
"name"
:
"searchIndex"
,
"style"
:
{
"navigationBarTitleText"
:
"搜索"
,
"navigationStyle"
:
"custom"
,
"disableScroll"
:
true
}
},
{
"path"
:
"detail"
,
"name"
:
"searchDetail"
,
"style"
:
{
"navigationBarTitleText"
:
"搜索结果"
,
"navigationStyle"
:
"custom"
,
"disableScroll"
:
true
}
}
]
},
{
{
"root"
:
"pages/learn"
,
"root"
:
"pages/learn"
,
"pages"
:
[
"pages"
:
[
...
@@ -58,6 +81,16 @@
...
@@ -58,6 +81,16 @@
"disableScroll"
:
true
"disableScroll"
:
true
}
}
},
},
{
"path"
:
"answerBackup"
,
"name"
:
"learnAnswerrBackup"
,
"style"
:
{
"navigationBarTitleText"
:
"答题-备份"
,
"navigationStyle"
:
"custom"
,
"enablePullDownRefresh"
:
false
,
"disableScroll"
:
true
}
},
{
{
"path"
:
"detail"
,
"path"
:
"detail"
,
"name"
:
"learnDetail"
,
"name"
:
"learnDetail"
,
...
...
src/pages/learn/answer.vue
View file @
8c2078a8
...
@@ -10,60 +10,26 @@
...
@@ -10,60 +10,26 @@
></u-navbar>
></u-navbar>
<view
class=
"head"
v-if=
"type !== 3"
>
<view
class=
"head"
v-if=
"type !== 3"
>
<view
class=
"u-flex tab"
v-if=
"type === 1"
>
<view
class=
"u-flex tab"
v-if=
"type === 1"
>
<view
<view
:class=
"['tab-list',
{'active': model === 1}]" @click="changeModel(1)">答题模式
</view>
:class=
"['tab-list',
{ active: model === 1 }]"
<view
:class=
"['tab-list',
{'active': model === 2}]" @click="changeModel(2)">学习模式
</view>
@click="changeModel(1)"
>答题模式
</view
>
<view
:class=
"['tab-list',
{ active: model === 2 }]"
@click="changeModel(2)"
>学习模式
</view
>
</view>
</view>
<view
class=
"u-flex count-down"
v-if=
"type === 2"
>
<view
class=
"u-flex count-down"
v-if=
"type === 2"
>
<view
<view>
倒计时:
<u-count-down
:timestamp=
"timestamp"
bg-color=
""
:show-hours=
"false"
></u-count-down></view>
>
倒计时:
<u-count-down
:timestamp=
"timestamp"
bg-color=
""
:show-hours=
"false"
></u-count-down
></view>
</view>
</view>
</view>
</view>
<view
class=
"swiper"
>
<view
class=
"swiper"
>
<page-swiper
<swiper-limited-load
ref=
"pageSwiper"
ref=
"swiper"
:dataLength=
"dataLength"
:swiperHeight=
"500"
:initIndex=
"index"
:swiperDuration=
"swiperDuration"
@
swiperChange=
"swiperChange"
:list=
"list"
@
endChange=
"endChange"
:current=
"current"
style=
"flex: 1;"
:type=
"type"
>
:model=
"model"
<view
class=
"u-flex subject"
>
@
answerChange=
"answerChange"
<view
class=
"title"
@
change=
"swiperChange"
><text>
{{
titleType
[
list
[
index
].
type
-
1
]
}}
</text
>
{{
list
[
index
].
title
}}
</view
>
>
<view
class=
"content"
>
</swiper-limited-load>
<answer-sheet
ref=
"answerSheet"
:answerList=
"list[index].answerList"
:rightKey=
"list[index].rightKey"
:multiple=
"list[index].type === 3"
:submitStatus=
"list[index].submitStatus"
@
change=
"answerChange"
></answer-sheet>
</view>
<view
class=
"explain"
>
<answer-explanation
v-show=
"model === 2 || list[index].errShow"
:answer=
"list[index].answer"
:explain=
"list[index].explain"
></answer-explanation>
</view>
</view>
</page-swiper>
</view>
</view>
<view
class=
"u-flex u-row-around bottom"
>
<view
class=
"u-flex u-row-around bottom"
>
<view
class=
"u-flex"
>
<view
class=
"u-flex"
>
...
@@ -73,11 +39,7 @@
...
@@ -73,11 +39,7 @@
</view>
</view>
</view>
</view>
<view
class=
"u-flex"
>
<view
class=
"u-flex"
>
<view
<view
class=
"c-list"
v-if=
"type === 1 || type === 3"
@
click=
"collection"
>
class=
"c-list"
v-if=
"type === 1 || type === 3"
@
click=
"collection"
>
<u-icon
name=
"star"
color=
"#5A6073"
size=
"40"
></u-icon>
<u-icon
name=
"star"
color=
"#5A6073"
size=
"40"
></u-icon>
<text>
收藏
</text>
<text>
收藏
</text>
</view>
</view>
...
@@ -88,15 +50,15 @@
...
@@ -88,15 +50,15 @@
</view>
</view>
</view>
</view>
<
!--
<
answer-operation-tips
:show
.
sync=
"show"
/>
<answer-operation-tips
:show
.
sync=
"show"
/>
<answer-complete-pop
<answer-complete-pop
:numberList=
"
[1, 2, 3]
"
:numberList=
"
result
"
type=
"fail"
type=
"fail"
:visible
.
sync=
"visible"
:visible
.
sync=
"visible"
@
cancel=
"visible = false"
@
cancel=
"visible = false"
@
submit=
"submit"
@
submit=
"submit"
>
>
</answer-complete-pop>
-->
</answer-complete-pop>
</view>
</view>
</
template
>
</
template
>
...
@@ -104,19 +66,15 @@
...
@@ -104,19 +66,15 @@
import
swiperLimitedLoad
from
'@/components/swiper-limited-load/index.vue'
import
swiperLimitedLoad
from
'@/components/swiper-limited-load/index.vue'
import
answerOperationTips
from
'@/components/answer-operation-tips/index.vue'
import
answerOperationTips
from
'@/components/answer-operation-tips/index.vue'
import
answerCompletePop
from
'@/components/answer-complete-pop/index.vue'
import
answerCompletePop
from
'@/components/answer-complete-pop/index.vue'
import
pageSwiper
from
'@/components/page-swiper/index.vue'
import
answerSheet
from
'@/components/answer-sheet/index.vue'
import
answerExplanation
from
'@/components/answer-explanation/index.vue'
const
NO_PREV_PAGE
=
-
1
const
NO_NEXT_PAGE
=
-
2
const
app
=
getApp
()
const
app
=
getApp
()
export
default
{
export
default
{
components
:
{
components
:
{
swiperLimitedLoad
,
swiperLimitedLoad
,
answerOperationTips
,
answerOperationTips
,
answerCompletePop
,
answerCompletePop
,
pageSwiper
,
answerSheet
,
answerExplanation
,
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -128,9 +86,10 @@ export default {
...
@@ -128,9 +86,10 @@ export default {
model
:
1
,
model
:
1
,
timestamp
:
60
*
60
,
timestamp
:
60
*
60
,
list
:
[],
list
:
[],
index
:
0
,
current
:
0
,
dataLength
:
0
,
currentIndex
:
0
,
titleType
:
[
'单选题'
,
'判断题'
,
'多选题'
],
swiperDuration
:
'0'
,
result
:
[
1
,
2
,
3
]
}
}
},
},
computed
:
{},
computed
:
{},
...
@@ -216,7 +175,8 @@ export default {
...
@@ -216,7 +175,8 @@ export default {
},
},
],
],
answer
:
'B'
,
answer
:
'B'
,
explain
:
'测试内容测试内容测试内容测试内容测试内容测试内容'
,
explain
:
'测试内容测试内容测试内容测试内容测试内容测试内容'
,
index
:
3
,
index
:
3
,
rightKey
:
[
'B'
],
rightKey
:
[
'B'
],
},
},
...
@@ -225,66 +185,69 @@ export default {
...
@@ -225,66 +185,69 @@ export default {
this
.
requestQuestionInfo
(
lists
)
this
.
requestQuestionInfo
(
lists
)
},
},
methods
:
{
methods
:
{
swiperChange
(
e
)
{
requestQuestionInfo
(
lists
)
{
this
.
index
=
e
// 初始化setData后,需要调用swiper组件的init方法
// 初始化checked confirm
this
.
list
=
lists
this
.
list
[
e
].
answerList
=
this
.
list
[
e
].
answerList
.
map
((
v
)
=>
{
this
.
$nextTick
(()
=>
{
if
(
!
v
.
checked
)
v
.
checked
=
false
// 比如上次答到了第20题
if
(
!
v
.
confirm
)
v
.
confirm
=
false
this
.
$refs
.
swiper
.
init
(
0
)
return
v
// 初始化后再把动画弄出来,否则初始的current不是0,界面会自动跳动到当前位置,体验不太好
this
.
swiperDuration
=
'250'
// 全局记一下list, 答题卡页暂时就直接用了
app
.
globalData
.
questionList
=
lists
})
})
},
},
endChange
(
type
)
{
swiperChange
(
e
)
{
if
(
type
===
'left'
)
{
let
current
=
e
.
current
this
.
currentIndex
=
current
if
(
current
==
NO_PREV_PAGE
)
{
return
uni
.
showToast
({
return
uni
.
showToast
({
title
:
'已经是第一题了'
,
title
:
'已经是第一题了'
,
icon
:
'none'
,
icon
:
'none'
,
})
})
}
else
if
(
type
===
'right'
)
{
}
if
(
current
==
NO_NEXT_PAGE
)
{
return
uni
.
showToast
({
return
uni
.
showToast
({
title
:
'已经是最后一题了'
,
title
:
'已经是最后一题了'
,
icon
:
'none'
,
icon
:
'none'
,
})
})
}
}
},
},
requestQuestionInfo
(
lists
)
{
this
.
list
=
lists
this
.
dataLength
=
lists
.
length
app
.
globalData
.
questionList
=
lists
},
changeModel
(
i
)
{
changeModel
(
i
)
{
this
.
model
=
i
this
.
model
=
i
},
},
collection
()
{
collection
()
{
console
.
log
(
'收藏'
)
console
.
log
(
"this.list[this.currentIndex]"
,
this
.
list
[
this
.
currentIndex
])
console
.
log
(
"收藏"
)
},
},
// 作答完毕
// 作答完毕
answerChange
(
status
,
lists
)
{
answerChange
(
status
,
lists
)
{
// 保存答题状态
// 保存答题状态
this
.
$set
(
this
.
list
[
this
.
index
],
'submitStatus'
,
true
)
this
.
$set
(
this
.
list
[
this
.
currentIndex
],
'submitStatus'
,
lists
)
this
.
$set
(
this
.
list
[
this
.
index
],
'answerList'
,
lists
)
this
.
$set
(
this
.
list
[
this
.
currentIndex
],
'answerList'
,
lists
)
this
.
$set
(
this
.
$set
(
this
.
list
[
this
.
currentIndex
],
'result'
,
status
)
this
.
list
[
this
.
index
],
this
.
$set
(
this
.
list
[
this
.
currentIndex
],
'errShow'
,
this
.
type
===
2
?
true
:
status
===
'fail'
)
'errShow'
,
this
.
type
===
2
?
true
:
status
===
'fail'
)
app
.
globalData
.
questionList
=
this
.
list
app
.
globalData
.
questionList
=
this
.
list
// 如果回答错误或者是考试模式,自动进入下一题
// 如果回答错误或者是考试模式,自动进入下一题
if
(
status
===
'pass'
||
this
.
type
===
2
)
{
if
(
status
===
'pass'
||
this
.
type
===
2
)
{
if
(
this
.
index
+
1
===
this
.
list
.
length
)
return
if
(
this
.
currentIndex
+
1
>
this
.
list
.
length
-
1
)
{
this
.
index
++
return
this
.
$refs
.
pageSwiper
.
swiperTo
(
this
.
index
)
}
this
.
current
=
this
.
currentIndex
+
1
}
}
},
},
// 交卷
// 交卷
handPapers
()
{
handPapers
()
{
const
fail
=
this
.
list
.
filter
(
v
=>
v
.
result
===
'fail'
).
length
const
noStart
=
this
.
list
.
filter
(
v
=>
!
v
.
result
).
length
this
.
result
=
[
fail
,
noStart
,
0
]
this
.
visible
=
true
this
.
visible
=
true
console
.
log
(
'交卷'
)
},
},
// 提前交卷
// 提前交卷
submit
()
{
submit
()
{
console
.
log
(
'提前交卷'
)
console
.
log
(
"提前交卷"
)
}
,
}
},
},
}
}
</
script
>
</
script
>
...
@@ -300,64 +263,31 @@ export default {
...
@@ -300,64 +263,31 @@ export default {
width
:
100%
;
width
:
100%
;
height
:
90rpx
;
height
:
90rpx
;
.tab
{
.tab
{
margin
:
10rpx
auto
;
margin
:
10rpx
auto
;
border
:
2rpx
solid
#2953
ff
;
border
:
2rpx
solid
#2953
FF
;
border-radius
:
10rpx
;
border-radius
:
10rpx
;
width
:
300rpx
;
width
:
300rpx
;
.tab-list
{
.tab-list
{
flex
:
1
;
flex
:
1
;
padding
:
10rpx
25rpx
;
padding
:
10rpx
25rpx
;
font-size
:
24rpx
;
font-size
:
24rpx
;
color
:
#191
c
27
;
color
:
#191
C
27
;
}
}
.active
{
.active
{
background
:
#2953
ff
;
background
:
#2953
FF
;
color
:
#fff
;
color
:
#fff
;
}
}
}
}
.count-down
{
.count-down
{
color
:
#5
a6073
;
color
:
#5
A6073
;
font-size
:
32rpx
;
font-size
:
32rpx
;
margin
:
10rpx
auto
;
margin
:
10rpx
auto
;
width
:
230rpx
;
width
:
230rpx
;
}
}
}
}
.swiper
{
.swiper
{
width
:
100%
;
width
:
100%
;
flex
:
1
;
flex
:
1
;
display
:
flex
;
flex-direction
:
column
;
.subject
{
flex-flow
:
column
;
padding
:
20rpx
;
.type
{
width
:
100%
;
text-align
:
left
;
padding
:
20rpx
0
;
}
.title
{
color
:
#191c27
;
font-size
:
32rpx
;
line-height
:
50rpx
;
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%
;
padding-top
:
50rpx
;
}
}
}
}
.bottom
{
.bottom
{
width
:
100%
;
width
:
100%
;
...
...
src/pages/learn/answerBackup.vue
0 → 100644
View file @
8c2078a8
<
template
>
<view
class=
"u-flex answer"
>
<u-navbar
back-icon-color=
"#333333"
background=
"transparent"
titleColor=
"#191C27"
:border-bottom=
"false"
title=
"答题"
title-bold
></u-navbar>
<view
class=
"head"
v-if=
"type !== 3"
>
<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"
>
<page-swiper
ref=
"pageSwiper"
:dataLength=
"dataLength"
:initIndex=
"index"
@
swiperChange=
"swiperChange"
@
endChange=
"endChange"
style=
"flex: 1;"
>
<view
class=
"u-flex subject"
>
<view
class=
"title"
><text>
{{
titleType
[
list
[
index
].
type
-
1
]
}}
</text
>
{{
list
[
index
].
title
}}
</view
>
<view
class=
"content"
>
<answer-sheet
ref=
"answerSheet"
:answerList=
"list[index].answerList"
:rightKey=
"list[index].rightKey"
:multiple=
"list[index].type === 3"
:submitStatus=
"list[index].submitStatus"
@
change=
"answerChange"
></answer-sheet>
</view>
<view
class=
"explain"
>
<answer-explanation
v-show=
"model === 2 || list[index].errShow"
:answer=
"list[index].answer"
:explain=
"list[index].explain"
></answer-explanation>
</view>
</view>
</page-swiper>
</view>
<view
class=
"u-flex u-row-around bottom"
>
<view
class=
"u-flex"
>
<view
class=
"c-list"
>
<u-icon
name=
"grid"
color=
"#5A6073"
size=
"40"
></u-icon>
<text>
1/2887
</text>
</view>
</view>
<view
class=
"u-flex"
>
<view
class=
"c-list"
v-if=
"type === 1 || type === 3"
@
click=
"collection"
>
<u-icon
name=
"star"
color=
"#5A6073"
size=
"40"
></u-icon>
<text>
收藏
</text>
</view>
<view
class=
"c-list"
v-if=
"type === 2"
@
click=
"handPapers"
>
<u-icon
name=
"file-text"
color=
"#5A6073"
size=
"40"
></u-icon>
<text>
交卷
</text>
</view>
</view>
</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'
import
pageSwiper
from
'@/components/page-swiper/index.vue'
import
answerSheet
from
'@/components/answer-sheet/index.vue'
import
answerExplanation
from
'@/components/answer-explanation/index.vue'
const
app
=
getApp
()
export
default
{
components
:
{
swiperLimitedLoad
,
answerOperationTips
,
answerCompletePop
,
pageSwiper
,
answerSheet
,
answerExplanation
,
},
data
()
{
return
{
visible
:
false
,
show
:
false
,
// 1 练习 2 考试 3 每日一练 4 错题记录 5 收藏记录
type
:
1
,
// 1 答题模式 2 学习模式
model
:
1
,
timestamp
:
60
*
60
,
list
:
[],
index
:
0
,
dataLength
:
0
,
titleType
:
[
'单选题'
,
'判断题'
,
'多选题'
],
}
},
computed
:
{},
created
()
{
const
lists
=
[
{
type
:
1
,
title
:
'采用QS1电桥测量tanδ的接线方式一般有差接线及和接线。'
,
answerList
:
[
{
sort
:
'A'
,
text
:
'正确'
,
},
{
sort
:
'B'
,
text
:
'错误'
,
},
],
answer
:
'A'
,
explain
:
'极性电介质在外电场作用下,由偶极子分子的转向形成的极化称为偶极子式极化。'
,
index
:
0
,
rightKey
:
[
'A'
],
},
{
type
:
2
,
title
:
'空气间隙的操作冲击击穿电压数值大小不仅与间隙距离、电极形状、电极极性有关,而且与操作冲击电压波的波前时间的长短有关。'
,
answerList
:
[
{
sort
:
'A'
,
text
:
'正确'
,
},
{
sort
:
'B'
,
text
:
'错误'
,
},
],
answer
:
'B'
,
explain
:
'极性电介质在外电场作用下,由偶极子分子的转向形成的极化称为偶极子式极化。'
,
index
:
1
,
rightKey
:
[
'B'
],
},
{
type
:
3
,
title
:
'西林电桥采用正接线及反接线时,其测试原理相同'
,
answerList
:
[
{
sort
:
'A'
,
text
:
'影响'
,
},
{
sort
:
'B'
,
text
:
'影响很小'
,
},
{
sort
:
'C'
,
text
:
'影响很大'
,
},
{
sort
:
'D'
,
text
:
'无影响'
,
},
],
answer
:
'B,C'
,
explain
:
'双臂电桥是在单臂电桥的基础上增加特殊机构,以消除测试时连接线和接线柱接触电阻对测量结果的影响。'
,
index
:
2
,
rightKey
:
[
'B'
,
'C'
],
},
{
type
:
2
,
title
:
'测试标题测试标题测试标题测试标题'
,
answerList
:
[
{
sort
:
'A'
,
text
:
'是'
,
},
{
sort
:
'B'
,
text
:
'否'
,
},
],
answer
:
'B'
,
explain
:
'测试内容测试内容测试内容测试内容测试内容测试内容'
,
index
:
3
,
rightKey
:
[
'B'
],
},
]
this
.
requestQuestionInfo
(
lists
)
},
methods
:
{
swiperChange
(
e
)
{
this
.
index
=
e
// 初始化checked confirm
this
.
list
[
e
].
answerList
=
this
.
list
[
e
].
answerList
.
map
((
v
)
=>
{
if
(
!
v
.
checked
)
v
.
checked
=
false
if
(
!
v
.
confirm
)
v
.
confirm
=
false
return
v
})
},
endChange
(
type
)
{
if
(
type
===
'left'
)
{
return
uni
.
showToast
({
title
:
'已经是第一题了'
,
icon
:
'none'
,
})
}
else
if
(
type
===
'right'
)
{
return
uni
.
showToast
({
title
:
'已经是最后一题了'
,
icon
:
'none'
,
})
}
},
requestQuestionInfo
(
lists
)
{
this
.
list
=
lists
this
.
dataLength
=
lists
.
length
app
.
globalData
.
questionList
=
lists
},
changeModel
(
i
)
{
this
.
model
=
i
},
collection
()
{
console
.
log
(
'收藏'
)
},
// 作答完毕
answerChange
(
status
,
lists
)
{
// 保存答题状态
this
.
$set
(
this
.
list
[
this
.
index
],
'submitStatus'
,
true
)
this
.
$set
(
this
.
list
[
this
.
index
],
'answerList'
,
lists
)
this
.
$set
(
this
.
list
[
this
.
index
],
'errShow'
,
this
.
type
===
2
?
true
:
status
===
'fail'
)
app
.
globalData
.
questionList
=
this
.
list
// 如果回答错误或者是考试模式,自动进入下一题
if
(
status
===
'pass'
||
this
.
type
===
2
)
{
if
(
this
.
index
+
1
===
this
.
list
.
length
)
return
this
.
index
++
this
.
$refs
.
pageSwiper
.
swiperTo
(
this
.
index
)
}
},
// 交卷
handPapers
()
{
this
.
visible
=
true
console
.
log
(
'交卷'
)
},
// 提前交卷
submit
()
{
console
.
log
(
'提前交卷'
)
},
},
}
</
script
>
<
style
lang=
"scss"
scoped
>
.answer
{
height
:
100vh
;
flex-direction
:
column
;
background-color
:
#f8fafd
;
background-image
:
linear-gradient
(
to
top
,
#f8fafd
0%
,
#e9f3ff
50%
);
background-size
:
100%
520rpx
;
background-repeat
:
no-repeat
;
.head
{
width
:
100%
;
height
:
90rpx
;
.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
;
display
:
flex
;
flex-direction
:
column
;
.subject
{
flex-flow
:
column
;
padding
:
20rpx
;
.type
{
width
:
100%
;
text-align
:
left
;
padding
:
20rpx
0
;
}
.title
{
color
:
#191c27
;
font-size
:
32rpx
;
line-height
:
50rpx
;
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%
;
padding-top
:
50rpx
;
}
}
}
.bottom
{
width
:
100%
;
height
:
150rpx
;
border-top
:
2rpx
solid
#ccc
;
color
:
#5a6073
;
font-size
:
28rpx
;
.c-list
{
display
:
flex
;
text
{
padding-left
:
10rpx
;
}
}
}
}
</
style
>
src/pages/search/detail.vue
0 → 100644
View file @
8c2078a8
<
template
>
<view
class=
"search"
>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
keyword
:
''
}
},
computed
:
{
},
methods
:
{
},
}
</
script
>
<
style
lang=
"scss"
scoped
>
.search
{
height
:
100vh
;
flex-direction
:
column
;
background-color
:
#f8fafd
;
background-image
:
linear-gradient
(
to
top
,
#f8fafd
0%
,
#e9f3ff
50%
);
background-size
:
100%
520rpx
;
background-repeat
:
no-repeat
;
padding
:
0
20rpx
;
}
</
style
>
src/pages/search/index.vue
0 → 100644
View file @
8c2078a8
<
template
>
<view
class=
"search"
>
<u-navbar
back-icon-color=
"#333333"
background=
"transparent"
title=
"搜索"
titleColor=
"#191C27"
:border-bottom=
"false"
title-bold
></u-navbar>
<view
class=
"search-bar"
>
<u-search
:clearabled=
"true"
:action-style=
"searchStyle"
bg-color=
"#fff"
v-model=
"keyword"
@
custom=
"search"
@
search=
"search"
></u-search>
</view>
<view
class=
"title"
>
搜索历史
</view>
<view
class=
"u-flex history"
>
<view
class=
"history-list"
v-for=
"(item, index) in history"
:key=
"index"
@
click=
"toSearchDetail(item)"
>
{{
item
}}
</view
>
</view>
<view
class=
"u-flex clear"
@
click=
"removeHistory"
>
<image
:src=
"deleteImg"
></image>
<view>
清空搜索历史记录
</view>
</view>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
keyword
:
''
,
history
:
[],
}
},
computed
:
{
searchStyle
()
{
return
{
color
:
'#2272FF'
,
}
},
deleteImg
()
{
return
process
.
uniEnv
.
qn_base_url
+
'delete.png'
},
},
created
()
{
this
.
history
=
this
.
searchHistory
},
methods
:
{
search
(
val
)
{
this
.
keyword
=
val
this
.
history
.
push
(
val
)
this
.
$u
.
vuex
(
'searchHistory'
,
this
.
history
)
this
.
toSearchDetail
(
val
)
},
toSearchDetail
(
keyword
)
{
this
.
$u
.
route
({
url
:
'pages/search/detail'
,
params
:
{
keyword
:
keyword
}
})
},
removeHistory
()
{
uni
.
showModal
({
title
:
'提示'
,
content
:
'确认要清空搜索历史记录?'
,
success
:
(
res
)
=>
{
if
(
res
.
confirm
)
{
this
.
history
=
[]
this
.
$u
.
vuex
(
'searchHistory'
,
[])
}
},
})
},
},
}
</
script
>
<
style
lang=
"scss"
scoped
>
.search
{
height
:
100vh
;
flex-direction
:
column
;
background-color
:
#f8fafd
;
background-image
:
linear-gradient
(
to
top
,
#f8fafd
0%
,
#e9f3ff
50%
);
background-size
:
100%
520rpx
;
background-repeat
:
no-repeat
;
padding
:
0
20rpx
;
.title
{
color
:
#191c27
;
font-size
:
32rpx
;
font-weight
:
bold
;
margin-top
:
30rpx
;
}
.history
{
margin-top
:
20rpx
;
flex-wrap
:
wrap
;
.history-list
{
padding
:
20rpx
25rpx
;
background
:
#fff
;
color
:
#5a6073
;
margin
:
10rpx
20rpx
10rpx
0
;
font-size
:
26rpx
;
border-radius
:
10rpx
;
}
}
.clear
{
margin-top
:
30rpx
;
justify-content
:
center
;
image
{
width
:
28rpx
;
height
:
32rpx
;
padding-right
:
10rpx
;
}
}
}
</
style
>
src/store/index.js
View file @
8c2078a8
...
@@ -12,7 +12,7 @@ try{
...
@@ -12,7 +12,7 @@ try{
}
}
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名
let
saveStateKeys
=
[
'userInfo'
,
'vuex_token'
,
'openId'
];
let
saveStateKeys
=
[
'userInfo'
,
'vuex_token'
,
'openId'
,
'searchHistory'
];
// 保存变量到本地存储中
// 保存变量到本地存储中
const
saveLifeData
=
function
(
key
,
value
){
const
saveLifeData
=
function
(
key
,
value
){
...
@@ -35,6 +35,7 @@ const store = new Vuex.Store({
...
@@ -35,6 +35,7 @@ const store = new Vuex.Store({
userInfo
:
lifeData
.
userInfo
?
lifeData
.
userInfo
:
{},
userInfo
:
lifeData
.
userInfo
?
lifeData
.
userInfo
:
{},
vuex_token
:
lifeData
.
vuex_token
?
lifeData
.
vuex_token
:
''
,
vuex_token
:
lifeData
.
vuex_token
?
lifeData
.
vuex_token
:
''
,
openId
:
lifeData
.
openId
?
lifeData
.
openId
:
''
,
openId
:
lifeData
.
openId
?
lifeData
.
openId
:
''
,
searchHistory
:
lifeData
.
searchHistory
?
lifeData
.
searchHistory
:
[],
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
vuex_version
:
'1.0.1'
,
vuex_version
:
'1.0.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