Auto Commit

上级 e6261d12
...@@ -3,7 +3,7 @@ import GameChart from './components/GameChart.vue' ...@@ -3,7 +3,7 @@ import GameChart from './components/GameChart.vue'
import SearchGrade from './components/SearchGrade.vue' import SearchGrade from './components/SearchGrade.vue'
import { reactive, onMounted } from 'vue'; import { reactive, onMounted } from 'vue';
const state = reactive({ const state = reactive({
current: 'grade查询分数' current: '新星赛道选手信息可视化'
}) })
onMounted(() => { onMounted(() => {
const href = window.location.href const href = window.location.href
...@@ -17,10 +17,11 @@ onMounted(() => { ...@@ -17,10 +17,11 @@ onMounted(() => {
const value = itemArray[1] const value = itemArray[1]
data[key] = value data[key] = value
}) })
if (data['type'] = 'csdn_game') {
state.current = '新星赛道选手信息可视化'
} }
if(data['type']='csdn_game'){
state.current='新星赛道选手信息可视化'
} }
}) })
</script> </script>
......
...@@ -4,11 +4,21 @@ ...@@ -4,11 +4,21 @@
<a style="font-size: 24px;font-weight:bolder;">{{ state.title }}</a> <a style="font-size: 24px;font-weight:bolder;">{{ state.title }}</a>
</div> </div>
</div> </div>
<div style="width: 100%;text-align: right;line-height: 80px;"> <Author />
<div style="display: flex;height: 100px;margin:10px 0">
<div style="width: 600px;">
赛道信息:<a href="https://bbs.csdn.net/topics/616574177" target="_blank">https://bbs.csdn.net/topics/616574177</a>
</div>
<div style="width: 100%;text-align: right;">
<a-button @click="initDataSource" type="primary"> <a-button @click="initDataSource" type="primary">
重置表格 重置表格
</a-button> </a-button>
</div> </div>
</div>
<div>
参赛报名人数:{{ state.totlaNum }}
</div>
<div style="display:flex"> <div style="display:flex">
<div id="barChartId" style="flex:1;width:600px;height:900px;border: 1px solid #333;"> <div id="barChartId" style="flex:1;width:600px;height:900px;border: 1px solid #333;">
<div style="width: 100%;font-weight: 600;text-align: center;">{{ state.clickCity }}</div> <div style="width: 100%;font-weight: 600;text-align: center;">{{ state.clickCity }}</div>
...@@ -21,7 +31,7 @@ ...@@ -21,7 +31,7 @@
:loading="state.loading" :pagination="state.pagination" bordered style="border-bottom:1px solid #f0f0f0;"> :loading="state.loading" :pagination="state.pagination" bordered style="border-bottom:1px solid #f0f0f0;">
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'imgSrc'"> <template v-if="column.key === 'imgSrc'">
<a-image :src="record.imgSrc" height="50" :alt="record.imgSrc"/> <a-image :src="record.imgSrc" height="50" :alt="record.imgSrc" />
</template> </template>
</template> </template>
</a-table> </a-table>
...@@ -31,6 +41,7 @@ ...@@ -31,6 +41,7 @@
</template> </template>
<script setup> <script setup>
import chinaJson from './chinaGeo.js'; import chinaJson from './chinaGeo.js';
import Author from './Author.vue'
import gameJson from './gameJson.js'; import gameJson from './gameJson.js';
import { tableGameColumns } from './const.js' import { tableGameColumns } from './const.js'
import * as echarts from 'echarts'; import * as echarts from 'echarts';
...@@ -41,7 +52,8 @@ const props = defineProps({ ...@@ -41,7 +52,8 @@ const props = defineProps({
const state = reactive({ const state = reactive({
title: 'vue3 ts antd 参赛选手所在城市', title: 'vue3 ts antd 参赛选手所在城市',
clickCity:'全国', clickCity: '全国',
totlaNum:'',
linesCoord: [], linesCoord: [],
focusCity: '广东省', focusCity: '广东省',
locationGis: [], locationGis: [],
...@@ -65,7 +77,7 @@ const state = reactive({ ...@@ -65,7 +77,7 @@ const state = reactive({
} }
}) })
function initDataSource() { function initDataSource() {
state.clickCity='全国' state.clickCity = '全国'
state.dataSource = [] state.dataSource = []
state.total = 0 state.total = 0
Object.keys(gameJson).forEach(uid => { Object.keys(gameJson).forEach(uid => {
...@@ -77,16 +89,17 @@ function initDataSource() { ...@@ -77,16 +89,17 @@ function initDataSource() {
}) })
state.total += 1 state.total += 1
}) })
state.pagination.current=1 state.pagination.current = 1
state.totlaNum=state.total
} }
function filterName(name) { function filterName(name) {
state.clickCity=name state.clickCity = name
state.dataSource = [] state.dataSource = []
state.total = 0 state.total = 0
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)) {
state.dataSource.push({ state.dataSource.push({
uid: gameJson[uid].uid, uid: gameJson[uid].uid,
...@@ -97,7 +110,24 @@ function filterName(name) { ...@@ -97,7 +110,24 @@ function filterName(name) {
state.total += 1 state.total += 1
} }
}) })
state.pagination.current=1 state.pagination.current = 1
}
function filterMapName(name) {
const res=[]
Object.keys(gameJson).forEach(uid => {
const locName = gameJson[uid].ip.split('')[1]
if (name.includes(locName)) {
res.push({
uid: gameJson[uid].uid,
imgSrc: gameJson[uid].imgSrc,
name: gameJson[uid].name,
ip: locName
})
}
})
return res
} }
...@@ -106,8 +136,8 @@ function initMap() { ...@@ -106,8 +136,8 @@ function initMap() {
let itemData = chinaJson.features let itemData = chinaJson.features
let length = itemData.length let length = itemData.length
state.aimPointData = [] state.aimPointData = []
state.airData=[] state.airData = []
state.linesCoord= [] state.linesCoord = []
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
state.aimPointData.push({ state.aimPointData.push({
...@@ -124,8 +154,8 @@ function initMap() { ...@@ -124,8 +154,8 @@ function initMap() {
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.includes(locName) || locName.includes) {
number += 1 number += 1
} }
}) })
...@@ -134,7 +164,7 @@ function initMap() { ...@@ -134,7 +164,7 @@ function initMap() {
}) })
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (!name.includes(state.focusCity)) { if (!name.includes(state.focusCity)) {
if(center&&state.centerLoction){ if (center && state.centerLoction) {
state.linesCoord.push([center, state.centerLoction]) state.linesCoord.push([center, state.centerLoction])
} }
...@@ -150,9 +180,9 @@ function initMap() { ...@@ -150,9 +180,9 @@ function initMap() {
continue continue
} }
setTimeout(()=>{ setTimeout(() => {
renderEchartBar() renderEchartBar()
},500) }, 500)
} }
// storage // storage
...@@ -204,7 +234,7 @@ function renderEchartBar() { ...@@ -204,7 +234,7 @@ function renderEchartBar() {
// nameProperty: 'name', // nameProperty: 'name',
show: true, show: true,
color: '#333', color: '#333',
formatter:function(params){ formatter: function (params) {
return params.name return params.name
}, },
// backgroundColor: '#546de5', // backgroundColor: '#546de5',
...@@ -220,6 +250,20 @@ function renderEchartBar() { ...@@ -220,6 +250,20 @@ function renderEchartBar() {
}, },
zoom: 1.2 zoom: 1.2
}, },
tooltip:{
show:true,
formatter:(params)=>{
const {name}=params.data
const filterData=filterMapName(name)
const strInfo=filterData.map(item=>{
return `<img src=${item.imgSrc} width='20' height='20'/>&nbsp; ${item.name}`
}).join('&nbsp;')
const value=filterData.length
return `地区:${name}<br>
总人数:${value} <br>
详细信息:<br>${strInfo}`
}
},
series: [ series: [
// 坐标点的热力数据 // 坐标点的热力数据
{ {
...@@ -286,7 +330,7 @@ function renderEchartBar() { ...@@ -286,7 +330,7 @@ function renderEchartBar() {
// 监听 // 监听
state.echartInstance = myChart; state.echartInstance = myChart;
myChart.on('click', function (params) { myChart.on('click', function (params) {
console.log('params',params) console.log('params', params)
filterName(params.name) filterName(params.name)
}); });
window.onresize = myChart.resize; window.onresize = myChart.resize;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册