Compare commits

...

13 Commits

  1. 2
      build/vite/build.js
  2. 4
      src/api/AiEmotionApi.js
  3. 225
      src/views/AIchat.vue
  4. 189
      src/views/AiEmotion.vue
  5. 25
      src/views/Selectmodel.vue
  6. 212
      src/views/components/emoEnergyConverter.vue
  7. 6
      src/views/components/emotionDecod.vue
  8. 19
      src/views/components/marketTemperature.vue
  9. 2
      src/views/homePage.vue

2
build/vite/build.js

@ -5,7 +5,7 @@ export function createBuild(viteEnv) {
outDir: VITE_OUTPUT_DIR, outDir: VITE_OUTPUT_DIR,
cssCodeSplit: true, // 禁用 CSS 代码拆分,将整个项目中的所有 CSS 将被提取到一个 CSS 文件中 cssCodeSplit: true, // 禁用 CSS 代码拆分,将整个项目中的所有 CSS 将被提取到一个 CSS 文件中
brotliSize: false, // 关闭打包计算 brotliSize: false, // 关闭打包计算
target: 'esnext',
target: 'es2020',
minify: 'terser', // 混淆器, terser 构建后文件体积更小, esbuild minify: 'terser', // 混淆器, terser 构建后文件体积更小, esbuild
// 小于此阈值的导入或引用资源将内联为 base64 编码,以避免额外的 http 请求。设置为 0 可以完全禁用此项 // 小于此阈值的导入或引用资源将内联为 base64 编码,以避免额外的 http 请求。设置为 0 可以完全禁用此项
assetsInlineLimit: 4096, assetsInlineLimit: 4096,

4
src/api/AiEmotionApi.js

@ -15,7 +15,7 @@ export const getReplyAPI = function (params) {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
Authorization: Authorization:
"Bearer pat_lK1fvhLn9LnWCRETP7yFeR6xQ0niwQdcHJ5ZqpnUk8BdiUWCraPLSzWhiQNp2zOl",
"Bearer pat_cOhJRgrEpjXwJJLW1N3YNjCxy19HYTpMFY6XlNCLi4ogm5tdfV266gWIB7MeaRIU",
}, },
}); });
}; };
@ -31,7 +31,7 @@ export const getConclusionAPI = function (params) {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
Authorization: Authorization:
"Bearer pat_lK1fvhLn9LnWCRETP7yFeR6xQ0niwQdcHJ5ZqpnUk8BdiUWCraPLSzWhiQNp2zOl",
"Bearer pat_cOhJRgrEpjXwJJLW1N3YNjCxy19HYTpMFY6XlNCLi4ogm5tdfV266gWIB7MeaRIU",
}, },
}); });
}; };

225
src/views/AIchat.vue

@ -174,6 +174,28 @@ const playAudioSequence = (audioUrls) => {
currentUrl?.length currentUrl?.length
); );
// URL
if (!currentUrl || typeof currentUrl !== 'string' || currentUrl.trim() === '') {
console.error(`音频 ${currentIndex + 1} URL无效,跳过该音频`);
currentIndex++;
setTimeout(() => {
playNext();
}, 100);
return;
}
// URL
try {
new URL(currentUrl);
} catch (e) {
console.error(`音频 ${currentIndex + 1} URL格式错误:`, currentUrl);
currentIndex++;
setTimeout(() => {
playNext();
}, 100);
return;
}
// URL // URL
audioStore.setCurrentAudioUrl(currentUrl); audioStore.setCurrentAudioUrl(currentUrl);
@ -191,6 +213,11 @@ const playAudioSequence = (audioUrls) => {
audioStore.isPlaying = true; audioStore.isPlaying = true;
audioStore.isPaused = false; audioStore.isPaused = false;
console.log(`开始播放音频 ${currentIndex + 1}`); console.log(`开始播放音频 ${currentIndex + 1}`);
console.log('音频播放状态:', {
duration: sound.duration(),
state: sound.state(),
playing: sound.playing()
});
}, },
onpause: () => { onpause: () => {
audioStore.isPlaying = false; audioStore.isPlaying = false;
@ -204,6 +231,13 @@ const playAudioSequence = (audioUrls) => {
audioStore.playbackPosition = 0; audioStore.playbackPosition = 0;
console.log(`音频 ${currentIndex + 1} 播放完成`); console.log(`音频 ${currentIndex + 1} 播放完成`);
currentIndex++; currentIndex++;
//
if (currentIndex >= audioSequence.length) {
console.log('最后一个音频播放完成,清除音频实例');
audioStore.soundInstance = null;
audioStore.nowSound = null;
currentIndex = 0; //
}
// //
setTimeout(() => { setTimeout(() => {
playNext(); playNext();
@ -217,16 +251,50 @@ const playAudioSequence = (audioUrls) => {
}, },
onloaderror: (id, err) => { onloaderror: (id, err) => {
console.error(`音频 ${currentIndex + 1} 加载失败:`, err); console.error(`音频 ${currentIndex + 1} 加载失败:`, err);
currentIndex++;
//
setTimeout(() => {
playNext();
}, 100);
console.error('失败的音频URL:', currentUrl);
console.error('错误详情:', { id, err });
//
if (!sound.retryCount) {
sound.retryCount = 0;
}
if (sound.retryCount < 2) {
sound.retryCount++;
console.log(`音频 ${currentIndex + 1}${sound.retryCount}次重试加载`);
setTimeout(() => {
sound.load();
}, 1000 * sound.retryCount); //
} else {
console.warn(`音频 ${currentIndex + 1} 重试失败,跳过该音频`);
currentIndex++;
//
setTimeout(() => {
playNext();
}, 100);
}
}, },
}); });
audioStore.nowSound = sound; audioStore.nowSound = sound;
audioStore.setAudioInstance(sound); audioStore.setAudioInstance(sound);
//
const playTimeout = setTimeout(() => {
if (!audioStore.isPlaying && sound.state() === 'loading') {
console.warn(`音频 ${currentIndex + 1} 播放超时,可能网络问题`);
sound.stop();
currentIndex++;
playNext();
}
}, 10000); // 10
//
sound.once('play', () => {
clearTimeout(playTimeout);
});
console.log(`尝试播放音频 ${currentIndex + 1},URL: ${currentUrl}`);
sound.play(); sound.play();
}; };
@ -647,17 +715,24 @@ watch(
const isPlayingAudio = ref(false); const isPlayingAudio = ref(false);
// //
//
let isCallingPlayNext = false;
const playNextAudio = () => { const playNextAudio = () => {
if (audioQueue.value.length === 0 || isPlayingAudio.value) {
if (audioQueue.value.length === 0 || isPlayingAudio.value || isCallingPlayNext) {
console.log('播放条件不满足 - 队列长度:', audioQueue.value.length, '正在播放:', isPlayingAudio.value, '正在调用:', isCallingPlayNext);
return; return;
} }
isCallingPlayNext = true;
isPlayingAudio.value = true; isPlayingAudio.value = true;
const audioInfo = audioQueue.value.shift(); const audioInfo = audioQueue.value.shift();
console.log(`开始播放${audioInfo.name}音频`);
console.log(`开始播放${audioInfo.name}音频,剩余队列:`, audioQueue.value.length);
if (audioStore.nowSound) {
//
if (audioStore.nowSound && (audioStore.nowSound.playing() || audioStore.nowSound.state() === 'loading')) {
console.log('停止之前的音频实例');
audioStore.nowSound.stop(); audioStore.nowSound.stop();
} }
@ -669,7 +744,9 @@ watch(
onplay: () => { onplay: () => {
audioStore.isPlaying = true; audioStore.isPlaying = true;
audioStore.isPaused = false; audioStore.isPaused = false;
console.log(`${audioInfo.name}音频开始播放`);
isCallingPlayNext = false; //
console.log(`${audioInfo.name}音频开始播放,时长:`, audio.duration());
console.log('音频播放状态确认 - isPlayingAudio:', isPlayingAudio.value, 'audioStore.isPlaying:', audioStore.isPlaying);
}, },
onpause: () => { onpause: () => {
audioStore.isPlaying = false; audioStore.isPlaying = false;
@ -683,26 +760,36 @@ watch(
console.log(`${audioInfo.name}音频继续播放`); console.log(`${audioInfo.name}音频继续播放`);
}, },
onend: () => { onend: () => {
console.log(`${audioInfo.name}音频播放完成,准备播放下一个`);
console.log('播放完成时的状态 - 队列长度:', audioQueue.value.length, 'isPlayingAudio:', isPlayingAudio.value);
audioStore.isPlaying = false; audioStore.isPlaying = false;
audioStore.isPaused = false; audioStore.isPaused = false;
audioStore.playbackPosition = 0; audioStore.playbackPosition = 0;
isPlayingAudio.value = false; isPlayingAudio.value = false;
console.log(`${audioInfo.name}音频播放完成`);
//
setTimeout(() => {
playNextAudio();
}, 100);
//
if (audioQueue.value.length > 0) {
console.log('队列中还有音频,500ms后播放下一个,当前队列:', audioQueue.value.map(item => item.name));
setTimeout(() => {
isCallingPlayNext = false; //
playNextAudio();
}, 500);
} else {
console.log('所有音频播放完成');
isCallingPlayNext = false; //
}
}, },
onstop: () => { onstop: () => {
console.log(`${audioInfo.name}音频被停止`);
audioStore.isPlaying = false; audioStore.isPlaying = false;
audioStore.isPaused = false; audioStore.isPaused = false;
audioStore.playbackPosition = 0; audioStore.playbackPosition = 0;
isPlayingAudio.value = false;
console.log(`${audioInfo.name}音频已停止`);
// onstopisPlayingAudio.value = false
}, },
onloaderror: (id, err) => { onloaderror: (id, err) => {
console.error(`${audioInfo.name}音频播放失败:`, err); console.error(`${audioInfo.name}音频播放失败:`, err);
isPlayingAudio.value = false; isPlayingAudio.value = false;
isCallingPlayNext = false; //
// //
setTimeout(() => { setTimeout(() => {
playNextAudio(); playNextAudio();
@ -714,19 +801,61 @@ watch(
audioStore.setCurrentAudioUrl(audioInfo.url); audioStore.setCurrentAudioUrl(audioInfo.url);
audioStore.nowSound = audio; audioStore.nowSound = audio;
audioStore.setAudioInstance(audio); audioStore.setAudioInstance(audio);
console.log(`尝试播放${audioInfo.name}音频`);
audio.play(); audio.play();
}; };
//
//
const audioQueueOrder = {
'API1-第一个': 1,
'API2-第二个': 2,
'API3-第三个': 3,
'API4-第四个': 4
};
//
const addToAudioQueue = (url, name) => { const addToAudioQueue = (url, name) => {
console.log(`=== 添加音频到队列 ===`);
console.log('URL:', url);
console.log('Name:', name);
console.log('音频启用状态:', audioStore.isVoiceEnabled);
if (url && audioStore.isVoiceEnabled) { if (url && audioStore.isVoiceEnabled) {
audioQueue.value.push({ url, name });
console.log(`音频${name}已添加到播放队列`);
//
if (!isPlayingAudio.value) {
const audioItem = { url, name, order: audioQueueOrder[name] || 999 };
audioQueue.value.push(audioItem);
//
audioQueue.value.sort((a, b) => a.order - b.order);
console.log(`音频${name}已添加到播放队列,顺序:${audioItem.order}`);
console.log('当前队列顺序:', audioQueue.value.map(item => `${item.name}(${item.order})`));
console.log('当前播放状态详情:');
console.log(' - isPlayingAudio:', isPlayingAudio.value);
console.log(' - audioStore.isPlaying:', audioStore.isPlaying);
console.log(' - audioStore.nowSound:', audioStore.nowSound);
console.log(' - isCallingPlayNext:', isCallingPlayNext);
console.log(' - 队列长度:', audioQueue.value.length);
//
if (!isPlayingAudio.value && !audioStore.isPlaying && audioQueue.value.length === 1) {
console.log('✅ 条件满足:没有音频在播放且这是第一个音频,立即开始播放');
playNextAudio(); playNextAudio();
} else {
console.log('⏳ 等待条件:', {
isPlayingAudio: isPlayingAudio.value,
audioStoreIsPlaying: audioStore.isPlaying,
queueLength: audioQueue.value.length,
reason: audioQueue.value.length > 1 ? '队列中已有其他音频' : '有音频正在播放'
});
} }
} else {
console.log('❌ 跳过添加音频:', {
hasUrl: !!url,
voiceEnabled: audioStore.isVoiceEnabled
});
} }
console.log(`=== 添加音频完成 ===`);
}; };
// audioStoretogglePlayPause // audioStoretogglePlayPause
@ -735,6 +864,7 @@ watch(
console.log('主页音频控制按钮被点击'); console.log('主页音频控制按钮被点击');
console.log('当前音频状态 - isPlaying:', audioStore.isPlaying, 'isPaused:', audioStore.isPaused); console.log('当前音频状态 - isPlaying:', audioStore.isPlaying, 'isPaused:', audioStore.isPaused);
console.log('当前音频实例:', audioStore.soundInstance); console.log('当前音频实例:', audioStore.soundInstance);
console.log('队列播放状态 - isPlayingAudio:', isPlayingAudio.value, '队列长度:', audioQueue.value.length);
if (audioStore.soundInstance) { if (audioStore.soundInstance) {
if (audioStore.isPlaying) { if (audioStore.isPlaying) {
@ -752,10 +882,29 @@ watch(
audioStore.soundInstance.play(); audioStore.soundInstance.play();
} }
} else { } else {
console.log('没有音频实例,尝试播放队列中的音频');
//
if (!isPlayingAudio.value && audioQueue.value.length > 0) {
console.log('没有音频实例,检查是否需要重新播放队列');
//
if (!isPlayingAudio.value && audioQueue.value.length === 0) {
console.log('所有音频播放完成,重新构建队列从第一个开始播放');
//
if (audioPreloadStatus.one.url) {
addToAudioQueue(audioPreloadStatus.one.url, "API1-第一个");
}
if (audioPreloadStatus.two.url) {
addToAudioQueue(audioPreloadStatus.two.url, "API2-第二个");
}
if (audioPreloadStatus.three.url) {
addToAudioQueue(audioPreloadStatus.three.url, "API3-第三个");
}
if (audioPreloadStatus.four.url) {
addToAudioQueue(audioPreloadStatus.four.url, "API4-第四个");
}
console.log('队列重建完成,开始从第一个音频播放');
} else if (!isPlayingAudio.value && audioQueue.value.length > 0) {
console.log('队列中还有音频,继续播放');
playNextAudio(); playNextAudio();
} else {
console.log('无法播放 - isPlayingAudio:', isPlayingAudio.value, '队列长度:', audioQueue.value.length);
} }
} }
}; };
@ -767,6 +916,10 @@ watch(
return Promise.resolve(); return Promise.resolve();
} }
// URL使使
audioPreloadStatus[apiKey].url = url;
console.log(`设置音频${apiKey}的URL:`, url);
return new Promise((resolve) => { return new Promise((resolve) => {
const audio = new Howl({ const audio = new Howl({
src: [url], src: [url],
@ -777,12 +930,12 @@ watch(
onload: () => { onload: () => {
console.log(`音频${apiKey}预加载完成:`, url); console.log(`音频${apiKey}预加载完成:`, url);
audioPreloadStatus[apiKey].loaded = true; audioPreloadStatus[apiKey].loaded = true;
audioPreloadStatus[apiKey].url = url;
resolve(); resolve();
}, },
onloaderror: (id, err) => { onloaderror: (id, err) => {
console.error(`音频${apiKey}预加载失败:`, err); console.error(`音频${apiKey}预加载失败:`, err);
audioPreloadStatus[apiKey].loaded = true; // audioPreloadStatus[apiKey].loaded = true; //
// URL使URL
resolve(); resolve();
} }
}); });
@ -802,9 +955,10 @@ watch(
if (apiStatus.one.result) { if (apiStatus.one.result) {
console.log("执行OneAPI代码(文本和音频同步开始):", apiStatus.one.result); console.log("执行OneAPI代码(文本和音频同步开始):", apiStatus.one.result);
//
// API1
if (audioPreloadStatus.one.url) { if (audioPreloadStatus.one.url) {
addToAudioQueue(audioPreloadStatus.one.url, "第一个");
addToAudioQueue(audioPreloadStatus.one.url, "API1-第一个");
console.log("音频队列:添加API1音频,当前队列长度:", audioQueue.value.length);
} }
// OneAPI // OneAPI
@ -817,7 +971,7 @@ watch(
class: "title1", class: "title1",
type: "title1", type: "title1",
content: codeData.value.name + "全景作战报告", content: codeData.value.name + "全景作战报告",
date: moment().format("DD/MM/YYYY"),
date: result21.data.date,
}, },
"", "",
50 50
@ -1047,9 +1201,10 @@ watch(
if (apiStatus.two.result) { if (apiStatus.two.result) {
console.log("执行TwoAPI代码:", apiStatus.two.result); console.log("执行TwoAPI代码:", apiStatus.two.result);
//
// API2
if (audioPreloadStatus.two.url) { if (audioPreloadStatus.two.url) {
addToAudioQueue(audioPreloadStatus.two.url, "第二个");
addToAudioQueue(audioPreloadStatus.two.url, "API2-第二个");
console.log("音频队列:添加API2音频,当前队列长度:", audioQueue.value.length);
} }
// TwoAPI // TwoAPI
@ -1125,9 +1280,10 @@ watch(
if (apiStatus.three.result) { if (apiStatus.three.result) {
console.log("执行ThreeAPI代码:", apiStatus.three.result); console.log("执行ThreeAPI代码:", apiStatus.three.result);
//
// API3
if (audioPreloadStatus.three.url) { if (audioPreloadStatus.three.url) {
addToAudioQueue(audioPreloadStatus.three.url, "第三个");
addToAudioQueue(audioPreloadStatus.three.url, "API3-第三个");
console.log("音频队列:添加API3音频,当前队列长度:", audioQueue.value.length);
} }
// ThreeAPI // ThreeAPI
@ -1289,9 +1445,10 @@ watch(
if (apiStatus.four.result) { if (apiStatus.four.result) {
console.log("执行FourAPI代码:", apiStatus.four.result); console.log("执行FourAPI代码:", apiStatus.four.result);
//
// API4
if (audioPreloadStatus.four.url) { if (audioPreloadStatus.four.url) {
addToAudioQueue(audioPreloadStatus.four.url, "第四个");
addToAudioQueue(audioPreloadStatus.four.url, "API4-第四个");
console.log("音频队列:添加API4音频,当前队列长度:", audioQueue.value.length);
} }
// FourAPI // FourAPI

189
src/views/AiEmotion.vue

@ -1449,21 +1449,30 @@ defineExpose({
.class003 { .class003 {
padding-top: 8%; padding-top: 8%;
padding-left: 10%;
/* padding-left: 10%; */
display: flex; display: flex;
flex-direction: column;
gap: 1rem;
align-items: center;
justify-content: center;
gap: 25vw;
/* flex-direction: column; */
/* gap: 1rem; */
}
.img01 {
width: 11vw;
/* height: auto; */
} }
.div00 { .div00 {
display: flex; display: flex;
flex-direction: row;
gap: 2%;
justify-content: flex-start;
align-items: center;
flex-wrap: wrap;
width: 100%;
box-sizing: border-box;
flex-direction: column;
/* 竖向排列元素 */
/* margin-left: 15%; */
gap: 30px;
/* margin-top: -12%; */
/* width: 100%; */
/* height: auto; */
} }
.div00::after { .div00::after {
@ -1476,7 +1485,8 @@ defineExpose({
background-image: url('@/assets/img/AiEmotion/redBorder.png'); background-image: url('@/assets/img/AiEmotion/redBorder.png');
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
width: 35%;
/* width: 50%; */
width: 30vw;
min-width: 200px; min-width: 200px;
min-height: 40px; min-height: 40px;
text-align: center; text-align: center;
@ -1492,7 +1502,8 @@ defineExpose({
background-image: url('@/assets/img/AiEmotion/blueBorder.png'); background-image: url('@/assets/img/AiEmotion/blueBorder.png');
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
width: 35%;
/* width: 35%; */
width: 30vw;
min-width: 200px; min-width: 200px;
min-height: 40px; min-height: 40px;
text-align: center; text-align: center;
@ -1719,7 +1730,7 @@ defineExpose({
} }
.class0402 { .class0402 {
width: 80%;
/* width: 80vw; */
margin: 0 auto; margin: 0 auto;
} }
@ -1732,31 +1743,35 @@ defineExpose({
.class0502 { .class0502 {
padding-top: 7%; padding-top: 7%;
display: flex; display: flex;
justify-content: center;
align-items: center;
flex-direction: column; flex-direction: column;
/* 竖向排列元素 */ /* 竖向排列元素 */
gap: 1rem; gap: 1rem;
margin-left: 2rem;
/* margin-left: 2rem; */
} }
.class0601 { .class0601 {
padding-top: 5rem; padding-top: 5rem;
display: flex; display: flex;
justify-content: center;
align-items: center;
flex-direction: column; flex-direction: column;
/* 竖向排列元素 */ /* 竖向排列元素 */
gap: 1rem; gap: 1rem;
margin-left: 2rem;
/* margin-left: 2rem; */
} }
.img03 { .img03 {
width: 10%; width: 10%;
height: auto; height: auto;
margin-left: 43%;
/* margin-left: 43%; */
} }
.img04 { .img04 {
width: 10%; width: 10%;
height: auto; height: auto;
margin-left: 43%;
/* margin-left: 43%; */
} }
.class0701 { .class0701 {
@ -1795,36 +1810,38 @@ defineExpose({
padding-top: 5rem; padding-top: 5rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center;
align-items: center;
/* 竖向排列元素 */ /* 竖向排列元素 */
gap: 1rem; gap: 1rem;
margin-left: 2rem;
/* margin-left: 2rem; */
} }
.img02 { .img02 {
width: 10%; width: 10%;
height: auto; height: auto;
margin-left: 43%;
/* margin-left: 43%; */
} }
.title2 { .title2 {
color: white; color: white;
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
margin-left: 45%;
/* margin-left: 45%; */
} }
.title3 { .title3 {
color: white; color: white;
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
margin-left: 44.6%;
/* margin-left: 44.6%; */
} }
.title4 { .title4 {
color: white; color: white;
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
margin-left: 44%;
/* margin-left: 44%; */
} }
.class09 { .class09 {
@ -1919,13 +1936,14 @@ defineExpose({
/* 确保不超出父容器 */ /* 确保不超出父容器 */
height: auto; height: auto;
/* 高度根据内容动态变化 */ /* 高度根据内容动态变化 */
min-height: 75rem;
/* min-height: 75rem; */
/* 设置最小高度,确保图片显示 */ /* 设置最小高度,确保图片显示 */
margin: 0 auto; margin: 0 auto;
box-sizing: border-box; box-sizing: border-box;
/* 包括内边距在宽度计算中 */ /* 包括内边距在宽度计算中 */
transition: all 0.3s ease; transition: all 0.3s ease;
/* 添加平滑过渡效果 */ /* 添加平滑过渡效果 */
padding-bottom: 1rem;
} }
.class03 { .class03 {
@ -1973,9 +1991,10 @@ defineExpose({
.content1 { .content1 {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center;
/* 竖向排列元素 */ /* 竖向排列元素 */
gap: 1rem;
margin-left: 10%;
/* gap: 1rem; */
/* margin-left: 10%; */
} }
.title1 { .title1 {
@ -1986,21 +2005,8 @@ defineExpose({
} }
.img01 {
width: 10%;
height: auto;
}
.div00 {
display: flex;
flex-direction: column;
/* 竖向排列元素 */
margin-left: 15%;
gap: 1rem;
margin-top: -12%;
width: 100%;
height: auto;
}
.span02 { .span02 {
font-size: 1.5rem; font-size: 1.5rem;
@ -2167,10 +2173,6 @@ defineExpose({
min-height: 60rem; min-height: 60rem;
} }
.class04 {
min-height: 65rem;
}
.class05 { .class05 {
min-height: 75rem; min-height: 75rem;
} }
@ -2195,23 +2197,6 @@ defineExpose({
padding: 0.6rem; padding: 0.6rem;
} }
.class003 {
padding-top: 6%;
padding-left: 5%;
}
.div00 {
gap: 1%;
justify-content: center;
}
.class003 .div01,
.class003 .div02 {
width: 45%;
min-width: 180px;
font-size: 20px;
}
/* 调整图表容器高度 */ /* 调整图表容器高度 */
.class00 { .class00 {
min-height: 40rem; min-height: 40rem;
@ -2221,9 +2206,6 @@ defineExpose({
min-height: 55rem; min-height: 55rem;
} }
.class04 {
min-height: 55rem;
}
.class05 { .class05 {
min-height: 65rem; min-height: 65rem;
@ -2275,7 +2257,7 @@ defineExpose({
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: contain; background-size: contain;
text-align: center; text-align: center;
width:100%;
width: 100%;
margin-top: 4%; margin-top: 4%;
height: 200px; height: 200px;
min-height: 200px; min-height: 200px;
@ -2341,9 +2323,9 @@ defineExpose({
.img01 { .img01 {
height: auto; height: auto;
margin-left: 7%;
width: 25%;
margin-top: 10px;
/* margin-left: 7%; */
width: 15vw;
/* margin-top: 10px; */
} }
.title1 { .title1 {
@ -2367,10 +2349,6 @@ defineExpose({
height: auto; height: auto;
} }
.class03 .class003 {
padding-top: 3rem;
padding-left: 0rem;
}
.class01 { .class01 {
min-height: 100px; min-height: 100px;
@ -2383,7 +2361,7 @@ defineExpose({
.class04 { .class04 {
width: 100%; width: 100%;
height: auto; height: auto;
min-height: 38rem;
/* min-height: 38rem; */
/* min-height: 51rem; */ /* min-height: 51rem; */
/* margin-left: -39px; */ /* margin-left: -39px; */
/* min-height: 38rem; */ /* min-height: 38rem; */
@ -2416,7 +2394,7 @@ defineExpose({
.img02 { .img02 {
width: 25%; width: 25%;
height: auto; height: auto;
margin-left: 32%;
/* margin-left: 32%; */
} }
.class0401 { .class0401 {
@ -2427,7 +2405,7 @@ defineExpose({
.img04 { .img04 {
width: 25%; width: 25%;
height: auto; height: auto;
margin-left: 33%;
/* margin-left: 33%; */
} }
.text-container p { .text-container p {
@ -2653,42 +2631,31 @@ defineExpose({
padding: 5%; padding: 5%;
} }
.class003 {
padding-top: 12%;
gap: 20vw;
}
.div00 { .div00 {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-left: 5rem;
/* margin-left: 5rem; */
gap: 0; gap: 0;
margin-top: -6rem;
width: 100%;
/* margin-top: -6rem; */
/* width: 100%; */
height: auto; height: auto;
} }
.class003 .div01 {
background-repeat: no-repeat;
background-size: 100% 100%;
width: 35%;
min-height: 25px;
float: left;
margin-left: 100px;
text-align: center;
margin-top: 10px;
font-size: 10px;
color: white;
}
.class003 .div01,
.class003 .div02 { .class003 .div02 {
background-repeat: no-repeat;
background-size: 100% 100%;
width: 35%;
min-height: 25px;
float: left;
margin-left: 100px;
text-align: center;
margin-top: 10px;
font-size: 10px;
color: white;
/* width: 80%; */
min-width: 250px;
font-size: 16px;
min-height: 35px;
} }
.span01 { .span01 {
/* 使用导入的背景图片 */ /* 使用导入的背景图片 */
background-image: url('@/assets/img/AiEmotion/bk01.png'); background-image: url('@/assets/img/AiEmotion/bk01.png');
@ -2713,25 +2680,12 @@ defineExpose({
padding-top: 10%; padding-top: 10%;
} }
.class003 {
padding-top: 4%;
padding-left: 2%;
}
.div00 { .div00 {
flex-direction: column; flex-direction: column;
gap: 1rem; gap: 1rem;
align-items: center; align-items: center;
} }
.class003 .div01,
.class003 .div02 {
width: 80%;
min-width: 250px;
font-size: 16px;
min-height: 35px;
}
.span01 { .span01 {
width: 60%; width: 60%;
font-size: 1.2rem; font-size: 1.2rem;
@ -2766,9 +2720,15 @@ defineExpose({
align-items: center; align-items: center;
} }
.class003{
padding-top: 14%;
gap: 30px;
}
.class003 .div01, .class003 .div01,
.class003 .div02 { .class003 .div02 {
width: 90%;
/* width: 90%; */
width: 10vw;
min-width: 200px; min-width: 200px;
font-size: 14px; font-size: 14px;
min-height: 30px; min-height: 30px;
@ -2797,9 +2757,6 @@ defineExpose({
min-height: 35rem; min-height: 35rem;
} }
.class04 {
min-height: 30rem;
}
.class05 { .class05 {
min-height: 35rem; min-height: 35rem;

25
src/views/Selectmodel.vue

@ -308,13 +308,26 @@ const goToEmotionsmodel = () => {
.homepage { .homepage {
background-size: cover; background-size: cover;
min-height: 100vh; min-height: 100vh;
width: 100vw;
overflow-x: hidden;
}
.main-icon {
margin-top:46rem;
width: calc(20vw + 100px);
max-width: 300px;
min-width: 300px;
}
/* 隐藏滚动条 */
body {
overflow-x: hidden;
}
html, body {
width: 100%;
max-width: 100vw;
} }
/* .main-icon {
max-width: 350px;
width: 28vw;
height: auto;
margin-top:48vw;
} */
} }
@media screen and (min-width: 1025px) and (max-width: 1700px){ @media screen and (min-width: 1025px) and (max-width: 1700px){
.main-icon { .main-icon {

212
src/views/components/emoEnergyConverter.vue

@ -12,7 +12,7 @@ let qxnlzhqEchartsRef = ref(null);
let qxnlzhqEchartsInstance = null; let qxnlzhqEchartsInstance = null;
let regions = reactive([]); let regions = reactive([]);
const dataMax=ref(null)
// //
function getNameTop(min, max, regionMiidle) { function getNameTop(min, max, regionMiidle) {
// //
@ -30,14 +30,30 @@ function getNumberTop(min, max, regionMax) {
// //
const generateGraphics = (min, max) => { const generateGraphics = (min, max) => {
let hasPartialVisible = false; //
return regions.flatMap((region) => { return regions.flatMap((region) => {
if(!region.min || !region.max) return [];
const middleY = (Number(region.min) + Number(region.max)) / 2; const middleY = (Number(region.min) + Number(region.max)) / 2;
return [
//
{
const safeY = Math.max(min, Math.min(middleY, max*0.99));
//
const isFullyVisible = region.min >= min && region.max <= max;
//
const isPartiallyVisible = (region.min < max && region.max > min) && !isFullyVisible;
//
if (isPartiallyVisible && hasPartialVisible) {
return [];
}
//
if (isPartiallyVisible) {
hasPartialVisible = true;
}
const graphics = [];
//
if (isFullyVisible || isPartiallyVisible) {
graphics.push({
type: "text", type: "text",
left: '60', //
top: getNameTop(min, max, middleY),
left: '10%',
top: getNameTop(min, max, safeY),
style: { style: {
text: region.name, text: region.name,
fill: region.fontColor, fill: region.fontColor,
@ -45,11 +61,13 @@ const generateGraphics = (min, max) => {
fontWeight: "bold", fontWeight: "bold",
}, },
z: 3, z: 3,
},
// y
{
});
}
// y
if (isFullyVisible) {
graphics.push({
type: "text", type: "text",
left: '60', //
left: '5%', //
top: getNumberTop(min, max, region.max), top: getNumberTop(min, max, region.max),
// top: 100, // top: 100,
style: { style: {
@ -58,8 +76,9 @@ const generateGraphics = (min, max) => {
fontSize: 12, fontSize: 12,
}, },
z: 3, z: 3,
},
];
});
}
return graphics;
}); });
}; };
@ -89,41 +108,41 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
min: qxnlzhqData.dd, min: qxnlzhqData.dd,
max: qxnlzhqData.zc, max: qxnlzhqData.zc,
name: "【情绪冰点区】", name: "【情绪冰点区】",
color: "#e7a5d6",
fontColor: 'white',
NumberColor: 'blue',
color: "#FF9F9F",
fontColor: '#666666',
NumberColor: 'white',
}, },
{ {
min: qxnlzhqData.zc, min: qxnlzhqData.zc,
max: qxnlzhqData.ht, max: qxnlzhqData.ht,
name: "【认知潜伏区】", name: "【认知潜伏区】",
color: "#f36587",
fontColor: 'white',
NumberColor: 'blue',
color: "#FFCB75",
fontColor: '#666666',
NumberColor: 'white',
}, },
{ {
min: qxnlzhqData.ht, min: qxnlzhqData.ht,
max: qxnlzhqData.qs, max: qxnlzhqData.qs,
name: "【多空消化区】", name: "【多空消化区】",
color: "#e99883",
fontColor: 'white',
NumberColor: 'blue',
color: "#D7E95D",
fontColor: '#666666',
NumberColor: 'white',
}, },
{ {
min: qxnlzhqData.qs, min: qxnlzhqData.qs,
max: qxnlzhqData.tp, max: qxnlzhqData.tp,
name: "【共识加速区】", name: "【共识加速区】",
color: "#f0db84",
fontColor: 'white',
NumberColor: 'red',
color: "#A0F56F",
fontColor: '#666666',
NumberColor: 'white',
}, },
{ {
min: qxnlzhqData.tp, min: qxnlzhqData.tp,
max: qxnlzhqData.js, max: qxnlzhqData.js,
name: "【情绪临界区】", name: "【情绪临界区】",
color: "#dbeee3",
fontColor: 'red',
NumberColor: 'red',
color: "#87F3CD",
fontColor: '#666666',
NumberColor: 'white',
}, },
]; ];
// gg yl-1 // gg yl-1
@ -133,9 +152,9 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
min: qxnlzhqData.js, min: qxnlzhqData.js,
max: qxnlzhqData.yl, max: qxnlzhqData.yl,
name: "【杠杆失衡区】", name: "【杠杆失衡区】",
color: "#9ac2d8",
fontColor: 'red',
NumberColor: 'red',
color: "#51C3F9",
fontColor: '#666666',
NumberColor: 'white',
}, },
) )
} }
@ -145,13 +164,21 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
min: qxnlzhqData.yl, min: qxnlzhqData.yl,
max: qxnlzhqData.gg, max: qxnlzhqData.gg,
name: "【情绪熔断区】", name: "【情绪熔断区】",
color: "#bce283",
fontColor: 'red',
NumberColor: 'red',
color: "#D0A7FF",
fontColor: '#666666',
NumberColor: 'white',
}, },
) )
} }
// y
const priceValues = kline.flatMap(item => [item[1], item[2], item[3], item[4]]);
const dataMin = Math.min(...priceValues);
const dataMax = Math.max(...priceValues);
// K线
const lastKLine = mixData[mixData.length - 1];
const lastHigh = lastKLine.value[2]; //
const lastLow = lastKLine.value[3]; //
// //
const stopProfitPrice = Number(qxnlzhqData.cc) * 1.05; // const stopProfitPrice = Number(qxnlzhqData.cc) * 1.05; //
const stopLossPrice = Number(qxnlzhqData.cc) * 0.97; // const stopLossPrice = Number(qxnlzhqData.cc) * 0.97; //
@ -257,7 +284,7 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
borderWidth: 1 borderWidth: 1
} }
}, },
backgroundColor: 'rgba(0, 0, 0, 0.8)',
backgroundColor: '#646E71',
borderColor: '#fff', borderColor: '#fff',
borderWidth: 1, borderWidth: 1,
padding: 10, padding: 10,
@ -299,9 +326,9 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
result += `<div style="color: ${changeColor};">涨跌: ${priceChange >= 0 ? '+' : ''}${priceChange.toFixed(2)} (${changePercent}%)</div>` result += `<div style="color: ${changeColor};">涨跌: ${priceChange >= 0 ? '+' : ''}${priceChange.toFixed(2)} (${changePercent}%)</div>`
result += `</div>` result += `</div>`
} else if (param.seriesName === '止盈线' && value !== null && value !== undefined && typeof value === 'number') { } else if (param.seriesName === '止盈线' && value !== null && value !== undefined && typeof value === 'number') {
result += `<div style="color: #ff80ff; margin-bottom: 4px;">${param.seriesName}: ${value.toFixed(2)}</div>`
result += `<div style="color: #FF0000; margin-bottom: 4px;">${param.seriesName}: ${value.toFixed(2)}</div>`
} else if (param.seriesName === '止损线' && value !== null && value !== undefined && typeof value === 'number') { } else if (param.seriesName === '止损线' && value !== null && value !== undefined && typeof value === 'number') {
result += `<div style="color: #080bfd; margin-bottom: 4px;">${param.seriesName}: ${value.toFixed(2)}</div>`
result += `<div style="color: #001EFF; margin-bottom: 4px;">${param.seriesName}: ${value.toFixed(2)}</div>`
} }
}) })
@ -373,17 +400,12 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
qxnlzhqData.dd < stopLossPrice * 0.98 qxnlzhqData.dd < stopLossPrice * 0.98
? Math.floor(qxnlzhqData.dd) ? Math.floor(qxnlzhqData.dd)
: Math.floor(stopLossPrice * 0.98), : Math.floor(stopLossPrice * 0.98),
max:
qxnlzhqData.yl > stopProfitPrice * 1.02
? Math.ceil(qxnlzhqData.yl)
: Math.ceil(stopProfitPrice * 1.02),
max: Math.max(Math.ceil(dataMax * 1.02), (qxnlzhqData.yl > 0 ? qxnlzhqData.yl : Math.ceil(dataMax * 1.02)), stopProfitPrice * 1.02),
}, },
// //
graphic: generateGraphics(qxnlzhqData.dd < stopLossPrice * 0.98 graphic: generateGraphics(qxnlzhqData.dd < stopLossPrice * 0.98
? Math.floor(qxnlzhqData.dd) ? Math.floor(qxnlzhqData.dd)
: Math.floor(stopLossPrice * 0.98), qxnlzhqData.yl > stopProfitPrice * 1.02
? Math.ceil(qxnlzhqData.yl)
: Math.ceil(stopProfitPrice * 1.02)),
: Math.floor(stopLossPrice * 0.98), Math.max(Math.ceil(dataMax * 1.02), (qxnlzhqData.yl > 0 ? qxnlzhqData.yl : Math.ceil(dataMax * 1.02)), stopProfitPrice * 1.02),),
series: [ series: [
{ {
type: "candlestick", type: "candlestick",
@ -399,10 +421,12 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
itemStyle: { itemStyle: {
normal: { normal: {
// 线 > // 线 >
color: '#14b143', // < 绿
// color: '#14b143', // < 绿
color: 'rgba(0,0,0,0)',
color0: '#ef232a', // > color0: '#ef232a', // >
borderColor: '#14b143', // 线绿 borderColor: '#14b143', // 线绿
borderColor0: '#ef232a', // 线 borderColor0: '#ef232a', // 线
borderWidth: 1.5
} }
}, },
// //
@ -453,7 +477,7 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
symbol: 'none', symbol: 'none',
lineStyle: { lineStyle: {
normal: { normal: {
color: '#ff80ff', //
color: '#FF0000', //
width: 2, width: 2,
type: 'solid' type: 'solid'
} }
@ -470,15 +494,16 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
label: { label: {
normal: { normal: {
show: true, show: true,
position: 'bottom',
formatter: `{text|止盈: ${stopProfitPrice}}`,
position: 'top',
formatter: `{text|止盈}`,
rich: { rich: {
text: { text: {
color: '#820a06',
color: '#FF0000',
fontSize: 14, fontSize: 14,
fontWeight: 'bold' fontWeight: 'bold'
} }
}
},
offset: [-20, 0]
} }
} }
} }
@ -492,7 +517,7 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
symbol: 'none', symbol: 'none',
lineStyle: { lineStyle: {
normal: { normal: {
color: '#080bfd', //
color: '#001EFF',
width: 2, width: 2,
type: 'solid' type: 'solid'
} }
@ -510,20 +535,101 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
normal: { normal: {
show: true, show: true,
position: 'bottom', position: 'bottom',
formatter: `{text|止损: ${stopLossPrice}}`,
formatter: `{text|止损}`,
rich: { rich: {
text: { text: {
color: '#080bfd',
color: '#001EFF',
fontSize: 14, fontSize: 14,
fontWeight: 'bold' fontWeight: 'bold'
} }
}
},
offset: [-20, 0]
} }
} }
} }
] ]
} }
}, },
{
name: '最低价',
type: 'line',
symbol: 'none',
lineStyle: {
normal: {
color: 'transparent',
width: 0
}
},
markPoint: {
symbol: 'circle',
symbolSize: 1,
data: [
{
coord: [mixData.length - 1, mixData[mixData.length - 1].value[2]],
itemStyle: {
color: 'transparent'
},
label: {
normal: {
show: true,
position: 'top',
formatter: `{text|${mixData[mixData.length - 1].value[2].toFixed(2)}}`,
rich: {
text: {
color: '#001EFF',
fontSize: 12,
fontWeight: 'bold',
textBorderColor: '#ffffff',
textBorderWidth: 2,
}
},
offset: [20, 10]
}
}
}
]
}
},
{
name: '最高价',
type: 'line',
symbol: 'none',
lineStyle: {
normal: {
color: 'transparent',
width: 0
}
},
markPoint: {
symbol: 'circle',
symbolSize: 1,
data: [
{
coord: [mixData.length - 1, mixData[mixData.length - 1].value[3]],
itemStyle: {
color: 'transparent'
},
label: {
normal: {
show: true,
position: 'bottom',
formatter: `{text|${mixData[mixData.length - 1].value[3].toFixed(2)}}`,
rich: {
text: {
color: '#FF0000',
fontSize: 12,
fontWeight: 'bold',
textBorderColor: '#ffffff',
textBorderWidth: 2,
}
},
offset: [20, -10]
}
}
}
]
}
}
], ],
grid: { grid: {
left: "7%", left: "7%",

6
src/views/components/emotionDecod.vue

@ -251,7 +251,7 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
shadowOffsetX: 2, shadowOffsetX: 2,
shadowOffsetY: 2, shadowOffsetY: 2,
}, },
bottom: "10%", //
bottom: window.innerWidth > 768 ? "10%" : "5%", //
}, },
{ {
show: !1, show: !1,
@ -457,7 +457,7 @@ onBeforeUnmount(() => {
width: 100%; width: 100%;
height: 800px; height: 800px;
margin: 0; margin: 0;
top: 5rem;
/* top: 5rem; */
box-sizing: border-box; box-sizing: border-box;
overflow: hidden; overflow: hidden;
} }
@ -468,7 +468,7 @@ onBeforeUnmount(() => {
width: 100%; width: 100%;
height: 400px; height: 400px;
margin: 0; margin: 0;
top: 5rem;
/* top: 5rem; */
} }
.qxjmqbox { .qxjmqbox {

19
src/views/components/marketTemperature.vue

@ -698,7 +698,7 @@ defineExpose({ initChart });
} }
.market-temperature { .market-temperature {
min-height: 100vh;
/* min-height: 100vh; */
/* background-color: rgb(0, 22, 65); */ /* background-color: rgb(0, 22, 65); */
} }
@ -707,13 +707,17 @@ defineExpose({ initChart });
/* padding: 20px; */ /* padding: 20px; */
max-width: 80vw; max-width: 80vw;
padding-bottom: 10%; padding-bottom: 10%;
display:flex;
flex-direction:column;
justify-content:center;
align-items:center;
} }
.border3 { .border3 {
margin-top: 40px; margin-top: 40px;
border-radius: 8px; border-radius: 8px;
padding: 20px; padding: 20px;
margin-left: 0;
/* margin-left: 0; */
width: 100%; width: 100%;
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;
@ -725,7 +729,7 @@ defineExpose({ initChart });
border-radius: 8px; border-radius: 8px;
padding: 20px; padding: 20px;
width: 80%; width: 80%;
margin-left: 8%;
/* margin-left: 8%; */
height: 48vw; height: 48vw;
overflow: visible; overflow: visible;
} }
@ -747,6 +751,11 @@ defineExpose({ initChart });
/* 手机端适配样式 */ /* 手机端适配样式 */
@media only screen and (max-width: 768px) { @media only screen and (max-width: 768px) {
.container{
padding-bottom:16%
}
.KlineClass { .KlineClass {
width: 100%; width: 100%;
height: 300px; height: 300px;
@ -786,8 +795,8 @@ defineExpose({ initChart });
.border3 { .border3 {
margin-top: 25px; margin-top: 25px;
border-radius: 8px; border-radius: 8px;
padding: 20px;
margin-left: -13px;
padding: 10px 0px;
/* margin-left: -13px; */
width: 100%; width: 100%;
height: 100%; height: 100%;
} }

2
src/views/homePage.vue

@ -251,7 +251,7 @@ const tabContent = ref(null);
const isScrolling = ref(false); // const isScrolling = ref(false); //
const smoothScrollToBottom = async () => { const smoothScrollToBottom = async () => {
console.log("调用滚动到底部的方法");
// console.log("");
// await nextTick(); // await nextTick();
const container = tabContent.value; const container = tabContent.value;
// console.log(container, 'container') // console.log(container, 'container')

Loading…
Cancel
Save