From 9c7ea2527d6e079fec2ea419631c2542ce0244ba Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Mon, 4 Dec 2023 18:22:08 +0800 Subject: [PATCH] shit --- src/components/areaMap.vue | 279 ++++++++---------- src/view/detail.vue | 3 +- src/view/index.vue | 18 +- static/index/JS.png | Bin 0 -> 2962 bytes static/index/MC.png | Bin 1810 -> 2914 bytes static/index/{地方标签@3x.png => mapicon.png} | Bin static/jsonData/xuantan.js | 78 ++++- 7 files changed, 198 insertions(+), 180 deletions(-) create mode 100644 static/index/JS.png rename static/index/{地方标签@3x.png => mapicon.png} (100%) diff --git a/src/components/areaMap.vue b/src/components/areaMap.vue index 6925fd2..6a16cc2 100644 --- a/src/components/areaMap.vue +++ b/src/components/areaMap.vue @@ -44,74 +44,96 @@ import { ref, onMounted } from "vue" import axios from "axios"; import * as echarts from 'echarts'; import "echarts-gl" -// import geoJson from "/static/jsonData/xuantan.js" - +import iconbg from '/static/index/mapicon.png' +import geoJson from "/static/jsonData/xuantan.js" +const u = 'https:\/\/ceshi-worker-task.lihaink.cn\/uploads\/images\/20231129\/202311291816106120a4034.png' + const icon = "https:\/\/ceshi-worker-task.lihaink.cn\/uploads\/images\/20231204\/202312041608529c9e21252.png" + +const pointerFn = () => { + + // console.log() + let list = [] + geoJson.center.forEach((item, index) => { + + list.push({ + coord: item, + symbol: ('image://' + icon),// 自定义图片路径 + symbolSize: [100, 30], // 图片大小 + symbolOffset: ['50%', '-50%'], + value: geoJson.features[index].properties.name, + animation: true, + label: { + show: true, + color: 'white', + fontSize: 14, + }, + },) + }) + return list +} +// pointerFn() onMounted(() => { - const u = 'https:\/\/ceshi-worker-task.lihaink.cn\/uploads\/images\/20231129\/202311291816106120a4034.png' - - - axios.get('https://geo.datav.aliyun.com/areas_v3/bound/510500_full.json') - - - axios.get('https://geo.datav.aliyun.com/areas_v3/bound/510000_full.json') - .then(function (response) { - let geoJson = response.data - const dot = document.getElementById('img') var mapName = 'lz'; - let data = [ - ] const myChart = document.getElementById("chart2") /*获取地图数据*/ - - let option = { - - - geo: [ + + { - layoutSize: '100%',//大小 + type: "map", + map: mapName, + aspectScale: 1, + zoom: 1.2, + layoutCenter: ["50%", "51%"], + layoutSize: "100%", + roam: false, + label:{ + emphasis:{ + show:false + } + }, show: true, map: mapName, - - roam: false, zoom: 1.2, - layoutCenter: ["50%", "50%"], aspectScale: 1, - label: { - normal: { - show: false, - textStyle: { - color: '#fff' - } - }, - - }, + roam: false, itemStyle: { - areaColor: { - type: "linear", - x: 0, - y: 0, - x2: 0, - y2: 0, - colorStops: [{ - offset: 0, - color: "rgba(3,27,78,0.75)", // 0% 处的颜色 - }, { - offset: 1, - color: "rgba(58,149,253,0.75)", // 50% 处的颜色 - },], - global: true, // 缺省为 false + normal: { + areaColor: 'transparent', + }, - borderColor: "#D2F2FC", - borderWidth: 2, - shadowColor: "#8cd3ef", - shadowOffsetY: 10, - shadowBlur: 120, + emphasis: { + + areaColor: { + type: 'radial', // linear 线性渐变 radial径向渐变 + x: 0.5, // 0.5为正中心,如果小于渐变中心靠左 + y: 0.5, // 0.5为正中心,如果小于渐变中心靠上 + r: 1, + colorStops: [ + { + offset: 0, color: '#A46759' // 0% 处的颜色 + }, + { + offset: 0.1, color: '#A46759' // 0% 处的颜色 + }, + + + { + offset: 1, color: '#FFB821' // 100% 处的颜色 + }], + + } + + + // borderWidth: 0 + } + }, + }, @@ -125,20 +147,7 @@ onMounted(() => { layoutSize: "100%", roam: false, silent: true, - regions: [ - { - name: "南海诸岛", - itemStyle: { - // 隐藏地图 - normal: { - opacity: 0, // 为 0 时不绘制该图形 - } - }, - label: { - show: false // 隐藏文字 - } - } - ], + itemStyle: { normal: { borderWidth: 1, @@ -153,8 +162,6 @@ onMounted(() => { }, - - { type: "map", map: mapName, @@ -178,13 +185,15 @@ onMounted(() => { }, }, }, + + { type: "map", map: mapName, zlevel: -2, aspectScale: 1, zoom: 1.2, - layoutCenter: ["50%", "52%"], + layoutCenter: ["50%", "53%"], layoutSize: "100%", roam: false, silent: true, @@ -202,66 +211,17 @@ onMounted(() => { }, }, - // { - // type: "map", - // map: mapName, - // zlevel: -3, - // aspectScale: 1, - // zoom: 1.2, - // layoutCenter: ["50%", "53%"], - // layoutSize: "101%", - // roam: false, - // silent: true, - // regions: [ - // { - // name: "南海诸岛", - // itemStyle: { - // // 隐藏地图 - // normal: { - // opacity: 0, // 为 0 时不绘制该图形 - // } - // }, - // label: { - // show: false // 隐藏文字 - // } - // } - // ], - // itemStyle: { - // normal: { - // borderWidth: 1, - // // borderColor: "rgba(11, 43, 97,0.8)", - // borderColor: "rgba(58,149,253,0.4)", - // shadowColor: "rgba(58,149,253,1)", - // shadowOffsetY: 15, - // shadowBlur: 10, - // areaColor: "transpercent", - // }, - // }, - // }, { type: "map", map: mapName, zlevel: -4, aspectScale: 1, zoom: 1.2, - layoutCenter: ["50%", "53%"], + layoutCenter: ["50%", "54%"], layoutSize: "100%", roam: false, silent: true, - regions: [ - { - name: "南海诸岛", - itemStyle: { - // 隐藏地图 - normal: { - opacity: 0, // 为 0 时不绘制该图形 - } - }, - label: { - show: false // 隐藏文字 - } - } - ], + itemStyle: { normal: { borderWidth: 5, @@ -280,63 +240,54 @@ onMounted(() => { ], series: [ { - type: 'map', - map: mapName, - geoIndex: 0, - aspectScale: 1, //长宽比 - - showLegendSymbol: true, - roam: true, - label: { - show: true, - position: "top", - distance: -10, - formatter(params) { - return "2"; - }, - - textStyle: { - // color: "transparent", - padding: [15, 20], - backgroundColor: { - image: '/static/index/aa.png', - }, - // backgroundColor:"" - }, - }, - - - - animation: true, - markPoint: { - symbol: "none" + name: '资产数', + type: 'effectScatter', + coordinateSystem: 'geo', + rippleEffect: { + period: 4, //动画时间,值越小速度越快 + brushType: 'fill', //波纹绘制方式 stroke, fill + scale: 12, //波纹圆环最大限制,值越大波纹越大 + number: 2, }, - data: data, + + // 发散点的大小 + symbolSize: function (val) { + return 4 + // return val[2] / 10; + }, + markPoint: { + data:pointerFn() + }, + + data: (() => { + let data = { + 资产数: geoJson.center + + } + let finalData = [] + Object.keys(data).map((i, index) => { + let child = data[i].map((row) => ({ + value: row, + itemStyle: { + color: '#FFB922', + }, + })) + + finalData = [...finalData, ...child] + }) + return finalData + })(), }, - - ], }; - - - echarts.registerMap(mapName, geoJson) const bg = echarts.init(myChart) bg.setOption(option); - - - - - - - }) -}) - diff --git a/src/view/detail.vue b/src/view/detail.vue index 7e54c88..dc37c87 100644 --- a/src/view/detail.vue +++ b/src/view/detail.vue @@ -282,7 +282,8 @@ const test = () => { } onMounted(() => { - + document.getElementById("online").removeAttribute('_echarts_instance_'); + document.getElementById("offline").removeAttribute('_echarts_instance_'); initCharts('online', options.onLine) initCharts('offline', options.offLine) diff --git a/src/view/index.vue b/src/view/index.vue index 22f283a..ba1cc83 100644 --- a/src/view/index.vue +++ b/src/view/index.vue @@ -10,7 +10,6 @@
Ps{Tl@D_an*BLi;mz8rjA_ryc&
zJ92^dKfFcPDwQZ~2{HZj)f!@j(P)e|5HWxRlClMXmpDRtWh=_0N{LHSRbs%!DsRff
z8#?fbguNf!!oPH$8v`y3cM0Ip?SR40yo=k31>rp_q}VL|h{QGw?2Xav=k)YeHw77lFfP^pl$zkG;3b^0CXbqc&cX($NA~zcUNc3wv7_s;=*5^sbdw
zE6n^@I{fd_bJ7lM^jjS|t&ce6p;Pa%{PqfI0BM1pGsQ~-Ra0`^it7G;>$RO0$jAum
z=YMqjefy5LOqJhE@#)Mnc439}zr916=IGEcbaQmLFUuNi(;jtJK?B{$k=mwSH