|
|
@ -1,14 +1,26 @@ |
|
|
|
<template> |
|
|
|
<div class="ai-emotion-container"> |
|
|
|
<div class="ai-emotion-container" ref="userInputDisplayRef"> |
|
|
|
<!-- 金轮 --> |
|
|
|
<div class="golden-wheel"> |
|
|
|
<img src="@/assets/img/AiEmotion/金轮.png" alt="金轮图标" :class="{ 'rotating-image': isRotating }"> |
|
|
|
<img |
|
|
|
src="@/assets/img/AiEmotion/金轮.png" |
|
|
|
class="golden-wheel-img" |
|
|
|
alt="金轮图标" |
|
|
|
:class="{ 'rotating-image': isRotating }" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
<!-- 消息显示区域 --> |
|
|
|
<div class="user-input-display" ref="userInputDisplayRef"> |
|
|
|
<div v-for="(message, index) in messages" :key="index" class="message-container"> |
|
|
|
<div class="user-input-display"> |
|
|
|
<div |
|
|
|
v-for="(message, index) in messages" |
|
|
|
:key="index" |
|
|
|
class="message-container" |
|
|
|
> |
|
|
|
<!-- 用户输入内容 --> |
|
|
|
<div v-if="message.sender === 'user'" class="message-bubble user-message"> |
|
|
|
<div |
|
|
|
v-if="message.sender === 'user'" |
|
|
|
class="message-bubble user-message" |
|
|
|
> |
|
|
|
{{ message.text }} |
|
|
|
</div> |
|
|
|
<!-- AI返回结果 --> |
|
|
@ -17,9 +29,17 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- 输入框和发送按钮 --> |
|
|
|
<!-- <footer class="input-container fixed-bottom"> |
|
|
|
<input type="text" v-model="userInput" placeholder="请输入内容..." class="input-box" /> |
|
|
|
<button @click="handleSendMessage(userInput)" class="send-button">发送</button> |
|
|
|
</footer> --> |
|
|
|
<!-- <div class="input-container fixed-bottom"> |
|
|
|
<input type="text" v-model="userInput" placeholder="请输入内容..." class="input-box" /> |
|
|
|
<button @click="sendMessage" class="send-button">发送</button> |
|
|
|
</div> --> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 渲染整个页面 --> |
|
|
|
<div v-if="isPageLoaded" class="class01"> |
|
|
|
<div class="class00"> |
|
|
@ -135,13 +155,13 @@ import marketTemperature from '@/views/components/marketTemperature.vue'; |
|
|
|
import blueBorderImg from '@/assets/img/AiEmotion/blueBorder.png' //导入蓝色背景框图片 |
|
|
|
import { ElMessage } from 'element-plus'; |
|
|
|
|
|
|
|
const stockName = ref(''); // 存储股票名称 |
|
|
|
const stockName = ref(""); // 存储股票名称 |
|
|
|
const marketTemperatureRef = ref(null); // 引用市场温度计组件 |
|
|
|
const emoEnergyConverterRef = ref(null) |
|
|
|
const emotionDecodRef = ref(null) |
|
|
|
const emotionalBottomRadarRef = ref(null) |
|
|
|
const messages = ref([]); |
|
|
|
const displayDate = ref(''); // 用于存储显示的日期 |
|
|
|
const displayDate = ref(""); // 用于存储显示的日期 |
|
|
|
const isPageLoaded = ref(false); // 控制页面是否显示 |
|
|
|
const isRotating = ref(false);//控制旋转 |
|
|
|
const userInputDisplayRef = ref(null);//消息区域的引用 |
|
|
@ -162,7 +182,7 @@ function startImageRotation() { |
|
|
|
|
|
|
|
// 发送消息方法 |
|
|
|
async function handleSendMessage(input) { |
|
|
|
console.log('发送内容:', input); |
|
|
|
console.log("发送内容:", input); |
|
|
|
|
|
|
|
// 检查用户输入内容是否为空 |
|
|
|
if (input.trim()) { |
|
|
@ -176,32 +196,33 @@ async function handleSendMessage(input) { |
|
|
|
const params = { |
|
|
|
content: userMessage.text, |
|
|
|
userData: { |
|
|
|
token: '9ior41AF0xTIbIG2pRnnbZi0+fEeMx8pywnIlrmTwo5FbqJ9lWrSWOxp9MkpKiNtedtUafqvzIwpFKrwuMs', |
|
|
|
language: 'cn', |
|
|
|
brainPrivilegeState: '1', |
|
|
|
swordPrivilegeState: '1', |
|
|
|
stockForecastPrivile: '1', |
|
|
|
spaceForecastPrivile: '1', |
|
|
|
aibullPrivilegeState: '1', |
|
|
|
aigoldBullPrivilegeS: '1', |
|
|
|
airadarPrivilegeStat: '1', |
|
|
|
marketList: 'hk,cn,usa,my,sg,vi,in,gb', |
|
|
|
token: |
|
|
|
"9ior41AF0xTIbIG2pRnnbZi0+fEeMx8pywnIlrmTwo5FbqJ9lWrSWOxp9MkpKiNtedtUafqvzIwpFKrwuMs", |
|
|
|
language: "cn", |
|
|
|
brainPrivilegeState: "1", |
|
|
|
swordPrivilegeState: "1", |
|
|
|
stockForecastPrivile: "1", |
|
|
|
spaceForecastPrivile: "1", |
|
|
|
aibullPrivilegeState: "1", |
|
|
|
aigoldBullPrivilegeS: "1", |
|
|
|
airadarPrivilegeStat: "1", |
|
|
|
marketList: "hk,cn,usa,my,sg,vi,in,gb", |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
const result = await getReplyAPI(params); |
|
|
|
const response = await result.json(); // 解析返回的 JSON 数据 |
|
|
|
console.log('工作流接口返回数据:', response); |
|
|
|
console.log("工作流接口返回数据:", response); |
|
|
|
|
|
|
|
// 解析 data 字段 |
|
|
|
const parsedData = JSON.parse(response.data); // 将字符串形式的 JSON 转换为对象 |
|
|
|
console.log('解析后的数据:', parsedData); |
|
|
|
console.log("解析后的数据:", parsedData); |
|
|
|
|
|
|
|
if (parsedData && parsedData.market && parsedData.code) { |
|
|
|
console.log('工作流接口返回股票信息:', parsedData); |
|
|
|
console.log("工作流接口返回股票信息:", parsedData); |
|
|
|
|
|
|
|
// 更新股票名称 |
|
|
|
stockName.value = parsedData.name || '未知股票'; |
|
|
|
stockName.value = parsedData.name || "未知股票"; |
|
|
|
// 请求数据接口 |
|
|
|
fetchData(parsedData.code, parsedData.market); |
|
|
|
|
|
|
@ -234,12 +255,12 @@ async function fetchData(code, market) { |
|
|
|
}; |
|
|
|
|
|
|
|
const stockDataResult = await axios.post( |
|
|
|
'http://39.101.133.168:8828/link/api/aiEmotion/client/getAiEmotionData', |
|
|
|
"http://39.101.133.168:8828/link/api/aiEmotion/client/getAiEmotionData", |
|
|
|
// 'https://api.homilychart.com/link/api/aiEmotion/client/getAiEmotionData', |
|
|
|
stockDataParams, |
|
|
|
{ |
|
|
|
headers: { |
|
|
|
'Content-Type': 'application/json', |
|
|
|
"Content-Type": "application/json", |
|
|
|
}, |
|
|
|
} |
|
|
|
); |
|
|
@ -279,42 +300,57 @@ function renderCharts(data) { |
|
|
|
nextTick(() => { |
|
|
|
// 渲染股市温度计图表 |
|
|
|
if (marketTemperatureRef.value && data.GSWDJ) { |
|
|
|
console.log('开始渲染股市温度计图表'); |
|
|
|
console.log('股市温度计数据', data.GSWDJ) |
|
|
|
console.log("开始渲染股市温度计图表"); |
|
|
|
console.log("股市温度计数据", data.GSWDJ); |
|
|
|
marketTemperatureRef.value.initChart(data.GSWDJ, data.KLine20, data.WDRL); |
|
|
|
console.log('股市温度计图表已渲染'); |
|
|
|
console.log("股市温度计图表已渲染"); |
|
|
|
} |
|
|
|
// 渲染情绪解码器图表 |
|
|
|
if (emotionDecodRef.value && data.QXJMQ) { |
|
|
|
console.log('开始渲染情绪解码器图表'); |
|
|
|
console.log('情绪解码器数据', data.QXJMQ) |
|
|
|
console.log("开始渲染情绪解码器图表"); |
|
|
|
console.log("情绪解码器数据", data.QXJMQ); |
|
|
|
emotionDecodRef.value.initQXNLZHEcharts(data.KLine20, data.QXJMQ); |
|
|
|
console.log('情绪解码器图表已渲染'); |
|
|
|
console.log("情绪解码器图表已渲染"); |
|
|
|
} |
|
|
|
// 渲染情绪探底雷达图表 |
|
|
|
if (emotionalBottomRadarRef.value && data.QXTDLD) { |
|
|
|
console.log('开始渲染情绪探底雷达图表'); |
|
|
|
console.log('数据', data.QXTDLD) |
|
|
|
emotionalBottomRadarRef.value.initEmotionalBottomRadar(data.KLine20, data.QXTDLD); |
|
|
|
console.log('情绪探底雷达图表已渲染'); |
|
|
|
console.log("开始渲染情绪探底雷达图表"); |
|
|
|
console.log("数据", data.QXTDLD); |
|
|
|
emotionalBottomRadarRef.value.initEmotionalBottomRadar( |
|
|
|
data.KLine20, |
|
|
|
data.QXTDLD |
|
|
|
); |
|
|
|
console.log("情绪探底雷达图表已渲染"); |
|
|
|
} |
|
|
|
// 渲染情绪能量转化器图表 |
|
|
|
if (emoEnergyConverterRef.value && data.QXNLZHQ) { |
|
|
|
console.log('开始渲染情绪能量转化器图表'); |
|
|
|
console.log('KLine20:', data.KLine20); |
|
|
|
console.log('QXNLZHQ:', data.QXNLZHQ); |
|
|
|
console.log("开始渲染情绪能量转化器图表"); |
|
|
|
console.log("KLine20:", data.KLine20); |
|
|
|
console.log("QXNLZHQ:", data.QXNLZHQ); |
|
|
|
emoEnergyConverterRef.value.initQXNLZHEcharts(data.KLine20, data.QXNLZHQ); |
|
|
|
console.log('情绪能量转化器图表已渲染'); |
|
|
|
console.log("情绪能量转化器图表已渲染"); |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
const scrollToBottom = async () => { |
|
|
|
const container = userInputDisplayRef.value; |
|
|
|
if (!container) return; |
|
|
|
await nextTick(); |
|
|
|
console.log(container.scrollHeight, "container.scrollHeight"); |
|
|
|
console.log(container.scrollTop, "container.scrollTop"); |
|
|
|
console.log(container.offsetHeight, "container.offsetHeight"); |
|
|
|
container.scrollTop = container.scrollHeight - container.offsetHeight; |
|
|
|
}; |
|
|
|
|
|
|
|
// setInterval(() =>{ |
|
|
|
// scrollToBottom(); |
|
|
|
// },1000); |
|
|
|
|
|
|
|
// 页面挂载完成后触发图片旋转 |
|
|
|
onMounted(() => { |
|
|
|
startImageRotation(); |
|
|
|
}); |
|
|
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
<style scoped> |
|
|
@ -351,6 +387,17 @@ onMounted(() => { |
|
|
|
color: white; |
|
|
|
} |
|
|
|
|
|
|
|
.golden-wheel { |
|
|
|
width: 100%; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
} |
|
|
|
|
|
|
|
.golden-wheel-img { |
|
|
|
width: 60%; |
|
|
|
max-width: 500px; |
|
|
|
height: auto; |
|
|
|
} |
|
|
|
/* 定义旋转动画 */ |
|
|
|
@keyframes rotate { |
|
|
|
from { |
|
|
@ -369,7 +416,7 @@ onMounted(() => { |
|
|
|
} |
|
|
|
|
|
|
|
.bk-image { |
|
|
|
background-image: url('@/assets/img/AiEmotion/bk03.png'); |
|
|
|
background-image: url("@/assets/img/AiEmotion/bk03.png"); |
|
|
|
background-size: 100% 100%; |
|
|
|
/* background-position: center; */ |
|
|
|
background-repeat: no-repeat; |
|
|
@ -401,7 +448,7 @@ onMounted(() => { |
|
|
|
} |
|
|
|
|
|
|
|
.class07 { |
|
|
|
background-image: url('@/assets/img/AiEmotion/bk03.png'); |
|
|
|
background-image: url("@/assets/img/AiEmotion/bk03.png"); |
|
|
|
/* 使用导入的背景图片 */ |
|
|
|
background-size: cover; |
|
|
|
/* 确保背景图片完整显示 */ |
|
|
@ -558,14 +605,13 @@ onMounted(() => { |
|
|
|
} |
|
|
|
|
|
|
|
.class08 { |
|
|
|
background-image: url('@/assets/img/AiEmotion/bk03.png'); |
|
|
|
background-image: url("@/assets/img/AiEmotion/bk03.png"); |
|
|
|
background-size: 100% 100%; |
|
|
|
background-repeat: no-repeat; |
|
|
|
width: 95%; |
|
|
|
height: auto; |
|
|
|
min-height: 40rem; |
|
|
|
margin: 0 auto; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.class06 { |
|
|
@ -585,7 +631,7 @@ onMounted(() => { |
|
|
|
} |
|
|
|
|
|
|
|
.class05 { |
|
|
|
background-image: url('@/assets/img/AiEmotion/bk03.png'); |
|
|
|
background-image: url("@/assets/img/AiEmotion/bk03.png"); |
|
|
|
/* 使用导入的背景图片 */ |
|
|
|
background-size: 100% 100%; |
|
|
|
/* 确保背景图片完整显示 */ |
|
|
@ -725,7 +771,6 @@ onMounted(() => { |
|
|
|
margin: 0 auto; |
|
|
|
/* 居中容器 */ |
|
|
|
margin-bottom: 10rem; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.ai-emotion-container { |
|
|
|