feat: 发送命令的组件与发送调整
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -19,109 +19,35 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from "vue";
|
||||
import { currentClientType, ClientType } from "@/constant/base";
|
||||
import { ref } from "vue";
|
||||
import { Command } from "@/model/ChatModel";
|
||||
import { SEND_COMMAND_TYPE } from "@/constant/constant";
|
||||
|
||||
const itemList = ref([
|
||||
{
|
||||
icon: "",
|
||||
title: "快速预定",
|
||||
type: "Command.quickBooking",
|
||||
type: Command.quickBooking,
|
||||
},
|
||||
{
|
||||
icon: "",
|
||||
title: "探索发现",
|
||||
type: "Command.discovery",
|
||||
type: Command.discovery,
|
||||
},
|
||||
{
|
||||
icon: "",
|
||||
title: "呼叫服务",
|
||||
type: "Command.createWorkOrderCard",
|
||||
type: Command.createWorkOrderCard,
|
||||
},
|
||||
{
|
||||
icon: "https://oss.nianxx.cn/mp/static/version_101/home/more.png",
|
||||
title: "更多",
|
||||
type: "Command.more",
|
||||
type: Command.more,
|
||||
},
|
||||
]);
|
||||
|
||||
const emits = defineEmits(["replySent"]);
|
||||
|
||||
const sendReply = (item) => {
|
||||
if (item.type === "Command.more") {
|
||||
uni.$emit("SHOW_MORE_POPUP");
|
||||
return;
|
||||
}
|
||||
emits("replySent", item); // 向父组件传递数据
|
||||
};
|
||||
|
||||
// onMounted(() => {
|
||||
// initData();
|
||||
// });
|
||||
|
||||
const initData = () => {
|
||||
itemList.value =
|
||||
currentClientType() === ClientType.TIANMU
|
||||
? [
|
||||
{
|
||||
icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_yuding.png",
|
||||
showIcon: false,
|
||||
title: "快速预定",
|
||||
content: "预定门票、房间、餐食",
|
||||
type: "Command.quickBooking",
|
||||
},
|
||||
{
|
||||
icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_find.png",
|
||||
showIcon: false,
|
||||
title: "探索发现",
|
||||
content: "探索玩法、出片佳地",
|
||||
type: "Command.discovery",
|
||||
},
|
||||
{
|
||||
icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_call.png",
|
||||
showIcon: false,
|
||||
title: "反馈意见",
|
||||
content: "有意见告诉沐沐",
|
||||
type: "Command.feedbackCard",
|
||||
},
|
||||
{
|
||||
icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_order.png",
|
||||
showIcon: false,
|
||||
title: "订单/工单",
|
||||
content: "我的订单/工单",
|
||||
type: "Command.myOrder",
|
||||
},
|
||||
]
|
||||
: [
|
||||
{
|
||||
icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_yuding.png",
|
||||
showIcon: false,
|
||||
title: "快速预定",
|
||||
content: "预定门票、房间、餐食",
|
||||
type: "Command.quickBooking",
|
||||
},
|
||||
{
|
||||
icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_find.png",
|
||||
showIcon: false,
|
||||
title: "探索发现",
|
||||
content: "探索玩法、出片佳地",
|
||||
type: "Command.discovery",
|
||||
},
|
||||
{
|
||||
icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_order.png",
|
||||
showIcon: false,
|
||||
title: "订单/工单",
|
||||
content: "我的订单/工单",
|
||||
type: "Command.myOrder",
|
||||
},
|
||||
{
|
||||
icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_call.png",
|
||||
showIcon: false,
|
||||
title: "反馈意见",
|
||||
content: "有意见告诉朵朵",
|
||||
type: "Command.feedbackCard",
|
||||
},
|
||||
];
|
||||
uni.$emit(SEND_COMMAND_TYPE, item);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user