Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
basic-uniapp-v3
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-uniapp-v3
Commits
1d87e0fb
提交
1d87e0fb
authored
8月 14, 2023
作者:
方治民
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 优化地图基础样式
上级
60b6f528
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
46 行增加
和
39 行删除
+46
-39
index.ts
src/components/Map/Mapbox/index.ts
+33
-34
index.vue
src/components/Map/Mapbox/index.vue
+3
-2
mapbox.module.js
src/components/Map/Mapbox/mapbox.module.js
+8
-0
pages.json
src/pages.json
+1
-1
index.vue
src/pages/business/monitor/rain/index.vue
+1
-1
components.d.ts
types/components.d.ts
+0
-1
没有找到文件。
src/components/Map/Mapbox/index.ts
浏览文件 @
1d87e0fb
...
...
@@ -21,16 +21,10 @@ export function buildTdtTileUrl(id: string, tk: string) {
/**
* 地图样式
*/
export
const
defaultStyle
:
mapboxgl
.
Style
&
{
minzoom
?:
number
;
maxzoom
?:
number
;
maxBounds
?:
number
[][]
}
=
{
export
const
defaultStyle
:
mapboxgl
.
Style
=
{
version
:
8
,
zoom
:
5.5
,
center
:
[
111.6
,
27.070844
],
minzoom
:
5
,
maxzoom
:
18
,
maxBounds
:
[
[
99.94
,
20.89
],
[
125.03
,
33.52
],
],
center
:
[
111.6
,
27.170844
],
sprite
:
`
${
host
}
/api/sprites/hntq/sprite`
,
glyphs
:
`
${
host
}
/api/fonts/{fontstack}/{range}.pbf`
,
sources
:
{
...
...
@@ -200,6 +194,32 @@ export const defaultStyle: mapboxgl.Style & { minzoom?: number; maxzoom?: number
},
},
// 城市边界
{
id
:
`430000.city-line`
,
source
:
'430000.city'
,
'source-layer'
:
'430000.city'
,
type
:
'line'
,
paint
:
{
'line-width'
:
1
,
'line-color'
:
'#ccc'
,
},
minzoom
:
5
,
},
// 县城边界
{
id
:
`430000.area-line`
,
source
:
'430000.area'
,
'source-layer'
:
'430000.area'
,
type
:
'line'
,
paint
:
{
'line-width'
:
1
,
'line-color'
:
'#ccc'
,
},
minzoom
:
8
,
},
// ============ 省市县边界图层 ============
{
id
:
'430000-mask'
,
...
...
@@ -225,9 +245,10 @@ export const defaultStyle: mapboxgl.Style & { minzoom?: number; maxzoom?: number
'line-cap'
:
'round'
,
},
paint
:
{
'line-width'
:
8
,
'line-width'
:
4
,
'line-blur'
:
92.7
,
'line-offset'
:
-
4
,
'line-color'
:
'#444'
,
},
minzoom
:
5
,
},
...
...
@@ -238,20 +259,10 @@ export const defaultStyle: mapboxgl.Style & { minzoom?: number; maxzoom?: number
type
:
'line'
,
paint
:
{
'line-width'
:
2
,
'line-color'
:
'#444'
,
},
},
// 城市边界
{
id
:
`430000.city-line`
,
source
:
'430000.city'
,
'source-layer'
:
'430000.city'
,
type
:
'line'
,
paint
:
{
'line-width'
:
1
,
},
minzoom
:
5
,
},
// 城市名称
{
id
:
`430000.city-label`
,
...
...
@@ -273,24 +284,12 @@ export const defaultStyle: mapboxgl.Style & { minzoom?: number; maxzoom?: number
paint
:
{
'text-color'
:
'#000'
,
'text-halo-color'
:
'#fff'
,
'text-halo-width'
:
1
,
'text-halo-width'
:
2
,
'text-halo-blur'
:
1
,
},
minzoom
:
5
,
maxzoom
:
8
,
},
// 县城边界
{
id
:
`430000.area-line`
,
source
:
'430000.area'
,
'source-layer'
:
'430000.area'
,
type
:
'line'
,
paint
:
{
'line-width'
:
1
,
},
minzoom
:
8
,
},
// 县城名称
{
id
:
`430000.area-label`
,
...
...
@@ -312,7 +311,7 @@ export const defaultStyle: mapboxgl.Style & { minzoom?: number; maxzoom?: number
paint
:
{
'text-color'
:
'#000'
,
'text-halo-color'
:
'#fff'
,
'text-halo-width'
:
1
,
'text-halo-width'
:
2
,
'text-halo-blur'
:
1
,
},
minzoom
:
8
,
...
...
src/components/Map/Mapbox/index.vue
浏览文件 @
1d87e0fb
...
...
@@ -13,7 +13,7 @@
export
default
{
props
:
{
style
:
{
config
:
{
type
:
Object
,
default
:
()
=>
({}),
},
...
...
@@ -30,7 +30,8 @@
mounted
()
{
this
.
options
=
{
container
:
this
.
id
,
style
:
this
.
style
,
style
:
this
.
config
?.
style
,
options
:
this
.
config
?.
options
,
}
},
methods
:
{
...
...
src/components/Map/Mapbox/mapbox.module.js
浏览文件 @
1d87e0fb
...
...
@@ -25,6 +25,13 @@ export default {
...
defaultStyle
,
...
options
?.
style
,
}),
...
merge
(
{
minZoom
:
5
,
maxZoom
:
18
,
},
options
?.
options
,
),
})
// 绑定作用域
...
...
@@ -70,6 +77,7 @@ export default {
return
}
console
.
log
(
options
)
if
(
typeof
window
.
mapboxgl
===
'object'
)
{
this
.
initMap
(
options
)
}
else
{
...
...
src/pages.json
浏览文件 @
1d87e0fb
...
...
@@ -2,7 +2,7 @@
"globalStyle"
:
{
"navigationBarTextStyle"
:
"white"
,
"navigationBarBackgroundColor"
:
"#F8F8F8"
,
"backgroundColor"
:
"#F
8F8F8
"
,
"backgroundColor"
:
"#F
FFFFF
"
,
"pageOrientation"
:
"portrait"
//横屏配置,全局屏幕旋转设置(仅
APP/微信/QQ小程序),支持
auto
/
portrait
/
landscape
},
"pages"
:
[
...
...
src/pages/business/monitor/rain/index.vue
浏览文件 @
1d87e0fb
...
...
@@ -7,7 +7,7 @@
</
script
>
<
template
>
<view
class=
"bg h-100vh"
>
<view
class=
"bg
-white
h-100vh"
>
<!-- 地图组件 -->
<Mapbox
style=
"height: 100%"
/>
...
...
types/components.d.ts
浏览文件 @
1d87e0fb
...
...
@@ -136,7 +136,6 @@ declare module 'vue' {
Grid
:
typeof
import
(
'./../src/components/Layout/Grid.vue'
)[
'default'
]
Header
:
typeof
import
(
'./../src/components/Layout/Header.vue'
)[
'default'
]
Icon
:
typeof
import
(
'./../src/components/Icon/index.vue'
)[
'default'
]
Map
:
typeof
import
(
'./../src/components/Map/Mapbox/Map.vue'
)[
'default'
]
Mapbox
:
typeof
import
(
'./../src/components/Map/Mapbox/index.vue'
)[
'default'
]
MenuHeader
:
typeof
import
(
'./../src/components/Layout/MenuHeader.vue'
)[
'default'
]
RouterLink
:
typeof
import
(
'vue-router'
)[
'RouterLink'
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论