From 809c950301ffa9acb9da1246db21908998b9c261 Mon Sep 17 00:00:00 2001 From: zjc <1034206993@qq.com> Date: Thu, 26 Dec 2024 13:46:27 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=AE=8C=E5=96=84=E8=88=86?= =?UTF-8?q?=E6=83=85=E7=9B=91=E6=B5=8B=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/request.js | 1 + src/api/sentiment.js | 13 +++- src/components/Dropdown/index.vue | 6 +- src/components/Line/index.vue | 72 +++++-------------- src/components/PieRow/index.vue | 57 +++++++-------- src/hooks/echart.js | 28 ++++++++ src/hooks/map.js | 1 + src/hooks/socket.js | 57 +++++++++++++++ .../home/components/{box-2.vue => box-1.vue} | 23 ++++-- src/views/home/index.vue | 35 ++------- src/views/sentiment/index.vue | 38 ++++++---- 11 files changed, 192 insertions(+), 139 deletions(-) create mode 100644 src/hooks/echart.js create mode 100644 src/hooks/socket.js rename src/views/home/components/{box-2.vue => box-1.vue} (95%) diff --git a/src/api/request.js b/src/api/request.js index d344cc1..61a752c 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -106,6 +106,7 @@ const instance = axios.create({ */ instance.interceptors.request.use( (config) => { + console.log(config, 'config') // 规范写法 不可随意自定义 let urlParams = {} if (config.params) { diff --git a/src/api/sentiment.js b/src/api/sentiment.js index 45d50cf..1b78cdf 100644 --- a/src/api/sentiment.js +++ b/src/api/sentiment.js @@ -41,10 +41,11 @@ export function getHotWordApi() { } // 舆情指数 -export function getLineChartApi() { +export function getLineChartApi(data) { return request({ url: '/api/largeScreen/gsdata/lineChart', - method: 'post' + method: 'get', + params: data }) } @@ -55,3 +56,11 @@ export function getAreaApi() { method: 'post' }) } + +// 景区选择 +export function getSpotApi() { + return request({ + url: '/api/largeScreen/gsdata/spot', + method: 'post' + }) +} diff --git a/src/components/Dropdown/index.vue b/src/components/Dropdown/index.vue index c0697d1..9e38886 100644 --- a/src/components/Dropdown/index.vue +++ b/src/components/Dropdown/index.vue @@ -8,7 +8,7 @@ @@ -27,8 +27,10 @@ default: () => [] } }) + + let emit = defineEmits(['on-change']) const handleCommand = (command) => { - console.log(command) + emit('on-change', command) } diff --git a/src/components/Line/index.vue b/src/components/Line/index.vue index dd42e75..7ccb961 100644 --- a/src/components/Line/index.vue +++ b/src/components/Line/index.vue @@ -8,10 +8,10 @@ /> diff --git a/src/views/sentiment/index.vue b/src/views/sentiment/index.vue index 3a960a4..c2ff7e1 100644 --- a/src/views/sentiment/index.vue +++ b/src/views/sentiment/index.vue @@ -24,18 +24,10 @@
-
- - +
+ +
-
@@ -46,6 +38,7 @@
+ { + console.log(e, '===') + getLineChart(e.id) + } + const getStop = async () => { + let res = await getSpotApi() + options.value = res.data + } const getTotal = async () => { let res = await getTotalApi() total.value = res.data.total @@ -92,8 +99,8 @@ stateList.value = res.data console.log(stateList.value, '------') } - const getLineChart = async () => { - let res = await getLineChartApi() + const getLineChart = async (id) => { + let res = await getLineChartApi({ id }) xAxisData.value = res.data.data seriesData.value = res.data.series } @@ -102,6 +109,7 @@ hotNewList.value = res.data } onMounted(() => { + getStop() getHotNew() getTotal() getState()