Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform-ui
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
youjj
cloud-platform-ui
Commits
0cb38a5b
Commit
0cb38a5b
authored
May 15, 2019
by
lixy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
地图
parent
8d0f5726
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
16 deletions
+47
-16
companyMap.vue
src/views/baseInfo/companyInfo/companyMap.vue
+47
-16
No files found.
src/views/baseInfo/companyInfo/companyMap.vue
View file @
0cb38a5b
...
...
@@ -41,9 +41,17 @@
}
},
mounted
()
{
// let that = this;
// if(this.map){
// this.map.addEventListener("zoomend", function(e){
// var ZoomNum = that.map.getZoom();
// this.addMarker(map);
// });
// }
},
watch
:
{
provinceName
(
newValue
,
oldValue
)
{
let
that
=
this
;
console
.
log
(
this
.
provinceName
);
if
(
this
.
map
){
if
(
this
.
provinceName
==
"兰州"
){
...
...
@@ -52,6 +60,11 @@
this
.
map
.
centerAndZoom
(
this
.
provinceName
,
6
);
}
}
// this.map.addEventListener("zoomend", function(e){
// var ZoomNum = that.map.getZoom();
// that.map.clearOverlays();//清空地图上标注点
// that.addMarker(this,map);
// });
},
},
methods
:
{
...
...
@@ -80,22 +93,31 @@
},
handler
({
map
})
{
this
.
map
=
map
;
let
list
=
this
.
toSonData
;
// 定位
this
.
geolocation
(
map
);
// 产生随机点
const
bounds
=
map
.
getBounds
();
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
)
{
const
point
=
{
title
:
""
,
//list[i].name
point
:
{
lng
:
list
[
i
].
longitude
,
lat
:
list
[
i
].
latitude
page
(
this
.
listQuery
)
.
then
(
response
=>
{
let
listTemp
=
response
.
data
.
data
;
let
arr
=
[];
listTemp
.
map
(
function
(
item
){
arr
.
push
(
item
);
});
this
.
list
=
arr
;
// 定位
this
.
geolocation
(
map
);
// 产生随机点
const
bounds
=
map
.
getBounds
();
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
const
point
=
{
title
:
""
,
//list[i].name
point
:
{
lng
:
arr
[
i
].
longitude
,
lat
:
arr
[
i
].
latitude
}
};
this
.
pointList
.
push
(
point
);
}
};
this
.
pointList
.
push
(
point
);
}
this
.
addMarker
(
map
);
this
.
addMarker
(
map
);
})
},
mapClick
(
map
,
e
)
{
const
point
=
e
.
point
;
...
...
@@ -108,6 +130,7 @@
const
p
=
new
BMap
.
Point
(
point
.
lng
,
point
.
lat
);
this
.
pickPoint
=
new
BMap
.
Marker
(
p
);
this
.
addressDetail
(
point
);
//根据经纬度获取省市信息
// this.addMarker(map);
},
addressDetail
(
point
){
//获取地理位置
let
mydata
=
getSonRegionByCodes
(
1
);
...
...
@@ -130,9 +153,17 @@
});
},
addMarker
(
map
)
{
let
zoom
=
map
.
getZoom
();
var
myIcon
=
new
BMap
.
Icon
(
'https://cwmp.upyuns.com/attachment/images/4/2019/05/HnFr78H280dv972KuNZku70297rz7z.png'
,
new
BMap
.
Size
(
16
,
16
));
//这里先不用第三个参数IconOptions;
// if(zoom
<
6
){
// myIcon = new BMap.Icon('https://cwmp.upyuns.com/attachment/images/4/2019/05/HnFr78H280dv972KuNZku70297rz7z.png',new BMap.Size(16,16));//这里先不用第三个参数IconOptions
// }
for
(
const
item
of
this
.
pointList
)
{
const
point
=
new
BMap
.
Point
(
item
.
point
.
lng
,
item
.
point
.
lat
);
const
mk
=
new
BMap
.
Marker
(
point
);
var
mk
=
new
BMap
.
Marker
(
point
,
{
icon
:
myIcon
});
// if(zoom > 6){
// mk = new BMap.Marker(point);
// }
const
label
=
new
BMap
.
Label
(
item
.
title
);
label
.
setOffset
(
new
BMap
.
Size
(
15
,
-
15
));
label
.
setStyle
({
...
...
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