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
448a0312
Commit
448a0312
authored
Jul 13, 2021
by
Facius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 选择题库-设置页面弹窗
parent
584977a9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
239 additions
and
30 deletions
+239
-30
index.vue
src/components/pop-view/index.vue
+136
-0
addExam.vue
src/pages/learn/addExam.vue
+24
-11
examSetting.vue
src/pages/learn/examSetting.vue
+64
-13
selectCategory.vue
src/pages/learn/selectCategory.vue
+15
-6
No files found.
src/components/pop-view/index.vue
0 → 100644
View file @
448a0312
<
template
>
<u-popup
border-radius=
"12"
v-model=
"visible"
safe-area-inset-bottom
mode=
"center"
width=
"654rpx"
:mask-close-able=
"false"
>
<view
class=
"pop-view"
>
<view
class=
"pop-title"
>
<text>
{{
title
}}
</text>
</view>
<view
class=
"pop-message"
>
<text>
{{
message
}}
</text>
</view>
<view
class=
"line-view"
/>
<view
class=
"pop-content"
>
<slot></slot>
</view>
<view
class=
"pop-btn-view"
>
<u-button
:custom-style=
"customStyleCancel"
hover-class=
"none"
shape=
"circle"
@
click=
"handleClickCancel"
>
取消
</u-button>
<u-button
:custom-style=
"customStyleSave"
shape=
"circle"
type=
"primary"
@
click=
"handleClickSure"
>
{{
buttonText
}}
</u-button>
</view>
</view>
</u-popup>
</
template
>
<
script
>
export
default
{
props
:
{
visible
:
Boolean
,
title
:
String
,
message
:
String
,
buttonText
:
{
// 确定按钮
type
:
String
,
default
:
'确定'
,
},
},
data
()
{
return
{}
},
computed
:
{
customStyleCancel
()
{
return
{
width
:
'264rpx'
,
height
:
'80rpx'
,
color
:
'#9EA5BB'
,
fontWeight
:
'bold'
,
fontSize
:
'32rpx'
,
}
},
customStyleSave
()
{
return
{
backgroundColor
:
'#2953FF'
,
width
:
'264rpx'
,
height
:
'80rpx'
,
color
:
'#ffffff'
,
fontWeight
:
'bold'
,
fontSize
:
'32rpx'
,
}
},
},
methods
:
{
changeVisibleValue
(
val
)
{
this
.
$emit
(
'update:visible'
,
val
)
},
handleClickCancel
()
{
this
.
changeVisibleValue
(
false
)
this
.
$emit
(
'cancel'
)
},
handleClickSure
()
{
this
.
$emit
(
'submit'
)
},
},
}
</
script
>
<
style
lang=
"scss"
scoped
>
.pop-view
{
padding
:
48rpx
40rpx
;
min-height
:
520rpx
;
position
:
relative
;
.pop-title
{
font-size
:
40rpx
;
margin-bottom
:
30rpx
;
text-align
:
center
;
color
:
#191c27
;
font-weight
:
bold
;
}
.pop-message
{
font-size
:
28rpx
;
text-align
:
center
;
color
:
#5a6073
;
text-align
:
center
;
}
.pop-content
{
margin-bottom
:
140rpx
;
}
.line-view
{
background-color
:
#e8ebf3
;
height
:
2rpx
;
width
:
100%
;
margin-bottom
:
40rpx
;
margin-top
:
40rpx
;
}
.pop-btn-view
{
display
:
flex
;
padding-top
:
60rpx
;
align-items
:
center
;
justify-content
:
space-between
;
position
:
absolute
;
bottom
:
48rpx
;
left
:
40rpx
;
right
:
40rpx
;
}
}
</
style
>
src/pages/learn/addExam.vue
View file @
448a0312
...
@@ -52,15 +52,20 @@
...
@@ -52,15 +52,20 @@
</
template
>
</
template
>
<
script
>
<
script
>
const
key2
=
'2'
const
key3
=
'3'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
category
:
{},
list
:
[],
// 题库列表
list
:
[],
// 题库列表
loading
:
true
,
loading
:
true
,
selected
:
{},
}
}
},
},
computed
:
{
computed
:
{
category
()
{
return
this
.
selected
[
key2
]
},
buttonStyle
()
{
buttonStyle
()
{
return
{
return
{
width
:
'120rpx'
,
width
:
'120rpx'
,
...
@@ -73,23 +78,16 @@ export default {
...
@@ -73,23 +78,16 @@ export default {
},
},
},
},
onLoad
(
e
)
{
onLoad
(
e
)
{
if
(
e
&&
e
.
name
)
{
this
.
getPageInfo
()
this
.
category
.
name
=
decodeURIComponent
(
e
.
name
)
}
if
(
e
&&
e
.
id
)
{
this
.
category
.
id
=
e
.
id
}
this
.
loadList
()
// 获取题库列表
this
.
loadList
()
// 获取题库列表
},
},
methods
:
{
methods
:
{
// 点击了添加按钮
// 点击了添加按钮
handleClick
(
index
)
{
handleClick
(
index
)
{
this
.
selected
[
key3
]
=
this
.
list
[
index
]
this
.
setPageInfo
(
this
.
selected
)
this
.
$u
.
route
({
this
.
$u
.
route
({
url
:
'pages/learn/examSetting'
,
url
:
'pages/learn/examSetting'
,
params
:
{
name
:
this
.
list
[
index
].
name
,
id
:
this
.
list
[
index
].
id
,
},
})
})
},
},
// 获取题库列表
// 获取题库列表
...
@@ -112,6 +110,21 @@ export default {
...
@@ -112,6 +110,21 @@ export default {
}
}
// }
// }
},
},
// 本页数据设置,用于其他页面访问本页数据
setPageInfo
(
info
)
{
var
pages
=
getCurrentPages
()
if
(
pages
.
length
>=
1
)
{
var
page
=
pages
[
pages
.
length
-
1
]
page
.
info
=
info
}
},
getPageInfo
()
{
var
pages
=
getCurrentPages
()
if
(
pages
.
length
>=
2
)
{
var
page
=
pages
[
pages
.
length
-
2
]
this
.
selected
=
page
.
info
}
},
},
},
}
}
</
script
>
</
script
>
...
...
src/pages/learn/examSetting.vue
View file @
448a0312
...
@@ -65,18 +65,38 @@
...
@@ -65,18 +65,38 @@
确定
确定
</u-button>
</u-button>
</view>
</view>
<PopView
:visible
.
sync=
"showPop"
title=
"确认选择"
message=
"题库确认后不可更改,请查看确认"
@
submit=
"handleClickSubmit"
>
<view
v-for=
"(value, key) in selected"
:key=
"key"
class=
"pop-content"
>
<view
:class=
"['pop-content-text',
{ last: key == thirdKey }]">
{{
value
.
name
}}
</view>
<u-icon
v-if=
"key != thirdKey"
name=
"arrow-downward"
></u-icon>
</view>
</PopView>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
PopView
from
'@/components/pop-view'
let
r
=
require
(
'../../libs/bmap-wx.min.js'
)
let
r
=
require
(
'../../libs/bmap-wx.min.js'
)
let
h
=
new
r
.
BMapWX
({
let
h
=
new
r
.
BMapWX
({
ak
:
process
.
uniEnv
.
bmapAK
,
ak
:
process
.
uniEnv
.
bmapAK
,
})
})
const
key1
=
'1'
const
key2
=
'2'
const
key3
=
'3'
export
default
{
export
default
{
components
:
{
PopView
,
},
data
()
{
data
()
{
return
{
return
{
category
:
{
name
:
''
,
id
:
0
},
selected
:
{
},
list
:
[],
// 题库列表
list
:
[],
// 题库列表
show
:
false
,
show
:
false
,
value
:
''
,
value
:
''
,
...
@@ -87,9 +107,17 @@ export default {
...
@@ -87,9 +107,17 @@ export default {
selectedProvince
:
{
label
:
'北京市'
,
value
:
11
},
selectedProvince
:
{
label
:
'北京市'
,
value
:
11
},
loading
:
true
,
loading
:
true
,
showPop
:
false
,
showPop
:
false
,
selectedCategorys
:
[
{
name
:
'特种作业人员'
,
id
:
0
},
{
name
:
'高处作业'
,
id
:
0
},
{
name
:
'高处作业'
,
id
:
0
},
],
}
}
},
},
computed
:
{
computed
:
{
category
()
{
return
this
.
selected
[
key3
]
},
params
()
{
params
()
{
return
{
return
{
province
:
true
,
province
:
true
,
...
@@ -130,16 +158,12 @@ export default {
...
@@ -130,16 +158,12 @@ export default {
}
}
return
false
return
false
},
},
thirdKey
()
{
return
key3
},
},
},
onLoad
(
e
)
{
onLoad
(
e
)
{
if
(
e
&&
e
.
name
)
{
this
.
getPageInfo
()
this
.
category
.
name
=
decodeURIComponent
(
e
.
name
)
console
.
log
(
'--------this.category.name---------'
,
this
.
category
.
name
)
}
if
(
e
&&
e
.
id
)
{
this
.
category
.
id
=
e
.
id
console
.
log
(
'--------this.category.id---------'
,
this
.
category
.
id
)
}
this
.
getLocation
()
this
.
getLocation
()
},
},
methods
:
{
methods
:
{
...
@@ -184,6 +208,9 @@ export default {
...
@@ -184,6 +208,9 @@ export default {
console
.
log
(
'---------handleClickSure----------'
)
console
.
log
(
'---------handleClickSure----------'
)
this
.
showPop
=
true
this
.
showPop
=
true
},
},
handleClickSubmit
()
{
this
.
showPop
=
false
},
baiduLocation
(
long
,
lat
)
{
baiduLocation
(
long
,
lat
)
{
let
a
=
this
,
let
a
=
this
,
t
=
function
()
{
t
=
function
()
{
...
@@ -206,6 +233,21 @@ export default {
...
@@ -206,6 +233,21 @@ export default {
}
}
t
()
t
()
},
},
// 本页数据设置,用于其他页面访问本页数据
setPageInfo
(
info
)
{
var
pages
=
getCurrentPages
()
if
(
pages
.
length
>=
1
)
{
var
page
=
pages
[
pages
.
length
-
1
]
page
.
info
=
info
}
},
getPageInfo
()
{
var
pages
=
getCurrentPages
()
if
(
pages
.
length
>=
2
)
{
var
page
=
pages
[
pages
.
length
-
2
]
this
.
selected
=
page
.
info
}
},
// 获取报考类型
// 获取报考类型
// async loadList() {
// async loadList() {
// this.loading = true;
// this.loading = true;
...
@@ -218,10 +260,6 @@ export default {
...
@@ -218,10 +260,6 @@ export default {
},
},
}
}
</
script
>
</
script
>
<
style
lang=
"scss"
>
.exam-setting
{
}
</
style
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.exam-setting
{
.exam-setting
{
...
@@ -339,5 +377,18 @@ export default {
...
@@ -339,5 +377,18 @@ export default {
.bottom-view
{
.bottom-view
{
padding-bottom
:
44rpx
;
padding-bottom
:
44rpx
;
}
}
.pop-content
{
margin-bottom
:
10rpx
;
text-align
:
center
;
color
:
#9ea5bb
;
.pop-content-text
{
margin-bottom
:
10rpx
;
font-weight
:
bold
;
font-size
:
32rpx
;
&
.last
{
color
:
#2953ff
;
}
}
}
}
}
</
style
>
</
style
>
src/pages/learn/selectCategory.vue
View file @
448a0312
...
@@ -21,7 +21,10 @@
...
@@ -21,7 +21,10 @@
<view
<view
:class=
"[
:class=
"[
'label-normal',
'label-normal',
{ 'selected': label.id == selected[key].id, 'wide': key == secondKey },
{
selected: label.id == selected[key].id,
wide: key == secondKey,
},
]"
]"
@click="handleClick(key, label)"
@click="handleClick(key, label)"
>
>
...
@@ -38,7 +41,8 @@
...
@@ -38,7 +41,8 @@
<view
<view
class=
"tag-loading-view"
class=
"tag-loading-view"
v-else-if=
"item.length
<
=
0
&&
titles
[
key
]"
v-else-if=
"item.length
<
=
0
&&
titles
[
key
]"
>
{{
"暂无"
+
selected
[
key1
].
name
}}
</view>
>
{{
'暂无'
+
selected
[
key1
].
name
}}
</view
>
</view>
</view>
</view>
</view>
</
template
>
</
template
>
...
@@ -88,12 +92,9 @@ export default {
...
@@ -88,12 +92,9 @@ export default {
this
.
loadLabel
(
key2
,
label
.
id
)
// 获取二级标签
this
.
loadLabel
(
key2
,
label
.
id
)
// 获取二级标签
}
else
{
}
else
{
// 选中二级标签
// 选中二级标签
this
.
setPageInfo
(
this
.
selected
)
this
.
$u
.
route
({
this
.
$u
.
route
({
url
:
'pages/learn/addExam'
,
url
:
'pages/learn/addExam'
,
params
:
{
name
:
'金属冶炼(有色金属冶炼<除铜、铝、铅、锌之外的其他有色金属>'
,
id
:
'888'
,
},
})
})
}
}
},
},
...
@@ -133,6 +134,14 @@ export default {
...
@@ -133,6 +134,14 @@ export default {
}
}
// }
// }
},
},
// 本页数据设置,用于其他页面访问本页数据
setPageInfo
(
info
)
{
var
pages
=
getCurrentPages
()
if
(
pages
.
length
>=
1
)
{
var
page
=
pages
[
pages
.
length
-
1
]
page
.
info
=
info
}
},
},
},
}
}
</
script
>
</
script
>
...
...
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