Browse Source

Merge branch 'ds' of http://39.101.133.168:8807/hongxilin/AIxiaocaishen into ds

songjie/feature-20250628160649-上线前优化
宋杰 5 days ago
parent
commit
8832be2e77
  1. BIN
      src/assets/img/AIchat/圈.png
  2. 110
      src/views/AIchat.vue

BIN
src/assets/img/AIchat/圈.png

After

Width: 640  |  Height: 640  |  Size: 494 KiB

110
src/views/AIchat.vue

@ -30,7 +30,7 @@ import title3 from "@/assets/img/AIchat/攻防三维.png";
import title4 from "@/assets/img/AIchat/综合作战.png"; import title4 from "@/assets/img/AIchat/综合作战.png";
import logo1 from "@/assets/img/AIchat/夺宝奇兵logo.png"; import logo1 from "@/assets/img/AIchat/夺宝奇兵logo.png";
import logo2 from "@/assets/img/AIchat/开启无限财富.png"; import logo2 from "@/assets/img/AIchat/开启无限财富.png";
import bgc from "@/assets/img/AIchat/圈.png";
const chatStore = useChatStore(); const chatStore = useChatStore();
const audioStore = useAudioStore(); const audioStore = useAudioStore();
const dataStore = useDataStore(); const dataStore = useDataStore();
@ -139,7 +139,7 @@ const pauseAudio = () => {
// //
const playAudioSequence = (audioUrls) => { const playAudioSequence = (audioUrls) => {
console.log('playAudioSequence被调用,参数:', audioUrls);
console.log("playAudioSequence被调用,参数:", audioUrls);
if (!audioUrls || audioUrls.length === 0) { if (!audioUrls || audioUrls.length === 0) {
console.warn("音频URL列表为空,跳过播放"); console.warn("音频URL列表为空,跳过播放");
return; return;
@ -164,7 +164,12 @@ const playAudioSequence = (audioUrls) => {
const currentUrl = audioSequence[currentIndex]; const currentUrl = audioSequence[currentIndex];
console.log(`正在播放第${currentIndex + 1}个音频:`, currentUrl); console.log(`正在播放第${currentIndex + 1}个音频:`, currentUrl);
console.log('音频URL有效性检查:', !!currentUrl, '长度:', currentUrl?.length);
console.log(
"音频URL有效性检查:",
!!currentUrl,
"长度:",
currentUrl?.length
);
// URL // URL
audioStore.setCurrentAudioUrl(currentUrl); audioStore.setCurrentAudioUrl(currentUrl);
@ -1163,44 +1168,55 @@ watch(
// }); // });
} }
} }
// API // API
if (apiStatus.one.completed && apiStatus.two.completed && apiStatus.three.completed && apiStatus.four.completed && apiStatus.four.executed) {
console.log('所有API已完成,开始收集音频URL');
if (
apiStatus.one.completed &&
apiStatus.two.completed &&
apiStatus.three.completed &&
apiStatus.four.completed &&
apiStatus.four.executed
) {
console.log("所有API已完成,开始收集音频URL");
// URL // URL
const audioUrls = []; const audioUrls = [];
console.log('API返回结果检查:');
console.log('result21:', result21);
console.log('result22:', result22);
console.log('result23:', result23);
console.log('result24:', result24);
console.log("API返回结果检查:");
console.log("result21:", result21);
console.log("result22:", result22);
console.log("result23:", result23);
console.log("result24:", result24);
if (result21?.data?.url) { if (result21?.data?.url) {
console.log('添加result21音频URL:', result21.data.url);
console.log("添加result21音频URL:", result21.data.url);
audioUrls.push(result21.data.url.trim()); audioUrls.push(result21.data.url.trim());
} }
if (result22?.data?.url) { if (result22?.data?.url) {
console.log('添加result22音频URL:', result22.data.url);
console.log("添加result22音频URL:", result22.data.url);
audioUrls.push(result22.data.url.trim()); audioUrls.push(result22.data.url.trim());
} }
if (result23?.data?.url) { if (result23?.data?.url) {
console.log('添加result23音频URL:', result23.data.url);
console.log("添加result23音频URL:", result23.data.url);
audioUrls.push(result23.data.url.trim()); audioUrls.push(result23.data.url.trim());
} }
if (result24?.data?.url) { if (result24?.data?.url) {
console.log('添加result24音频URL:', result24.data.url);
console.log("添加result24音频URL:", result24.data.url);
audioUrls.push(result24.data.url.trim()); audioUrls.push(result24.data.url.trim());
} }
console.log('收集到的音频URLs:', audioUrls);
console.log('语音是否启用:', audioStore.isVoiceEnabled);
console.log("收集到的音频URLs:", audioUrls);
console.log("语音是否启用:", audioStore.isVoiceEnabled);
// //
if (audioUrls.length > 0 && audioStore.isVoiceEnabled) { if (audioUrls.length > 0 && audioStore.isVoiceEnabled) {
console.log('开始播放音频序列');
console.log("开始播放音频序列");
playAudioSequence(audioUrls); playAudioSequence(audioUrls);
} else { } else {
console.log('跳过音频播放 - audioUrls长度:', audioUrls.length, '语音启用状态:', audioStore.isVoiceEnabled);
console.log(
"跳过音频播放 - audioUrls长度:",
audioUrls.length,
"语音启用状态:",
audioStore.isVoiceEnabled
);
} }
} }
}; };
@ -3016,7 +3032,7 @@ onMounted(() => {
console.log("组件挂载完成"); console.log("组件挂载完成");
// //
document.addEventListener('visibilitychange', handleVisibilityChange);
document.addEventListener("visibilitychange", handleVisibilityChange);
// DOM // DOM
const observer = new MutationObserver((mutations) => { const observer = new MutationObserver((mutations) => {
@ -3046,7 +3062,7 @@ const handleVisibilityChange = () => {
if (audioStore.isPlaying) { if (audioStore.isPlaying) {
wasPlayingBeforeHidden = true; wasPlayingBeforeHidden = true;
audioStore.pause(); audioStore.pause();
console.log('页面切换离开,音频已暂停');
console.log("页面切换离开,音频已暂停");
} else { } else {
wasPlayingBeforeHidden = false; wasPlayingBeforeHidden = false;
} }
@ -3054,25 +3070,23 @@ const handleVisibilityChange = () => {
// //
if (wasPlayingBeforeHidden && !audioStore.isPlaying) { if (wasPlayingBeforeHidden && !audioStore.isPlaying) {
audioStore.play(); audioStore.play();
console.log('页面切换回来,音频已恢复播放');
console.log("页面切换回来,音频已恢复播放");
wasPlayingBeforeHidden = false; wasPlayingBeforeHidden = false;
} }
} }
}; };
// //
onUnmounted(() => { onUnmounted(() => {
// //
document.removeEventListener('visibilitychange', handleVisibilityChange);
document.removeEventListener("visibilitychange", handleVisibilityChange);
// //
if (audioStore.isPlaying) { if (audioStore.isPlaying) {
audioStore.stop(); audioStore.stop();
console.log('组件卸载,音频已停止');
console.log("组件卸载,音频已停止");
} }
// //
Object.keys(chartInstancesMap).forEach((key) => { Object.keys(chartInstancesMap).forEach((key) => {
if (chartInstancesMap[key]) { if (chartInstancesMap[key]) {
@ -3094,7 +3108,8 @@ onUnmounted(() => {
<div class="chat-container"> <div class="chat-container">
<!-- GIF区域 --> <!-- GIF区域 -->
<div class="gif-area"> <div class="gif-area">
<img :src="logo1" alt="夺宝奇兵大模型logo" />
<img :src="bgc" alt="夺宝奇兵大模型logo" class="bgc" />
<img :src="logo1" alt="夺宝奇兵大模型logo" class="logo1" />
<img :src="logo2" alt="夺宝奇兵大模型logo" class="logo2" /> <img :src="logo2" alt="夺宝奇兵大模型logo" class="logo2" />
</div> </div>
@ -3177,8 +3192,29 @@ onUnmounted(() => {
</template> </template>
<style scoped> <style scoped>
.bgc {
position: absolute;
z-index: -1;
max-width: 530px;
min-width: 340px;
width: 40%;
height: auto;
/* right: 30px; */
/* top: -30px; */
}
.logo1 {
position: relative;
max-width: 350px;
min-width: 200px;
width: 25%;
}
.logo2 { .logo2 {
margin-top: 20px; margin-top: 20px;
max-width: 350px;
min-width: 200px;
width: 30%;
/* position: relative; */
} }
.chat-container { .chat-container {
@ -3188,6 +3224,7 @@ onUnmounted(() => {
} }
.gif-area { .gif-area {
padding: 70px 0px;
/* position: relative; */ /* position: relative; */
/* height: 30vh; */ /* height: 30vh; */
display: flex; display: flex;
@ -3195,19 +3232,20 @@ onUnmounted(() => {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-shrink: 0; flex-shrink: 0;
/* 防止GIF区域被压缩 */ /* 防止GIF区域被压缩 */
} }
.gif-area img { .gif-area img {
width: 30%;
/* width: 30%; */
/* 改为百分比单位 */ /* 改为百分比单位 */
min-width: 200px;
/* min-width: 200px; */
/* 最小尺寸 */ /* 最小尺寸 */
max-width: 400px;
/* max-width: 400px; */
/* 最大尺寸 */ /* 最大尺寸 */
height: auto;
left: 50%;
transition: all 0.3s;
/* height: auto; */
/* left: 50%; */
/* transition: all 0.3s; */
/* 添加过渡效果 */ /* 添加过渡效果 */
} }

Loading…
Cancel
Save