This commit is contained in:
liuyalei 2023-12-19 10:08:03 +08:00
parent 1bf4b4ce12
commit 11a86c5942
1 changed files with 5 additions and 8 deletions

View File

@ -289,13 +289,10 @@ let messagesCopy = reactive([
]); ]);
const sendMessage = () => { const sendMessage = () => {
console.log("dddd", inputText.value)
/* setTimeout(() => {
console.log("inputText.value:", inputText.value);
}, 0); */
if (inputText.value.trim()) { if (inputText.value.trim()) {
console.log("sendMessage", inputText.value.trim()) // console.log("sendMessage", inputText.value.trim())
messages.push({ id: Date.now(), text: inputText.value, isMe: true, type: 'txt' }); messages.push({ id: Date.now(), text: inputText.value, isMe: true, type: 'txt' });
if (inputText.value.indexOf('导航') != -1 || inputText.value.indexOf('怎么走') != -1) { if (inputText.value.indexOf('导航') != -1 || inputText.value.indexOf('怎么走') != -1) {
messagesCopy[10].id = Date.now(); messagesCopy[10].id = Date.now();
@ -315,15 +312,15 @@ const sendMessage = () => {
messagesCopy[3].id = Date.now() + 1; messagesCopy[3].id = Date.now() + 1;
messages.push(messagesCopy[2], messagesCopy[3]); messages.push(messagesCopy[2], messagesCopy[3]);
} else { } else {
messages.push({ id: Date.now(), text: '抱歉没听懂 您可以尝试输入 最近总是头疼挂什么科室', isMe: false, type: 'txt' }); messages.push({ id: Date.now(), text: '抱歉没听懂 您可以尝试输入 最近总是头疼挂什么科室', isMe: false, type: 'txt' });
} }
console.log("messages", messages) // console.log("messages", messages)
scollToButtom(); scollToButtom();
inputText.value = ''; inputText.value = '';
} }
} }
const goke = () => { const goke = () => {
console.log("goke"); // console.log("goke");
const insertWord = '您想看普通还是专家门诊?如有其他需求,也请告诉我' const insertWord = '您想看普通还是专家门诊?如有其他需求,也请告诉我'
messagesCopy[11].id = Date.now(); messagesCopy[11].id = Date.now();
messagesCopy[11].text = insertWord messagesCopy[11].text = insertWord