chore: update dev token and refactor ChatMainList

update development token in .env.development
clean up imports in ChatMainList component, merge api imports
switch event listeners to use emitter utility and enable SEND_MESSAGE_COMMAND_TYPE handler
remove outdated commented onReady code block
This commit is contained in:
DEV_DSW
2026-06-01 10:45:36 +08:00
parent 1307c53c0b
commit 7a044e6716
2 changed files with 24 additions and 45 deletions

View File

@@ -138,7 +138,15 @@
import { onMounted, nextTick, onUnmounted, ref } from "vue";
import { emitter } from '@/utils/events'
import { MessageRole, MessageType, CompName, Command } from "@/constants/ChatModel";
import {
SWITCH_TO_COMPANION_TAB,
SWITCH_TO_DISCOVERY_TAB,
SCROLL_TO_BOTTOM,
SEND_MESSAGE_CONTENT_TEXT,
SEND_MESSAGE_COMMAND_TYPE,
NOTICE_EVENT_LOGOUT,
NOTICE_EVENT_LOGIN_SUCCESS,
} from "@/constants/constant";
import Welcome from "../Welcome/index.vue";
import AiTabSwitch from "../AiTabSwitch/index.vue";
import Discovery from "../Discovery/index.vue";
@@ -150,7 +158,6 @@ import ChatCardMine from "../ChatCardMine/index.vue";
import ChatCardOther from "../ChatCardOther/index.vue";
import ChatQuickAccess from "../ChatQuickAccess/index.vue";
import ChatInputArea from "../ChatInputArea/index.vue";
import QuickBookingComponent from "../QuickBookingComponent/index.vue";
import DiscoveryCardComponent from "../DiscoveryCardComponent/index.vue";
import ActivityListComponent from "../ActivityListComponent/index.vue";
@@ -160,24 +167,15 @@ import DetailCardCompontent from "../DetailCardCompontent/index.vue";
import OpenMapComponent from "../OpenMapComponent/index.vue";
import AnswerComponent from "../AnswerComponent/index.vue";
import GeneratorPhotoComponent from "../GeneratorPhotoComponent/index.vue";
import LongTextGuideCardPreview from "../LongTextGuideCardPreview/index.vue";
import CreateServiceOrder from "@/components/CreateServiceOrder/index.vue";
import Feedback from "@/components/Feedback/index.vue";
import AddCarCrad from "@/components/AddCarCrad/index.vue";
import SurveyQuestionnaire from "@/components/SurveyQuestionnaire/index.vue";
import { mainPageData } from "@/api/home";
import {
conversationMsgList,
recentConversation,
} from "@/api/home";
import { mainPageData, conversationMsgList, recentConversation } from "@/api/home";
import WebSocketManager from "@/utils/WebSocketManager";
import { IdUtils } from "@/utils/IdUtils";
import {
appendLongTextChunk,
createLongTextData,
} from "@/constants/longTextCard";
import { appendLongTextChunk, createLongTextData } from "@/constants/longTextCard";
import { checkToken } from "@/hooks/useGoLogin";
import { useAppStore } from "@/store";
import { getAccessToken } from "@/constants/token";
@@ -429,64 +427,45 @@ const sendMessageAction = (inputText) => {
/// 添加通知
const addNoticeListener = () => {
// uni.$on(NOTICE_EVENT_LOGIN_SUCCESS, () => {
// emitter.on(NOTICE_EVENT_LOGIN_SUCCESS, () => {
// if (!isWsConnected()) {
// initHandler();
// }
// });
// uni.$on(NOTICE_EVENT_LOGOUT, () => {
// emitter.on(NOTICE_EVENT_LOGOUT, () => {
// resetConfig();
// });
// uni.$on(SCROLL_TO_BOTTOM, () => {
// emitter.on(SCROLL_TO_BOTTOM, () => {
// setTimeout(() => {
// scrollToBottom(true);
// }, 200);
// });
// uni.$on(SEND_MESSAGE_CONTENT_TEXT, (value) => {
// emitter.on(SEND_MESSAGE_CONTENT_TEXT, (value) => {
// console.log("SEND_MESSAGE_CONTENT_TEXT:", value);
// if (value && value.length > 0) {
// handleReplyText(value);
// }
// });
// uni.$on(SEND_MESSAGE_COMMAND_TYPE, (item) => {
// console.log("SEND_MESSAGE_COMMAND_TYPE:", item);
// if (item && item.type) {
// handleReplyInstruct(item);
// }
// });
emitter.on(SEND_MESSAGE_COMMAND_TYPE, (item) => {
console.log("SEND_MESSAGE_COMMAND_TYPE:", item);
if (item && item.type) {
handleReplyInstruct(item);
}
});
// uni.$on(SWITCH_TO_COMPANION_TAB, () => {
// emitter.on(SWITCH_TO_COMPANION_TAB, () => {
// tabIndex.value = 1;
// });
// uni.$on(SWITCH_TO_DISCOVERY_TAB, () => {
// emitter.on(SWITCH_TO_DISCOVERY_TAB, () => {
// tabIndex.value = 0;
// });
};
/// =============生命周期函数↓================
// TODO
// onReady(() => {
// // #ifdef APP-PLUS
// const pages = getCurrentPages();
// const currentPage = pages[pages.length - 1];
// const currentWebdiv = currentPage && currentPage.$getAppWebdiv && currentPage.$getAppWebdiv();
// if (currentWebdiv && currentWebdiv.setStyle) {
// currentWebdiv.setStyle({
// bounce: "none",
// scrollIndicator: "none",
// });
// }
// // #endif
// });
// token存在初始化数据
const initHandler = () => {
console.log("initHandler");