|
@@ -0,0 +1,94 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div id="container"></div>
|
|
|
|
|
+</template>
|
|
|
|
|
+<script>
|
|
|
|
|
+import { mapState } from 'vuex';
|
|
|
|
|
+import axios from 'axios';
|
|
|
|
|
+import { clientMethod } from '../utils/Post';
|
|
|
|
|
+clientMethod();
|
|
|
|
|
+
|
|
|
|
|
+export default {
|
|
|
|
|
+ name: '',
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ heatData: [],
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ ...mapState(['userInfo']),
|
|
|
|
|
+ },
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ window.APP.invokeClientMethod('getList', { page: 0 }, data => {
|
|
|
|
|
+ console.log(data);
|
|
|
|
|
+ });
|
|
|
|
|
+ // this.$nextTick(() => {
|
|
|
|
|
+ // this.getData();
|
|
|
|
|
+ // this.initMap();
|
|
|
|
|
+ // });
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ getData() {
|
|
|
|
|
+ axios.get('http://dingdong.izouma.com/merchant/heatMap', {
|
|
|
|
|
+ longitude: '118.734661',
|
|
|
|
|
+ latitude: '31.981746',
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ initMap() {
|
|
|
|
|
+ var heatAddBtn = document.getElementById('heatAddBtn');
|
|
|
|
|
+ var heatDecBtn = document.getElementById('heatDecBtn');
|
|
|
|
|
+ var setStyleBtn = document.getElementById('setStyleBtn');
|
|
|
|
|
+
|
|
|
|
|
+ //初始化地图
|
|
|
|
|
+ var map = new TMap.Map('container', {
|
|
|
|
|
+ zoom: 12, //设置地图缩放级别
|
|
|
|
|
+ pitch: 45, // 设置地图俯仰角
|
|
|
|
|
+ center: new TMap.LatLng(39.909897147274364, 116.39756310116866), //设置地图中心点坐标
|
|
|
|
|
+ mapStyleId: 'style1', //个性化样式
|
|
|
|
|
+ });
|
|
|
|
|
+ //初始化热力图并添加至map图层
|
|
|
|
|
+ var heat = new TMap.visualization.Heat({
|
|
|
|
|
+ max: 180, // 热力最强阈值
|
|
|
|
|
+ min: 0, // 热力最弱阈值
|
|
|
|
|
+ height: 40, // 峰值高度
|
|
|
|
|
+ radius: 30, // 最大辐射半径
|
|
|
|
|
+ })
|
|
|
|
|
+ .addTo(map)
|
|
|
|
|
+ .setData(this.heatData); //设置数据
|
|
|
|
|
+
|
|
|
|
|
+ heatAddBtn.addEventListener(
|
|
|
|
|
+ 'click',
|
|
|
|
|
+ () => {
|
|
|
|
|
+ var radius = heat.getRadius() + 5;
|
|
|
|
|
+ heat.setRadius(radius);
|
|
|
|
|
+ },
|
|
|
|
|
+ false,
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ heatDecBtn.addEventListener(
|
|
|
|
|
+ 'click',
|
|
|
|
|
+ () => {
|
|
|
|
|
+ var radius = heat.getRadius() - 5;
|
|
|
|
|
+ if (radius > 0) {
|
|
|
|
|
+ heat.setRadius(radius);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ false,
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ setStyleBtn.addEventListener('click', () => {
|
|
|
|
|
+ heat.setGradientColor({
|
|
|
|
|
+ 0.6: '#673198',
|
|
|
|
|
+ 0.8: '#e53390',
|
|
|
|
|
+ 0.9: '#ffc95a',
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+};
|
|
|
|
|
+</script>
|
|
|
|
|
+<style lang='less' scoped>
|
|
|
|
|
+#container {
|
|
|
|
|
+ width: 100vw;
|
|
|
|
|
+ height: 100vh;
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|