Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
basic-uniapp-v3
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-uniapp-v3
Commits
2a075912
提交
2a075912
authored
8月 16, 2023
作者:
方治民
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 迁移 Widget 组件目录、初步实现 TimeBarWidget
上级
1be73da7
隐藏空白字符变更
内嵌
并排
正在显示
23 个修改的文件
包含
530 行增加
和
36 行删除
+530
-36
index.ts
src/components/Map/Mapbox/index.ts
+36
-4
TopBarWidget.vue
src/components/Map/Mapbox/widgets/TopBarWidget.vue
+0
-15
index.ts
src/components/Map/Widgets/BottomBar/index.ts
+0
-0
BottomBar.vue
src/components/Map/Widgets/BottomBar/src/BottomBar.vue
+10
-4
hook.ts
src/components/Map/Widgets/BottomBar/src/hook.ts
+0
-0
types.ts
src/components/Map/Widgets/BottomBar/src/types.ts
+2
-0
FloatFillterWidget.vue
src/components/Map/Widgets/FloatFillterWidget.vue
+0
-0
LeftBarWidget.vue
src/components/Map/Widgets/LeftBarWidget.vue
+0
-0
index.ts
src/components/Map/Widgets/Legend/index.ts
+0
-0
Legend.vue
src/components/Map/Widgets/Legend/src/Legend.vue
+0
-0
hook.ts
src/components/Map/Widgets/Legend/src/hook.ts
+0
-0
types.ts
src/components/Map/Widgets/Legend/src/types.ts
+0
-0
index.ts
src/components/Map/Widgets/SwitchControl/index.ts
+0
-0
SwitchControl.vue
...omponents/Map/Widgets/SwitchControl/src/SwitchControl.vue
+0
-0
hook.ts
src/components/Map/Widgets/SwitchControl/src/hook.ts
+0
-0
types.ts
src/components/Map/Widgets/SwitchControl/src/types.ts
+0
-0
index.ts
src/components/Map/Widgets/TimeBarWidget/index.ts
+4
-0
TimeBar.vue
src/components/Map/Widgets/TimeBarWidget/src/TimeBar.vue
+277
-0
hook.ts
src/components/Map/Widgets/TimeBarWidget/src/hook.ts
+71
-0
types.ts
src/components/Map/Widgets/TimeBarWidget/src/types.ts
+66
-0
utils.ts
src/components/Map/Widgets/utils.ts
+0
-0
index.vue
src/pages/business/monitor/rain/index.vue
+56
-7
components.d.ts
types/components.d.ts
+8
-6
没有找到文件。
src/components/Map/Mapbox/index.ts
浏览文件 @
2a075912
...
@@ -155,8 +155,8 @@ export const defaultStyle: mapboxgl.Style = {
...
@@ -155,8 +155,8 @@ export const defaultStyle: mapboxgl.Style = {
{
{
id
:
'background'
,
id
:
'background'
,
type
:
'background'
,
type
:
'background'
,
layout
:
{
visibility
:
'
non
e'
},
layout
:
{
visibility
:
'
visibl
e'
},
paint
:
{
'background-color'
:
'
hsla(0, 0%, 0%, 0)
'
},
paint
:
{
'background-color'
:
'
#FFFFFF
'
},
},
},
// 天空图层
// 天空图层
{
{
...
@@ -230,8 +230,7 @@ export const defaultStyle: mapboxgl.Style = {
...
@@ -230,8 +230,7 @@ export const defaultStyle: mapboxgl.Style = {
visibility
:
'visible'
,
visibility
:
'visible'
,
},
},
paint
:
{
paint
:
{
'fill-color'
:
'#fff'
,
'fill-color'
:
'#F4F5F7'
,
'fill-opacity'
:
0.3
,
},
},
minzoom
:
5
,
minzoom
:
5
,
},
},
...
@@ -779,3 +778,36 @@ export function getImageSource(map: mapboxgl.Map, sourceName: string): mapboxgl.
...
@@ -779,3 +778,36 @@ export function getImageSource(map: mapboxgl.Map, sourceName: string): mapboxgl.
export
const
EmptyImage
=
export
const
EmptyImage
=
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAABlBMVEXMzMz/+v+u+uEzAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAACklEQVQImWNgAAAAAgAB9HFkpgAAAABJRU5ErkJggg=='
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAABlBMVEXMzMz/+v+u+uEzAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAACklEQVQImWNgAAAAAgAB9HFkpgAAAABJRU5ErkJggg=='
/**
* Mapbox 组件配置参数类型定义
*/
export
interface
MapboxConfig
{
/**
* Mapbox 构造函数参数
* @link https://docs.mapbox.com/mapbox-gl-js/api/map/
*/
options
?:
Partial
<
mapboxgl
.
MapboxOptions
>
/**
* Mapbox 地图样式
* @link https://docs.mapbox.com/mapbox-gl-js/style-spec/
*/
style
?:
Partial
<
mapboxgl
.
Style
>
/**
* 地图资源/数据源来源或归属描述信息
*/
attribution
?:
{
/**
* 文本
* @example 湖南省气象台
* @default ''
*/
text
:
string
/**
* 位置, 默认为 'bottom-right'
* @example 'bottom-left', 'bottom-right'
* @default 'bottom-right'
*/
align
?:
'bottom-left'
|
'bottom-right'
}
}
src/components/Map/Mapbox/widgets/TopBarWidget.vue
deleted
100644 → 0
浏览文件 @
1be73da7
<!-- 顶部 Bar 组件 -->
<
script
setup
lang=
"ts"
>
//
</
script
>
<
template
>
<view
class=
"wrap top-bar"
>
<!-- -->
</view>
</
template
>
<
style
lang=
"scss"
scoped
>
//
</
style
>
src/components/Map/
Mapbox/w
idgets/BottomBar/index.ts
→
src/components/Map/
W
idgets/BottomBar/index.ts
浏览文件 @
2a075912
File moved
src/components/Map/
Mapbox/w
idgets/BottomBar/src/BottomBar.vue
→
src/components/Map/
W
idgets/BottomBar/src/BottomBar.vue
浏览文件 @
2a075912
...
@@ -12,6 +12,11 @@
...
@@ -12,6 +12,11 @@
type
:
Boolean
,
type
:
Boolean
,
default
:
false
,
default
:
false
,
},
},
// 是否有展开按钮
showExpandButton
:
{
type
:
Boolean
,
default
:
true
,
},
// 高度
// 高度
height
:
{
height
:
{
type
:
Number
,
type
:
Number
,
...
@@ -32,6 +37,7 @@
...
@@ -32,6 +37,7 @@
const
data
=
reactive
({
const
data
=
reactive
({
show
:
props
.
show
,
show
:
props
.
show
,
expand
:
props
.
expand
,
expand
:
props
.
expand
,
showExpandButton
:
props
.
showExpandButton
,
height
:
props
.
height
,
height
:
props
.
height
,
maxHeight
:
props
.
maxHeight
,
maxHeight
:
props
.
maxHeight
,
})
})
...
@@ -41,7 +47,9 @@
...
@@ -41,7 +47,9 @@
}
}
function
toggleExpand
(
expand
?:
boolean
)
{
function
toggleExpand
(
expand
?:
boolean
)
{
data
.
expand
=
expand
??
!
data
.
expand
if
(
data
.
showExpandButton
)
{
data
.
expand
=
expand
??
!
data
.
expand
}
}
}
function
setProps
(
value
:
Partial
<
typeof
props
>
)
{
function
setProps
(
value
:
Partial
<
typeof
props
>
)
{
...
@@ -59,7 +67,7 @@
...
@@ -59,7 +67,7 @@
<
template
>
<
template
>
<view
class=
"wrap bottom-bar"
:class=
"
{ expand: data.expand }" v-show="data.show">
<view
class=
"wrap bottom-bar"
:class=
"
{ expand: data.expand }" v-show="data.show">
<view
class=
"action"
@
tap=
"toggleExpand()"
>
<view
class=
"action"
@
tap=
"toggleExpand()"
v-show=
"data.showExpandButton"
>
<Icon
icon=
"solar-double-alt-arrow-up-line-duotone"
size=
"60"
class=
"icon"
/>
<Icon
icon=
"solar-double-alt-arrow-up-line-duotone"
size=
"60"
class=
"icon"
/>
</view>
</view>
...
@@ -89,8 +97,6 @@
...
@@ -89,8 +97,6 @@
}
}
.bottom-bar
{
.bottom-bar
{
@include
animate();
position
:
fixed
;
position
:
fixed
;
bottom
:
0
;
bottom
:
0
;
left
:
0
;
left
:
0
;
...
...
src/components/Map/
Mapbox/w
idgets/BottomBar/src/hook.ts
→
src/components/Map/
W
idgets/BottomBar/src/hook.ts
浏览文件 @
2a075912
File moved
src/components/Map/
Mapbox/w
idgets/BottomBar/src/types.ts
→
src/components/Map/
W
idgets/BottomBar/src/types.ts
浏览文件 @
2a075912
...
@@ -3,6 +3,8 @@ export interface BottomBarProps {
...
@@ -3,6 +3,8 @@ export interface BottomBarProps {
show
?:
boolean
show
?:
boolean
// 是否展开
// 是否展开
expand
?:
boolean
expand
?:
boolean
// 是否有展开按钮
showExpandButton
?:
boolean
// 高度 rpx
// 高度 rpx
height
?:
number
height
?:
number
// 最大高度 rpx
// 最大高度 rpx
...
...
src/components/Map/
Mapbox/w
idgets/FloatFillterWidget.vue
→
src/components/Map/
W
idgets/FloatFillterWidget.vue
浏览文件 @
2a075912
File moved
src/components/Map/
Mapbox/w
idgets/LeftBarWidget.vue
→
src/components/Map/
W
idgets/LeftBarWidget.vue
浏览文件 @
2a075912
File moved
src/components/Map/
Mapbox/w
idgets/Legend/index.ts
→
src/components/Map/
W
idgets/Legend/index.ts
浏览文件 @
2a075912
File moved
src/components/Map/
Mapbox/w
idgets/Legend/src/Legend.vue
→
src/components/Map/
W
idgets/Legend/src/Legend.vue
浏览文件 @
2a075912
File moved
src/components/Map/
Mapbox/w
idgets/Legend/src/hook.ts
→
src/components/Map/
W
idgets/Legend/src/hook.ts
浏览文件 @
2a075912
File moved
src/components/Map/
Mapbox/w
idgets/Legend/src/types.ts
→
src/components/Map/
W
idgets/Legend/src/types.ts
浏览文件 @
2a075912
File moved
src/components/Map/
Mapbox/w
idgets/SwitchControl/index.ts
→
src/components/Map/
W
idgets/SwitchControl/index.ts
浏览文件 @
2a075912
File moved
src/components/Map/
Mapbox/w
idgets/SwitchControl/src/SwitchControl.vue
→
src/components/Map/
W
idgets/SwitchControl/src/SwitchControl.vue
浏览文件 @
2a075912
File moved
src/components/Map/
Mapbox/w
idgets/SwitchControl/src/hook.ts
→
src/components/Map/
W
idgets/SwitchControl/src/hook.ts
浏览文件 @
2a075912
File moved
src/components/Map/
Mapbox/w
idgets/SwitchControl/src/types.ts
→
src/components/Map/
W
idgets/SwitchControl/src/types.ts
浏览文件 @
2a075912
File moved
src/components/Map/Widgets/TimeBarWidget/index.ts
0 → 100644
浏览文件 @
2a075912
export
type
*
from
'./src/types'
export
*
from
'./src/hook'
export
{
default
as
TimeBarWidget
}
from
'./src/TimeBar.vue'
src/components/Map/Widgets/TimeBarWidget/src/TimeBar.vue
0 → 100644
浏览文件 @
2a075912
<!-- 顶部时间栏 Bar 组件 -->
<
script
setup
lang=
"ts"
>
import
dayjs
from
'dayjs'
import
type
{
TimeBarButton
,
TimeBarLabel
,
TimeBarTime
}
from
'./types'
import
{
formatTime
}
from
'./hook'
import
{
deepMerge
}
from
'@/utils'
const
props
=
defineProps
({
// 是否显示
show
:
{
type
:
Boolean
,
default
:
true
,
},
// 是否只读
readonly
:
{
type
:
Boolean
,
default
:
false
,
},
// 对齐方式
align
:
{
type
:
String
,
default
:
'left'
,
},
// 标签
label
:
{
type
:
Object
as
PropType
<
TimeBarLabel
>
,
default
:
()
=>
({})
as
TimeBarLabel
,
},
// 时间
time
:
{
type
:
Object
as
PropType
<
TimeBarTime
>
,
default
:
()
=>
({})
as
TimeBarTime
,
},
// 扩展按钮
buttons
:
{
type
:
Array
as
PropType
<
TimeBarButton
[]
>
,
default
:
()
=>
[]
as
TimeBarButton
[],
},
})
const
emits
=
defineEmits
([
'register'
])
const
data
=
reactive
({
show
:
props
.
show
,
readonly
:
props
.
readonly
,
align
:
props
.
align
,
label
:
props
.
label
,
time
:
props
.
time
,
buttons
:
props
.
buttons
,
// 组件自身的数据
showDropdownMenu
:
false
,
})
function
toggleShow
(
show
?:
boolean
)
{
data
.
show
=
show
??
!
data
.
show
}
function
setProps
(
value
:
Partial
<
typeof
props
>
)
{
deepMerge
(
data
,
value
)
if
(
!
data
?.
time
?.
value
)
{
const
time
=
dayjs
()
data
.
time
.
value
=
[
time
.
subtract
(
1
,
'days'
),
time
]
}
}
const
labelText
=
computed
(()
=>
{
let
text
:
string
if
(
data
.
label
.
options
?.
length
)
{
text
=
checkedLabelOption
.
value
?.
text
}
else
{
text
=
data
.
label
.
text
}
return
text
||
''
})
const
timeText
=
computed
(()
=>
{
let
text
:
string
if
(
data
.
time
)
{
const
format
=
checkedLabelOption
.
value
?.
format
||
data
.
time
.
format
text
=
data
.
time
.
value
.
map
((
item
)
=>
dayjs
(
item
).
format
(
format
)).
join
(
' - '
)
}
return
text
||
''
})
const
timePickerType
=
computed
(()
=>
{
let
type
:
number
if
(
data
.
time
)
{
type
=
checkedLabelOption
.
value
?.
timeType
||
data
.
time
.
timeType
}
return
type
||
3
})
const
dropdownMenu
=
ref
(
null
)
const
checkedLabelOption
=
computed
(()
=>
data
.
label
?.
options
?.
find
((
option
)
=>
option
.
checked
)
||
{})
function
changeLabelOption
(
option
:
TimeBarLabel
[
'options'
][
0
])
{
data
.
showDropdownMenu
=
false
data
.
label
.
options
.
forEach
((
item
)
=>
{
item
.
checked
=
item
.
value
===
option
.
value
if
(
item
.
checked
)
{
data
.
label
?.
onChange
?.({
option
:
{
text
:
item
.
text
,
value
:
item
.
value
},
value
:
toRaw
(
data
.
time
.
value
),
})
}
})
}
function
openDropdownMenu
()
{
data
.
showDropdownMenu
=
true
dropdownMenu
.
value
?.
show
()
}
function
closeDropdownMenu
()
{
data
.
showDropdownMenu
=
false
}
const
showTimePicker
=
ref
(
false
)
function
changeTime
(
e
:
Recordable
)
{
if
(
e
.
startDate
)
{
data
.
time
.
value
=
[
dayjs
(
e
.
startDate
.
result
),
dayjs
(
e
.
endDate
.
result
)]
}
else
{
data
.
time
.
value
=
[
dayjs
(
e
.
result
)]
}
data
.
time
.
onChange
?.({
option
:
{
text
:
checkedLabelOption
.
value
.
text
,
value
:
checkedLabelOption
.
value
.
value
},
value
:
toRaw
(
data
.
time
.
value
),
})
showTimePicker
.
value
=
false
}
emits
(
'register'
,
{
setProps
,
toggleShow
,
})
</
script
>
<
template
>
<view
class=
"wrap time-bar"
:class=
"[data.align]"
v-show=
"data.show"
>
<view
class=
"label"
>
<Icon
icon=
"ic-outline-access-time"
size=
"36"
color=
"#333"
class=
"icon"
v-if=
"data.label.breforeIcon !== false"
/>
<template
v-if=
"data.label.options?.length"
>
<fui-dropdown-menu
:size=
"28"
selectedColor=
"#465CFF"
:options=
"data.label.options"
@
click=
"changeLabelOption"
@
close=
"closeDropdownMenu"
ref=
"dropdownMenu"
>
<view
class=
"fui-filter__item"
@
tap=
"openDropdownMenu"
>
<text>
{{
checkedLabelOption
.
text
}}
</text>
<view
class=
"fui-filter__icon"
:class=
"
{ 'fui-icon__ani': data.showDropdownMenu }">
<fui-icon
name=
"turningdown"
:size=
"32"
/>
</view>
</view>
</fui-dropdown-menu>
</
template
>
<
template
v-else
>
<view
class=
"text after"
>
{{
labelText
}}
</view>
</
template
>
</view>
<view
class=
""
>
<view
class=
"time-wrap"
@
tap=
"showTimePicker = true"
>
<!-- -->
<view
class=
"time"
>
{{ timeText }}
</view>
</view>
<view
class=
"buttons"
v-if=
"data.buttons?.length"
>
<!-- -->
</view>
</view>
<!-- 时间选择组件 -->
<fui-date-picker
start=
"开始时间"
end=
"结束时间"
:range=
"data.time.type === 'range'"
:show=
"showTimePicker"
:type=
"timePickerType"
:value=
"formatTime(data.time?.value?.[0])"
:valueEnd=
"formatTime(data.time?.value?.[1])"
@
change=
"changeTime"
@
cancel=
"showTimePicker = false"
/>
</view>
</template>
<
style
lang=
"scss"
scoped
>
@mixin
animate
()
{
transition
:
all
0.35s
;
}
.wrap
{
@include
animate();
position
:
absolute
;
top
:
0
;
left
:
0
;
//
层级需要比其他
widget
高,否则
picker
会被遮挡
z-index
:
100
;
background-color
:
white
;
}
.time-bar
{
padding
:
20
rpx
;
width
:
100%
;
display
:
flex
;
align-items
:
center
;
font-size
:
28
rpx
;
//
box-shadow
:
0
0
15
rpx
rgba
(
0
,
0
,
0
,
0.1
);
&.center
{
justify-content
:
center
;
}
>
.label
{
display
:
flex
;
align-items
:
center
;
font-size
:
28
rpx
;
color
:
#333
;
.icon
{
margin-right
:
10
rpx
;
}
.text
{
margin-right
:
5
rpx
;
&.
after
::
after
{
content
:
':'
;
}
}
.fui-filter__item
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
/* #ifdef H5 */
cursor
:
pointer
;
/* #endif */
background-color
:
#fff
;
margin-right
:
10
rpx
;
}
.fui-filter__icon
{
transition
:
all
0.15s
linear
;
margin-left
:
5
rpx
;
}
.fui-icon__ani
{
transform
:
rotate
(
180deg
);
}
:deep
(
.fui-dropdown__menu-list
)
{
width
:
230
rpx
;
}
}
.time-wrap
{
flex
:
auto
;
.time
{
color
:
#1890ff
;
}
}
}
</
style
>
src/components/Map/Widgets/TimeBarWidget/src/hook.ts
0 → 100644
浏览文件 @
2a075912
import
type
{
Dayjs
}
from
'dayjs'
import
type
{
TimeBarInstance
,
TimeBarProps
}
from
'./types'
import
{
getBooleanOrDefault
}
from
'../../utils'
import
{
isProdMode
}
from
'/@/utils/env'
export
function
formatTime
(
time
:
Dayjs
,
format
=
'YYYY-MM-DD HH:mm:ss'
)
{
return
time
?.
format
(
format
)
??
''
}
export
function
getFormatByType
(
type
:
number
)
{
switch
(
type
)
{
case
1
:
return
'YYYY'
case
2
:
return
'YYYY-MM'
case
3
:
return
'YYYY-MM-DD'
case
4
:
return
'YYYY-MM-DD HH:00'
case
5
:
return
'YYYY-MM-DD HH:mm'
case
6
:
return
'YYYY-MM-DD HH:mm:ss'
default
:
return
'YYYY-MM-DD HH:mm:ss'
}
}
/**
* 顶部时间栏组件响应式 Hook
* @param props 组件参数
* @returns 组件响应式数据
*/
export
function
useTimeBarWidget
<
T
extends
TimeBarInstance
>
(
props
:
TimeBarProps
):
[(
instance
:
T
)
=>
void
,
T
]
{
const
instanceRef
=
ref
<
Nullable
<
T
>>
(
null
)
function
register
(
instance
:
T
)
{
if
(
isProdMode
())
{
if
(
instance
===
unref
(
instanceRef
))
{
return
}
onUnmounted
(()
=>
{
instanceRef
.
value
=
null
})
}
instanceRef
.
value
=
instance
props
&&
instance
?.
setProps
(
props
)
}
function
getInstance
():
T
{
const
instance
=
unref
(
instanceRef
)
if
(
!
instance
)
{
console
.
warn
(
'时间栏小部件还未加载完成'
)
}
return
instance
as
T
}
return
[
register
,
{
setProps
:
(
props
:
TimeBarProps
)
=>
{
getInstance
()?.
setProps
(
props
)
},
toggleShow
:
(
show
?:
boolean
)
=>
{
getInstance
()?.
toggleShow
(
getBooleanOrDefault
(
show
))
},
}
as
T
,
]
}
src/components/Map/Widgets/TimeBarWidget/src/types.ts
0 → 100644
浏览文件 @
2a075912
import
type
{
Dayjs
}
from
'dayjs'
type
FirstUIDatePickerType
=
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
export
interface
TimeBarChangeEvent
{
value
:
Dayjs
[]
option
?:
{
text
?:
string
value
?:
string
}
}
export
interface
TimeBarLabel
{
text
?:
string
breforeIcon
?:
boolean
afterIcon
?:
boolean
options
?:
{
text
?:
string
value
?:
string
checked
?:
boolean
format
?:
string
/**
* 对应 first-ui datePicker 组件 type 参数
*/
timeType
?:
FirstUIDatePickerType
}[]
onClick
?:
()
=>
void
onChange
?:
(
e
:
TimeBarChangeEvent
)
=>
void
}
export
interface
TimeBarTime
{
type
:
'single'
|
'range'
/**
* 对应 first-ui datePicker 组件 type 参数
*/
timeType
:
FirstUIDatePickerType
format
?:
string
value
?:
Dayjs
[]
onChange
?:
(
e
:
TimeBarChangeEvent
)
=>
void
}
export
interface
TimeBarButton
{
icon
?:
string
label
:
string
onClick
?:
(
e
:
{
index
:
number
;
label
:
string
},
time
:
string
|
{
start
?:
string
;
end
?:
string
})
=>
void
}
export
interface
TimeBarProps
{
// 是否显示
show
?:
boolean
// 是否只读
readonly
?:
boolean
// 对齐方式
align
?:
'left'
|
'center'
|
'right'
// 标题
label
?:
TimeBarLabel
// 时间
time
:
TimeBarTime
// 扩展按钮
buttons
?:
TimeBarButton
[]
}
export
interface
TimeBarInstance
{
setProps
:
(
props
:
TimeBarProps
)
=>
void
toggleShow
:
(
show
?:
boolean
)
=>
void
}
src/components/Map/
Mapbox/w
idgets/utils.ts
→
src/components/Map/
W
idgets/utils.ts
浏览文件 @
2a075912
File moved
src/pages/business/monitor/rain/index.vue
浏览文件 @
2a075912
...
@@ -3,20 +3,67 @@
...
@@ -3,20 +3,67 @@
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
defaultLegendConfig
}
from
'./config'
import
{
defaultLegendConfig
}
from
'./config'
import
{
useShare
}
from
'@/hooks/page/useShare'
import
{
useShare
}
from
'@/hooks/page/useShare'
import
{
LegendWidget
,
useLegendWidget
}
from
'@/components/Map/Mapbox/widgets/Legend'
import
type
{
MapboxConfig
}
from
'@/components/Map/Mapbox'
import
{
BottomBarWidget
,
useBottomBarWidget
}
from
'@/components/Map/Mapbox/widgets/BottomBar'
import
{
LegendWidget
,
useLegendWidget
}
from
'@/components/Map/Widgets/Legend'
import
{
SwitchControlWidget
,
useSwitchControlWidget
}
from
'@/components/Map/Mapbox/widgets/SwitchControl'
import
{
TimeBarWidget
,
formatTime
,
useTimeBarWidget
}
from
'@/components/Map/Widgets/TimeBarWidget'
import
{
BottomBarWidget
,
useBottomBarWidget
}
from
'@/components/Map/Widgets/BottomBar'
import
{
SwitchControlWidget
,
useSwitchControlWidget
}
from
'@/components/Map/Widgets/SwitchControl'
useShare
()
useShare
()
const
config
=
{
const
config
:
MapboxConfig
=
{
//
测试
地图数据来源标注展示
//
说明:
地图数据来源标注展示
attribution
:
{
attribution
:
{
text
:
'湖南省气象台'
,
text
:
'湖南省气象台'
,
// align: 'bottom-left',
// align: 'bottom-left',
},
},
style
:
{
// 说明: 根据每个页面的 widget 布局情况,可能需要适当调整地图的中心位置,让界面显示效果更好
center
:
[
111.6
,
26.170844
],
},
}
}
// 顶部时间轴小部件
const
[
registerTimeBarWidget
]
=
useTimeBarWidget
({
show
:
true
,
label
:
{
options
:
[
{
text
:
'小时级'
,
value
:
'hour'
,
format
:
'M月D日H时'
,
timeType
:
4
,
checked
:
true
,
},
{
text
:
'分钟级'
,
value
:
'minute'
,
format
:
'M月D日H时m分'
,
timeType
:
5
,
},
],
onChange
:
({
option
,
value
})
=>
{
console
.
log
(
'[TimeBarWidget] ChangeOption'
,
option
,
value
.
map
((
item
)
=>
formatTime
(
item
)),
)
},
},
time
:
{
type
:
'range'
,
timeType
:
4
,
format
:
'M月D日H时'
,
onChange
:
({
option
,
value
})
=>
{
console
.
log
(
'[TimeBarWidget] ChangeTime'
,
option
,
value
.
map
((
item
)
=>
formatTime
(
item
)),
)
},
},
})
// 前后切换小部件
// 前后切换小部件
const
[
registerSwitchControlWidget
]
=
useSwitchControlWidget
({
const
[
registerSwitchControlWidget
]
=
useSwitchControlWidget
({
show
:
true
,
show
:
true
,
...
@@ -36,6 +83,7 @@
...
@@ -36,6 +83,7 @@
const
[
registerBottomBarWidget
,
{
height
}]
=
useBottomBarWidget
({
const
[
registerBottomBarWidget
,
{
height
}]
=
useBottomBarWidget
({
show
:
true
,
show
:
true
,
expand
:
true
,
expand
:
true
,
showExpandButton
:
true
,
height
:
150
,
height
:
150
,
maxHeight
:
240
,
maxHeight
:
240
,
})
})
...
@@ -49,6 +97,7 @@
...
@@ -49,6 +97,7 @@
<!-- 地图上方所有小部件 -->
<!-- 地图上方所有小部件 -->
<view
class=
"widgets"
>
<view
class=
"widgets"
>
<!-- -->
<!-- -->
<TimeBarWidget
@
register=
"registerTimeBarWidget"
/>
<!-- 前后切换小部件 -->
<!-- 前后切换小部件 -->
<SwitchControlWidget
@
register=
"registerSwitchControlWidget"
/>
<SwitchControlWidget
@
register=
"registerSwitchControlWidget"
/>
...
@@ -87,10 +136,10 @@
...
@@ -87,10 +136,10 @@
.page
{
.page
{
//
#ifdef
H5
//
#ifdef
H5
:
deep
(.
mapboxgl-ctrl-bottom-right
)
{
:
deep
(.
mapboxgl-ctrl-bottom-right
)
{
bottom
:
calc
(
8
0
rpx
+
v-bind
(
height
));
bottom
:
calc
(
8
5
rpx
+
v-bind
(
height
));
}
}
:deep
(
.mapboxgl-ctrl-bottom-left
)
{
:deep
(
.mapboxgl-ctrl-bottom-left
)
{
bottom
:
calc
(
8
0
rpx
+
v-bind
(
height
));
bottom
:
calc
(
8
5
rpx
+
v-bind
(
height
));
}
}
//
#endif
//
#endif
//
#ifdef
APP-PLUS
//
#ifdef
APP-PLUS
...
...
types/components.d.ts
浏览文件 @
2a075912
...
@@ -7,13 +7,13 @@ export {}
...
@@ -7,13 +7,13 @@ export {}
declare
module
'vue'
{
declare
module
'vue'
{
export
interface
GlobalComponents
{
export
interface
GlobalComponents
{
BottomBar
:
typeof
import
(
'./../src/components/Map/
Mapbox/w
idgets/BottomBar/src/BottomBar.vue'
)[
'default'
]
BottomBar
:
typeof
import
(
'./../src/components/Map/
W
idgets/BottomBar/src/BottomBar.vue'
)[
'default'
]
CacheImage
:
typeof
import
(
'./../src/components/CacheImage/index.vue'
)[
'default'
]
CacheImage
:
typeof
import
(
'./../src/components/CacheImage/index.vue'
)[
'default'
]
CustomPicker
:
typeof
import
(
'./../src/components/CustomPicker/index.vue'
)[
'default'
]
CustomPicker
:
typeof
import
(
'./../src/components/CustomPicker/index.vue'
)[
'default'
]
Empty
:
typeof
import
(
'./../src/components/Empty/index.vue'
)[
'default'
]
Empty
:
typeof
import
(
'./../src/components/Empty/index.vue'
)[
'default'
]
FDragItem
:
typeof
import
(
'./../src/components/FirstUI/fui-drag/f-drag-item.vue'
)[
'default'
]
FDragItem
:
typeof
import
(
'./../src/components/FirstUI/fui-drag/f-drag-item.vue'
)[
'default'
]
FIndexListItem
:
typeof
import
(
'./../src/components/FirstUI/fui-index-list/f-index-list-item.vue'
)[
'default'
]
FIndexListItem
:
typeof
import
(
'./../src/components/FirstUI/fui-index-list/f-index-list-item.vue'
)[
'default'
]
FloatFillterWidget
:
typeof
import
(
'./../src/components/Map/
Mapbox/w
idgets/FloatFillterWidget.vue'
)[
'default'
]
FloatFillterWidget
:
typeof
import
(
'./../src/components/Map/
W
idgets/FloatFillterWidget.vue'
)[
'default'
]
FuiActionsheet
:
typeof
import
(
'./../src/components/FirstUI/fui-actionsheet/fui-actionsheet.vue'
)[
'default'
]
FuiActionsheet
:
typeof
import
(
'./../src/components/FirstUI/fui-actionsheet/fui-actionsheet.vue'
)[
'default'
]
FuiAlert
:
typeof
import
(
'./../src/components/FirstUI/fui-alert/fui-alert.vue'
)[
'default'
]
FuiAlert
:
typeof
import
(
'./../src/components/FirstUI/fui-alert/fui-alert.vue'
)[
'default'
]
FuiAnimation
:
typeof
import
(
'./../src/components/FirstUI/fui-animation/fui-animation.vue'
)[
'default'
]
FuiAnimation
:
typeof
import
(
'./../src/components/FirstUI/fui-animation/fui-animation.vue'
)[
'default'
]
...
@@ -138,15 +138,17 @@ declare module 'vue' {
...
@@ -138,15 +138,17 @@ declare module 'vue' {
Grid
:
typeof
import
(
'./../src/components/Layout/Grid.vue'
)[
'default'
]
Grid
:
typeof
import
(
'./../src/components/Layout/Grid.vue'
)[
'default'
]
Header
:
typeof
import
(
'./../src/components/Layout/Header.vue'
)[
'default'
]
Header
:
typeof
import
(
'./../src/components/Layout/Header.vue'
)[
'default'
]
Icon
:
typeof
import
(
'./../src/components/Icon/index.vue'
)[
'default'
]
Icon
:
typeof
import
(
'./../src/components/Icon/index.vue'
)[
'default'
]
LeftBarWidget
:
typeof
import
(
'./../src/components/Map/
Mapbox/w
idgets/LeftBarWidget.vue'
)[
'default'
]
LeftBarWidget
:
typeof
import
(
'./../src/components/Map/
W
idgets/LeftBarWidget.vue'
)[
'default'
]
Legend
:
typeof
import
(
'./../src/components/Map/
Mapbox/w
idgets/Legend/src/Legend.vue'
)[
'default'
]
Legend
:
typeof
import
(
'./../src/components/Map/
W
idgets/Legend/src/Legend.vue'
)[
'default'
]
Mapbox
:
typeof
import
(
'./../src/components/Map/Mapbox/index.vue'
)[
'default'
]
Mapbox
:
typeof
import
(
'./../src/components/Map/Mapbox/index.vue'
)[
'default'
]
MenuHeader
:
typeof
import
(
'./../src/components/Layout/MenuHeader.vue'
)[
'default'
]
MenuHeader
:
typeof
import
(
'./../src/components/Layout/MenuHeader.vue'
)[
'default'
]
RouterLink
:
typeof
import
(
'vue-router'
)[
'RouterLink'
]
RouterLink
:
typeof
import
(
'vue-router'
)[
'RouterLink'
]
RouterView
:
typeof
import
(
'vue-router'
)[
'RouterView'
]
RouterView
:
typeof
import
(
'vue-router'
)[
'RouterView'
]
SwitchControl
:
typeof
import
(
'./../src/components/Map/
Mapbox/w
idgets/SwitchControl/src/SwitchControl.vue'
)[
'default'
]
SwitchControl
:
typeof
import
(
'./../src/components/Map/
W
idgets/SwitchControl/src/SwitchControl.vue'
)[
'default'
]
ThumbnailPreview
:
typeof
import
(
'./../src/components/ThumbnailPreview/index.vue'
)[
'default'
]
ThumbnailPreview
:
typeof
import
(
'./../src/components/ThumbnailPreview/index.vue'
)[
'default'
]
TopBarWidget
:
typeof
import
(
'./../src/components/Map/Mapbox/widgets/TopBarWidget.vue'
)[
'default'
]
TimeBar
:
typeof
import
(
'./../src/components/Map/Widgets/TimeBarWidget/src/TimeBar.vue'
)[
'default'
]
TopBar
:
typeof
import
(
'./../src/components/Map/Mapbox/widgets/TopBarWidget/src/TopBar.vue'
)[
'default'
]
TopBarWidget
:
typeof
import
(
'./../src/components/Map/Mapbox/widgets/TopBarWidget/TopBarWidget.vue'
)[
'default'
]
View
:
typeof
import
(
'./../src/components/Layout/View.vue'
)[
'default'
]
View
:
typeof
import
(
'./../src/components/Layout/View.vue'
)[
'default'
]
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论