Browse Source

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

master
no99 3 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,
chartData: [],
kLineData: [],
dbqbClickRecord:{},
dbqbClickRecord: {},
searchRecord: false,
currentUserIndex: null,
announcementMsg: null,
}),
actions: {
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 { useDataStore } from "@/store/dataList.js";
const dataStore = useDataStore();
import { useChatStore } from "../store/chat";
const chatStore = useChatStore();
const marketList = ref({
usa: "美股",
cn: "A股",
@ -72,14 +73,11 @@ const handleVideoPlay = () => {
//
};
//
const emit = defineEmits(["updateMessage", "ensureAIchat"]);
const clickCode = (code) => {
console.log(code);
emit("updateMessage", code);
emit("ensureAIchat");
chatStore.announcementMsg = code;
console.log("chatStore.announcementMsg", chatStore.announcementMsg);
dataStore.isFeedback = false;
};
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(
navigator.userAgent
);
const token = getQueryVariable("token");
!isPhone &&
token &&
localStorage.setItem(
"localToken",
decodeURIComponent(String(getQueryVariable("token")))

104
src/views/components/HistoryRecord.vue

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

35
src/views/homePage.vue

@ -174,8 +174,31 @@ const isInputDisabled = ref(false);
//
const updateMessage = (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 () => {
if (
localStorage.getItem("localToken") == null ||
@ -228,6 +251,8 @@ const sendMessage = async () => {
sender: "user",
content: messageContent,
timestamp: new Date().toISOString(),
audioArray: [],
audioStatus: true,
},
];
console.log(messages.value, "messages.value");
@ -236,6 +261,7 @@ const sendMessage = async () => {
//
const enableInput = () => {
console.log("解除禁用");
isInputDisabled.value = false;
};
@ -435,16 +461,16 @@ const heightListener = () => {
if (activeTab.value === "AIchat") {
if (aftertop - befortop > 0) {
// console.log('');
// console.log("");
isScrolling.value = true;
} else {
// console.log('');
// console.log("");
isScrolling.value = true;
}
//
if (isBottom) {
// console.log('');
// console.log("");
isScrolling.value = false;
}
}
@ -616,6 +642,7 @@ onMounted(async () => {
setHeight(document.getElementById("testId")); //
//
await chatStore.getUserCount();
//
throttledSmoothScrollToBottom();
//

Loading…
Cancel
Save