Commit 83516382 authored by xinzhedeai's avatar xinzhedeai

amap marker

parent 6f319043
<template> <template>
<div class="Screen cm-layout"> <div class="Screen cm-layout">
<div class="a_0"> <div class="a_0">
<cu-amap <!-- <cu-amap ref="amap" :options="amapOptions()" /> -->
ref="amap"
:options="amapOptions()"
/>
<div id="container"></div>
<div class="a0_"> <div class="a0_">
<header id="header"> <header id="header">
<div class="b1_bg"> <div class="b1_bg">
...@@ -102,14 +99,18 @@ ...@@ -102,14 +99,18 @@
<script> <script>
import { reqApi } from "@/assets/js/httpApi.js"; import { reqApi } from "@/assets/js/httpApi.js";
import { Highchart } from "@/assets/js/chartTemplates.js"; import { Highchart } from "@/assets/js/chartTemplates.js";
import cuAmap from '@/components/AMap'; import cuAmap from "@/components/AMap";
import request from '@/utils/request' import request from "@/utils/request";
//关闭信息窗体
function closeInfoWindow(mapEle) {
mapEle.clearInfoWindow();
}
export default { export default {
data() { data() {
return { return {
map: null,
infoWindow: null,
navActive: null, navActive: null,
sjzlList: [], sjzlList: [],
srphList: [], srphList: [],
...@@ -119,11 +120,10 @@ export default { ...@@ -119,11 +120,10 @@ export default {
}, },
}; };
}, },
components: {cuAmap }, components: { cuAmap },
mounted() { mounted() {
var that = this; var that = this;
this.$nextTick(() => { this.$nextTick(() => {
/** /**
* 1、地图渲染 * 1、地图渲染
* 1-1、地图坐标点定位回显,marker事件添加 * 1-1、地图坐标点定位回显,marker事件添加
...@@ -134,47 +134,110 @@ export default { ...@@ -134,47 +134,110 @@ export default {
* *
* *
*/ */
this.initMap();
this.navActive = 0 this.navActive = 0;
// 获取总览数据 // 获取总览数据
this.sjzl() this.sjzl();
this.srph() this.srph();
this.qycxcysjfx() this.qycxcysjfx();
this.fhqfhqysjfx() this.fhqfhqysjfx();
this.fhqyndsjsfbhqs() this.fhqyndsjsfbhqs();
this.zfqyndsjsfbhqs() this.zfqyndsjsfbhqs();
// const map = new AMap.Map('map', { // const map = new AMap.Map('map', {
// resizeEnable: true, // resizeEnable: true,
// center: [116.397128, 39.916527], // 设置中心坐标 // center: [116.397128, 39.916527], // 设置中心坐标
// zoom: 10, // 设置缩放级别 // zoom: 10, // 设置缩放级别
// viewMode: '3D' // 3D视图 // viewMode: '3D' // 3D视图
// }); // });
}) });
}, },
methods: { methods: {
sjzl () { // 数据总览 initMap() {
var VUE = this;
VUE.map = new AMap.Map("container", {
resizeEnable: true,
center: [116.481181, 39.989792],
zoom: 13,
});
console.log(VUE.map, "map");
addMarker();
//添加marker标记
function addMarker() {
VUE.map.clearMap();
var marker = new AMap.Marker({
map: VUE.map,
position: [116.481181, 39.989792],
icon: "/static/images/marker-dp.png",
});
//鼠标点击marker弹出自定义的信息窗体
marker.on("click", function () {
VUE.infoWindow.open(VUE.map, marker.getPosition());
});
}
const item = {};
//实例化信息窗体
var title =
'方恒假日酒店<span style="font-size:11px;color:#F00;">价格:318</span>',
content = `<div class="popupBgImage" style="">
<h4>详细信息</h4><i id="closeInfoWindowBtn"></i>
<dl>
<dd><font>孵化器名称:</font><span>${item.incubatorName}</span></dd>
<dd><font>运营机构:</font><span>${item.operatingAgency}</span></dd>
<dd><font>在孵企业:</font><span>${item.incubatorCount || 0}家</span></dd>
<dd><font>毕业企业:</font><span>${item.graduationCount || 0}家</span></dd>
<dd><font>使用总面积:</font><span>${item.totalArea || 0}(㎡)</span></dd>
<dd><font>总收入:</font><span>${item.totalIncome || 0}万元</span></dd>
</dl>
<button type="button">更多</button>
</div>`;
VUE.infoWindow = new AMap.InfoWindow({
isCustom: true, //使用自定义窗体
anchor: "top-center",
// content: createInfoWindow(title, content),
content,
offset: new AMap.Pixel(30, 70),
open: function(){
}
});
VUE.infoWindow.on('open',function(){ // 关闭信息框
document.getElementById("closeInfoWindowBtn").onclick = () => {
VUE.infoWindow.close();
};
})
// document.getElementById("closeInfoWindowBtn").onclick = () => {
// this.closeInfo();
// };
},
closeInfo() {
this.infoWindow.close();
},
sjzl() {
// 数据总览
request({ request({
url: 'api/homePage/incubatorOverview?size=9', url: "api/homePage/incubatorOverview?size=9",
method: 'get' method: "get",
}) .then((res) => { }).then((res) => {
this.sjzlList = res.body || []; this.sjzlList = res.body || [];
}); });
}, },
srph () { // 收入排行 srph() {
// 收入排行
request({ request({
url: 'api/homePage/incubatorLeaderboard', url: "api/homePage/incubatorLeaderboard",
method: 'get' method: "get",
}) .then((res) => { }).then((res) => {
const list = res.body || []; const list = res.body || [];
var colors = [ var colors = ["#ff8371", "#08b2c0", "#427fff", "#8dbffa", "#b2e2fe"];
"#ff8371",
"#08b2c0",
"#427fff",
"#8dbffa",
"#b2e2fe",
];
var chartData = Highchart.formatSeriesList(list, { var chartData = Highchart.formatSeriesList(list, {
value: "value", value: "value",
colors: colors, colors: colors,
...@@ -210,14 +273,19 @@ export default { ...@@ -210,14 +273,19 @@ export default {
}, },
isSeriesData: true, isSeriesData: true,
}; };
Highchart.template.rich(document.querySelector('.srphWrapper'), list, opts); Highchart.template.rich(
document.querySelector(".srphWrapper"),
list,
opts
);
}); });
}, },
qycxcysjfx () { //企业创新创业数据分析 qycxcysjfx() {
//企业创新创业数据分析
request({ request({
url: 'api/homePage/enterpriseInnovationAnalysis', url: "api/homePage/enterpriseInnovationAnalysis",
method: 'get' method: "get",
}) .then((res) => { }).then((res) => {
const list = res.body || []; const list = res.body || [];
var colors = ["#0b50f5", "#00d1e6", "#0ce2a6", "#fdbe17"]; var colors = ["#0b50f5", "#00d1e6", "#0ce2a6", "#fdbe17"];
var seriesFormat = Highchart.formatSeriesList(list, { var seriesFormat = Highchart.formatSeriesList(list, {
...@@ -273,14 +341,19 @@ export default { ...@@ -273,14 +341,19 @@ export default {
isSeriesData: true, isSeriesData: true,
}; };
// Highchart.template.pie(wrap34, list, opts); // Highchart.template.pie(wrap34, list, opts);
Highchart.template.rich(document.querySelector('.qycxcysjfxWrapper'), list, opts); Highchart.template.rich(
document.querySelector(".qycxcysjfxWrapper"),
list,
opts
);
}); });
}, },
fhqfhqysjfx () { //孵化器孵化企业数据分析 fhqfhqysjfx() {
//孵化器孵化企业数据分析
request({ request({
url: 'api/homePage/incubatorEnterpriseNumber', url: "api/homePage/incubatorEnterpriseNumber",
method: 'get' method: "get",
}) .then((res) => { }).then((res) => {
const list = res.body || []; const list = res.body || [];
var opts = { var opts = {
chartConfig: { chartConfig: {
...@@ -297,14 +370,19 @@ export default { ...@@ -297,14 +370,19 @@ export default {
}, },
}; };
// Highchart.template.rich(wrap35, list, opts); // Highchart.template.rich(wrap35, list, opts);
Highchart.template.rich(document.querySelector('.fhqfhqysjfxWrapper'), list, opts); Highchart.template.rich(
document.querySelector(".fhqfhqysjfxWrapper"),
list,
opts
);
}); });
}, },
fhqyndsjsfbhqs () { //孵化企业年度上缴税费变化趋势 fhqyndsjsfbhqs() {
//孵化企业年度上缴税费变化趋势
request({ request({
url: 'api/homePage/incubatorTaxTrend', url: "api/homePage/incubatorTaxTrend",
method: 'get' method: "get",
}) .then((res) => { }).then((res) => {
let list = res.body || []; let list = res.body || [];
list = { list = {
names: [ names: [
...@@ -437,14 +515,19 @@ export default { ...@@ -437,14 +515,19 @@ export default {
isSeriesData: true, isSeriesData: true,
}; };
// Highchart.template.rich(wrap35, list, opts); // Highchart.template.rich(wrap35, list, opts);
Highchart.template.rich(document.querySelector('.fhqyndsjsfbhqsWrapper'), list, opts); Highchart.template.rich(
document.querySelector(".fhqyndsjsfbhqsWrapper"),
list,
opts
);
}); });
}, },
zfqyndsjsfbhqs () { // 在孵企业年度上缴税费变化趋势 zfqyndsjsfbhqs() {
// 在孵企业年度上缴税费变化趋势
request({ request({
url: 'api/homePage/incubatorTaxTrend', url: "api/homePage/incubatorTaxTrend",
method: 'get' method: "get",
}) .then((res) => { }).then((res) => {
let list = res.body || []; let list = res.body || [];
list = { list = {
names: [ names: [
...@@ -577,27 +660,62 @@ export default { ...@@ -577,27 +660,62 @@ export default {
isSeriesData: true, isSeriesData: true,
}; };
// Highchart.template.rich(wrap35, list, opts); // Highchart.template.rich(wrap35, list, opts);
Highchart.template.rich(document.querySelector('.zfqyndsjsfbhqsWrapper'), list, opts); Highchart.template.rich(
document.querySelector(".zfqyndsjsfbhqsWrapper"),
list,
opts
);
}); });
}, },
amapOptions(cmap) {
amapOptions(cmap){
var self = this; var self = this;
var VUE = this;
return { return {
zoom:13, zoom: 13,
center:[122.050189, 37.515189], center: [122.050189, 37.515189],
//showLabel: true, //showLabel: true,
//pitch: 40, //pitch: 40,
onload: function(cmap){ onload: function (cmap) {
console.log('onload ________________ ', self, cmap); console.log("onload ________________ ", self, cmap);
const form = {
longitude: 122.050189,
latitude: 37.515189,
};
self.cmap = cmap; self.cmap = cmap;
// debugger
VUE.cmap = cmap;
var center = cmap.options.center;
var lng = form.longitude || center[0],
lat = form.latitude || center[1];
if (lng && lat) {
cmap.setCenter([lng, lat]);
addMarker();
// // 添加标记
// cmap.addMarker({
// lnglat: [lng, lat],
// title: "",
// content: markerContent,
// offset: new AMap.Pixel(-13, -30),
// draggable: true,
// click: function () {
// infoWindow.open(cmap, marker.getPosition()); // 打开信息窗口
// },
// });
// //鼠标点击marker弹出自定义的信息窗体
// AMap.event.addListener(cmap, "click", function () {
// infoWindow.open(map, marker.getPosition());
// });
}
}, },
click: function(e, cmap){ click: function (e, cmap) {
console.log('click ________________ ', cmap); console.log("click ________________ ", cmap);
}, },
}; };
}, },
// 首页 // 首页
module0(m, t, f, dmIndex, view) { module0(m, t, f, dmIndex, view) {
var self = this, var self = this,
...@@ -690,9 +808,7 @@ export default { ...@@ -690,9 +808,7 @@ export default {
// 孵化总收入排行榜 // 孵化总收入排行榜
(m.reqSrph = function () { (m.reqSrph = function () {
m.srph().then(function (list) { m.srph().then(function (list) {});
});
})(); })();
// md4 // md4
...@@ -1421,6 +1537,11 @@ export default { ...@@ -1421,6 +1537,11 @@ export default {
</script> </script>
<style lang="scss" scope> <style lang="scss" scope>
#container {
height: 100%;
width: 100%;
background-color: #29557a;
}
@font-face { @font-face {
font-family: "diget year"; font-family: "diget year";
src: url("~@/assets/fonts/DS-Digital.ttf"); src: url("~@/assets/fonts/DS-Digital.ttf");
...@@ -1554,7 +1675,7 @@ export default { ...@@ -1554,7 +1675,7 @@ export default {
justify-content: center; justify-content: center;
pointer-events: none; pointer-events: none;
h2 { h2 {
font-size: 0.4rem; font-size: 0.4534rem;
line-height: 1; line-height: 1;
margin: 0.23rem 0 0 0rem; margin: 0.23rem 0 0 0rem;
font-weight: bold; font-weight: bold;
...@@ -2163,10 +2284,78 @@ export default { ...@@ -2163,10 +2284,78 @@ export default {
/* 弹窗背景图 */ /* 弹窗背景图 */
.popupBgImage { .popupBgImage {
color: #fff;
width: 3.86rem;
height: 3.66rem;
font-size: 0.12rem;
padding: 0.1rem;
background-image: url("/static/images/frame1.png"); background-image: url("/static/images/frame1.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
background-size: 100% 100%; background-size: 100% 100%;
position: relative;
button {
width: 1.5rem;
height: 0.4rem;
background: #00d2ff;
border-radius: 0.04rem;
font-size: 0.19rem;
color: #fff;
border: none;
outline: none;
margin-left: 50%;
margin-top: 0.14rem;
transform: translateX(-50%);
cursor: pointer;
}
dl {
padding: 0 0.4rem;
}
dd {
margin-top: 0.08rem;
margin-bottom: 0.08rem;
}
dd > font {
// 标题
font-size: 0.19rem;
color: #00f0ff;
}
dd > span {
// 值
font-size: 0.19rem;
color: #fff;
}
i {
background-image: url("~@/assets/images/dpNew/close_icon.png");
background-repeat: no-repeat;
background-position: center center;
background-size: 100% 100%;
display: block;
width: 0.21rem;
height: 0.21rem;
position: absolute;
top: 0.21rem;
right: 0.21rem;
}
h4 {
width: 2.58rem;
height: 0.5rem;
text-align: center;
line-height: 0.5rem;
margin: 0 auto;
margin-top: 0.21rem;
// background: linear-gradient(90deg, rgba(4,205,255,0) 0%, rgba(4,205,255,0.98) 51%, rgba(4,205,255,0) 100%);
// opacity: 0.82;
font-family: SimHei;
font-weight: 400;
font-size: 0.24rem;
color: #ffffff;
background-image: url("~@/assets/images/dpNew/title2.png");
background-repeat: no-repeat;
background-position: center center;
background-size: 100% 100%;
}
} }
/* 加载动画 */ /* 加载动画 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment