From 5eb7aba333a0f6700b096cafc9062aee8a913e4a Mon Sep 17 00:00:00 2001 From: zouzhibing Date: Fri, 10 Jun 2022 17:40:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B0=B4=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/router/modules/other.ts | 6 + src/views/charts/components/js/data.js | 40 ++++++ .../charts/components/migration/index.vue | 47 ++++++- src/views/charts/migration.vue | 15 ++- src/views/other/water-marker.vue | 123 ++++++++++++++++++ 6 files changed, 227 insertions(+), 6 deletions(-) create mode 100644 src/views/charts/components/js/data.js create mode 100644 src/views/other/water-marker.vue diff --git a/package.json b/package.json index 2a221c9..da47ea6 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "ad", + "name": "vue-admin-perfect", "version": "0.1.0", "private": true, "scripts": { diff --git a/src/router/modules/other.ts b/src/router/modules/other.ts index 85af372..05b29e1 100644 --- a/src/router/modules/other.ts +++ b/src/router/modules/other.ts @@ -54,6 +54,12 @@ const othersRouter = { name: 'qrcode', meta: { title: '生成二维码' } }, + // { + // path: 'water-marker', + // component: () => import('@/views/other/water-marker.vue'), + // name: 'water-marker', + // meta: { title: '生成水印' } + // }, { path: 'right-menu', component: () => import('@/views/other/right-menu.vue'), diff --git a/src/views/charts/components/js/data.js b/src/views/charts/components/js/data.js new file mode 100644 index 0000000..b1a5eaf --- /dev/null +++ b/src/views/charts/components/js/data.js @@ -0,0 +1,40 @@ +export const cityIconData = [ + { + adcode: 650000, + name: "新疆维吾尔自治区", + value:[88.999903,43.607078] + },{ + adcode: 150000, + name: "内蒙古自治区", + value:[119.24787,42.205741] + }, + ,{ + adcode: 150000, + name: "内蒙古自治区", + value:[110.627161,41.16628] + }, + { + adcode: 540000, + name: "西藏自治区", + value:[89.483714,30.251951] + }, + { + adcode: 630000, + name: "青海省", + value:[102.064693,37.084008] + }, + { + adcode: 530000, + name: "云南省", + value:[102.187665,25.083688] + }, + { + adcode: 610000, + name: "陕西省", + value:[109.20663,35.018625] + }, + +] + + + diff --git a/src/views/charts/components/migration/index.vue b/src/views/charts/components/migration/index.vue index ba3ef8e..9b5b765 100644 --- a/src/views/charts/components/migration/index.vue +++ b/src/views/charts/components/migration/index.vue @@ -1,4 +1,3 @@ - @@ -7,7 +6,8 @@ import { geoJson } from './get.js' import * as echarts from 'echarts' import { EChartsType } from 'echarts/core' import { onMounted } from 'vue' - +import {cityIconData} from '../js/data.js' +import logo from '@/assets/logo.png' const props = defineProps({ className: { type: String, @@ -132,6 +132,12 @@ var convertToLineData = function (data, gps) { } const options = { + tooltip:{ + trigger: 'item', + formatter(val){ + // console.log('val==========',val) + } + }, backgroundColor: '#001540', geo: { show: true, @@ -194,6 +200,7 @@ const options = { } } }, + roam: true, itemStyle: { normal: { @@ -258,7 +265,41 @@ const options = { } }, data: convertToLineData(mapData, geoGpsMap) - } + }, + { + type:'scatter', + zlevel: 16, + coordinateSystem: 'geo', + symbolSize:30, + symbol:`image://${logo}`, + data:cityIconData, + rippleEffect: { + period: 4, brushType: 'stroke', scale: 4 + }, + tooltip:{ + trigger:'item', + padding:0, + borderColor:'black', + background:'rgba(0,0,0,0.7)', + textStyle: { + fontSize:20 + }, + formatter(val){ + console.log('val=======',val) + let tipHtml = ` +
+
${val.name}
+ + + +
` + return tipHtml + } + } + }, ] } let chart:EChartsType diff --git a/src/views/charts/migration.vue b/src/views/charts/migration.vue index 5002896..3a68bf8 100644 --- a/src/views/charts/migration.vue +++ b/src/views/charts/migration.vue @@ -1,8 +1,8 @@ - diff --git a/src/views/other/water-marker.vue b/src/views/other/water-marker.vue new file mode 100644 index 0000000..51462c9 --- /dev/null +++ b/src/views/other/water-marker.vue @@ -0,0 +1,123 @@ + + + + +