Compare commits

...

2 Commits

  1. 3087
      src/assets/china.json
  2. 158
      src/components/map/map.vue
  3. 16
      src/router/views/index.js

3087
src/assets/china.json

File diff suppressed because it is too large Load Diff

158
src/components/map/map.vue

@ -0,0 +1,158 @@
<template>
<div class="content">
<div
ref="charts"
style="width: 1200px; height: 1000px;margin:0 auto"
></div>
</div>
</template>
<script>
import * as echarts from 'echarts'
import china from '@/assets/china.json'
export default {
data () {
return {
points: [ //
{ name: '龙泉仓', value: [87.628579, 43.793301], itemStyle: { color: '#00EEFF' } }, //
{ name: '四川', value: [104.076452, 30.651696], itemStyle: { color: '#00EEFF' } }, //
{ name: '甘肃', value: [103.826777, 36.060634], itemStyle: { color: '#00EEFF' } }, //
{ name: '云南', value: [102.709372, 25.046432], itemStyle: { color: '#00EEFF' } }, //
{ name: '广西', value: [108.327537, 22.816659], itemStyle: { color: '#00EEFF' } }, // 广西
{ name: '湖南', value: [112.982951, 28.116007], itemStyle: { color: '#00EEFF' } }, //
{ name: '山东', value: [117.020725, 36.670201], itemStyle: { color: '#00EEFF' } }, //
{ name: '河南', value: [113.753094, 34.767052], itemStyle: { color: '#00EEFF' } }, //
{ name: '山西', value: [112.578781, 37.813948], itemStyle: { color: '#00EEFF' } }, // 西
{ name: '福建', value: [119.296194, 26.101082], itemStyle: { color: '#00EEFF' } }, //
{ name: '浙江', value: [120.152575, 30.266619], itemStyle: { color: '#00EEFF' } }, //
{ name: '江苏', value: [118.763563, 32.061377], itemStyle: { color: '#00EEFF' } }, //
{ name: '北京', value: [116.407387, 39.904179], itemStyle: { color: '#A6283F' } }, //
{ name: '陕西', value: [108.953939, 34.266611], itemStyle: { color: '#00EEFF' } }, // 西
{ name: '广东', value: [113.266887, 23.133306], itemStyle: { color: '#00EEFF' } } // 广
],
linesData: [// 线
{ coords: [[116.407387, 39.904179], [87.628579, 43.793301]] },// ->
{ coords: [[116.407387, 39.904179], [104.076452, 30.651696]] },// ->
{ coords: [[116.407387, 39.904179], [103.826777, 36.060634]] },// ->
{ coords: [[116.407387, 39.904179], [102.709372, 25.046432]] },// ->
{ coords: [[116.407387, 39.904179], [108.327537, 22.816659]] },// ->广西
{ coords: [[116.407387, 39.904179], [112.982951, 28.116007]] },// ->
{ coords: [[116.407387, 39.904179], [117.020725, 36.670201]] },// ->
{ coords: [[116.407387, 39.904179], [113.753094, 34.767052]] },// ->
{ coords: [[116.407387, 39.904179], [112.578781, 37.813948]] },// ->西
{ coords: [[116.407387, 39.904179], [119.296194, 26.101082]] },// ->
{ coords: [[116.407387, 39.904179], [120.152575, 30.266619]] },// ->
{ coords: [[116.407387, 39.904179], [118.763563, 32.061377]] },// ->
{ coords: [[116.407387, 39.904179], [113.266887, 23.133306]] },// ->广
{ coords: [[116.407387, 39.904179], [108.953939, 34.266611]] }// ->西
],
planePath: // svg
'path://M1705.06,1318.313v-89.254l-319.9-221.799l0.073-208.063c0.521-84.662-26.629-121.796-63.961-121.491c-37.332-0.305-64.482,36.829-63.961,121.491l0.073,208.063l-319.9,221.799v89.254l330.343-157.288l12.238,241.308l-134.449,92.931l0.531,42.034l175.125-42.917l175.125,42.917l0.531-42.034l-134.449-92.931l12.238-241.308L1705.06,1318.313z',
}
},
mounted () {
this.initCharts()
},
methods: {
initCharts () {
const charts = echarts.init(this.$refs['charts'])
const option = {
backgroundColor: '#0E2152',//
geo: {//
map: 'china',
label: { //
normal: {//
show: true,
textStyle: {
color: '#fff'
}
},
emphasis: {//
textStyle: {
color: '#fff'
}
}
},
itemStyle: {//
normal: { //
borderColor: '#5089EC',
borderWidth: 1,
areaColor: { //
type: 'radial', //
x: 0.5, //
y: 0.5,//
r: 0.8,//
colorStops: [
{ // 0%
offset: 0,
color: 'rgba(0, 102, 154, 0)'
},
{ // 100%
offset: 1,
color: 'rgba(0, 102, 154, .4)'
}
]
}
},
//
emphasis: {
areaColor: '#2386AD',
borderWidth: 0
}
}
},
series: [
{ //
type: 'effectScatter',//
coordinateSystem: 'geo', //使:
// ,'ripple'
effectType: 'ripple',
// 'render''emphasis'
showEffectOn: 'render',
rippleEffect: { //
period: 10, //
scale: 4,//
// 'stroke' 'fill'
brushType: 'fill'
},
zlevel: 1, // zlevel
data: this.points
},
{ // 线
type: 'lines',
zlevel: 2,
symbol: ['none', 'arrow'], // :
symbolSize: 10, //
effect: { // 线
show: true,
period: 6, // s
trailLength: 0, // [0,1]
symbol: this.planePath, // 'circle'
symbolSize: 15//
},
lineStyle: { // 线
normal: {
color: '#93EBF8',
width: 2.5, // 线
opacity: 0.6, // 线
curveness: 0.2// 线
}
},
data: this.linesData
}
]
}
// option.geo.map
echarts.registerMap('china', china)
charts.setOption(option)
}
}
}
</script>
<style scoped>
.content {
background-color: #0e2152;
height: 100%;
}
</style>

16
src/router/views/index.js

@ -1865,4 +1865,20 @@ export default [
},
],
},
{
path: '/components/map',
component: Layout,
redirect: '/components/map',
children: [
{
meta: {
i18n: 'dict',
keepAlive: false,
},
path: '/components/map',
name: '地图',
component: () => import('@/components/map/map.vue'),
},
],
},
];

Loading…
Cancel
Save