Auto Commit

上级 b97c8e8d
...@@ -53,7 +53,7 @@ const props = defineProps({ ...@@ -53,7 +53,7 @@ const props = defineProps({
const state = reactive({ const state = reactive({
title: 'vue3 ts antd 参赛选手所在城市', title: 'vue3 ts antd 参赛选手所在城市',
clickCity: '全国', clickCity: '全国',
totlaNum:'', totlaNum: '',
linesCoord: [], linesCoord: [],
focusCity: '广东省', focusCity: '广东省',
locationGis: [], locationGis: [],
...@@ -90,7 +90,7 @@ function initDataSource() { ...@@ -90,7 +90,7 @@ function initDataSource() {
state.total += 1 state.total += 1
}) })
state.pagination.current = 1 state.pagination.current = 1
state.totlaNum=state.total state.totlaNum = state.total
} }
function filterName(name) { function filterName(name) {
...@@ -114,7 +114,7 @@ function filterName(name) { ...@@ -114,7 +114,7 @@ function filterName(name) {
} }
function filterMapName(name) { function filterMapName(name) {
const res=[] const res = []
Object.keys(gameJson).forEach(uid => { Object.keys(gameJson).forEach(uid => {
const locName = gameJson[uid].ip.split('')[1] const locName = gameJson[uid].ip.split('')[1]
if (name.includes(locName)) { if (name.includes(locName)) {
...@@ -150,12 +150,14 @@ function initMap() { ...@@ -150,12 +150,14 @@ function initMap() {
} }
} }
for (let loc = 0; loc < length; ++loc) { for (let loc = 0; loc < length; ++loc) {
let name = itemData[loc].properties.name let name = itemData[loc].properties.name
console.log('name',name)
let number = 0 let number = 0
let center = itemData[loc].properties.center let center = itemData[loc].properties.center
Object.keys(gameJson).forEach(uid => { Object.keys(gameJson).forEach(uid => {
const locName = gameJson[uid].ip.split('')[1] const locName = gameJson[uid].ip.split('')[1]
if (name.includes(locName) || locName.includes) { if (name&&name.includes(locName)) {
number += 1 number += 1
} }
}) })
...@@ -163,20 +165,21 @@ function initMap() { ...@@ -163,20 +165,21 @@ function initMap() {
value: center value: center
}) })
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (!name.includes(state.focusCity)) { if (name && !name.includes(state.focusCity)) {
if (center && state.centerLoction) { if (center && state.centerLoction) {
state.linesCoord.push([center, state.centerLoction]) state.linesCoord.push([center, state.centerLoction])
} }
} }
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (name && name !== state.focusCity) { if (name) {
let temp = { let temp = {
name: `${name}`, name: name,
value: Number(number) value: Number(number)
} }
state.airData.push(temp) state.airData.push(temp)
} }
console.log('state.airData',state.airData)
continue continue
} }
...@@ -226,6 +229,8 @@ function renderEchartBar() { ...@@ -226,6 +229,8 @@ function renderEchartBar() {
map: 'chinaJson', // 这里的值要和上面registerMap的第一个参数一致 map: 'chinaJson', // 这里的值要和上面registerMap的第一个参数一致
roam: false, // 拖拽 roam: false, // 拖拽
nameProperty: 'name', nameProperty: 'name',
geoIndex: 1,
aspectScale: 0.75, // 长宽比, 默认值 0.75
// 悬浮标签 // 悬浮标签
label: { label: {
type: 'map', type: 'map',
...@@ -250,18 +255,19 @@ function renderEchartBar() { ...@@ -250,18 +255,19 @@ function renderEchartBar() {
}, },
zoom: 1.2 zoom: 1.2
}, },
tooltip:{ tooltip: {
show:true, show: true,
formatter:(params)=>{ position: ['10%', '10%'],
const {name}=params.data formatter: (params) => {
const filterData=filterMapName(name) const { name } = params.data
const strInfo=filterData.map(item=>{ const filterData = filterMapName(name)
const strInfo = filterData.map(item => {
return `<img src=${item.imgSrc} width='20' height='20'/>&nbsp; ${item.name}` return `<img src=${item.imgSrc} width='20' height='20'/>&nbsp; ${item.name}`
}).join('&nbsp;') }).join('<br>')
const value=filterData.length const value = filterData.length
return `地区:${name}<br> return `地区:${name}<br>
总人数:${value} <br> 总人数:${value} <br>
详细信息:<br>${strInfo}` 人员信息:<br>${strInfo}`
} }
}, },
series: [ series: [
...@@ -269,7 +275,17 @@ function renderEchartBar() { ...@@ -269,7 +275,17 @@ function renderEchartBar() {
{ {
data: state.airData, data: state.airData,
geoIndex: 0, // 将热力的数据和第0个geo配置关联在一起 geoIndex: 0, // 将热力的数据和第0个geo配置关联在一起
type: 'map' type: 'map',
roam: false,
itemStyle: {
normal: {
areaColor: "rgba(0, 0, 0, 0)",
borderWidth: 8, //设置外层边框
borderColor: "#00FFD7",
shadowColor: "rgba(63, 236, 209, 1)",
shadowBlur: 40, //地图外层光晕
},
},
}, },
{ {
type: 'effectScatter', type: 'effectScatter',
...@@ -320,7 +336,7 @@ function renderEchartBar() { ...@@ -320,7 +336,7 @@ function renderEchartBar() {
min: 0, min: 0,
max: 100, max: 100,
inRange: { inRange: {
color: ['white', '#0984e3'] // 控制颜色渐变的范围 color: ['rgba(255,255,255,.7)', 'rgba(63, 236, 209, 1)'] // 控制颜色渐变的范围
}, },
calculable: false // 出现滑块 calculable: false // 出现滑块
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册