Browse Source

Merge branch 'hongxilin/feature-20250628153758-财神优化:字正确性,一致性等' into milestone-20250710-上线前优化

master
no99 4 days ago
parent
commit
db63264c2b
  1. 6
      src/store/chat.js
  2. 1116
      src/views/AIchat.vue
  3. 12
      src/views/Announcement.vue
  4. 2
      src/views/Selectmodel.vue
  5. 104
      src/views/components/HistoryRecord.vue
  6. 35
      src/views/homePage.vue

6
src/store/chat.js

@ -7,8 +7,10 @@ export const useChatStore = defineStore("chat", {
UserCount: 0, UserCount: 0,
chartData: [], chartData: [],
kLineData: [], kLineData: [],
dbqbClickRecord:{},
dbqbClickRecord: {},
searchRecord: false,
currentUserIndex: null,
announcementMsg: null,
}), }),
actions: { actions: {
async getUserCount() { async getUserCount() {

1116
src/views/AIchat.vue
File diff suppressed because it is too large
View File

12
src/views/Announcement.vue

@ -8,7 +8,8 @@ import {
import back from "../assets/img/Feedback/back.png"; import back from "../assets/img/Feedback/back.png";
import { useDataStore } from "@/store/dataList.js"; import { useDataStore } from "@/store/dataList.js";
const dataStore = useDataStore(); const dataStore = useDataStore();
import { useChatStore } from "../store/chat";
const chatStore = useChatStore();
const marketList = ref({ const marketList = ref({
usa: "美股", usa: "美股",
cn: "A股", cn: "A股",
@ -72,14 +73,11 @@ const handleVideoPlay = () => {
// //
}; };
//
const emit = defineEmits(["updateMessage", "ensureAIchat"]);
const clickCode = (code) => { const clickCode = (code) => {
console.log(code); console.log(code);
emit("updateMessage", code);
emit("ensureAIchat");
chatStore.announcementMsg = code;
console.log("chatStore.announcementMsg", chatStore.announcementMsg);
dataStore.isFeedback = false;
}; };
const feedbackBack = () => { const feedbackBack = () => {

2
src/views/Selectmodel.vue

@ -47,7 +47,9 @@ onMounted(() => {
/phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone/i.test( /phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone/i.test(
navigator.userAgent navigator.userAgent
); );
const token = getQueryVariable("token");
!isPhone && !isPhone &&
token &&
localStorage.setItem( localStorage.setItem(
"localToken", "localToken",
decodeURIComponent(String(getQueryVariable("token"))) decodeURIComponent(String(getQueryVariable("token")))

104
src/views/components/HistoryRecord.vue

@ -18,18 +18,27 @@
@click="openHistory" @click="openHistory"
src="https://d31zlh4on95l9h.cloudfront.net/images/b2d784f8607ab65081f5289459581bfe.png" src="https://d31zlh4on95l9h.cloudfront.net/images/b2d784f8607ab65081f5289459581bfe.png"
alt="icon" alt="icon"
title="打开边栏"
/> />
</div> </div>
<div v-if="isCollapsed" class="collapsed-bottom-container"> <div v-if="isCollapsed" class="collapsed-bottom-container">
<div class="collapsed-bottom-btn" @click="handleFeedbackClick">
<div
class="collapsed-bottom-btn"
@click="handleFeedbackClick"
title="用户反馈"
>
<img <img
class="collapsed-bottom-feedback" class="collapsed-bottom-feedback"
src="https://d31zlh4on95l9h.cloudfront.net/images/41d6e25c19466718d462bcee2f050140.png" src="https://d31zlh4on95l9h.cloudfront.net/images/41d6e25c19466718d462bcee2f050140.png"
alt="icon" alt="icon"
/> />
</div> </div>
<div class="collapsed-bottom-btn" @click="handleAnnouncementClick">
<div
class="collapsed-bottom-btn"
@click="handleAnnouncementClick"
title="公告"
>
<img <img
class="collapsed-bottom-announcement" class="collapsed-bottom-announcement"
src="https://d31zlh4on95l9h.cloudfront.net/images/c51c7fbb68671729801fb10d65bd7789.png" src="https://d31zlh4on95l9h.cloudfront.net/images/c51c7fbb68671729801fb10d65bd7789.png"
@ -55,11 +64,20 @@
@click="closeHistory" @click="closeHistory"
src="https://d31zlh4on95l9h.cloudfront.net/images/b2d784f8607ab65081f5289459581bfe.png" src="https://d31zlh4on95l9h.cloudfront.net/images/b2d784f8607ab65081f5289459581bfe.png"
alt="icon" alt="icon"
title="收起边栏"
/> />
</div> </div>
<!-- 历史记录列表 --> <!-- 历史记录列表 -->
<div class="history-list"> <div class="history-list">
<div v-for="history in categoryHistory" :key="history.name">
<!-- 空状态 -->
<div v-if="historyRecords.length === 0" class="empty-state">
<div class="empty-icon">
<el-icon class="documentDelete"><DocumentDelete /></el-icon>
</div>
<p class="empty-text">暂无历史记录</p>
</div>
<div v-else v-for="history in categoryHistory" :key="history.name">
<div class="categoryName"> <div class="categoryName">
{{ history.name }} {{ history.name }}
</div> </div>
@ -146,25 +164,17 @@
</div> </div>
</div> </div>
</div> </div>
<!-- 空状态 -->
<div v-if="historyRecords.length === 0" class="empty-state">
<div class="empty-icon">
<el-icon class="documentDelete"><DocumentDelete /></el-icon>
</div>
<p class="empty-text">暂无历史记录</p>
</div>
</div> </div>
<div class="bottom-container"> <div class="bottom-container">
<div class="bottom-btn" @click="handleFeedbackClick">
<div class="bottom-btn" @click="handleFeedbackClick" title="用户反馈">
<img <img
class="bottom-feedback" class="bottom-feedback"
src="https://d31zlh4on95l9h.cloudfront.net/images/41d6e25c19466718d462bcee2f050140.png" src="https://d31zlh4on95l9h.cloudfront.net/images/41d6e25c19466718d462bcee2f050140.png"
alt="icon" alt="icon"
/> />
</div> </div>
<div class="bottom-btn" @click="handleAnnouncementClick">
<div class="bottom-btn" @click="handleAnnouncementClick" title="公告">
<img <img
class="bottom-announcement" class="bottom-announcement"
src="https://d31zlh4on95l9h.cloudfront.net/images/c51c7fbb68671729801fb10d65bd7789.png" src="https://d31zlh4on95l9h.cloudfront.net/images/c51c7fbb68671729801fb10d65bd7789.png"
@ -203,7 +213,15 @@
</div> </div>
<!-- 历史记录列表 --> <!-- 历史记录列表 -->
<div class="history-list"> <div class="history-list">
<div v-for="history in categoryHistory" :key="history.name">
<!-- 空状态 -->
<div v-if="historyRecords.length === 0" class="empty-state">
<div class="empty-icon">
<el-icon class="documentDelete"><DocumentDelete /></el-icon>
</div>
<p class="empty-text">暂无历史记录</p>
</div>
<div v-else v-for="history in categoryHistory" :key="history.name">
<div class="categoryName"> <div class="categoryName">
{{ history.name }} {{ history.name }}
</div> </div>
@ -290,18 +308,14 @@
</div> </div>
</div> </div>
</div> </div>
<!-- 空状态 -->
<div v-if="historyRecords.length === 0" class="empty-state">
<div class="empty-icon">
<el-icon class="documentDelete"><DocumentDelete /></el-icon>
</div>
<p class="empty-text">暂无历史记录</p>
</div>
</div> </div>
<div class="mobile-bottom-container"> <div class="mobile-bottom-container">
<div class="mobile-bottom-btn" @click="handleFeedbackClick">
<div
class="mobile-bottom-btn"
@click="handleFeedbackClick"
title="用户反馈"
>
<img <img
class="mobile-bottom-feedback" class="mobile-bottom-feedback"
src="https://d31zlh4on95l9h.cloudfront.net/images/41d6e25c19466718d462bcee2f050140.png" src="https://d31zlh4on95l9h.cloudfront.net/images/41d6e25c19466718d462bcee2f050140.png"
@ -309,7 +323,11 @@
/> />
<div class="mobile-bottom-text">用户反馈</div> <div class="mobile-bottom-text">用户反馈</div>
</div> </div>
<div class="mobile-bottom-btn" @click="handleAnnouncementClick">
<div
class="mobile-bottom-btn"
@click="handleAnnouncementClick"
title="公告"
>
<img <img
class="mobile-bottom-announcement" class="mobile-bottom-announcement"
src="https://d31zlh4on95l9h.cloudfront.net/images/c51c7fbb68671729801fb10d65bd7789.png" src="https://d31zlh4on95l9h.cloudfront.net/images/c51c7fbb68671729801fb10d65bd7789.png"
@ -346,6 +364,9 @@ 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 { useRouter } from "vue-router";
const router = useRouter();
// Props // Props
const props = defineProps({ const props = defineProps({
currentType: { currentType: {
@ -407,12 +428,12 @@ const getHistoryList = async (params) => {
// 2. // 2.
let todayList = remainingRecords.filter((record) => { let todayList = remainingRecords.filter((record) => {
const today = moment().format("YYYY-MM-DD"); const today = moment().format("YYYY-MM-DD");
const recordDate = moment(record.updateTime).format("YYYY-MM-DD");
const recordDate = moment(record.updatedTime).format("YYYY-MM-DD");
return recordDate === today; return recordDate === today;
}); });
remainingRecords = remainingRecords.filter((record) => { remainingRecords = remainingRecords.filter((record) => {
const today = moment().format("YYYY-MM-DD"); const today = moment().format("YYYY-MM-DD");
const recordDate = moment(record.updateTime).format("YYYY-MM-DD");
const recordDate = moment(record.updatedTime).format("YYYY-MM-DD");
return recordDate !== today; return recordDate !== today;
}); });
@ -420,13 +441,13 @@ const getHistoryList = async (params) => {
let recent3DaysList = remainingRecords.filter((record) => { let recent3DaysList = remainingRecords.filter((record) => {
const threeDaysAgo = moment().subtract(3, "days").startOf("day"); const threeDaysAgo = moment().subtract(3, "days").startOf("day");
const yesterday = moment().subtract(1, "days").endOf("day"); const yesterday = moment().subtract(1, "days").endOf("day");
const recordDate = moment(record.updateTime);
const recordDate = moment(record.updatedTime);
return recordDate.isAfter(threeDaysAgo) && recordDate.isBefore(yesterday); return recordDate.isAfter(threeDaysAgo) && recordDate.isBefore(yesterday);
}); });
remainingRecords = remainingRecords.filter((record) => { remainingRecords = remainingRecords.filter((record) => {
const threeDaysAgo = moment().subtract(3, "days").startOf("day"); const threeDaysAgo = moment().subtract(3, "days").startOf("day");
const yesterday = moment().subtract(1, "days").endOf("day"); const yesterday = moment().subtract(1, "days").endOf("day");
const recordDate = moment(record.updateTime);
const recordDate = moment(record.updatedTime);
return !( return !(
recordDate.isAfter(threeDaysAgo) && recordDate.isBefore(yesterday) recordDate.isAfter(threeDaysAgo) && recordDate.isBefore(yesterday)
); );
@ -435,24 +456,24 @@ const getHistoryList = async (params) => {
// 4. 73 // 4. 73
let recent7DaysList = remainingRecords.filter((record) => { let recent7DaysList = remainingRecords.filter((record) => {
const sevenDaysAgo = moment().subtract(7, "days").startOf("day"); const sevenDaysAgo = moment().subtract(7, "days").startOf("day");
const recordDate = moment(record.updateTime);
const recordDate = moment(record.updatedTime);
return recordDate.isAfter(sevenDaysAgo); return recordDate.isAfter(sevenDaysAgo);
}); });
remainingRecords = remainingRecords.filter((record) => { remainingRecords = remainingRecords.filter((record) => {
const sevenDaysAgo = moment().subtract(7, "days").startOf("day"); const sevenDaysAgo = moment().subtract(7, "days").startOf("day");
const recordDate = moment(record.updateTime);
const recordDate = moment(record.updatedTime);
return !recordDate.isAfter(sevenDaysAgo); return !recordDate.isAfter(sevenDaysAgo);
}); });
// 5. 30 // 5. 30
let recent30DaysList = remainingRecords.filter((record) => { let recent30DaysList = remainingRecords.filter((record) => {
const thirtyDaysAgo = moment().subtract(30, "days").startOf("day"); const thirtyDaysAgo = moment().subtract(30, "days").startOf("day");
const recordDate = moment(record.updateTime);
const recordDate = moment(record.updatedTime);
return recordDate.isAfter(thirtyDaysAgo); return recordDate.isAfter(thirtyDaysAgo);
}); });
remainingRecords = remainingRecords.filter((record) => { remainingRecords = remainingRecords.filter((record) => {
const thirtyDaysAgo = moment().subtract(30, "days").startOf("day"); const thirtyDaysAgo = moment().subtract(30, "days").startOf("day");
const recordDate = moment(record.updateTime);
const recordDate = moment(record.updatedTime);
return !recordDate.isAfter(thirtyDaysAgo); return !recordDate.isAfter(thirtyDaysAgo);
}); });
@ -523,6 +544,10 @@ const toggleCollapse = () => {
localStorage.setItem("historyRecordCollapsed", isCollapsed.value); localStorage.setItem("historyRecordCollapsed", isCollapsed.value);
}; };
const backToSelectModel = () => {
router.push("/Selectmodel");
};
const openHistory = () => { const openHistory = () => {
// getHistoryList({ // getHistoryList({
// model: props.currentType == "AIchat" ? 1 : 2, // model: props.currentType == "AIchat" ? 1 : 2,
@ -608,6 +633,19 @@ const handleFeedbackClick = () => {
emit("showFeedback"); emit("showFeedback");
}; };
watch(
() => chatStore.searchRecord,
(newVal) => {
if (chatStore.searchRecord) {
getHistoryList({
model: props.currentType == "AIchat" ? 1 : 2,
token: localStorage.getItem("localToken"),
});
chatStore.searchRecord = false;
}
}
);
// //
defineExpose({ defineExpose({
isCollapsed, isCollapsed,
@ -751,6 +789,7 @@ onMounted(() => {
/* height: 50%; */ /* height: 50%; */
display: flex; display: flex;
justify-content: center; justify-content: center;
cursor: pointer;
/* align-items: center; */ /* align-items: center; */
} }
@ -1002,6 +1041,7 @@ onMounted(() => {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
cursor: pointer;
} }
.mobile-bottom-btn { .mobile-bottom-btn {

35
src/views/homePage.vue

@ -174,8 +174,31 @@ const isInputDisabled = ref(false);
// //
const updateMessage = (title) => { const updateMessage = (title) => {
message.value = title; message.value = title;
// console.log("updateMessage :", title);
console.log("updateMessage 的值:", title);
}; };
watch(
() => chatStore.announcementMsg,
(newVal) => {
console.log("监听到公告改变", chatStore.announcementMsg);
if (chatStore.announcementMsg) {
message.value = chatStore.announcementMsg;
chatStore.announcementMsg = null;
}
}
);
watch(
() => dataStore.isFeedback,
async (newVal) => {
if (!dataStore.isFeedback) {
await nextTick();
//
throttledHeightListener();
}
}
);
const sendMessage = async () => { const sendMessage = async () => {
if ( if (
localStorage.getItem("localToken") == null || localStorage.getItem("localToken") == null ||
@ -228,6 +251,8 @@ const sendMessage = async () => {
sender: "user", sender: "user",
content: messageContent, content: messageContent,
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
audioArray: [],
audioStatus: true,
}, },
]; ];
console.log(messages.value, "messages.value"); console.log(messages.value, "messages.value");
@ -236,6 +261,7 @@ const sendMessage = async () => {
// //
const enableInput = () => { const enableInput = () => {
console.log("解除禁用");
isInputDisabled.value = false; isInputDisabled.value = false;
}; };
@ -435,16 +461,16 @@ const heightListener = () => {
if (activeTab.value === "AIchat") { if (activeTab.value === "AIchat") {
if (aftertop - befortop > 0) { if (aftertop - befortop > 0) {
// console.log('');
// console.log("");
isScrolling.value = true; isScrolling.value = true;
} else { } else {
// console.log('');
// console.log("");
isScrolling.value = true; isScrolling.value = true;
} }
// //
if (isBottom) { if (isBottom) {
// console.log('');
// console.log("");
isScrolling.value = false; isScrolling.value = false;
} }
} }
@ -616,6 +642,7 @@ onMounted(async () => {
setHeight(document.getElementById("testId")); // setHeight(document.getElementById("testId")); //
// //
await chatStore.getUserCount(); await chatStore.getUserCount();
// //
throttledSmoothScrollToBottom(); throttledSmoothScrollToBottom();
// //

Loading…
Cancel
Save