From 5b57986e83306c819625dc4d5a8e8d890d77dbeb Mon Sep 17 00:00:00 2001 From: zhaowenkang Date: Sat, 5 Jul 2025 17:04:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=B7=A6=E4=BE=A7?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=EF=BC=8C=E8=87=AA=E5=8A=A8=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E7=BD=AE=E4=B8=BAfalse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/components/emoEnergyConverter.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/components/emoEnergyConverter.vue b/src/views/components/emoEnergyConverter.vue index 66e14f0..78a23cf 100644 --- a/src/views/components/emoEnergyConverter.vue +++ b/src/views/components/emoEnergyConverter.vue @@ -632,11 +632,11 @@ const lastLow = lastKLine.value[3]; // 最低价 } ], grid: { - left: "7%", + left: "10%", right: "10", top: '10', bottom: "60", - containLabel: true, + containLabel: false, width: '85%', height: 'auto', overflow: 'hidden' From d151f7937bf8f031a247b4033c6f3435f57a2cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=9D=B0?= Date: Sat, 5 Jul 2025 17:16:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=83=85=E7=BB=AA=E5=A4=A7=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E6=96=B0=E5=A2=9E=E6=A0=A1=E9=AA=8CQXNLZHQ=E7=9A=84?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E5=BD=93=E5=90=8E=E7=AB=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=BF=94=E5=9B=9E=E6=95=B0=E6=8D=AE=E4=B8=8D=E5=85=A8?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=B8=8D=E6=B8=B2=E6=9F=93=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/AiEmotion.vue | 77 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/src/views/AiEmotion.vue b/src/views/AiEmotion.vue index d930dfa..bedd275 100644 --- a/src/views/AiEmotion.vue +++ b/src/views/AiEmotion.vue @@ -1160,6 +1160,54 @@ async function fetchData(code, market, stockName, queryText) { } } +// 检查对象是否包含有效数据的辅助函数 +function hasValidData(obj) { + if (!obj || typeof obj !== 'object') { + return false; + } + + // 定义可以为空的数组字段 + const allowedEmptyArrays = ['lowxh', 'qixh', 'topxh']; + + // 检查对象的所有属性值 + for (const key in obj) { + if (obj.hasOwnProperty(key)) { + const value = obj[key]; + + // 如果是字符串字段 + if (typeof value === 'string') { + // 字符串字段必须有内容,为空则表示异常 + if (value.trim() !== '') { + return true; + } + } + // 如果是数组字段 + else if (Array.isArray(value)) { + // 数组字段可以为空,但如果有内容则表示有效 + if (value.length > 0) { + return true; + } + } + // 如果是数字且不为0 + else if (typeof value === 'number' && value !== 0) { + return true; + } + // 如果是布尔值且为true + else if (typeof value === 'boolean' && value === true) { + return true; + } + // 如果是对象且包含有效数据(递归检查) + else if (typeof value === 'object' && value !== null) { + if (hasValidData(value)) { + return true; + } + } + } + } + + return false; +} + // 渲染组件图表的方法 function renderCharts(data) { console.log('开始渲染图表,数据:', data); @@ -1172,10 +1220,17 @@ function renderCharts(data) { marketTemperature: !!(clonedData.GSWDJ && clonedData.GSWDJ.length > 0), emotionDecod: !!(clonedData.QXJMQ && clonedData.QXJMQ.length > 0), emotionalBottomRadar: !!(clonedData.QXTDLD && clonedData.QXTDLD.length > 0), - emoEnergyConverter: !!(clonedData.QXNLZHQ && clonedData.QXNLZHQ.length > 0) + emoEnergyConverter: !!(clonedData.QXNLZHQ && (Array.isArray(clonedData.QXNLZHQ) ? clonedData.QXNLZHQ.length > 0 : hasValidData(clonedData.QXNLZHQ))) }; console.log('图表显示状态:', chartVisibility.value); + console.log('数据检查:', { + GSWDJ: !!(clonedData.GSWDJ && clonedData.GSWDJ.length > 0), + QXJMQ: !!(clonedData.QXJMQ && clonedData.QXJMQ.length > 0), + QXTDLD: !!(clonedData.QXTDLD && clonedData.QXTDLD.length > 0), + QXNLZHQ: !!(clonedData.QXNLZHQ && (Array.isArray(clonedData.QXNLZHQ) ? clonedData.QXNLZHQ.length > 0 : hasValidData(clonedData.QXNLZHQ))) + }); + console.log('QXNLZHQ数据详情:', clonedData.QXNLZHQ); nextTick(() => { // 增加延迟确保DOM完全更新和组件完全挂载 @@ -1188,6 +1243,26 @@ function renderCharts(data) { emoEnergyConverterRef: !!emoEnergyConverterRef.value }); + // 检查DOM元素是否存在 + console.log('DOM元素检查:', { + marketTemperatureDOM: !!document.querySelector('.class03'), + emotionDecodDOM: !!document.querySelector('.class04'), + emotionalBottomRadarDOM: !!document.querySelector('.class05'), + emoEnergyConverterDOM: !!document.querySelector('.class06') + }); + + // 检查具体的组件元素 + const emoEnergyElement = document.querySelector('emo-energy-converter'); + console.log('emoEnergyConverter元素:', emoEnergyElement); + + // 等待更长时间再次检查ref + setTimeout(() => { + console.log('延迟检查emoEnergyConverterRef:', !!emoEnergyConverterRef.value); + if (emoEnergyConverterRef.value) { + console.log('emoEnergyConverter方法:', typeof emoEnergyConverterRef.value.initQXNLZHEcharts); + } + }, 1000); + // 渲染股市温度计图表 if (marketTemperatureRef.value && chartVisibility.value.marketTemperature) { console.log('开始渲染股市温度计图表');