Browse Source

图表数据存储到pinia中,删除无用的滚动,border3调整

ds_hxl
宋杰 3 weeks ago
parent
commit
7d4acfd095
  1. 1
      src/store/chat.js
  2. 48
      src/views/AiEmotion.vue
  3. 5
      src/views/components/marketTemperature.vue

1
src/store/chat.js

@ -6,6 +6,7 @@ export const useChatStore = defineStore('chat', {
isLoading: false, // 新增加载状态
UserCount: 0,
chartData: [],
kLineData: [],
}),
actions: {
async getUserCount() {

48
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({
@ -563,6 +541,7 @@ onMounted(() => {
gap: 1rem;
margin-left: 2rem;
}
.class0601 {
padding-top: 5rem;
text-align: center;
@ -572,16 +551,19 @@ onMounted(() => {
gap: 1rem;
margin-left: 2rem;
}
.img03 {
width: 10rem;
height: 10rem;
margin-left: 40rem;
}
.img04 {
width: 10rem;
height: 10rem;
margin-left: 40rem;
}
.class0701 {
margin: 0 auto;
width: fit-content;
@ -616,32 +598,36 @@ onMounted(() => {
gap: 1rem;
margin-left: 2rem;
}
.class0502{
}
.class0502 {}
.img02 {
width: 10rem;
height: 10rem;
margin-left: 40rem;
}
.title2 {
color: white;
font-size: 2rem;
font-weight: bold;
margin-left: -4rem;
}
.title3 {
color: white;
font-size: 2rem;
font-weight: bold;
margin-left: -4rem;
}
.title4 {
color: white;
font-size: 2rem;
font-weight: bold;
margin-left: -4rem;
}
.class09 {
text-align: center;
}

5
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;

Loading…
Cancel
Save