Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mallapp
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
viitto
mallapp
Commits
2626727f
Commit
2626727f
authored
Mar 30, 2021
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
1e7a1aa7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
670 additions
and
0 deletions
+670
-0
index.vue
pages/blindDate/liudx-pickerAddress/index.vue
+223
-0
u-mask.vue
pages/blindDate/liudx-pickerAddress/u-mask.vue
+99
-0
u-popup.vue
pages/blindDate/liudx-pickerAddress/u-popup.vue
+347
-0
zh-address-parse.min.js
pages/blindDate/liudx-pickerAddress/zh-address-parse.min.js
+1
-0
No files found.
pages/blindDate/liudx-pickerAddress/index.vue
0 → 100644
View file @
2626727f
<
template
>
<u-popup
:maskCloseAble=
"maskCloseAble"
mode=
"bottom"
:popup=
"false"
v-model=
"value"
length=
"auto"
:safeAreaInsetBottom=
"safeAreaInsetBottom"
@
close=
"close"
z-index=
"999"
>
<view
class=
"u-picker-header"
@
touchmove
.
stop
.
prevent=
"stop"
catchtouchmove=
"stop"
>
<view
class=
"u-btn-picker u-btn-picker--tips"
hover-class=
"u-opacity"
:hover-stay-time=
"150"
@
tap=
"getResult('cancel')"
>
取消
</view>
<view
class=
"u-btn-picker u-btn-picker--primary"
hover-class=
"u-opacity"
:hover-stay-time=
"150"
@
touchmove
.
stop=
""
@
tap
.
stop=
"getResult('confirm')"
>
确定
</view>
</view>
<view
class=
"u-picker-body"
>
<picker-view
:value=
"pickVal"
@
change=
"bindChange"
class=
"u-picker-view"
>
<picker-view-column>
<view
class=
"u-column-item"
v-for=
"(item,index) in districtsObj.provinces"
:key=
"index"
>
<view
class=
"u-line-1"
>
{{
item
.
Name
}}
</view>
</view>
</picker-view-column>
<picker-view-column>
<view
class=
"u-column-item"
v-for=
"(item,index) in districtsObj.cities"
:key=
"index"
>
<view
class=
"u-line-1"
>
{{
item
.
Name
}}
</view>
</view>
</picker-view-column>
<picker-view-column>
<view
class=
"u-column-item"
v-for=
"(item,index) in districtsObj.areas"
:key=
"index"
>
<view
class=
"u-line-1"
>
{{
item
.
Name
}}
</view>
</view>
</picker-view-column>
</picker-view>
</view>
</u-popup>
</
template
>
<
script
>
import
uPopup
from
'./u-popup'
export
default
{
props
:
{
safeAreaInsetBottom
:
{
type
:
Boolean
,
default
:
false
},
// 是否允许通过点击遮罩关闭Picker
maskCloseAble
:
{
type
:
Boolean
,
default
:
true
},
// 通过双向绑定控制组件的弹出与收起
value
:
{
type
:
Boolean
,
default
:
false
},
},
data
()
{
return
{
pickVal
:[
0
,
0
,
0
],
districtsObj
:
{
provinces
:
[],
cities
:
[],
areas
:
[],
},
province
:
0
,
city
:
0
,
area
:
0
}
},
watch
:
{
// 如果地区发生变化,为了让picker联动起来,必须重置this.citys和this.areas
province
(
val
)
{
this
.
loadCities
(
this
.
districtsObj
.
provinces
[
this
.
province
].
ID
);
},
city
(
val
)
{
this
.
loadAreas
(
this
.
districtsObj
.
cities
[
this
.
city
].
ID
);
}
},
mounted
()
{
console
.
log
(
this
.
value
)
this
.
loadDistrict
()
},
methods
:
{
close
()
{
this
.
$emit
(
'input'
,
false
);
},
async
loadDistrict
()
{
this
.
loadProvinces
()
},
loadProvinces
()
{
// 加载省份
this
.
request2
(
{
url
:
'/api/Destination/GetChildList'
,
data
:
{
Id
:
1
}
},
res
=>
{
let
data
=
res
.
data
this
.
districtsObj
.
provinces
=
data
this
.
loadCities
(
data
[
0
].
ID
)
},
);
},
loadCities
(
Id
)
{
this
.
request2
(
{
url
:
'/api/Destination/GetChildList'
,
data
:
{
Id
:
Id
}
},
res
=>
{
let
data
=
res
.
data
this
.
districtsObj
.
cities
=
data
this
.
loadAreas
(
data
[
0
].
ID
)
},
);
},
loadAreas
(
Id
)
{
this
.
request2
(
{
url
:
'/api/Destination/GetChildList'
,
data
:
{
Id
:
Id
}
},
res
=>
{
let
data
=
res
.
data
this
.
districtsObj
.
areas
=
data
},
);
},
bindChange
(
event
)
{
this
.
pickVal
=
event
.
detail
.
value
;
let
i
=
0
;
this
.
province
=
this
.
pickVal
[
i
++
];
this
.
city
=
this
.
pickVal
[
i
++
];
this
.
area
=
this
.
pickVal
[
i
++
];
},
getResult
(
event
=
null
)
{
let
result
=
{
province
:
this
.
districtsObj
.
provinces
[
this
.
province
],
city
:
this
.
districtsObj
.
cities
[
this
.
city
],
area
:
this
.
districtsObj
.
areas
[
this
.
area
],
}
if
(
event
)
this
.
$emit
(
event
,
result
);
this
.
close
();
}
},
components
:{
uPopup
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.u-datetime-picker
{
position
:
relative
;
z-index
:
999
;
}
.u-picker-view
{
height
:
100%
;
box-sizing
:
border-box
;
}
.u-picker-header
{
width
:
100%
;
height
:
90rpx
;
padding
:
0
40rpx
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
box-sizing
:
border-box
;
font-size
:
32rpx
;
background
:
#ddd
;
position
:
relative
;
}
.
u-picker-header
:
:
after
{
content
:
''
;
position
:
absolute
;
border-bottom
:
1rpx
solid
#eaeef1
;
-webkit-transform
:
scaleY
(
0
.5
);
transform
:
scaleY
(
0
.5
);
bottom
:
0
;
right
:
0
;
left
:
0
;
}
.u-picker-body
{
width
:
100%
;
height
:
500rpx
;
overflow
:
hidden
;
background-color
:
#fff
;
}
.u-column-item
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
font-size
:
32rpx
;
padding
:
0
8rpx
;
}
.u-text
{
font-size
:
24rpx
;
padding-left
:
8rpx
;
}
.u-btn-picker
{
padding
:
16rpx
;
box-sizing
:
border-box
;
text-align
:
center
;
text-decoration
:
none
;
}
.u-opacity
{
opacity
:
0
.5
;
}
.u-btn-picker--primary
{
}
.u-btn-picker--tips
{
}
</
style
>
pages/blindDate/liudx-pickerAddress/u-mask.vue
0 → 100644
View file @
2626727f
<
template
>
<view
class=
"u-mask"
:style=
"[maskStyle]"
:class=
"[show ? 'u-mask-show' : '']"
@
tap=
"click"
@
touchmove
.
stop
.
prevent
>
<slot
/>
</view>
</
template
>
<
script
>
/**
* mask 遮罩
* @description 创建一个遮罩层,用于强调特定的页面元素,并阻止用户对遮罩下层的内容进行操作,一般用于弹窗场景
* @tutorial https://www.uviewui.com/components/mask.html
* @property {Boolean} show 是否显示遮罩(默认false)
* @property {String Number} z-index z-index 层级(默认1070)
* @property {Object} custom-style 自定义样式对象,见上方说明
* @property {String Number} duration 动画时长,单位毫秒(默认300)
* @property {Boolean} zoom 是否使用scale对这招进行缩放(默认true)
* @property {Boolean} mask-click-able 遮罩是否可点击,为false时点击不会发送click事件(默认true)
* @event {Function} click mask-click-able为true时,点击遮罩发送此事件
* @example <u-mask :show="show" @click="show = false"></u-mask>
*/
export
default
{
name
:
"u-mask"
,
props
:
{
// 是否显示遮罩
show
:
{
type
:
Boolean
,
default
:
false
},
// 层级z-index
zIndex
:
{
type
:
[
Number
,
String
],
default
:
'1'
},
// 用户自定义样式
customStyle
:
{
type
:
Object
,
default
()
{
return
{}
}
},
// 遮罩的动画样式, 是否使用使用zoom进行scale进行缩放
zoom
:
{
type
:
Boolean
,
default
:
true
},
// 遮罩的过渡时间,单位为ms
duration
:
{
type
:
[
Number
,
String
],
default
:
300
},
// 是否可以通过点击遮罩进行关闭
maskClickAble
:
{
type
:
Boolean
,
default
:
true
}
},
computed
:
{
maskStyle
()
{
let
style
=
{};
style
.
backgroundColor
=
"rgba(0, 0, 0, 0.6)"
;
style
.
zIndex
=
this
.
zIndex
?
this
.
zIndex
:
this
.
$u
.
zIndex
.
mask
;
style
.
transition
=
`all
${
this
.
duration
/
1000
}
s ease-in-out`
;
// 缩放
if
(
this
.
zoom
==
true
)
style
.
transform
=
'scale(1.2, 1.2)'
;
// 判断用户传递的对象是否为空
if
(
Object
.
keys
(
this
.
customStyle
).
length
)
style
=
{
...
style
,
...
this
.
customStyle
};
// 合并自定义的样式
//Object.assign(style, customStyle);
return
style
;
}
},
methods
:
{
click
()
{
if
(
!
this
.
maskClickAble
)
return
;
this
.
$emit
(
'click'
);
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.u-mask
{
position
:
fixed
;
top
:
0
;
left
:
0
;
right
:
0
;
bottom
:
0
;
opacity
:
0
;
visibility
:
hidden
;
}
.u-mask-show
{
opacity
:
1
;
visibility
:
visible
;
transform
:
scale
(
1
);
}
</
style
>
pages/blindDate/liudx-pickerAddress/u-popup.vue
0 → 100644
View file @
2626727f
<
template
>
<view
v-if=
"visibleSync"
:style=
"[customStyle]"
:class=
"
{ 'u-drawer-visible': showDrawer }" class="u-drawer">
<u-mask
:maskClickAble=
"maskCloseAble"
:show=
"showDrawer && mask"
@
click=
"maskClick"
></u-mask>
<view
class=
"u-drawer-content"
@
tap=
"modeCenterClose(mode)"
:class=
"[
safeAreaInsetBottom ? 'safe-area-inset-bottom' : '',
'u-drawer-' + mode,
showDrawer ? 'u-drawer-content-visible' : '',
zoom && mode == 'center' ? 'u-animation-zoom' : ''
]"
@
touchmove
.
stop
.
prevent
@
tap
.
stop
.
prevent
:style=
"[style]"
>
<view
class=
"u-mode-center-box"
@
tap
.
stop
.
prevent
@
touchmove
.
stop
.
prevent
v-if=
"mode == 'center'"
:style=
"[centerStyle]"
>
<slot
/>
</view>
<block
v-else
>
<slot
/>
</block>
</view>
</view>
</
template
>
<
script
>
/**
* popup 弹窗
* @description 弹出层容器,用于展示弹窗、信息提示等内容,支持上、下、左、右和中部弹出。组件只提供容器,内部内容由用户自定义
* @tutorial https://www.uviewui.com/components/popup.html
* @property {String} mode 弹出方向(默认left)
* @property {Boolean} mask 是否显示遮罩(默认true)
* @property {String Number} length mode=left | 见官网说明(默认auto)
* @property {Boolean} zoom 是否开启缩放动画,只在mode为center时有效(默认true)
* @property {Boolean} safe-area-inset-bottom 是否开启底部安全区适配(默认false)
* @property {Boolean} mask-close-able 点击遮罩是否可以关闭弹出层(默认true)
* @property {Object} custom-style 用户自定义样式
* @property {Number String} border-radius 弹窗圆角值(默认0)
* @property {Number String} z-index 弹出内容的z-index值(默认1075)
* @event {Function} open 弹出层打开
* @event {Function} close 弹出层收起
* @example <u-popup v-model="show"><view>出淤泥而不染,濯清涟而不妖</view></u-popup>
*/
import
uMask
from
'./u-mask'
export
default
{
name
:
'u-popup'
,
props
:
{
/**
* 显示状态
*/
show
:
{
type
:
Boolean
,
default
:
false
},
/**
* 弹出方向,left|right|top|bottom|center
*/
mode
:
{
type
:
String
,
default
:
'left'
},
/**
* 是否显示遮罩
*/
mask
:
{
type
:
Boolean
,
default
:
true
},
// 抽屉的宽度(mode=left|right),或者高度(mode=top|bottom),单位rpx,或者"auto"
// 或者百分比"50%",表示由内容撑开高度或者宽度
length
:
{
type
:
[
Number
,
String
],
default
:
'auto'
},
// 是否开启缩放动画,只在mode=center时有效
zoom
:
{
type
:
Boolean
,
default
:
true
},
// 是否开启底部安全区适配,开启的话,会在iPhoneX机型底部添加一定的内边距
safeAreaInsetBottom
:
{
type
:
Boolean
,
default
:
false
},
// 是否可以通过点击遮罩进行关闭
maskCloseAble
:
{
type
:
Boolean
,
default
:
true
},
// 用户自定义样式
customStyle
:
{
type
:
Object
,
default
()
{
return
{};
}
},
value
:
{
type
:
Boolean
,
default
:
false
},
// 此为内部参数,不在文档对外使用,为了解决Picker和keyboard等融合了弹窗的组件
// 对v-model双向绑定多层调用造成报错不能修改props值的问题
popup
:
{
type
:
Boolean
,
default
:
true
},
// 显示显示弹窗的圆角,单位rpx
borderRadius
:
{
type
:
[
Number
,
String
],
default
:
0
},
zIndex
:
{
type
:
[
Number
,
String
],
default
:
'100'
}
},
data
()
{
return
{
visibleSync
:
false
,
showDrawer
:
false
,
timer
:
null
,
style1
:
{}
};
},
computed
:
{
// 根据mode的位置,设定其弹窗的宽度(mode = left|right),或者高度(mode = top|bottom)
style
()
{
let
style
=
{};
let
translate
=
'100%'
;
// 判断是否是否百分比或者auto值,是的话,直接使用该值,否则默认为rpx单位的数值
let
length
=
(
/%$/
.
test
(
this
.
length
)
||
this
.
length
==
'auto'
)
?
this
.
length
:
uni
.
upx2px
(
this
.
length
)
+
'px'
;
// 如果是左边或者上边弹出时,需要给translate设置为负值,用于隐藏
if
(
this
.
mode
==
'left'
||
this
.
mode
==
'top'
)
translate
=
length
==
'auto'
?
'-100%'
:
'-'
+
length
;
if
(
this
.
mode
==
'left'
||
this
.
mode
==
'right'
)
{
style
=
{
width
:
length
,
height
:
'100%'
,
transform
:
`translate3D(
${
translate
}
,0px,0px)`
};
}
else
if
(
this
.
mode
==
'top'
||
this
.
mode
==
'bottom'
)
{
style
=
{
width
:
'100%'
,
height
:
length
,
transform
:
`translate3D(0px,
${
translate
}
,0px)`
};
}
style
.
zIndex
=
this
.
zIndex
?
this
.
zIndex
:
this
.
$u
.
zIndex
.
popup
;
// 如果用户设置了borderRadius值,添加弹窗的圆角
if
(
this
.
borderRadius
)
{
switch
(
this
.
mode
)
{
case
'left'
:
style
.
borderRadius
=
`0
${
this
.
borderRadius
}
rpx
${
this
.
borderRadius
}
rpx 0`
;
break
;
case
'top'
:
style
.
borderRadius
=
`0 0
${
this
.
borderRadius
}
rpx
${
this
.
borderRadius
}
rpx`
;
break
;
case
'right'
:
style
.
borderRadius
=
`
${
this
.
borderRadius
}
rpx 0 0
${
this
.
borderRadius
}
rpx`
;
break
;
case
'bottom'
:
style
.
borderRadius
=
`
${
this
.
borderRadius
}
rpx
${
this
.
borderRadius
}
rpx 0 0`
;
break
;
default
:
;
}
// 不加可能圆角无效
style
.
overflow
=
'hidden'
;
}
return
style
;
},
// 中部弹窗的特有样式
centerStyle
()
{
let
style
=
{};
let
length
=
(
/%$/
.
test
(
this
.
length
)
||
this
.
length
==
'auto'
)
?
this
.
length
:
uni
.
upx2px
(
this
.
length
)
+
'px'
;
style
.
width
=
length
;
style
.
zIndex
=
this
.
zIndex
?
this
.
zIndex
:
this
.
$u
.
zIndex
.
popup
;
if
(
this
.
borderRadius
)
{
style
.
borderRadius
=
`
${
this
.
borderRadius
}
rpx`
;
// 不加可能圆角无效
style
.
overflow
=
'hidden'
;
}
return
style
;
}
},
watch
:
{
value
(
val
)
{
if
(
val
)
{
this
.
open
();
}
else
{
this
.
close
();
}
}
},
created
()
{
// 先让弹窗组件渲染,再改变遮罩和抽屉元素的样式,让其动画其起作用(必须要有延时,才会有效果)
this
.
visibleSync
=
this
.
value
;
setTimeout
(()
=>
{
this
.
showDrawer
=
this
.
value
;
},
30
);
},
methods
:
{
// 遮罩被点击
maskClick
()
{
this
.
close
();
},
close
()
{
this
.
change
(
'showDrawer'
,
'visibleSync'
,
false
);
},
// 中部弹出时,需要.u-drawer-content将居中内容,此元素会铺满屏幕,点击需要关闭弹窗
// 让其只在mode=center时起作用
modeCenterClose
(
mode
)
{
if
(
mode
!=
'center'
||
!
this
.
maskCloseAble
)
return
;
this
.
close
();
},
open
()
{
this
.
change
(
'visibleSync'
,
'showDrawer'
,
true
);
},
// 此处的原理是,关闭时先通过动画隐藏弹窗和遮罩,再移除整个组件
// 打开时,先渲染组件,延时一定时间再让遮罩和弹窗的动画起作用
change
(
param1
,
param2
,
status
)
{
// 如果this.popup为false,以为着为picker,actionsheet等组件调用了popup组件
if
(
this
.
popup
==
true
)
this
.
$emit
(
'input'
,
status
);
this
[
param1
]
=
status
;
if
(
this
.
timer
)
{
clearTimeout
(
this
.
timer
);
}
this
.
timer
=
setTimeout
(
()
=>
{
this
[
param2
]
=
status
;
this
.
$emit
(
status
?
'open'
:
'close'
);
},
status
?
30
:
300
);
}
},
components
:{
uMask
}
};
</
script
>
<
style
scoped
lang=
"scss"
>
.u-drawer
{
/* #ifndef APP-NVUE */
display
:
block
;
/* #endif */
position
:
fixed
;
top
:
0
;
left
:
0
;
right
:
0
;
bottom
:
0
;
overflow
:
hidden
;
z-index
:
999
;
background-color
:
rgba
(
0
,
0
,
0
,
0
.4
);
}
.u-drawer-content
{
/* #ifndef APP-NVUE */
display
:
block
;
/* #endif */
position
:
absolute
;
z-index
:
1003
;
transition
:
all
0
.25s
linear
;
}
.u-drawer-left
{
top
:
0
;
bottom
:
0
;
left
:
0
;
background-color
:
#ffffff
;
}
.u-drawer-right
{
right
:
0
;
top
:
0
;
bottom
:
0
;
background-color
:
#ffffff
;
}
.u-drawer-top
{
top
:
0
;
left
:
0
;
right
:
0
;
background-color
:
#ffffff
;
}
.u-drawer-bottom
{
bottom
:
0
;
left
:
0
;
right
:
0
;
background-color
:
#ffffff
;
}
.u-drawer-center
{
/* #ifndef APP-NVUE */
display
:
flex
;
flex-direction
:
column
;
/* #endif */
bottom
:
0
;
left
:
0
;
right
:
0
;
top
:
0
;
justify-content
:
center
;
align-items
:
center
;
opacity
:
0
;
z-index
:
99999
;
}
.u-mode-center-box
{
min-width
:
100rpx
;
min-height
:
100rpx
;
/* #ifndef APP-NVUE */
display
:
block
;
/* #endif */
position
:
relative
;
background-color
:
#ffffff
;
}
.u-drawer-content-visible.u-drawer-center
{
transform
:
scale
(
1
);
opacity
:
1
;
}
.u-animation-zoom
{
transform
:
scale
(
1
.15
);
}
.u-drawer-content-visible
{
transform
:
translate3D
(
0px
,
0px
,
0px
)
!
important
;
}
.u-drawer-mask
{
/* #ifndef APP-NVUE */
display
:
block
;
/* #endif */
opacity
:
0
;
position
:
absolute
;
top
:
0
;
left
:
0
;
bottom
:
0
;
right
:
0
;
background-color
:
rgba
(
0
,
0
,
0
,
0
.4
);
transition
:
opacity
0
.25s
;
}
.u-drawer-mask-visible
{
/* #ifndef APP-NVUE */
display
:
block
;
/* #endif */
opacity
:
1
;
}
</
style
>
pages/blindDate/liudx-pickerAddress/zh-address-parse.min.js
0 → 100644
View file @
2626727f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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