From 7d4acfd095a90e0db9c4184bd6f2c9282160746f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=9D=B0?= Date: Sat, 14 Jun 2025 10:13:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E6=95=B0=E6=8D=AE=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E5=88=B0pinia=E4=B8=AD=EF=BC=8C=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E7=9A=84=E6=BB=9A=E5=8A=A8=EF=BC=8Cborder3?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/chat.js | 1 + src/views/AiEmotion.vue | 82 +++++++++++++----------------- src/views/components/marketTemperature.vue | 5 +- 3 files changed, 39 insertions(+), 49 deletions(-) diff --git a/src/store/chat.js b/src/store/chat.js index 2e91462..6da35cb 100644 --- a/src/store/chat.js +++ b/src/store/chat.js @@ -6,6 +6,7 @@ export const useChatStore = defineStore('chat', { isLoading: false, // 新增加载状态 UserCount: 0, chartData: [], + kLineData: [], }), actions: { async getUserCount() { diff --git a/src/views/AiEmotion.vue b/src/views/AiEmotion.vue index c12dd79..76824bf 100644 --- a/src/views/AiEmotion.vue +++ b/src/views/AiEmotion.vue @@ -150,6 +150,7 @@ import { ref, reactive } from 'vue'; import { getReplyAPI } from '@/api/AiEmotionApi.js'; // 导入工作流接口方法 import axios from 'axios'; +import { useChatStore } from '@/store/chat.js'; import item from '@/assets/img/AiEmotion/bk01.png'; // 导入思维矩阵图片 import emotionDecod from '@/views/components/emotionDecod.vue'; // 导入情绪解码组件 import emotionalBottomRadar from '@/views/components/emotionalBottomRadar.vue'; // 导入情绪探底雷达图组件 @@ -220,14 +221,6 @@ async function handleSendMessage(input) { sender: 'ai', text: '数据加载中,请稍候...' }); - - // 滚动到最新消息 - nextTick(() => { - if (userInputDisplayRef.value) { - userInputDisplayRef.value.scrollTop = userInputDisplayRef.value.scrollHeight; - } - }); - // 触发图片旋转 isRotating.value = true; @@ -292,13 +285,6 @@ async function handleSendMessage(input) { sender: 'ai', text: '请输入内容后再发送。', }); - - // 滚动到最新消息 - nextTick(() => { - if (userInputDisplayRef.value) { - userInputDisplayRef.value.scrollTop = userInputDisplayRef.value.scrollHeight; - } - }); } } const version1 = ref(2); // 版本号 @@ -326,8 +312,11 @@ async function fetchData(code, market) { ); const stockDataResponse = stockDataResult.data; // 获取返回所有的数据 - console.log('图表数据接口返回数据:', stockDataResponse.data); + + const chatStore = useChatStore(); + chatStore.kLineData.push(stockDataResponse.data); + console.log('图表数据接口返回数据:', stockDataResponse.data); if (stockDataResponse.code === 200 && stockDataResponse.data) { messages.value.push({ @@ -344,15 +333,10 @@ async function fetchData(code, market) { // 取最后一条数据 data1.value = lastTwoNumbers[1] // 个股温度 data2.value = lastTwoNumbers[2] // 市场温度 - // 滚动到最新消息 - nextTick(() => { - if (userInputDisplayRef.value) { - userInputDisplayRef.value.scrollTop = userInputDisplayRef.value.scrollHeight; - } - }); console.log('1111111111111111111111') // 调用渲染图表的方法 - renderCharts(stockDataResponse.data); + const chatStore = useChatStore(); + renderCharts(chatStore.kLineData[chatStore.kLineData.length - 1]); console.log('2222222222222222222222') // 设置当天日期 const today = new Date(); @@ -368,12 +352,6 @@ async function fetchData(code, market) { sender: 'ai', text: '图表数据接口返回数据不完整,请稍后再试。', }); - // 滚动到最新消息 - nextTick(() => { - if (userInputDisplayRef.value) { - userInputDisplayRef.value.scrollTop = userInputDisplayRef.value.scrollHeight; - } - }); } } catch (error) { messages.value.push({ @@ -557,31 +535,35 @@ onMounted(() => { .class0502 { padding-top: 5rem; text-align: center; - display: flex; + display: flex; flex-direction: column; /* 竖向排列元素 */ gap: 1rem; margin-left: 2rem; } -.class0601{ - padding-top: 5rem; + +.class0601 { + padding-top: 5rem; text-align: center; - display: flex; + display: flex; flex-direction: column; /* 竖向排列元素 */ gap: 1rem; margin-left: 2rem; } -.img03{ - width: 10rem; + +.img03 { + width: 10rem; height: 10rem; margin-left: 40rem; } -.img04{ - width: 10rem; + +.img04 { + width: 10rem; height: 10rem; margin-left: 40rem; } + .class0701 { margin: 0 auto; width: fit-content; @@ -610,38 +592,42 @@ onMounted(() => { .class0401 { padding-top: 5rem; text-align: center; - display: flex; + display: flex; flex-direction: column; /* 竖向排列元素 */ gap: 1rem; margin-left: 2rem; } -.class0502{ -} -.img02{ - width: 10rem; +.class0502 {} + +.img02 { + width: 10rem; height: 10rem; margin-left: 40rem; } -.title2{ - color: white; + +.title2 { + color: white; font-size: 2rem; font-weight: bold; margin-left: -4rem; } -.title3{ - color: white; + +.title3 { + color: white; font-size: 2rem; font-weight: bold; margin-left: -4rem; } -.title4{ - color: white; + +.title4 { + color: white; font-size: 2rem; font-weight: bold; margin-left: -4rem; } + .class09 { text-align: center; } diff --git a/src/views/components/marketTemperature.vue b/src/views/components/marketTemperature.vue index ae7592a..30cd7c2 100644 --- a/src/views/components/marketTemperature.vue +++ b/src/views/components/marketTemperature.vue @@ -277,7 +277,10 @@ defineExpose({ initChart }) .border3 { margin-top: 40px; border-radius: 8px; - padding: 20px; + /* padding: 20px; */ + margin-left: 12rem; + width: 100%; + height: 100%; } .border4 { margin-top: 40px;