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
1b360b91
Commit
1b360b91
authored
Jul 24, 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
d99a445b
7d92b1ed
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
231 additions
and
163 deletions
+231
-163
App.vue
src/App.vue
+4
-2
uni-list.vue
src/components/uni-list/uni-list.vue
+106
-0
pages.json
src/pages.json
+1
-2
answer.vue
src/pages/learn/answer.vue
+9
-3
index.vue
src/pages/login/index.vue
+3
-1
detail.vue
src/pages/search/detail.vue
+108
-155
No files found.
src/App.vue
View file @
1b360b91
...
@@ -4,9 +4,11 @@ export default {
...
@@ -4,9 +4,11 @@ export default {
globalData
:
{
globalData
:
{
// 开发环境
// 开发环境
uniEnv
:
process
.
uniEnv
,
uniEnv
:
process
.
uniEnv
,
questionList
:
[]
questionList
:
[],
orgId
:
-
1
},
},
onLaunch
:
function
()
{
onLaunch
:
function
(
options
)
{
this
.
globalData
.
orgId
=
options
?.
orgId
||
-
1
// 版本更新
// 版本更新
this
.
updateApp
()
this
.
updateApp
()
},
},
...
...
src/components/uni-list/uni-list.vue
0 → 100644
View file @
1b360b91
<
template
>
<!-- #ifndef APP-NVUE -->
<view
class=
"uni-list uni-border-top-bottom"
>
<view
v-if=
"border"
class=
"uni-list--border-top"
></view>
<slot
/>
<view
v-if=
"border"
class=
"uni-list--border-bottom"
></view>
</view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<list
class=
"uni-list"
:class=
"
{ 'uni-list--border': border }" :enableBackToTop="enableBackToTop" loadmoreoffset="15">
<slot
/></list>
<!-- #endif -->
</
template
>
<
script
>
/**
* List 列表
* @description 列表组件
* @tutorial https://ext.dcloud.net.cn/plugin?id=24
* @property {String} border = [true|false] 标题
*/
export
default
{
name
:
'uniList'
,
'mp-weixin'
:
{
options
:
{
multipleSlots
:
false
}
},
props
:
{
enableBackToTop
:
{
type
:
[
Boolean
,
String
],
default
:
false
},
scrollY
:
{
type
:
[
Boolean
,
String
],
default
:
false
},
border
:
{
type
:
Boolean
,
default
:
true
}
},
// provide() {
// return {
// list: this
// };
// },
created
()
{
this
.
firstChildAppend
=
false
;
},
methods
:
{
loadMore
(
e
)
{
this
.
$emit
(
'scrolltolower'
);
}
}
};
</
script
>
<
style
lang=
"scss"
>
.uni-list
{
/* #ifndef APP-NVUE */
display
:
flex
;
/* #endif */
background-color
:
$uni-bg-color
;
position
:
relative
;
flex-direction
:
column
;
}
.uni-list--border
{
position
:
relative
;
/* #ifdef APP-NVUE */
border-top-color
:
$uni-border-color
;
border-top-style
:
solid
;
border-top-width
:
0
.5px
;
border-bottom-color
:
$uni-border-color
;
border-bottom-style
:
solid
;
border-bottom-width
:
0
.5px
;
/* #endif */
z-index
:
-1
;
}
/* #ifndef APP-NVUE */
.uni-list--border-top
{
position
:
absolute
;
top
:
0
;
right
:
0
;
left
:
0
;
height
:
1px
;
-webkit-transform
:
scaleY
(
0
.5
);
transform
:
scaleY
(
0
.5
);
background-color
:
$uni-border-color
;
z-index
:
1
;
}
.uni-list--border-bottom
{
position
:
absolute
;
bottom
:
0
;
right
:
0
;
left
:
0
;
height
:
1px
;
-webkit-transform
:
scaleY
(
0
.5
);
transform
:
scaleY
(
0
.5
);
background-color
:
$uni-border-color
;
}
/* #endif */
</
style
>
src/pages.json
View file @
1b360b91
...
@@ -63,8 +63,7 @@
...
@@ -63,8 +63,7 @@
"name"
:
"searchDetail"
,
"name"
:
"searchDetail"
,
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
"搜索结果"
,
"navigationBarTitleText"
:
"搜索结果"
,
"navigationStyle"
:
"custom"
,
"navigationStyle"
:
"custom"
"disableScroll"
:
true
}
}
}
}
]
]
...
...
src/pages/learn/answer.vue
View file @
1b360b91
...
@@ -244,7 +244,7 @@ export default {
...
@@ -244,7 +244,7 @@ export default {
}
}
if
(
this
.
source
===
1
){
// 顺序答题,如果答满则清空数据
if
(
this
.
source
===
1
){
// 顺序答题,如果答满则清空数据
const
check
=
this
.
questionList
.
every
(
v
=>
v
.
id
)
const
check
=
this
.
questionList
.
every
(
v
=>
v
.
submitStatus
)
if
(
check
)
{
if
(
check
)
{
this
.
$u
.
vuex
(
'lastIndex'
,
0
)
this
.
$u
.
vuex
(
'lastIndex'
,
0
)
this
.
$u
.
vuex
(
'questionList'
,
[])
this
.
$u
.
vuex
(
'questionList'
,
[])
...
@@ -419,7 +419,7 @@ export default {
...
@@ -419,7 +419,7 @@ export default {
// 统计是否达满所有试题
// 统计是否达满所有试题
const
count
=
this
.
questionList
.
reduce
((
accumulator
,
currentValue
)
=>
{
const
count
=
this
.
questionList
.
reduce
((
accumulator
,
currentValue
)
=>
{
if
(
currentValue
.
id
)
accumulator
++
if
(
currentValue
.
submitStatus
)
accumulator
++
return
accumulator
return
accumulator
},
0
)
},
0
)
...
@@ -525,7 +525,13 @@ export default {
...
@@ -525,7 +525,13 @@ export default {
const
info
=
this
.
list
.
find
(
v
=>
v
.
index
===
this
.
currentIndex
)
const
info
=
this
.
list
.
find
(
v
=>
v
.
index
===
this
.
currentIndex
)
const
action
=
status
?
'removeCollection'
:
'joinCollection'
const
action
=
status
?
'removeCollection'
:
'joinCollection'
this
.
$u
.
api
[
action
]({
questionId
:
info
.
id
}).
then
(
res
=>
{
this
.
$u
.
api
[
action
]({
questionId
:
info
.
id
}).
then
(
res
=>
{
if
(
res
)
info
.
collectionFlag
=
!
status
if
(
res
)
{
info
.
collectionFlag
=
!
status
if
(
this
.
source
===
1
)
{
//更新缓存数据
this
.
questionList
[
this
.
currentIndex
]
=
info
this
.
$u
.
vuex
(
'questionList'
,
this
.
questionList
)
}
}
})
})
},
},
// 移除
// 移除
...
...
src/pages/login/index.vue
View file @
1b360b91
...
@@ -17,7 +17,8 @@ export default {
...
@@ -17,7 +17,8 @@ export default {
host
:
''
,
//配置为自己的额服务器即可
host
:
''
,
//配置为自己的额服务器即可
}
}
},
},
onShow
()
{},
onShow
()
{
},
methods
:
{
methods
:
{
wxLogin
()
{
wxLogin
()
{
// 获取code 小程序专有,用户登录凭证。
// 获取code 小程序专有,用户登录凭证。
...
@@ -36,6 +37,7 @@ export default {
...
@@ -36,6 +37,7 @@ export default {
code
:
code
,
code
:
code
,
avatar
:
userInfo
.
avatarUrl
,
avatar
:
userInfo
.
avatarUrl
,
nickname
:
userInfo
.
nickName
,
nickname
:
userInfo
.
nickName
,
orgId
:
getApp
().
globalData
.
orgId
}
}
uni
.
showLoading
({
uni
.
showLoading
({
title
:
'加载中'
title
:
'加载中'
...
...
src/pages/search/detail.vue
View file @
1b360b91
...
@@ -21,13 +21,14 @@
...
@@ -21,13 +21,14 @@
></u-search>
></u-search>
</view>
</view>
<view
v-
show
=
"lists.length > 0"
>
<view
v-
if
=
"lists.length > 0"
>
<view
class=
"title"
<view
class=
"title"
>
共找到含有
<text>
“
{{
keyword
}}
”
</text>
相关试题
<text>
10
</text>
道
</view
>
共找到含有
<text>
“
{{
keyword
}}
”
</text>
相关试题
<text>
{{
count
}}
</text>
道
</view
>
>
<view
class=
"result"
>
<view
class=
"result"
>
<u-collapse
:item-style=
"itemStyle"
event-type=
"close"
>
<u-collapse
:item-style=
"itemStyle"
event-type=
"close"
>
<uni-list
:border=
"false"
>
<u-collapse-item
<u-collapse-item
:ref=
"`collapse$
{index}`"
:ref=
"`collapse$
{index}`"
:index="index"
:index="index"
...
@@ -35,9 +36,9 @@
...
@@ -35,9 +36,9 @@
v-for="(item, index) in lists"
v-for="(item, index) in lists"
:key="index"
:key="index"
>
>
<view
slot=
"title-all"
class=
"u-flex head
"
>
<view
slot=
"title-all"
:class=
"['u-flex','head',
{'selected': index === arrIndex}]
">
<view
class=
"titles"
>
<view
class=
"titles"
>
<text>
{{
titleType
[
item
.
type
-
1
]
}}
</text
<text>
{{
item
.
type
}}
</text
>
{{
item
.
title
}}
>
{{
item
.
title
}}
</view>
</view>
<view
class=
"u-flex arrow"
v-show=
"index !== arrIndex"
>
<view
class=
"u-flex arrow"
v-show=
"index !== arrIndex"
>
...
@@ -66,8 +67,9 @@
...
@@ -66,8 +67,9 @@
</view>
</view>
<view
class=
"u-flex opera"
>
<view
class=
"u-flex opera"
>
<view
class=
"opera-list"
@
click=
"collection(item)"
>
<view
class=
"opera-list"
@
click=
"collection(item)"
>
<u-icon
name=
"star"
color=
"#5A6073"
size=
"40"
></u-icon>
<u-icon
v-show=
"!collectionFlag"
name=
"star"
color=
"#5A6073"
size=
"40"
></u-icon>
<text>
收藏
</text>
<u-icon
v-show=
"collectionFlag"
name=
"star-fill"
color=
"#FF930D"
size=
"40"
></u-icon>
<text>
{{
collectionFlag
?
'已收藏'
:
'收藏'
}}
</text>
</view>
</view>
<view
class=
"opera-list"
@
click=
"arrowUp(index)"
>
<view
class=
"opera-list"
@
click=
"arrowUp(index)"
>
<text>
收起
</text>
<text>
收起
</text>
...
@@ -75,11 +77,13 @@
...
@@ -75,11 +77,13 @@
</view>
</view>
</view>
</view>
</u-collapse-item>
</u-collapse-item>
</uni-list>
</u-collapse>
</u-collapse>
</view>
</view>
</view>
</view>
<view
class=
"u-flex default"
v-
show=
"lists.length
=== 0"
>
<view
class=
"u-flex default"
v-
if=
"count
=== 0"
>
<view>
<view>
<image
:src=
"defaultImg"
/>
<image
:src=
"defaultImg"
/>
</view>
</view>
...
@@ -93,10 +97,12 @@
...
@@ -93,10 +97,12 @@
<
script
>
<
script
>
import
answerSheet
from
'@/components/answer-sheet/index.vue'
import
answerSheet
from
'@/components/answer-sheet/index.vue'
import
answerExplanation
from
'@/components/answer-explanation/index.vue'
import
answerExplanation
from
'@/components/answer-explanation/index.vue'
import
uniList
from
'@/components/uni-list/uni-list.vue'
export
default
{
export
default
{
components
:
{
components
:
{
answerSheet
,
answerSheet
,
answerExplanation
,
answerExplanation
,
uniList
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -106,108 +112,8 @@ export default {
...
@@ -106,108 +112,8 @@ export default {
margin
:
'10rpx 0'
,
margin
:
'10rpx 0'
,
'border-radius'
:
'30rpx 30rpx 0 0'
'border-radius'
:
'30rpx 30rpx 0 0'
},
},
titleType
:
[
'单选题'
,
'判断题'
,
'多选题'
],
keyword
:
''
,
keyword
:
''
,
lists
:
[
lists
:
[],
{
type
:
1
,
title
:
'采用QS1电桥测量tanδ的接线方式一般有差接线及和接线。'
,
answerList
:
[
{
sort
:
'A'
,
text
:
'正确'
,
checked
:
true
,
confirm
:
true
,
},
{
sort
:
'B'
,
text
:
'错误'
,
},
],
answer
:
'A'
,
explain
:
'极性电介质在外电场作用下,由偶极子分子的转向形成的极化称为偶极子式极化。'
,
index
:
0
,
rightKey
:
[
'A'
],
submitStatus
:
true
,
},
{
type
:
2
,
title
:
'空气间隙的操作冲击击穿电压数值大小不仅与间隙距离、电极形状、电极极性有关,而且与操作冲击电压波的波前时间的长短有关。'
,
answerList
:
[
{
sort
:
'A'
,
text
:
'正确'
,
},
{
sort
:
'B'
,
text
:
'错误'
,
checked
:
true
,
confirm
:
true
,
},
],
answer
:
'B'
,
explain
:
'极性电介质在外电场作用下,由偶极子分子的转向形成的极化称为偶极子式极化。'
,
index
:
1
,
rightKey
:
[
'B'
],
submitStatus
:
true
,
},
{
type
:
3
,
title
:
'西林电桥采用正接线及反接线时,其测试原理相同'
,
answerList
:
[
{
sort
:
'A'
,
text
:
'影响'
,
},
{
sort
:
'B'
,
text
:
'影响很小'
,
checked
:
true
,
confirm
:
true
,
},
{
sort
:
'C'
,
text
:
'影响很大'
,
checked
:
true
,
confirm
:
true
,
},
{
sort
:
'D'
,
text
:
'无影响'
,
},
],
answer
:
'B,C'
,
explain
:
'双臂电桥是在单臂电桥的基础上增加特殊机构,以消除测试时连接线和接线柱接触电阻对测量结果的影响。'
,
index
:
2
,
rightKey
:
[
'B'
,
'C'
],
submitStatus
:
true
,
},
{
type
:
2
,
title
:
'测试标题测试标题测试标题测试标题'
,
answerList
:
[
{
sort
:
'A'
,
text
:
'是'
,
},
{
sort
:
'B'
,
text
:
'否'
,
checked
:
true
,
confirm
:
true
,
},
],
answer
:
'B'
,
explain
:
'测试内容测试内容测试内容测试内容测试内容测试内容'
,
index
:
3
,
rightKey
:
[
'B'
],
submitStatus
:
true
,
},
],
arrIndex
:
null
,
arrIndex
:
null
,
}
}
},
},
...
@@ -219,6 +125,13 @@ export default {
...
@@ -219,6 +125,13 @@ export default {
defaultImg
()
{
defaultImg
()
{
return
process
.
uniEnv
.
qn_base_url
+
'no-search.png'
return
process
.
uniEnv
.
qn_base_url
+
'no-search.png'
},
},
count
()
{
return
this
.
lists
.
length
},
collectionFlag
()
{
const
info
=
this
.
lists
.
find
(
v
=>
v
.
index
===
this
.
arrIndex
)
return
info
?
info
.
collectionFlag
:
false
}
},
},
methods
:
{
methods
:
{
init
()
{
init
()
{
...
@@ -226,8 +139,37 @@ export default {
...
@@ -226,8 +139,37 @@ export default {
questionWarehouseId
:
this
.
questionWarehouseId
,
questionWarehouseId
:
this
.
questionWarehouseId
,
keyWord
:
this
.
keyword
keyWord
:
this
.
keyword
}
}
uni
.
showLoading
({
title
:
'加载中'
})
this
.
$u
.
api
.
searchQuestion
(
data
).
then
(
res
=>
{
this
.
$u
.
api
.
searchQuestion
(
data
).
then
(
res
=>
{
console
.
log
(
"res"
,
res
)
uni
.
hideLoading
()
this
.
lists
=
res
.
length
>
0
?
res
.
map
((
v
,
i
)
=>
{
const
rightKey
=
v
.
answer
.
split
(
','
)
const
content
=
JSON
.
parse
(
v
.
content
)
const
answerList
=
content
.
choiceList
.
map
(
item
=>
{
return
{
sort
:
item
.
value
,
text
:
item
.
label
,
checked
:
rightKey
.
includes
(
item
.
value
),
confirm
:
rightKey
.
includes
(
item
.
value
)
}
})
return
{
id
:
v
.
id
,
index
:
i
,
answer
:
v
.
answer
,
title
:
content
.
title
,
type
:
v
.
echoMap
.
questionTypeId
,
answerList
:
answerList
,
explain
:
v
.
analysis
,
rightKey
:
rightKey
,
collectionFlag
:
v
.
collectionFlag
,
submitStatus
:
true
}
})
:
[]
})
})
},
},
itemChange
(
e
)
{
itemChange
(
e
)
{
...
@@ -243,7 +185,10 @@ export default {
...
@@ -243,7 +185,10 @@ export default {
this
.
$u
.
vuex
(
'searchHistory'
,
history
)
this
.
$u
.
vuex
(
'searchHistory'
,
history
)
},
},
collection
(
item
)
{
collection
(
item
)
{
console
.
log
(
"item"
,
item
)
const
action
=
item
.
collectionFlag
?
'removeCollection'
:
'joinCollection'
this
.
$u
.
api
[
action
]({
questionId
:
item
.
id
}).
then
(
res
=>
{
if
(
res
)
item
.
collectionFlag
=
!
item
.
collectionFlag
})
},
},
arrowUp
(
index
)
{
arrowUp
(
index
)
{
this
.
$refs
[
`collapse
${
index
}
`
][
0
].
headClick
()
this
.
$refs
[
`collapse
${
index
}
`
][
0
].
headClick
()
...
@@ -287,16 +232,16 @@ export default {
...
@@ -287,16 +232,16 @@ export default {
font-size
:
32rpx
;
font-size
:
32rpx
;
line-height
:
50rpx
;
line-height
:
50rpx
;
font-weight
:
bold
;
font-weight
:
bold
;
flex
:
1
;
height
:
60rpx
;
height
:
60rpx
;
overflow
:
hidden
;
overflow
:
hidden
;
flex
:
1
;
text
{
text
{
background
:
#9ea5bb
;
background
:
#9ea5bb
;
color
:
#fff
;
color
:
#fff
;
padding
:
8rpx
20rpx
;
padding
:
8rpx
20rpx
;
margin-right
:
10rpx
;
margin-right
:
10rpx
;
font-size
:
20rpx
;
font-size
:
20rpx
;
border-radius
:
50rpx
;
border-radius
:
50rpx
0
50rpx
50rpx
;
}
}
}
}
.arrow
{
.arrow
{
...
@@ -308,6 +253,14 @@ export default {
...
@@ -308,6 +253,14 @@ export default {
}
}
}
}
}
}
.selected
{
height
:
auto
;
overflow
:
auto
;
.titles
{
height
:
auto
;
overflow
:
auto
;
}
}
.subject
{
.subject
{
flex-flow
:
column
;
flex-flow
:
column
;
.type
{
.type
{
...
...
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