关键词
This commit is contained in:
parent
c5b1bd9650
commit
f00c5fa731
|
@ -66,7 +66,7 @@ let clickNum = (num,path) => {
|
|||
bottom: 0px;
|
||||
left: 0px;
|
||||
width: 100vw;
|
||||
border: 1px solid red;
|
||||
// border: 1px solid red;
|
||||
padding: 9px 0px;
|
||||
.bt_itm {
|
||||
display: flex;
|
||||
|
|
|
@ -267,19 +267,23 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, reactive, nextTick, onMounted } from 'vue'
|
||||
import { ref, reactive, nextTick, onMounted, watch } from 'vue'
|
||||
let inputText = ref('')
|
||||
let messages = reactive([
|
||||
|
||||
]);
|
||||
let messagesCopy = reactive([
|
||||
{ id: 1, type: 'fstxt', text: '您可以点击下方快捷方式选择问题,或直接编辑问题发送给我哟', isMe: false },
|
||||
{ id: 2, type: 'txt', text: '骨折去哪家医院', isMe: true },
|
||||
{ id: 3, type: 'card1', text: '基于您目前的地理位置、时间、医院号源等多种因素为您推荐如下结果。您还可根据自身偏好重新选择,继续为您推荐;如偏好因素不在其列,可继续提出您的需求。', isMe: false },
|
||||
{ id: 4, type: 'txt', text: '基于号源等多种因素考虑,以下是相关医生推荐:', isMe: false },
|
||||
{ id: 5, type: 'card2', text: '基:', isMe: false },
|
||||
{ id: 6, type: 'txt', text: '最近总是头疼可以挂什么科室', isMe: true },
|
||||
{ id: 7, type: 'card3', text: '卡片3', isMe: false },
|
||||
{ id: 8, type: 'card4', text: '为您推荐相关医生,也可选择查看更多医生。', isMe: false },
|
||||
{ id: 9, type: 'txt', text: '人民医院怎么走', isMe: true },
|
||||
{ id: 10, type: 'card5', text: '卡片5', isMe: false },
|
||||
{ id: 3, type: 'txt', text: '基于您目前的地理位置、时间、医院号源等多种因素为您推荐如下结果。您还可根据自身偏好重新选择,继续为您推荐;如偏好因素不在其列,可继续提出您的需求。', isMe: false },
|
||||
{ id: 4, type: 'card1', text: ' ', isMe: false },
|
||||
{ id: 5, type: 'txt', text: '基于号源等多种因素考虑,以下是相关医生推荐:', isMe: false },
|
||||
{ id: 6, type: 'card2', text: '卡片2', isMe: false },
|
||||
{ id: 7, type: 'txt', text: '最近总是头疼可以挂什么科室', isMe: true },
|
||||
{ id: 8, type: 'card3', text: '卡片3', isMe: false },
|
||||
{ id: 9, type: 'card4', text: '为您推荐相关医生,也可选择查看更多医生。', isMe: false },
|
||||
{ id: 10, type: 'txt', text: '人民医院怎么走', isMe: true },
|
||||
{ id: 11, type: 'card5', text: '卡片5', isMe: false },
|
||||
]);
|
||||
|
||||
const sendMessage = () => {
|
||||
|
@ -291,6 +295,24 @@ const sendMessage = () => {
|
|||
if (inputText.value.trim()) {
|
||||
console.log("sendMessage", inputText.value.trim())
|
||||
messages.push({ id: Date.now(), text: inputText.value, isMe: true, type: 'txt' });
|
||||
if (inputText.value.indexOf('医院') != -1) {
|
||||
messagesCopy[2].id = Date.now();
|
||||
messagesCopy[3].id = Date.now()+1;
|
||||
messages.push(messagesCopy[2],messagesCopy[3]);
|
||||
} else if (inputText.value.indexOf('医生') != -1) {
|
||||
messagesCopy[4].id = Date.now();
|
||||
messagesCopy[5].id = Date.now()+1;
|
||||
messages.push(messagesCopy[4],messagesCopy[5]);
|
||||
}else if (inputText.value.indexOf('科室') != -1) {
|
||||
messagesCopy[7].id = Date.now();
|
||||
messagesCopy[8].id = Date.now()+1;
|
||||
messages.push(messagesCopy[7],messagesCopy[8]);
|
||||
}else if (inputText.value.indexOf('导航') != -1) {
|
||||
messagesCopy[10].id = Date.now();
|
||||
messages.push(messagesCopy[10]);
|
||||
}else{
|
||||
messages.push({ id: Date.now(), text: '抱歉没听听懂 支持 医院 医生 科室 导航 关键词', isMe: false, type: 'txt' });
|
||||
}
|
||||
console.log("messages", messages)
|
||||
scollToButtom();
|
||||
inputText.value = '';
|
||||
|
@ -304,7 +326,19 @@ const scollToButtom = () => {
|
|||
}
|
||||
});
|
||||
}
|
||||
// onMounted(scrollToBottom);
|
||||
/* watch(inputText, (newValue, oldValue) => {
|
||||
console.log('inputText changed from', oldValue, 'to', newValue)
|
||||
// 在这里,你可以添加处理 inputText 变化的逻辑
|
||||
}) */
|
||||
onMounted(() => {
|
||||
scollToButtom()
|
||||
// messages
|
||||
setTimeout(() => {
|
||||
messages.push({ id: Date.now(), type: 'fstxt', text: '您可以点击下方快捷方式选择问题,或直接编辑问题发送给我哟', isMe: false });
|
||||
}, 500);
|
||||
|
||||
})
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
::-webkit-input-placeholder {
|
||||
|
@ -710,7 +744,8 @@ const scollToButtom = () => {
|
|||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
.heng{
|
||||
|
||||
.heng {
|
||||
width: 21px;
|
||||
height: 1px;
|
||||
border: 1px solid transparent;
|
||||
|
@ -720,14 +755,15 @@ const scollToButtom = () => {
|
|||
.sw_itm_slected {
|
||||
font-weight: 600;
|
||||
color: #4379FF;
|
||||
.heng{
|
||||
|
||||
.heng {
|
||||
width: 21px;
|
||||
height: 1px;
|
||||
border: 1px solid #4379FF ;
|
||||
border: 1px solid #4379FF;
|
||||
}
|
||||
}
|
||||
|
||||
/* .sw_itm_slected::before {
|
||||
/* .sw_itm_slected::before {
|
||||
content: '';
|
||||
display: block;
|
||||
height: 1px;
|
||||
|
@ -1029,7 +1065,7 @@ const scollToButtom = () => {
|
|||
// height: 60px;
|
||||
min-height: 60px;
|
||||
background-color: #fff;
|
||||
border: 1px solid transparent ;
|
||||
border: 1px solid transparent;
|
||||
position: absolute;
|
||||
// bottom: 180px;
|
||||
top: calc(100vh - 122px);
|
||||
|
|
Loading…
Reference in New Issue