"use strict"; const common_vendor = require("../../common/vendor.js"); const common_assets = require("../../common/assets.js"); const model_ChatModel = require("../../model/ChatModel.js"); if (!Math) { (ChatTopBgImg + ChatTopNavBar + ChatTopBanner + OneFeelMK001 + ResponseIntro + ImageSwiper + Stepper + SumCard + FormCard + ResponseWrapper + ChatCardAI + ChatCardMine + ChatMoreTips + ChatQuickAccess)(); } const ChatTopBanner = () => "./ChatTopBanner.js"; const ChatTopBgImg = () => "./ChatTopBgImg.js"; const ChatTopNavBar = () => "./ChatTopNavBar.js"; const ChatCardAI = () => "./ChatCardAI.js"; const ChatCardMine = () => "./ChatCardMine.js"; const ChatQuickAccess = () => "./ChatQuickAccess2.js"; const ChatMoreTips = () => "./ChatMoreTips.js"; const OneFeelMK001 = () => "../module/OneFeelMK001.js"; const ResponseIntro = () => "../../components/ResponseIntro/index.js"; const ResponseWrapper = () => "../../components/ResponseWrapper/index.js"; const ImageSwiper = () => "../../components/ImageSwiper/index.js"; const Stepper = () => "../../components/Stepper/index.js"; const SumCard = () => "../../components/SumCard/index.js"; const FormCard = () => "../../components/FormCard/index.js"; const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ __name: "ChatMainList", emits: ["openDrawer"], setup(__props, { emit: __emit }) { const statusBarHeight = common_vendor.ref(20); const navBgColor = common_vendor.ref("rgba(66, 173, 249, 0)"); common_vendor.ref(0); const timer = common_vendor.ref(null); const holdKeyboard = common_vendor.ref(false); const holdKeyboardFlag = common_vendor.ref(true); const chatMsgList = common_vendor.ref([]); const inputMessage = common_vendor.ref(""); const lastMsgId = common_vendor.ref("anchor-bottom"); holdKeyboard.value = true; const emits = __emit; const openDrawer = () => { emits("openDrawer"); common_vendor.index.__f__("log", "at pages/chat/ChatMainList.vue:178", "=============打开抽屉"); }; const handleReply = (text) => { loadMessage(text); scrollToBottom(); }; common_vendor.onLoad(() => { common_vendor.index.getSystemInfo({ success: (res) => { statusBarHeight.value = res.statusBarHeight || 20; } }); }); common_vendor.onMounted(() => { initData(); }); const initData = () => { const msg = { msgId: `msg_${0}`, msgType: model_ChatModel.MessageRole.AI, msg: "查信息、预定下单、探索玩法、呼叫服务、我通通可以满足,快试试问我问题吧!" }; chatMsgList.value.push(msg); }; const handleTouchEnd = () => { clearTimeout(timer.value); timer.value = setTimeout(() => { if (handleNoHideKeyboard) { common_vendor.index.hideKeyboard(); } holdKeyboardFlag.value = true; }, 50); }; const handleNoHideKeyboard = () => { holdKeyboardFlag.value = false; }; const sendMessage = () => { if (!inputMessage.value.trim()) return; handleNoHideKeyboard(); loadMessage(inputMessage.value); inputMessage.value = ""; scrollToBottom(); }; const loadMessage = (text) => { const newMsg = { msgId: `msg_${chatMsgList.value.length}`, msgType: model_ChatModel.MessageRole.ME, msg: text, msgContent: { type: model_ChatModel.MessageType.TEXT, text } }; chatMsgList.value.push(newMsg); let type = chatMsgList.value.length % 3 === 0; const newMsgAI = { msgId: `msg_${chatMsgList.value.length}`, msgType: model_ChatModel.MessageRole.AI, msg: `我是ai,你输入的内容是:${text}`, msgContent: { type: type ? model_ChatModel.MessageType.IMAGE : model_ChatModel.MessageType.TEXT, url: "" } }; chatMsgList.value.push(newMsgAI); common_vendor.index.__f__("log", "at pages/chat/ChatMainList.vue:262", "发送的新消息:", JSON.stringify(newMsg)); }; const scrollToBottom = () => { lastMsgId.value = `${chatMsgList.value[chatMsgList.value.length - 1].msgId}`; common_vendor.nextTick$1(() => { lastMsgId.value = "anchor-bottom"; }); }; return (_ctx, _cache) => { return { a: common_vendor.o(openDrawer), b: statusBarHeight.value + "px", c: navBgColor.value, d: common_vendor.p({ referencePrice: 700, discount: 10 }), e: common_vendor.f(chatMsgList.value, (item, k0, i0) => { return common_vendor.e({ a: item.msgType === common_vendor.unref(model_ChatModel.MessageRole).AI }, item.msgType === common_vendor.unref(model_ChatModel.MessageRole).AI ? common_vendor.e({ b: item.msgContent && item.msgContent.type === common_vendor.unref(model_ChatModel.MessageType).IMAGE }, item.msgContent && item.msgContent.type === common_vendor.unref(model_ChatModel.MessageType).IMAGE ? { c: common_assets._imports_0$1 } : {}, { d: "d7316ec5-13-" + i0 + "," + ("d7316ec5-12-" + i0), e: "d7316ec5-12-" + i0, f: common_vendor.p({ text: item.msg }) }) : item.msgType === common_vendor.unref(model_ChatModel.MessageRole).ME ? { h: "d7316ec5-14-" + i0, i: common_vendor.p({ text: item.msg }) } : { j: common_vendor.t(item.msg) }, { g: item.msgType === common_vendor.unref(model_ChatModel.MessageRole).ME, k: item.msgId, l: item.msgId }); }), f: lastMsgId.value, g: lastMsgId.value, h: common_vendor.o(handleReply), i: common_vendor.o(handleReply), j: common_assets._imports_1, k: common_vendor.o(sendMessage), l: common_vendor.o(handleNoHideKeyboard), m: holdKeyboard.value, n: inputMessage.value, o: common_vendor.o(($event) => inputMessage.value = $event.detail.value), p: common_assets._imports_2, q: common_vendor.o(sendMessage), r: common_vendor.o(handleTouchEnd) }; }; } }); const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-d7316ec5"]]); wx.createComponent(Component); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/chat/ChatMainList.js.map