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 @@
+
+
+
+
+

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ record.type === 'AIchat' ? '夺宝奇兵' : 'AI情绪' }}
+
+
+
{{ record.question }}
+
{{ formatTime(record.timestamp) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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(() => {
-
+
+
+
+
@@ -693,7 +726,7 @@ onUnmounted(() => {
-
+
@@ -849,6 +882,7 @@ body {
background-repeat: no-repeat;
background-position: center;
display: flex;
+ flex-direction: row; /* 改为水平布局 */
overflow: hidden;
position: fixed;
top: 0;
@@ -859,6 +893,31 @@ body {
/* -webkit-overflow-scrolling: touch; */
}
+.main-container {
+ flex: 1;
+ margin-left: 300px; /* 为历史记录组件留出空间 */
+ transition: margin-left 0.3s ease;
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+}
+
+/* 当历史记录组件折叠时调整主容器边距 */
+.main-container.collapsed {
+ margin-left: 40px;
+}
+
+/* 移动端适配 */
+@media (max-width: 768px) {
+ .main-container {
+ margin-left: 280px;
+ }
+
+ .main-container.collapsed {
+ margin-left: 40px;
+ }
+}
+
.homepage .el-container {
height: 100%;
flex-direction: column;