diff --git a/src/store/emotion.ts b/src/store/emotion.ts new file mode 100644 index 0000000..117b3b7 --- /dev/null +++ b/src/store/emotion.ts @@ -0,0 +1,30 @@ +// @/store/emotion.js +import { defineStore } from 'pinia'; + +export const useEmotionStore = defineStore('emotion', { + state: () => ({ + history: [] as HistoryItem[], // 历史记录数组 + }), + actions: { + // 添加历史记录 + addHistory(item: HistoryItem) { + this.history.unshift(item); // 新记录添加到数组顶部,保持顺序 + }, + // 清空历史记录 + clearHistory() { + this.history = []; + }, + }, +}); + +// 定义历史记录项的类型 +interface HistoryItem { + queryText: string; // 用户输入的查询文本(如股票名称/代码) + stockInfo: { + name: string; // 股票名称 + code: string; // 股票代码 + market: string; // 市场(如 usa/cn/hk) + }; + apiData: any; // 接口返回的原始数据(包含图表数据) + timestamp: string; // 记录时间 +} \ No newline at end of file diff --git a/src/views/AiEmotion.vue b/src/views/AiEmotion.vue index 76824bf..e99a26b 100644 --- a/src/views/AiEmotion.vue +++ b/src/views/AiEmotion.vue @@ -17,15 +17,6 @@ - - - @@ -132,18 +123,9 @@