chore: dev proxy config, sprite animator refactor, cleanups
- add vite dev proxy for `/ingress` to forward requests to backend https://onefeel.brother7.cn - update .env.development to use relative proxy paths instead of full backend URLs - move SpriteAnimator component to correct directory, update all imports and global type declarations in components.d.ts - remove unused CSS styles and fix styling for ChatTopNavBar component, including switching to van-icon and hardcoding temporary site name - uncomment and enable the ChatMainList component in home page - clean up unused code, fix formatting, and set default client ID in src/utils/request.ts - comment out redundant uni API calls in ChatMainList to simplify code - update WebSocket URL handling to support relative paths in ChatMainList
This commit is contained in:
@@ -2,10 +2,10 @@
|
|||||||
VITE_APP_ENV = 'development'
|
VITE_APP_ENV = 'development'
|
||||||
|
|
||||||
# API 基础 URL
|
# API 基础 URL
|
||||||
VITE_API_BASE_URL = 'https://onefeel.brother7.cn/ingress'
|
VITE_API_BASE_URL = '/ingress'
|
||||||
|
|
||||||
# API 请求超时时间(毫秒)
|
# API 请求超时时间(毫秒)
|
||||||
VITE_API_TIMEOUT_MS = 10000
|
VITE_API_TIMEOUT_MS = 10000
|
||||||
|
|
||||||
# Socket 基础 URL
|
# Socket 基础 URL
|
||||||
VITE_SOCKET_BASE_URL = "wss://onefeel.brother7.cn/ingress/agent/ws/chat"
|
VITE_SOCKET_BASE_URL = "/ingress/agent/ws/chat"
|
||||||
|
|||||||
4
components.d.ts
vendored
4
components.d.ts
vendored
@@ -39,7 +39,7 @@ declare module 'vue' {
|
|||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
RouterView: typeof import('vue-router')['RouterView']
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
ServiceTipsWord: typeof import('./src/components/ServiceTipsWord/index.vue')['default']
|
ServiceTipsWord: typeof import('./src/components/ServiceTipsWord/index.vue')['default']
|
||||||
SpriteAnimator: typeof import('./src/components/Sprite/SpriteAnimator.vue')['default']
|
SpriteAnimator: typeof import('./src/components/SpriteAnimator/index.vue')['default']
|
||||||
Stepper: typeof import('./src/components/Stepper/index.vue')['default']
|
Stepper: typeof import('./src/components/Stepper/index.vue')['default']
|
||||||
SumCard: typeof import('./src/components/SumCard/index.vue')['default']
|
SumCard: typeof import('./src/components/SumCard/index.vue')['default']
|
||||||
SurveyQuestionnaire: typeof import('./src/components/SurveyQuestionnaire/index.vue')['default']
|
SurveyQuestionnaire: typeof import('./src/components/SurveyQuestionnaire/index.vue')['default']
|
||||||
@@ -83,7 +83,7 @@ declare global {
|
|||||||
const RouterLink: typeof import('vue-router')['RouterLink']
|
const RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
const RouterView: typeof import('vue-router')['RouterView']
|
const RouterView: typeof import('vue-router')['RouterView']
|
||||||
const ServiceTipsWord: typeof import('./src/components/ServiceTipsWord/index.vue')['default']
|
const ServiceTipsWord: typeof import('./src/components/ServiceTipsWord/index.vue')['default']
|
||||||
const SpriteAnimator: typeof import('./src/components/Sprite/SpriteAnimator.vue')['default']
|
const SpriteAnimator: typeof import('./src/components/SpriteAnimator/index.vue')['default']
|
||||||
const Stepper: typeof import('./src/components/Stepper/index.vue')['default']
|
const Stepper: typeof import('./src/components/Stepper/index.vue')['default']
|
||||||
const SumCard: typeof import('./src/components/SumCard/index.vue')['default']
|
const SumCard: typeof import('./src/components/SumCard/index.vue')['default']
|
||||||
const SurveyQuestionnaire: typeof import('./src/components/SurveyQuestionnaire/index.vue')['default']
|
const SurveyQuestionnaire: typeof import('./src/components/SurveyQuestionnaire/index.vue')['default']
|
||||||
|
|||||||
@@ -1,153 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col h-screen relative overflow-hidden">
|
<div class="flex flex-col h-screen relative overflow-hidden">
|
||||||
<!-- 顶部自定义导航栏 -->
|
<!-- 顶部自定义导航栏 -->
|
||||||
<div class="header absolute top-0 left-0 w-full z-10" :style="{ paddingTop: statusBarHeight + 'px' }">
|
<div class="absolute top-0 left-0 w-full z-10">
|
||||||
<ChatTopNavBar ref="topNavBarRef" :mainPageDataModel="mainPageDataModel" @showDrawer="handleShowDrawer" />
|
<ChatTopNavBar ref="topNavBarRef" :mainPageDataModel="mainPageDataModel" @showDrawer="handleShowDrawer" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="relative">
|
|
||||||
<img class="w-full block" :src="mainPageDataModel?.initPageImages?.backgroundImageUrl" mode="aspectFill"
|
|
||||||
style="height: 252px;" />
|
|
||||||
<div class="absolute bottom-0 left-0 right-0 flex-full">
|
|
||||||
<div class="px-12 pt-12">
|
|
||||||
<HomeWelcome :mainPageDataModel="mainPageDataModel" />
|
|
||||||
</div>
|
|
||||||
<div style="margin-bottom: -1px;">
|
|
||||||
<AiTabSwitch v-model="tabIndex" :list="tabList" @change="handleChange" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-show="tabIndex === 0" class="main-scroll-area flex-full overflow-hidden min-height-0"
|
|
||||||
@touchstart.capture="handleScrollAreaTouchStart" @touchstart="handleScrollAreaTouchStart"
|
|
||||||
@touchmove="handleScrollAreaTouchMove">
|
|
||||||
<Discovery @scroll-touch-start="handleScrollAreaTouchStart" @scroll-touch="handleScrollAreaTouchMove" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 消息列表(可滚动区域) -->
|
|
||||||
<div v-show="tabIndex === 1" class="main main-scroll-area flex-full overflow-hidden min-height-0" scroll-y
|
|
||||||
:scroll-top="scrollTop" :scroll-with-animation="true" @scroll="handleScroll" @scrolltolower="handleScrollToLower"
|
|
||||||
@touchstart.capture="handleScrollAreaTouchStart" @touchstart="handleScrollAreaTouchStart"
|
|
||||||
@touchmove="handleScrollAreaTouchMove">
|
|
||||||
|
|
||||||
<div class="area-msg-list-content" v-for="item in chatMsgList" :key="item.msgId" :id="item.msgId">
|
|
||||||
<template v-if="item.msgType === MessageRole.AI">
|
|
||||||
<ChatCardAI class="flex flex-justify-start" :key="`ai-${item.msgId}-${item.msg ? item.msg.length : 0}`" :text="item.componentName && isLongTextCard(item.componentName)
|
|
||||||
? ''
|
|
||||||
: item.msg || ''
|
|
||||||
" :isLoading="item.isLoading">
|
|
||||||
<template #content v-if="
|
|
||||||
item.toolCall ||
|
|
||||||
(item.componentName && isLongTextCard(item.componentName))
|
|
||||||
">
|
|
||||||
<!-- <AnswerComponent
|
|
||||||
v-if="isLongTextCard(item.componentName)"
|
|
||||||
:longTextData="item.longTextData"
|
|
||||||
:finish="item.finish"
|
|
||||||
/> -->
|
|
||||||
|
|
||||||
<LongTextGuideCardPreview v-if="item.componentName && isLongTextCard(item.componentName)"
|
|
||||||
:componentName="item.componentName" />
|
|
||||||
|
|
||||||
<QuickBookingComponent v-if="
|
|
||||||
item.toolCall &&
|
|
||||||
item.toolCall.componentName === CompName.quickBookingCard
|
|
||||||
" />
|
|
||||||
<DiscoveryCardComponent v-else-if="
|
|
||||||
item.toolCall &&
|
|
||||||
item.toolCall.componentName === CompName.discoveryCard
|
|
||||||
" />
|
|
||||||
<CreateServiceOrder v-else-if="
|
|
||||||
item.toolCall &&
|
|
||||||
item.toolCall.componentName === CompName.callServiceCard
|
|
||||||
" :toolCall="item.toolCall" />
|
|
||||||
<OpenMapComponent v-else-if="
|
|
||||||
item.toolCall &&
|
|
||||||
item.toolCall.componentName === CompName.mapCard
|
|
||||||
" />
|
|
||||||
<GeneratorPhotoComponent v-else-if="
|
|
||||||
item.toolCall &&
|
|
||||||
item.toolCall.componentName ===
|
|
||||||
CompName.aigcPhotoGeneratorCard
|
|
||||||
" :toolCall="item.toolCall" />
|
|
||||||
<!-- <ZModuleC01
|
|
||||||
v-else-if="
|
|
||||||
item.toolCall &&
|
|
||||||
item.toolCall.componentName === CompName.aigcPhotoGeneratorCard
|
|
||||||
"
|
|
||||||
/> -->
|
|
||||||
|
|
||||||
<Feedback v-else-if="
|
|
||||||
item.toolCall &&
|
|
||||||
item.toolCall.componentName === CompName.feedbackCard
|
|
||||||
" :toolCall="item.toolCall" />
|
|
||||||
<DetailCardCompontent v-else-if="
|
|
||||||
item.toolCall &&
|
|
||||||
item.toolCall.componentName ===
|
|
||||||
CompName.pictureAndCommodityCard
|
|
||||||
" :toolCall="item.toolCall" />
|
|
||||||
<AddCarCrad v-else-if="
|
|
||||||
item.toolCall &&
|
|
||||||
item.toolCall.componentName === CompName.enterLicensePlateCard
|
|
||||||
" :toolCall="item.toolCall" />
|
|
||||||
<SurveyQuestionnaire v-else-if="
|
|
||||||
item.toolCall &&
|
|
||||||
item.toolCall.componentName ===
|
|
||||||
CompName.callSurveyQuestionnaire
|
|
||||||
" :toolCall="item.toolCall" />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #footer>
|
|
||||||
<!-- 这个是底部 -->
|
|
||||||
<AttachListComponent v-if="item.question" :question="item.question" />
|
|
||||||
</template>
|
|
||||||
</ChatCardAI>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-else-if="item.msgType === MessageRole.ME">
|
|
||||||
<ChatCardMine class="flex flex-justify-end" :text="item.msg" />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-else>
|
|
||||||
<ChatCardOther class="flex flex-justify-center" :text="item.msg">
|
|
||||||
<ChatGuide v-if="chatMsgList.length < 2" />
|
|
||||||
<ActivityListComponent v-if="
|
|
||||||
mainPageDataModel.activityList &&
|
|
||||||
mainPageDataModel.activityList.length > 0
|
|
||||||
" :activityList="mainPageDataModel.activityList" />
|
|
||||||
|
|
||||||
<!-- 先不展示了,等后续有需求再加回来 false -->
|
|
||||||
<RecommendPostsComponent v-if="
|
|
||||||
false &&
|
|
||||||
mainPageDataModel.recommendTheme &&
|
|
||||||
mainPageDataModel.recommendTheme.length > 0
|
|
||||||
" :recommendThemeList="mainPageDataModel.recommendTheme" />
|
|
||||||
</ChatCardOther>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 输入框区域 -->
|
|
||||||
<div class="pb-safe-area">
|
|
||||||
<ChatQuickAccess />
|
|
||||||
<ChatInputArea ref="inputAreaRef" v-model="inputMessage" :holdKeyboard="holdKeyboard"
|
|
||||||
:is-session-active="isSessionActive" :stop-request="stopRequest" @send="sendMessageAction"
|
|
||||||
@noHideKeyboard="handleNoHideKeyboard" @keyboardShow="handleKeyboardShow" @keyboardHide="handleKeyboardHide" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, nextTick, onUnmounted, ref } from "vue";
|
import { onMounted, nextTick, onUnmounted, ref } from "vue";
|
||||||
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 { MessageRole, MessageType, CompName, Command } from "@/constants/ChatModel";
|
import { MessageRole, MessageType, CompName, Command } from "@/constants/ChatModel";
|
||||||
|
|
||||||
import HomeWelcome from "../HomeWelcome/index.vue";
|
import HomeWelcome from "../HomeWelcome/index.vue";
|
||||||
@@ -195,8 +56,7 @@ import { getAccessToken } from "@/constants/token";
|
|||||||
|
|
||||||
const emit = defineEmits(["showDrawer"]);
|
const emit = defineEmits(["showDrawer"]);
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
/// 导航栏相关
|
|
||||||
const statusBarHeight = ref(20);
|
|
||||||
/// 输入框组件引用
|
/// 输入框组件引用
|
||||||
const inputAreaRef = ref(null);
|
const inputAreaRef = ref(null);
|
||||||
const topNavBarRef = ref();
|
const topNavBarRef = ref();
|
||||||
@@ -278,7 +138,7 @@ const handleTouchEnd = () => {
|
|||||||
holdKeyboardTimer.value = setTimeout(() => {
|
holdKeyboardTimer.value = setTimeout(() => {
|
||||||
// 键盘弹出时点击界面则关闭键盘
|
// 键盘弹出时点击界面则关闭键盘
|
||||||
if (holdKeyboardFlag.value && isKeyboardShow.value) {
|
if (holdKeyboardFlag.value && isKeyboardShow.value) {
|
||||||
uni.hideKeyboard();
|
// uni.hideKeyboard();
|
||||||
}
|
}
|
||||||
holdKeyboardFlag.value = true;
|
holdKeyboardFlag.value = true;
|
||||||
}, 100);
|
}, 100);
|
||||||
@@ -319,13 +179,7 @@ const hideKeyboardByScroll = () => {
|
|||||||
inputAreaRef.value.blurInput();
|
inputAreaRef.value.blurInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.hideKeyboard();
|
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
if (typeof plus !== "undefined" && plus.key && plus.key.hideSoftKeybord) {
|
|
||||||
plus.key.hideSoftKeybord();
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const hideKeyboardAfterSend = () => {
|
const hideKeyboardAfterSend = () => {
|
||||||
@@ -338,8 +192,6 @@ const hideKeyboardAfterSend = () => {
|
|||||||
typeof inputAreaRef.value.blurInput === "function"
|
typeof inputAreaRef.value.blurInput === "function"
|
||||||
) {
|
) {
|
||||||
inputAreaRef.value.blurInput();
|
inputAreaRef.value.blurInput();
|
||||||
} else {
|
|
||||||
uni.hideKeyboard();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -439,54 +291,48 @@ const sendMessageAction = (inputText) => {
|
|||||||
|
|
||||||
/// 添加通知
|
/// 添加通知
|
||||||
const addNoticeListener = () => {
|
const addNoticeListener = () => {
|
||||||
uni.$on(NOTICE_EVENT_LOGIN_SUCCESS, () => {
|
// uni.$on(NOTICE_EVENT_LOGIN_SUCCESS, () => {
|
||||||
if (!isWsConnected()) {
|
// if (!isWsConnected()) {
|
||||||
initHandler();
|
// initHandler();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
uni.$on(NOTICE_EVENT_LOGOUT, () => {
|
// uni.$on(NOTICE_EVENT_LOGOUT, () => {
|
||||||
resetConfig();
|
// resetConfig();
|
||||||
});
|
// });
|
||||||
|
|
||||||
uni.$on(SCROLL_TO_BOTTOM, () => {
|
// uni.$on(SCROLL_TO_BOTTOM, () => {
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
scrollToBottom(true);
|
// scrollToBottom(true);
|
||||||
}, 200);
|
// }, 200);
|
||||||
});
|
// });
|
||||||
|
|
||||||
uni.$on(SEND_MESSAGE_CONTENT_TEXT, (value) => {
|
// uni.$on(SEND_MESSAGE_CONTENT_TEXT, (value) => {
|
||||||
console.log("SEND_MESSAGE_CONTENT_TEXT:", value);
|
// console.log("SEND_MESSAGE_CONTENT_TEXT:", value);
|
||||||
if (value && value.length > 0) {
|
// if (value && value.length > 0) {
|
||||||
handleReplyText(value);
|
// handleReplyText(value);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
uni.$on(SEND_MESSAGE_COMMAND_TYPE, (item) => {
|
// uni.$on(SEND_MESSAGE_COMMAND_TYPE, (item) => {
|
||||||
console.log("SEND_MESSAGE_COMMAND_TYPE:", item);
|
// console.log("SEND_MESSAGE_COMMAND_TYPE:", item);
|
||||||
if (item && item.type) {
|
// if (item && item.type) {
|
||||||
handleReplyInstruct(item);
|
// handleReplyInstruct(item);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
uni.$on(SWITCH_TO_COMPANION_TAB, () => {
|
// uni.$on(SWITCH_TO_COMPANION_TAB, () => {
|
||||||
tabIndex.value = 1;
|
// tabIndex.value = 1;
|
||||||
});
|
// });
|
||||||
|
|
||||||
uni.$on(SWITCH_TO_DISCOVERY_TAB, () => {
|
// uni.$on(SWITCH_TO_DISCOVERY_TAB, () => {
|
||||||
tabIndex.value = 0;
|
// tabIndex.value = 0;
|
||||||
});
|
// });
|
||||||
};
|
};
|
||||||
|
|
||||||
/// =============生命周期函数↓================
|
/// =============生命周期函数↓================
|
||||||
// TODO
|
// TODO
|
||||||
// onLoad(() => {
|
|
||||||
// uni.getSystemInfo({
|
|
||||||
// success: (res) => {
|
|
||||||
// statusBarHeight.value = res.statusBarHeight || 20;
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
|
|
||||||
// onReady(() => {
|
// onReady(() => {
|
||||||
// // #ifdef APP-PLUS
|
// // #ifdef APP-PLUS
|
||||||
@@ -548,9 +394,10 @@ const loadConversationMsgList = async () => {
|
|||||||
// 获取首页数据
|
// 获取首页数据
|
||||||
|
|
||||||
const getMainPageData = async () => {
|
const getMainPageData = async () => {
|
||||||
/// 从个渠道获取如二维,没有的时候就返回首页的数据
|
// 从个渠道获取如二维,没有的时候就返回首页的数据
|
||||||
const sceneId = appStore.sceneId || "";
|
const sceneId = appStore.sceneId || "";
|
||||||
const res = await mainPageData({ sceneId });
|
const res = await mainPageData({ sceneId });
|
||||||
|
console.log("🚀 ~ getMainPageData ~ res:", res)
|
||||||
|
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
initData();
|
initData();
|
||||||
@@ -582,7 +429,18 @@ const initWebSocket = async () => {
|
|||||||
|
|
||||||
// 使用配置的WebSocket服务器地址
|
// 使用配置的WebSocket服务器地址
|
||||||
const token = getAccessToken();
|
const token = getAccessToken();
|
||||||
const wsUrl = `${appStore.serverConfig.wssUrl}?access_token=${token}`;
|
const rawWsUrl = appStore.serverConfig.wssUrl;
|
||||||
|
const resolvedWsUrl =
|
||||||
|
typeof rawWsUrl === "string" &&
|
||||||
|
(rawWsUrl.startsWith("ws://") || rawWsUrl.startsWith("wss://"))
|
||||||
|
? rawWsUrl
|
||||||
|
: `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.host}${typeof rawWsUrl === "string"
|
||||||
|
? rawWsUrl.startsWith("/")
|
||||||
|
? rawWsUrl
|
||||||
|
: `/${rawWsUrl}`
|
||||||
|
: ""
|
||||||
|
}`;
|
||||||
|
const wsUrl = `${resolvedWsUrl}?access_token=${token}`;
|
||||||
|
|
||||||
// 初始化WebSocket管理器
|
// 初始化WebSocket管理器
|
||||||
webSocketManager = new WebSocketManager({
|
webSocketManager = new WebSocketManager({
|
||||||
@@ -917,9 +775,9 @@ const sendMessage = async (message, isInstruct = false) => {
|
|||||||
if (!isWsConnected()) {
|
if (!isWsConnected()) {
|
||||||
console.log("WebSocket未连接,尝试重新连接...");
|
console.log("WebSocket未连接,尝试重新连接...");
|
||||||
// 显示加载提示
|
// 显示加载提示
|
||||||
uni.showLoading({
|
// uni.showLoading({
|
||||||
title: "正在连接服务器...",
|
// title: "正在连接服务器...",
|
||||||
});
|
// });
|
||||||
|
|
||||||
// 尝试重新初始化WebSocket连接
|
// 尝试重新初始化WebSocket连接
|
||||||
try {
|
try {
|
||||||
@@ -929,34 +787,34 @@ const sendMessage = async (message, isInstruct = false) => {
|
|||||||
|
|
||||||
// 检查连接是否成功建立
|
// 检查连接是否成功建立
|
||||||
if (!isWsConnected()) {
|
if (!isWsConnected()) {
|
||||||
uni.hideLoading();
|
// uni.hideLoading();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
title: "连接服务器失败,请稍后重试",
|
// title: "连接服务器失败,请稍后重试",
|
||||||
icon: "none",
|
// icon: "none",
|
||||||
});
|
// });
|
||||||
}, 100);
|
}, 100);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.hideLoading();
|
// uni.hideLoading();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("重新连接WebSocket失败:", error);
|
console.error("重新连接WebSocket失败:", error);
|
||||||
uni.hideLoading();
|
// uni.hideLoading();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
title: "连接服务器失败,请稍后重试",
|
// title: "连接服务器失败,请稍后重试",
|
||||||
icon: "none",
|
// icon: "none",
|
||||||
});
|
// });
|
||||||
}, 100);
|
}, 100);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSessionActive.value) {
|
if (isSessionActive.value) {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
title: "请等待当前回复完成",
|
// title: "请等待当前回复完成",
|
||||||
icon: "none",
|
// icon: "none",
|
||||||
});
|
// });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
isSessionActive.value = true;
|
isSessionActive.value = true;
|
||||||
@@ -1230,11 +1088,11 @@ const stopRequest = async () => {
|
|||||||
|
|
||||||
// 组件销毁时清理资源
|
// 组件销毁时清理资源
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
uni.$off(NOTICE_EVENT_LOGIN_SUCCESS);
|
// uni.$off(NOTICE_EVENT_LOGIN_SUCCESS);
|
||||||
uni.$off(SCROLL_TO_BOTTOM);
|
// uni.$off(SCROLL_TO_BOTTOM);
|
||||||
uni.$off(SEND_MESSAGE_CONTENT_TEXT);
|
// uni.$off(SEND_MESSAGE_CONTENT_TEXT);
|
||||||
uni.$off(SEND_MESSAGE_COMMAND_TYPE);
|
// uni.$off(SEND_MESSAGE_COMMAND_TYPE);
|
||||||
uni.$off(NOTICE_EVENT_LOGOUT);
|
// uni.$off(NOTICE_EVENT_LOGOUT);
|
||||||
|
|
||||||
resetConfig();
|
resetConfig();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,32 +1,31 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="border-box h-44 flex flex-items-center pl-12 pr-12">
|
<div class="h-[44px] flex items-center pl-[12px] pr-[12px]">
|
||||||
<div class="nav-icon-button" @tap.stop="showDrawer">
|
<div class="w-[44px] h-[44px] flex items-center justify-center" @tap.stop="showDrawer">
|
||||||
<uni-icons type="bars" size="24" color="#ffffff" />
|
<van-icon name="apps-o" size="24" color="#333" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 隐藏 -->
|
<!-- 隐藏 -->
|
||||||
<div v-if="false" class="flex-full h-full flex flex-items-center flex-justify-center">
|
<div v-if="false" class="flex-1 h-full flex items-center justify-center">
|
||||||
<!-- ChatTopWelcome不在可视区:显示并添加动画;在可视区:隐藏 -->
|
<!-- ChatTopWelcome不在可视区:显示并添加动画;在可视区:隐藏 -->
|
||||||
<SpriteAnimator v-show="show" class="image-animated" :src="spriteStyle.ipSmallImage"
|
<SpriteAnimator v-show="show" class="image-animated" :src="spriteStyle.ipSmallImage"
|
||||||
:frameWidth="spriteStyle.frameWidth" :frameHeight="spriteStyle.frameHeight"
|
:frameWidth="spriteStyle.frameWidth" :frameHeight="spriteStyle.frameHeight"
|
||||||
:totalFrames="spriteStyle.totalFrames" :columns="spriteStyle.columns" :displayWidth="spriteStyle.displayWidth"
|
:totalFrames="spriteStyle.totalFrames" :columns="spriteStyle.columns" :displayWidth="spriteStyle.displayWidth"
|
||||||
:fps="16" />
|
:fps="16" />
|
||||||
<span v-show="show" :class="[
|
<span v-show="show" :class="[
|
||||||
'font-size-14 font-500 color-171717 ml-10',
|
'text-[14px] text-500 text-[#171717] ml-[10px]',
|
||||||
{ 'text-animated': show },
|
{ 'text-animated': show },
|
||||||
]">
|
]">
|
||||||
{{ config.name }}
|
nianxx
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="w-24 h-24"></div>
|
<div class="w-[24px] h-[24px]"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, defineProps, computed, defineExpose } from "vue";
|
import { ref, defineProps, computed, defineExpose } from "vue";
|
||||||
import { getCurrentConfig } from "@/constants/base";
|
import SpriteAnimator from "@/components/SpriteAnimator/index.vue";
|
||||||
import SpriteAnimator from "@/components/Sprite/SpriteAnimator.vue";
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
mainPageDataModel: {
|
mainPageDataModel: {
|
||||||
@@ -42,16 +41,15 @@ const initPageImages = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const show = ref(false);
|
const show = ref(false);
|
||||||
const config = getCurrentConfig();
|
|
||||||
|
|
||||||
const spriteStyle = computed(() => {
|
const spriteStyle = computed(() => {
|
||||||
const images = initPageImages.value;
|
const images = initPageImages.value;
|
||||||
return {
|
return {
|
||||||
ipSmallImage: images.ipSmallImage ?? config.ipSmallImage,
|
ipSmallImage: images.ipSmallImage,
|
||||||
frameWidth: images.ipSmallImageWidth ?? config.ipSmallImageWidth,
|
frameWidth: images.ipSmallImageWidth,
|
||||||
frameHeight: images.ipSmallImageHeight ?? config.ipSmallImageHeight,
|
frameHeight: images.ipSmallImageHeight,
|
||||||
totalFrames: images.ipSmallTotalFrames ?? config.ipSmallTotalFrames,
|
totalFrames: images.ipSmallTotalFrames,
|
||||||
columns: images.ipSmallColumns ?? config.ipSmallColumns,
|
columns: images.ipSmallColumns,
|
||||||
displayWidth: 32,
|
displayWidth: 32,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,11 +1,3 @@
|
|||||||
.nav-icon-button {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 图片从0%到100%动画
|
// 图片从0%到100%动画
|
||||||
.image-animated {
|
.image-animated {
|
||||||
animation: logo-scale 0.3s ease-in-out;
|
animation: logo-scale 0.3s ease-in-out;
|
||||||
@@ -36,4 +28,4 @@
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: translateX(0);
|
transform: translateX(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ v
|
|||||||
import { defineProps, computed, getCurrentInstance, defineExpose } from "vue";
|
import { defineProps, computed, getCurrentInstance, defineExpose } from "vue";
|
||||||
import { getCurrentConfig } from "@/constants/base";
|
import { getCurrentConfig } from "@/constants/base";
|
||||||
import ChatMoreTips from "../ChatMoreTips/index.vue";
|
import ChatMoreTips from "../ChatMoreTips/index.vue";
|
||||||
import SpriteAnimator from "@/components/Sprite/SpriteAnimator.vue";
|
import SpriteAnimator from "@/components/SpriteAnimator/index.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
mainPageDataModel: {
|
mainPageDataModel: {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { defineProps, computed } from "vue";
|
import { defineProps, computed } from "vue";
|
||||||
import SpriteAnimator from "@/components/Sprite/SpriteAnimator.vue";
|
import SpriteAnimator from "@/components/SpriteAnimator/index.vue";
|
||||||
import NoticeMessage from "../NoticeMessage/index.vue";
|
import NoticeMessage from "../NoticeMessage/index.vue";
|
||||||
import { getLocalWeather } from "@/api/home";
|
import { getLocalWeather } from "@/api/home";
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="index-page w-full h-screen overflow-hidden bg-liner">
|
<div class="index-page w-full h-screen overflow-hidden bg-liner">
|
||||||
<!-- <ChatMainList @showDrawer="showDrawer" /> -->
|
<ChatMainList @showDrawer="showDrawer" />
|
||||||
|
|
||||||
<!-- 日历组件 -->
|
<!-- 日历组件 -->
|
||||||
<!-- <Calender :visible="calendarVisible" mode="single" :default-value="selectedDate" @close="handleCalendarClose"
|
<!-- <Calender :visible="calendarVisible" mode="single" :default-value="selectedDate" @close="handleCalendarClose"
|
||||||
@@ -20,7 +20,7 @@ import { emitter } from '@/utils/events'
|
|||||||
// import { getUrlParams } from "@/utils/UrlParams";
|
// import { getUrlParams } from "@/utils/UrlParams";
|
||||||
// import { useAppStore } from "@/store";
|
// import { useAppStore } from "@/store";
|
||||||
// import { checkToken } from "@/hooks/useGoLogin";
|
// import { checkToken } from "@/hooks/useGoLogin";
|
||||||
// import ChatMainList from "./components/ChatMainList/index.vue";
|
import ChatMainList from "./components/ChatMainList/index.vue";
|
||||||
import MoreService from "./components/MoreService/index.vue";
|
import MoreService from "./components/MoreService/index.vue";
|
||||||
import DrawerSection from "./components/DrawerSection/index.vue";
|
import DrawerSection from "./components/DrawerSection/index.vue";
|
||||||
// import Calender from "@/components/Calender/index.vue";
|
// import Calender from "@/components/Calender/index.vue";
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ import type {
|
|||||||
} from "@/shared/request-types";
|
} from "@/shared/request-types";
|
||||||
|
|
||||||
function resolveBaseURL(): string {
|
function resolveBaseURL(): string {
|
||||||
const baseURL = (import.meta.env as Record<string, unknown>).VITE_API_BASE_URL;
|
const baseURL = (import.meta.env as Record<string, unknown>)
|
||||||
|
.VITE_API_BASE_URL;
|
||||||
if (typeof baseURL !== "string" || baseURL.trim() === "") {
|
if (typeof baseURL !== "string" || baseURL.trim() === "") {
|
||||||
throw new Error("Missing VITE_API_BASE_URL");
|
throw new Error("Missing VITE_API_BASE_URL");
|
||||||
}
|
}
|
||||||
@@ -33,7 +34,7 @@ const http = axios.create({
|
|||||||
|
|
||||||
let context: RequestContext = {
|
let context: RequestContext = {
|
||||||
token: null,
|
token: null,
|
||||||
clientId: null,
|
clientId: "6",
|
||||||
latitude: null,
|
latitude: null,
|
||||||
longitude: null,
|
longitude: null,
|
||||||
language: null,
|
language: null,
|
||||||
@@ -47,7 +48,10 @@ export function setClientId(clientId: string | null): void {
|
|||||||
context = { ...context, clientId };
|
context = { ...context, clientId };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setLocation(latitude: number | null, longitude: number | null): void {
|
export function setLocation(
|
||||||
|
latitude: number | null,
|
||||||
|
longitude: number | null,
|
||||||
|
): void {
|
||||||
context = { ...context, latitude, longitude };
|
context = { ...context, latitude, longitude };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,4 +211,3 @@ export async function requestData<T>(
|
|||||||
const res = await request<T>(config, options);
|
const res = await request<T>(config, options);
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,5 +38,13 @@ export default defineConfig({
|
|||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
port: 5174,
|
port: 5174,
|
||||||
open: false,
|
open: false,
|
||||||
|
proxy: {
|
||||||
|
"/ingress": {
|
||||||
|
target: "https://onefeel.brother7.cn",
|
||||||
|
changeOrigin: true,
|
||||||
|
ws: true,
|
||||||
|
secure: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user