From 9026496a823a19d055a025d004a176c02add1671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=9D=B0?= Date: Wed, 6 Aug 2025 11:49:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8E=86=E5=8F=B2=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E7=BB=84=E4=BB=B6=EF=BC=9B=E6=8E=A2=E5=BA=95=E9=9B=B7?= =?UTF-8?q?=E8=BE=BE=E5=9B=BE=E8=A1=A8=E4=BF=AE=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/components/HistoryRecord.vue | 517 ++++++++++++++++++++++++++ src/views/components/emotionalBottomRadar.vue | 53 ++- src/views/homePage.vue | 63 +++- 3 files changed, 614 insertions(+), 19 deletions(-) create mode 100644 src/views/components/HistoryRecord.vue diff --git a/src/views/components/HistoryRecord.vue b/src/views/components/HistoryRecord.vue new file mode 100644 index 0000000..21520a5 --- /dev/null +++ b/src/views/components/HistoryRecord.vue @@ -0,0 +1,517 @@ + + + + + \ No newline at end of file diff --git a/src/views/components/emotionalBottomRadar.vue b/src/views/components/emotionalBottomRadar.vue index a677dec..a69c9f7 100644 --- a/src/views/components/emotionalBottomRadar.vue +++ b/src/views/components/emotionalBottomRadar.vue @@ -129,6 +129,11 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) { // 配置图表选项,很多操作和展示已限制,如果需要需放开 let option = { // backgroundColor: '#000046', // 设置整个图表的背景色 + axisPointer: { + link: { + xAxisIndex: 'all' // 全局设置所有x轴联动 + } + }, tooltip: { show: true, // 启用tooltip显示 trigger: 'axis', @@ -155,14 +160,13 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) { }, // backgroundColor: 'rgba(0, 0, 0, 0.8)', backgroundColor: 'rgba(232, 232, 242, 0.87)', - borderColor: '#fff', - borderWidth: 1, - borderRadius: 8, - padding: 10, - textStyle: { - color: '#fff', - fontSize: 12 - }, + borderColor: '#fff', + borderWidth: 1, + padding: 10, + textStyle: { + color: '#fff', + fontSize: 12 + }, formatter: function (params) { if (!params || params.length === 0) return '' @@ -178,9 +182,18 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) { return '' } - let result = `
${params[0].name}
` + let result = `
${params[0].name}
` + + // 对params进行排序,确保K线数据优先显示 + const sortedParams = params.sort((a, b) => { + if (a.seriesType === 'candlestick') return -1; + if (b.seriesType === 'candlestick') return 1; + if (a.seriesName === '红线') return -1; + if (b.seriesName === '红线') return 1; + return 0; + }); - params.forEach(param => { + sortedParams.forEach(param => { let value = param.value let color = param.color @@ -216,11 +229,11 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) { } result += `
` - result += `
${param.seriesName}
` - result += `
开盘价: ${openPrice.toFixed(1)}
` - result += `
收盘价: ${closePrice.toFixed(1)}
` - result += `
最低价: ${lowPrice.toFixed(1)}
` - result += `
最高价: ${highPrice.toFixed(1)}
` + result += `
${param.seriesName}
` + result += `
开盘价: ${openPrice}
` + result += `
收盘价: ${closePrice}
` + result += `
最低价: ${lowPrice}
` + result += `
最高价: ${highPrice}
` // 只有当存在前一日收盘价时才显示涨跌幅 if (previousClosePrice !== null && typeof previousClosePrice === 'number') { @@ -293,7 +306,7 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) { } }, axisTick: { - show: true, + show: false, alignWithLabel: true, // 刻度线与标签对齐 lineStyle: { color: "#999", // 与十字线颜色保持一致 @@ -311,6 +324,9 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) { link: { xAxisIndex: 'all' }, + label: { + show: false // 不显示标签 + } } }, { @@ -337,6 +353,9 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) { axisPointer: { link: { xAxisIndex: 'all' + }, + label: { + show: false // 不显示标签 } } }, @@ -392,7 +411,7 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) { width: 50, // 宽度限制 color: 'white', formatter: function (value, index) { - return value.toFixed(2) + return Math.round(value) } }, splitLine: { diff --git a/src/views/homePage.vue b/src/views/homePage.vue index 9d03e06..75763e1 100644 --- a/src/views/homePage.vue +++ b/src/views/homePage.vue @@ -31,6 +31,7 @@ import sendBtn from "../assets/img/homePage/tail/send.png"; import msgBtn from "../assets/img/homePage/tail/msg.png"; import feedbackBtn from "../assets/img/Feedback/feedbackBtn.png"; import AiEmotion from "./AiEmotion.vue"; +import HistoryRecord from "./components/HistoryRecord.vue"; // import VConsole from "vconsole"; @@ -38,6 +39,8 @@ import AiEmotion from "./AiEmotion.vue"; // 获取 AiEmotion 组件的 ref const aiEmotionRef = ref(null); +// 获取历史记录组件的 ref +const historyRecordRef = ref(null); // import { useUserStore } from "../store/userPessionCode.js"; const { getQueryVariable, setActiveTabIndex } = useDataStore(); const dataStore = useDataStore(); @@ -182,6 +185,11 @@ const sendMessage = async () => { } isScrolling.value = false; + // 添加到历史记录 + if (historyRecordRef.value && message.value.trim()) { + historyRecordRef.value.addRecord(message.value.trim(), activeTab.value); + } + // 判断当前是否为 AiEmotion 组件 if (activeTab.value === "AiEmotion") { // 禁用输入框 @@ -227,6 +235,23 @@ const enableInput = () => { isInputDisabled.value = false; }; +// 处理历史记录选择 +const handleHistorySelect = (record) => { + // 设置输入框内容 + message.value = record.question; + + // 如果记录类型与当前激活的tab不同,切换到对应的tab + if (record.type !== activeTab.value) { + const tabIndex = record.type === 'AIchat' ? 0 : 1; + setActiveTab(record.type, tabIndex); + } +}; + +// 处理历史记录添加 +const handleHistoryAdded = (record) => { + console.log('新增历史记录:', record); +}; + // 公告 // 引入公告组件 import Announcement from "./Announcement.vue"; @@ -558,7 +583,15 @@ onUnmounted(() => {