add change

This commit is contained in:
liuyalei 2023-12-18 10:46:15 +08:00
parent 59a76b1a51
commit c54e26d758
2 changed files with 55 additions and 27 deletions

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { RouterLink, RouterView } from 'vue-router' import { useRoute, useRouter, RouterView, RouterLink } from 'vue-router'
import HelloWorld from './components/HelloWorld.vue' import HelloWorld from './components/HelloWorld.vue'
import { ref, reactive } from 'vue' import { ref, reactive, onMounted } from 'vue'
import s1 from './assets/s1.png' import s1 from './assets/s1.png'
import s2 from './assets/s2.png' import s2 from './assets/s2.png'
import s3 from './assets/s3.png' import s3 from './assets/s3.png'
@ -10,7 +10,7 @@ import sl1 from './assets/s5.png'
import sl2 from './assets/s6.png' import sl2 from './assets/s6.png'
import sl3 from './assets/s7.png' import sl3 from './assets/s7.png'
import sl4 from './assets/s8.png' import sl4 from './assets/s8.png'
import { useRoute, useRouter } from 'vue-router'
const route = useRoute() const route = useRoute()
let routePath = ref(route.path) let routePath = ref(route.path)
const router = useRouter() const router = useRouter()
@ -21,6 +21,20 @@ let clickNum = (num, path) => {
routePath.value = path routePath.value = path
router.push(path) router.push(path)
} }
onMounted(() => {
console.log('routePath.value', routePath.value)
if (routePath.value == '/') {
clickNum(0, '/')
} else if (routePath.value == '/chat') {
clickNum(1, '/chat')
} else if (routePath.value == '/znyt') {
clickNum(2, '/znyt')
} else if (routePath.value == '/comment') {
clickNum(3, '/comment')
}
})
</script> </script>
<template> <template>
@ -38,9 +52,6 @@ let clickNum = (num, path) => {
* { * {
padding: 0px; padding: 0px;
} }
.bottom { .bottom {
z-index: 999; z-index: 999;
background-color: #fff !important; background-color: #fff !important;

View File

@ -156,9 +156,9 @@
推荐您可以挂神经内科您还可根据自身偏好重新选择继续为您推荐如偏好因素不在其列可继续提出您的需求 推荐您可以挂神经内科您还可根据自身偏好重新选择继续为您推荐如偏好因素不在其列可继续提出您的需求
</div> </div>
<div class="c_bt"> <div class="c_bt">
<div class="cbt_it" v-for=" v in 3"> <div class="cbt_it" v-for=" (v, i) in kearr" :key="i">
<div class="it_name">神经内科</div> <div class="it_name">{{ v.name }}</div>
<div class="book_btn">预约</div> <div class="book_btn" @click="goke">预约</div>
</div> </div>
</div> </div>
</div> </div>
@ -207,7 +207,7 @@
</div> </div>
</div> </div>
<div class="book_btn">预约</div> <div @click="bookDoctor" class="book_btn">预约</div>
</div> </div>
</div> </div>
</div> </div>
@ -272,6 +272,7 @@ let inputText = ref('')
let messages = reactive([ let messages = reactive([
]); ]);
let kearr = reactive([{ name: '神经内科', path: '' }, { name: '儿科', path: '' }, { name: '外科', path: '' }])
let messagesCopy = reactive([ let messagesCopy = reactive([
{ id: 1, type: 'fstxt', text: '您可以点击下方快捷方式选择问题,或直接编辑问题发送给我哟', isMe: false }, { id: 1, type: 'fstxt', text: '您可以点击下方快捷方式选择问题,或直接编辑问题发送给我哟', isMe: false },
{ id: 2, type: 'txt', text: '骨折去哪家医院', isMe: true }, { id: 2, type: 'txt', text: '骨折去哪家医院', isMe: true },
@ -284,6 +285,7 @@ let messagesCopy = reactive([
{ id: 9, type: 'card4', text: '为您推荐相关医生,也可选择查看更多医生。', isMe: false }, { id: 9, type: 'card4', text: '为您推荐相关医生,也可选择查看更多医生。', isMe: false },
{ id: 10, type: 'txt', text: '人民医院怎么走', isMe: true }, { id: 10, type: 'txt', text: '人民医院怎么走', isMe: true },
{ id: 11, type: 'card5', text: '卡片5', isMe: false }, { id: 11, type: 'card5', text: '卡片5', isMe: false },
{ id: 12, type: 'txt', text: '空白', isMe: false },
]); ]);
const sendMessage = () => { const sendMessage = () => {
@ -295,29 +297,43 @@ const sendMessage = () => {
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) { if (inputText.value.indexOf('导航') != -1 || 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(); messagesCopy[10].id = Date.now();
messages.push(messagesCopy[10]); messages.push(messagesCopy[10]);
}else{ } else if (inputText.value.indexOf('医生') != -1) {
messages.push({ id: Date.now(), text: '抱歉没听听懂 支持 医院 医生 科室 导航 关键词', isMe: false, type: 'txt' }); 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();
messages.push(messagesCopy[7]);
} else if (inputText.value.indexOf('普通') != -1 || inputText.value.indexOf('专家') != -1) {
messagesCopy[8].id = Date.now();
messages.push(messagesCopy[8]);
} else if (inputText.value.indexOf('医院') != -1) {
messagesCopy[2].id = Date.now();
messagesCopy[3].id = Date.now() + 1;
messages.push(messagesCopy[2], messagesCopy[3]);
} else {
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 = () => {
console.log("goke");
const insertWord = '您想看普通还是专家门诊?如有其他需求,也请告诉我'
messagesCopy[11].id = Date.now();
messagesCopy[11].text = insertWord
messages.push(messagesCopy[11]);
scollToButtom();
};
//
const bookDoctor = () => {
location.href = 'https://wx.nbgzjk.cn/#/home'
};
const scollToButtom = () => { const scollToButtom = () => {
nextTick(() => { nextTick(() => {
let chatForm = document.getElementById('chatform'); // let chatForm = document.getElementById('chatform'); //
@ -1128,8 +1144,9 @@ onMounted(() => {
width: 16px; width: 16px;
height: 16px; height: 16px;
position: absolute; position: absolute;
left: calc(100vw - 303px); // left: calc(100vw - 303px);
; left: 73px;
top: 22px; top: 22px;
z-index: 2; z-index: 2;