Browse Source

Merge branch 'milestone-20250710-上线前优化' of http://39.101.133.168:8807/hongxilin/AIxiaocaishen into milestone-20250710-上线前优化

dev
宋杰 8 hours ago
parent
commit
4ab669b826
  1. 33
      src/views/AIchat.vue
  2. 8
      src/views/Selectmodel.vue
  3. 38
      src/views/components/HistoryRecord.vue
  4. 157
      src/views/homePage.vue

33
src/views/AIchat.vue

@ -111,7 +111,7 @@ const playNextAudio = () => {
src: [audioInfo.url], src: [audioInfo.url],
html5: false, html5: false,
format: ["mp3", "acc"], format: ["mp3", "acc"],
// rate: 1.2,
// rate: 2,
retryCount: 0, retryCount: 0,
onplay: () => { onplay: () => {
audioStore.isPlaying = true; audioStore.isPlaying = true;
@ -214,7 +214,6 @@ const addToAudioQueue = (url, name) => {
"当前队列顺序:", "当前队列顺序:",
audioQueue.value.map((item) => `${item.name}(${item.order})`) audioQueue.value.map((item) => `${item.name}(${item.order})`)
); );
// //
if ( if (
!isPlayingAudio.value && !isPlayingAudio.value &&
@ -275,6 +274,12 @@ const toggleVoiceForUser = (index) => {
chatStore.messages[chatStore.currentUserIndex].audioStatus = false; chatStore.messages[chatStore.currentUserIndex].audioStatus = false;
} }
//
if (audioStore.soundInstance) {
audioStore.soundInstance.stop();
audioStore.soundInstance = null;
}
audioPreloadStatus.one = { loaded: false, url: null }; audioPreloadStatus.one = { loaded: false, url: null };
audioPreloadStatus.two = { loaded: false, url: null }; audioPreloadStatus.two = { loaded: false, url: null };
audioPreloadStatus.three = { loaded: false, url: null }; audioPreloadStatus.three = { loaded: false, url: null };
@ -301,20 +306,22 @@ const toggleVoiceForUser = (index) => {
audioStore.soundInstance = null; audioStore.soundInstance = null;
currentPlayIndex = 0; currentPlayIndex = 0;
isCallingPlayNext = false; isCallingPlayNext = false;
addToAudioQueue(chatStore.messages[index].audioArray[0], "API1-第一个");
addToAudioQueue(chatStore.messages[index].audioArray[1], "API2-第二个");
addToAudioQueue(chatStore.messages[index].audioArray[2], "API3-第三个");
addToAudioQueue(chatStore.messages[index].audioArray[3], "API4-第四个");
setTimeout(() => {
addToAudioQueue(chatStore.messages[index].audioArray[0], "API1-第一个");
addToAudioQueue(chatStore.messages[index].audioArray[1], "API2-第二个");
addToAudioQueue(chatStore.messages[index].audioArray[2], "API3-第三个");
addToAudioQueue(chatStore.messages[index].audioArray[3], "API4-第四个");
if (!audioStore.isVoiceEnabled) {
audioStore.toggleVoice();
} else {
if (audioStore.currentAudioUrl || audioStore.ttsUrl) {
audioStore.togglePlayPause();
} else {
if (!audioStore.isVoiceEnabled) {
audioStore.toggleVoice(); audioStore.toggleVoice();
} else {
if (audioStore.currentAudioUrl || audioStore.ttsUrl) {
// audioStore.togglePlayPause();
} else {
audioStore.toggleVoice();
}
} }
}
}, 100); // 100ms
} else { } else {
if (!audioStore.isVoiceEnabled) { if (!audioStore.isVoiceEnabled) {
console.log("1111"); console.log("1111");

8
src/views/Selectmodel.vue

@ -55,10 +55,10 @@ onMounted(() => {
decodeURIComponent(String(getQueryVariable("token"))) decodeURIComponent(String(getQueryVariable("token")))
); );
localStorage.setItem(
"localToken",
"pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q"
);
// localStorage.setItem(
// "localToken",
// "pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q"
// );
}); });
const goToDBQBmodel = () => { const goToDBQBmodel = () => {

38
src/views/components/HistoryRecord.vue

@ -396,6 +396,8 @@ import moment from "moment";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { useChatStore } from "../../store/chat"; import { useChatStore } from "../../store/chat";
const chatStore = useChatStore(); const chatStore = useChatStore();
import { useDataStore } from "@/store/dataList.js";
const dataStore = useDataStore();
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
const router = useRouter(); const router = useRouter();
@ -405,12 +407,8 @@ const props = defineProps({
type: String, type: String,
default: "AIchat", // 'AIchat' 'AiEmotion' default: "AIchat", // 'AIchat' 'AiEmotion'
}, },
isMobile: {
type: Boolean,
default: false,
},
}); });
const isMobile = ref(null);
// Emits // Emits
const emit = defineEmits([ const emit = defineEmits([
"selectRecord", "selectRecord",
@ -440,7 +438,7 @@ const dialogWidth = ref("500px"); // 对话框动态宽度
// //
const computedDialogWidth = computed(() => { const computedDialogWidth = computed(() => {
if (props.isMobile) {
if (isMobile.value) {
return "70%"; // 使 return "70%"; // 使
} }
return dialogWidth.value; // 使 return dialogWidth.value; // 使
@ -485,20 +483,15 @@ const getHistoryList = async (params) => {
// "emotionTirstFlag", // "emotionTirstFlag",
// emotionTirstFlag // emotionTirstFlag
// ); // );
const userAgent = navigator.userAgent;
const isMobile =
!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
userAgent
);
if (chatFirstFlag && params.model == 1 && result.data.length != 0) { if (chatFirstFlag && params.model == 1 && result.data.length != 0) {
if (isMobile) {
if (!isMobile.value) {
chatStore.aiChatCall = true; chatStore.aiChatCall = true;
} }
chatFirstFlag = false; chatFirstFlag = false;
} }
if (emotionTirstFlag && params.model == 2 && result.data.length != 0) { if (emotionTirstFlag && params.model == 2 && result.data.length != 0) {
if (isMobile) {
if (!isMobile.value) {
chatStore.aiEmotionCall = true; chatStore.aiEmotionCall = true;
} }
emotionTirstFlag = false; emotionTirstFlag = false;
@ -506,13 +499,17 @@ const getHistoryList = async (params) => {
// chatStore // chatStore
if (isMobile) {
if (isMobile.value) {
console.log("移动设备默认关闭");
isCollapsed.value = true; isCollapsed.value = true;
} else { } else {
if (props.currentType == "AIchat" && chatFirstFlag) {
console.log("pc设备进行判断");
if (props.currentType == "AIchat") {
isCollapsed.value = !chatStore.aiChatCall; isCollapsed.value = !chatStore.aiChatCall;
} else if (props.currentType == "AiEmotion" && emotionTirstFlag) {
console.log("夺宝奇兵页面", isCollapsed.value);
} else if (props.currentType == "AiEmotion") {
isCollapsed.value = !chatStore.aiEmotionCall; isCollapsed.value = !chatStore.aiEmotionCall;
console.log("情绪大模型页面", isCollapsed.value);
} }
} }
// //
@ -674,7 +671,7 @@ const selectRecord = async (record) => {
}); });
if (result && result.data) { if (result && result.data) {
if (props.isMobile) {
if (isMobile.value) {
// //
isCollapsed.value = true; isCollapsed.value = true;
if (props.currentType == "AIchat") { if (props.currentType == "AIchat") {
@ -683,6 +680,7 @@ const selectRecord = async (record) => {
chatStore.aiEmotionCall = false; chatStore.aiEmotionCall = false;
} }
} }
dataStore.isFeedback = false;
historyData.value = result.data; historyData.value = result.data;
chatStore.dbqbClickRecord = historyData.value; chatStore.dbqbClickRecord = historyData.value;
// //
@ -782,6 +780,12 @@ defineExpose({
// //
onMounted(() => { onMounted(() => {
const userAgent = navigator.userAgent;
isMobile.value =
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
userAgent
);
getHistoryList({ getHistoryList({
model: props.currentType == "AIchat" ? 1 : 2, model: props.currentType == "AIchat" ? 1 : 2,
token: localStorage.getItem("localToken"), token: localStorage.getItem("localToken"),

157
src/views/homePage.vue

@ -214,8 +214,8 @@ watch(
watch( watch(
() => chatStore.chatInput, () => chatStore.chatInput,
async (newVal) => { async (newVal) => {
if(activeTab.value=='AIchat'){
isInputDisabled.value=chatStore.chatInput;
if (activeTab.value == "AIchat") {
isInputDisabled.value = chatStore.chatInput;
} }
} }
); );
@ -223,8 +223,8 @@ watch(
watch( watch(
() => chatStore.emotionInput, () => chatStore.emotionInput,
async (newVal) => { async (newVal) => {
if(activeTab.value=='AiEmotion'){
isInputDisabled.value=chatStore.emotionInput;
if (activeTab.value == "AiEmotion") {
isInputDisabled.value = chatStore.emotionInput;
} }
} }
); );
@ -886,6 +886,29 @@ const backToHome = () => {
} }
}; };
// 8.18Token start
const userInfo = ref({
username: "HomilyLink",
jwcode: "90042088",
});
const changeRule = ref("1金币=1Token");
const changeLevelList = ref([
{ gold: 10, token: 10 },
{ gold: 20, token: 20 },
{ gold: 50, token: 50 },
{ gold: 100, token: 100 },
{ gold: 200, token: 200 },
{ gold: 500, token: 500 },
{ gold: 1000, token: 1000 },
]);
const shouldPay=ref(0);
const gold=ref(0);
// 8.18Token end
onMounted(async () => { onMounted(async () => {
throttledJudgeDevice(); throttledJudgeDevice();
// //
@ -1209,26 +1232,34 @@ onUnmounted(() => {
<!-- 弹窗 --> <!-- 弹窗 -->
<!-- 新增弹窗组件 --> <!-- 新增弹窗组件 -->
<el-dialog v-model="dialogVisible" max-width="65%"> <el-dialog v-model="dialogVisible" max-width="65%">
<!-- 自定义标题插槽实现居中显示 -->
<template #header>
<div style="text-align: center">
<span>活动规则</span>
</div>
</template>
<!-- 中间内容部分 --> <!-- 中间内容部分 -->
<div class="ruleContent">
<p>试运行期间AI小财神可以检索全市场数据</p>
<p>每个市场20支股票股票详情参见公告页面</p>
<!-- <p>弘历会员每人每日拥有10次检索机会</p> -->
<div class="changeMsg">
<div class="changeInfo">
<div class="changeImg">
<img
src="https://d31zlh4on95l9h.cloudfront.net/images/74e20c65c9ef2526477c63ad68698a50.png"
alt="头像"
/>
</div>
<div class="changeContent">
<div class="changeUsername">{{ userInfo.username }}</div>
<div class="changeJwcode">精网号{{ userInfo.jwcode }}</div>
</div>
</div>
<div class="changeRule">兑换规则{{ changeRule }}</div>
</div>
<div class="changeLevel">
<div class="changeLevelTitle">兑换Token</div>
<div class="changeLevelItems"></div>
</div> </div>
<!-- <template #footer> -->
<!-- 添加一个div来包裹按钮并设置样式使其居中 -->
<!-- <div style="text-align: center"> -->
<!-- <el-button style="background-color: orange; color: white; border: none" @click="goToRecharge"> -->
<!-- 去充值 -->
<!-- </el-button> -->
<!-- </div> -->
<!-- </template> -->
<div class="changeNow">
应付金额
<div class="changePay">{{ shouldPay }}</div>
(金币余额{{ gold }})
</div>
<div class="changeBtn">立即兑换</div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -1283,9 +1314,9 @@ onUnmounted(() => {
/* 添加平滑滚动效果 */ /* 添加平滑滚动效果 */
} }
/* .pcTabContent {
margin: 0 6%;
} */
.pcTabContent {
padding: 0 6%;
}
@media (max-width: 768px) { @media (max-width: 768px) {
.tab-container { .tab-container {
@ -1803,7 +1834,81 @@ body {
} }
} }
.ruleContent {
.changeMsg {
display: flex;
width: 100%;
margin-bottom: 30px;
}
.changeInfo {
display: flex;
background-color: #f8f8f8;
border-radius: 5px;
padding: 10px 20px;
/* width: 40%; */
margin-right: 5%;
white-space: nowrap;
}
.changeImg {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.changeContent {
display: flex;
flex-direction: column;
font-weight: bold;
}
.changeRule {
display: flex;
background-color: #f8f8f8;
border-radius: 5px;
text-align: center; text-align: center;
align-items: center;
justify-content: center;
color: #4e86fe;
white-space: nowrap;
padding: 5px;
width: 40%;
}
.changeLevel {
display: flex;
flex-direction: column;
}
.changeLevelTitle {
font-weight: bold;
}
.changeNow {
display: flex;
white-space: nowrap;
/* font-weight: bold; */
margin-bottom: 15px;
}
.changePay {
color: #4e86fe;
margin: 0px 5px;
}
.changeBtn {
width: 40%;
background-color: #4e86fe;
color: white;
display: flex;
justify-content: center;
align-content: center;
padding: 10px;
border-radius: 5px;
cursor: pointer;
}
.changeBtn:hover {
background-color: #3a73e6;
} }
</style> </style>
Loading…
Cancel
Save