feat: 发送命令的组件与发送调整

This commit is contained in:
2025-10-16 20:03:14 +08:00
parent 24df46f2a3
commit 1f590202a8
6 changed files with 66 additions and 105 deletions

View File

@@ -104,7 +104,7 @@
<!-- 输入框区域 -->
<view class="pb-safe-area">
<ChatQuickAccess @replySent="handleReplyInstruct" />
<ChatQuickAccess />
<ChatInputArea
ref="inputAreaRef"
v-model="inputMessage"
@@ -121,12 +121,12 @@
</template>
<script setup>
import { onMounted, nextTick, onUnmounted, ref, defineEmits, watch } from "vue";
import { onMounted, nextTick, onUnmounted, ref, defineEmits } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import {
SCROLL_TO_BOTTOM,
RECOMMEND_POSTS_TITLE,
SEND_COMMAND_TEXT,
SEND_COMMAND_TYPE,
NOTICE_EVENT_LOGOUT,
NOTICE_EVENT_LOGIN_SUCCESS,
} from "@/constant/constant";
@@ -274,6 +274,11 @@ const handleReply = (text) => {
// 是发送指令
const handleReplyInstruct = async (item) => {
await checkToken();
// 更多服务
if (item.type === "Command.more") {
uni.$emit("SHOW_MORE_POPUP");
return;
}
if (item.type === "Command.myOrder") {
// 订单
@@ -337,12 +342,10 @@ const addNoticeListener = () => {
}
});
uni.$on(SEND_COMMAND_TEXT, (value) => {
console.log("SEND_COMMAND_TEXT:", value);
if (value && value.length > 0) {
commonType = "Command.quickBooking";
sendMessage(value, true);
setTimeoutScrollToBottom();
uni.$on(SEND_COMMAND_TYPE, (item) => {
console.log("SEND_COMMAND_TYPE:", item);
if (item && item.type) {
handleReplyInstruct(item);
}
});
};
@@ -744,7 +747,7 @@ onUnmounted(() => {
uni.$off(NOTICE_EVENT_LOGIN_SUCCESS);
uni.$off(SCROLL_TO_BOTTOM);
uni.$off(RECOMMEND_POSTS_TITLE);
uni.$off(SEND_COMMAND_TEXT);
uni.$off(SEND_COMMAND_TYPE);
uni.$off(NOTICE_EVENT_LOGOUT);
resetConfig();