From 9c62ac9ca35bce2c5a839cdbd1e400905ffeb90b Mon Sep 17 00:00:00 2001 From: "34701892@qq.com" <34701892@qq.com> Date: Sat, 13 Sep 2025 20:02:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DAPI=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=92=8C=E5=9B=BE=E8=A1=A8=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复newsInfo.ts中getTopSourcePeriod方法的参数名错误,将data.start_date改为data.start_time 优化LineHolYellow.vue图表组件,添加props.data的watch监听并移除mounted中的直接初始化 修正indexRelease.vue中行业和概念数据获取方法的调用错误 --- src/api/newsInfo.ts | 2 +- src/components/charts/LineHolYellow.vue | 11 +++++++++-- src/pages/realtimeInfo/indexRelease.vue | 14 ++++++-------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/api/newsInfo.ts b/src/api/newsInfo.ts index 406d0a7..8d873d8 100644 --- a/src/api/newsInfo.ts +++ b/src/api/newsInfo.ts @@ -51,5 +51,5 @@ export const getTopIndustryPeriod = (data: any) => { // 热门标签某时间段内topN列表(右边) export const getTopSourcePeriod = (data: any) => { - return request.get("/top_source_period?start_date=" + data.start_date + "&end_date=" + data.end_time + "&limit_num=" + data.limit_num, data); + return request.get("/top_source_period?start_date=" + data.start_time + "&end_date=" + data.end_time + "&limit_num=" + data.limit_num, data); }; diff --git a/src/components/charts/LineHolYellow.vue b/src/components/charts/LineHolYellow.vue index d9177fc..ad1b0fa 100644 --- a/src/components/charts/LineHolYellow.vue +++ b/src/components/charts/LineHolYellow.vue @@ -19,7 +19,7 @@ const values = ref([]); const props = defineProps({ data: { type: Object, - default: () => {}, + default: () => { }, }, }); @@ -114,6 +114,14 @@ const initChart = () => { myChart.setOption(option); }; +watch( + () => props.data, + (newVal) => { + if (newVal) { + initChart(); + } + } +); onMounted(async () => { // await getData(); // initChart(); @@ -122,7 +130,6 @@ onMounted(async () => { // initChart(); // }, 5000); - initChart(); }); diff --git a/src/pages/realtimeInfo/indexRelease.vue b/src/pages/realtimeInfo/indexRelease.vue index 24cdb22..aaad624 100644 --- a/src/pages/realtimeInfo/indexRelease.vue +++ b/src/pages/realtimeInfo/indexRelease.vue @@ -73,7 +73,8 @@ - + @@ -100,11 +101,8 @@ 退出登录 - + @@ -263,7 +261,7 @@ const lineTopData = ref({}); async function getLineDataFn() { if (lineTabIndex.value == 0) { // 行业 - getTopConceptPeriod({ + getTopIndustryPeriod({ start_time: "2025-09-06", end_time: "2025-09-13", limit_num: 10, @@ -272,7 +270,7 @@ async function getLineDataFn() { }); } else if (lineTabIndex.value == 1) { // 概念 - getTopIndustryPeriod({ + getTopConceptPeriod({ start_time: "2025-09-06", end_time: "2025-09-13", limit_num: 10,