yxdth5/src/views/IndexChat.vue

1127 lines
37 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="c_body">
<!-- <div class="message-container">
<div class="Left">
<div class="Left_mesg">
<h4>你好呀</h4>
<h4>我是你的智能生活助手~</h4> 您可以点击下方快捷方式选择问题或直接编辑问题发送给我哟
</div>
</div>
<div class="Left">
<div class="card">
<div class="main_card">
<div class="card_top">
<img src="../assets/5.png" alt="">
<div class="desc">
<div class="name">象山县中医医院新院区</div>
<div class="addr">宁波市象山县南部新城新洋路...</div>
<div class="tag_wrp">
<div class="tag">医保定点</div>
<div style="width: 4px;"></div>
<div class="tag">医保定点</div>
</div>
<div class="detail"> 象山中医院建于1985年3月是一所集中医中西医结合医疗预防康复于一体的非...</div>
</div>
</div>
<div class="card_botm">
<div class="card_bt">换一家医院</div>
<div class="split_line"></div>
<div class="card_bt">帮我预约该医院</div>
</div>
</div>
<div class="prise_wrp">
<div class="prise">
<img src="../assets/1.png" alt="">
<div class="spl_line"></div>
<img src="../assets/2.png" alt="">
</div>
</div>
</div>
</div>
<div class="Right">
<div class="Right_mesg">
骨折去哪家医院
</div>
</div>
<div class="Right">
<div class="Right_mesg">
基于您目前的地理位置时间医院号源等多种因素为您推荐如下结果您还可根据自身偏好重新选择继续为您推荐如偏好因素不在其列可继续提出您的需求
基于您目前的地理位置时间医院号源等多种因素为您推荐如下结果您还可根据自身偏好重新选择继续为您推荐如偏好因素不在其列可继续提出您的需求
基于您目前的地理位置时间医院号源等多种因素为您推荐如下结果您还可根据自身偏好重新选择继续为您推荐如偏好因素不在其列可继续提出您的需求
基于您目前的地理位置时间医院号源等多种因素为您推荐如下结果您还可根据自身偏好重新选择继续为您推荐如偏好因素不在其列可继续提出您的需求
</div>
</div>
<div class="card">
<div class="main_card">
<div class="card_top">
<img src="../assets/5.png" alt="">
<div class="desc">
<div class="name">象山县中医医院新院区</div>
<div class="addr">宁波市象山县南部新城新洋路...</div>
<div class="tag_wrp">
<div class="tag">医保定点</div>
<div style="width: 4px;"></div>
<div class="tag">医保定点</div>
</div>
<div class="detail"> 象山中医院建于1985年3月是一所集中医中西医结合医疗预防康复于一体的非...</div>
</div>
</div>
<div class="card_botm">
<div class="card_bt">换一家医院</div>
<div class="split_line"></div>
<div class="card_bt">帮我预约该医院</div>
</div>
</div>
<div class="prise_wrp">
<div class="prise">
<img src="../assets/1.png" alt="">
<div class="spl_line"></div>
<img src="../assets/2.png" alt="">
</div>
</div>
</div>
</div> -->
<div class="message-container" id="chatform">
<div class="message" v-for="(message, index) in messages" :key="message.id">
<div class="Left" v-if="!message.isMe">
<div class="Left_mesg">
<div v-if="message.type == 'txt'" class="txt txt_l"> {{ message.text }}</div>
<div v-else-if="message.type == 'fstxt'" class="txt txt_l">
<div style="font-weight: 600;font-size: 14px;">嘿,你好呀</div>
<div style="font-weight: 600;font-size: 14px;">我是你的智能生活助手~</div>
<div> 您可以点击下方快捷方式选择问题,或直接编辑问题发送给我哟</div>
</div>
<div v-else-if="message.type == 'card1'" class="card">
<div class="main_card">
<div class="card_top">
<img src="../assets/5.png" alt="">
<div class="desc">
<div class="name">象山县中医医院(新院区)</div>
<div class="addr">宁波市象山县南部新城新洋路...</div>
<div class="tag_wrp">
<div class="tag">医保定点</div>
<div style="width: 4px;"></div>
<div class="tag">医保定点</div>
</div>
<div class="detail"> 象山中医院建于1985年3月是一所集中医、中西医结合医疗、预防、康复于一体的非...</div>
</div>
</div>
<div class="card_botm">
<div class="card_bt">换一家医院</div>
<div class="split_line"></div>
<div class="card_bt">帮我预约该医院</div>
</div>
</div>
<div class="prise_wrp">
<div class="prise">
<img src="../assets/1.png" alt="">
<div class="spl_line"></div>
<img src="../assets/2.png" alt="">
</div>
</div>
</div>
<div v-else-if="message.type == 'card2'" class="card2">
<div class="main_card">
<div class="card_top">
<img src="../assets/c1.png" alt="">
<div class="desc">
<div class="name">
<span class="fullname">白亮</span>
<span class="workername">主任医师</span>
</div>
<div class="work_tag">
<span>象山县中医医院</span>
<div class="xie"></div>
<span>神经外科</span>
</div>
<div class="detail"> 象山中医院建于1985年3月是一所集中医、中西医结合医疗、预防、康复于一体的非...</div>
</div>
</div>
<div class="card_botm">
<div class="card_bt">换一家医院</div>
<div class="split_line"></div>
<div class="card_bt">帮我预约该医院</div>
</div>
</div>
<div class="prise_wrp">
<div class="prise">
<img src="../assets/1.png" alt="">
<div class="spl_line"></div>
<img src="../assets/2.png" alt="">
</div>
</div>
</div>
<div v-else-if="message.type == 'card3'" class="card3">
<div class="c_top">
推荐您可以挂神经内科,您还可根据自身偏好重新选择,继续为您推荐,如偏好因素不在其列,可继续提出您的需求。
</div>
<div class="c_bt">
<div class="cbt_it" v-for=" v in 3">
<div class="it_name">神经内科</div>
<div class="book_btn">预约</div>
</div>
</div>
</div>
<div v-else-if="message.type == 'card4'" class="card4">
<div class="c_top">
{{ message.text }}
</div>
<div class="c_bt">
<div class="switch">
<div class="sw_itm sw_itm_slected">
<div>立即就诊</div>
<div class="heng"></div>
</div>
<div class="sw_itm">
<div>更多医生</div>
<div class="heng"></div>
</div>
</div>
<div class="helper" v-for="dd in 3">
<div class="help_top">
推荐指数98
</div>
<div class="help_botom">
<div class="card_top">
<img src="../assets/c1.png" alt="">
<div class="desc">
<div class="name">
<span class="fullname">白亮</span>
<span class="workername">主任医师</span>
</div>
<div class="work_tag">
<span>象山县中医医院</span>
<div class="xie"></div>
<span>神经外科</span>
</div>
<div class="source_tag">
<div class="tagitm">剩余号源1</div>
</div>
<div class="reson">
<div>推荐理由:</div>
<div class="fill_tag">离家近</div>
<div class="fill_tag">主任医师</div>
<div class="fill_tag fill_tag_warn">号源紧张</div>
</div>
</div>
</div>
<div class="book_btn">预约</div>
</div>
</div>
</div>
</div>
<div v-else-if="message.type == 'card5'" class="card5">
<div class="card_container">
<div class="cd_l">
<img src="@/assets/c2.png" alt="">
</div>
<div class="cd_r">
<div class="hostbital_name">象山第一人民医院</div>
<div class="second">
<div class="howway">
<img src="@/assets/c5.png" alt="">
<span>3公里</span>
</div>
<div class="addr">宁波市象山县东谷路28991</div>
</div>
<div class="tag_wrp">
<div class="tag">医保定点</div>
<div style="width: 4px;"></div>
<div class="tag">危重孕产妇救治中心</div>
</div>
</div>
<!-- <img src="@/assets/c5.png" alt=""> -->
</div>
<div class="guid_img">
<img src="@/assets/c3.png" alt="">
</div>
</div>
</div>
</div>
<div class="Right" v-else>
<div class="Right_mesg">
<div v-if="message.type == 'txt'" class="txt txt_r"> {{ message.text }}</div>
</div>
</div>
</div>
</div>
<div class="recomand">
<div class="recomand_itm">公积金查询</div>
<div class="recomand_itm">2024放假安排</div>
<div class="recomand_itm">附近推荐的锻炼场所</div>
</div>
<div class="c_bottom">
<img src="../assets/3.png">
<input v-model="inputText" type="text" placeholder="有问题尽管问我~" class="sendinput" />
<div class="w_icon">
<img src="../assets/4.png" alt="">
</div>
<div class="send" @click="sendMessage">发送</div>
</div>
</div>
</template>
<script setup>
import { ref, reactive, nextTick, onMounted } from 'vue'
let inputText = ref('')
let messages = 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 },
]);
const sendMessage = () => {
console.log("dddd", inputText.value)
/* setTimeout(() => {
console.log("inputText.value:", inputText.value);
}, 0); */
if (inputText.value.trim()) {
console.log("sendMessage", inputText.value.trim())
messages.push({ id: Date.now(), text: inputText.value, isMe: true, type: 'txt' });
console.log("messages", messages)
scollToButtom();
inputText.value = '';
}
}
const scollToButtom = () => {
nextTick(() => {
let chatForm = document.getElementById('chatform'); // 获取对象
if (chatForm) {
chatForm.scrollTop = chatForm.scrollHeight; // 滚动高度
}
});
}
// onMounted(scrollToBottom);
</script>
<style lang="scss" scoped>
::-webkit-input-placeholder {
color: #999999;
font-size: 14px;
}
.sendinput {
height: 36px;
width: calc(100vw - 154px);
border-radius: 21px;
border: 0px;
background: #F5F5FB;
padding: 0px 12px;
padding-left: 36px;
position: absolute;
left: 60px;
z-index: 1;
}
.sendinput:focus {
outline: 1px solid #4379FF;
}
.Left {
display: flex;
justify-content: flex-start;
padding-left: 16px;
padding-right: 59px;
.Left_mesg {
// margin-bottom: 16px;
}
}
.Right {
display: flex;
justify-content: flex-end;
padding-right: 16px;
padding-left: 59px;
.Right_mesg {
// margin-bottom: 16px;
}
}
.recomand {
display: flex;
padding-left: 16px;
width: 100vw;
position: fixed;
top: calc(100vh - 156px);
left: 0px;
// align-items: center;
.recomand_itm {
// width: 84px;
margin-right: 8px;
height: 28px;
line-height: 12px;
text-align: center;
box-sizing: border-box;
padding: 8px 12px;
box-sizing: border-box;
background: #DFE7FB;
border-radius: 30px;
font-size: 12px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #4379FF;
}
}
.card {
width: 343px;
height: 216px;
// margin: 0 auto;
// padding-left: 16px;
// margin-left: 16px;
.main_card {
border-radius: 16px;
background: #FFFFFF;
height: 178px;
.card_top {
display: flex;
padding: 16px;
box-sizing: border-box;
img {
width: 98px;
height: 98px;
border-radius: 5px;
margin-right: 12px;
}
.desc {
.name {
font-size: 14px;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #333333;
line-height: 14px;
}
.addr {
font-size: 12px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #666666;
line-height: 12px;
margin: 8px 0px;
}
.tag_wrp {
display: flex;
.tag {
font-size: 10px;
color: #4379FF;
// width: 48px;
padding: 0px 2px;
height: 16px;
text-align: center;
line-height: 16px;
border-radius: 2px 2px 2px 2px;
opacity: 1;
border: 1px solid #B8CCFF;
}
}
.detail {
font-size: 10px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 14px;
margin-top: 12px;
}
}
}
.card_botm {
border-top: 1px solid #F1F1F1;
display: flex;
align-items: center;
.card_bt {
height: 47px;
width: calc(50% - 1px);
color: #4379FF;
text-align: center;
line-height: 47px;
}
.split_line {
width: 1px;
height: 47px;
background-color: #F1F1F1;
}
}
}
.prise_wrp {
display: flex;
justify-content: end;
.prise {
width: 76px;
height: 28px;
background-color: #fff;
box-sizing: border-box;
padding: 6px 12px;
display: flex;
align-items: center;
margin-top: 8px;
// margin-right: -1px;
img {
width: 16px;
height: 16px;
}
.spl_line {
height: 12px;
width: 1px;
border: 1px solid #D6D6D6;
margin-left: 10px;
margin-right: 10px;
}
}
}
}
.card2 {
width: 300px;
height: 210px;
.main_card {
border-radius: 16px;
background: #FFFFFF;
height: 165px;
.card_top {
display: flex;
padding: 16px;
box-sizing: border-box;
img {
width: 50px;
height: 50px;
border-radius: 5px;
margin-right: 12px;
}
.desc {
.name {
.fullname {
font-size: 14px;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #333333;
line-height: 14px;
}
.workername {
font-size: 12px;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #666666;
margin-left: 8px;
}
}
.work_tag {
font-size: 12px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #999999;
display: flex;
align-items: center;
.xie {
width: 1px;
border: 1px solid #999999;
height: 12px;
margin: 0px 10px;
opacity: 0.5;
}
}
.detail {
font-size: 10px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 14px;
margin-top: 12px;
}
}
}
.card_botm {
border-top: 1px solid #F1F1F1;
display: flex;
align-items: center;
.card_bt {
height: 47px;
width: calc(50% - 1px);
color: #4379FF;
text-align: center;
line-height: 47px;
}
.split_line {
width: 1px;
height: 47px;
background-color: #F1F1F1;
}
}
}
.prise_wrp {
display: flex;
justify-content: end;
.prise {
width: 76px;
height: 28px;
background-color: #fff;
box-sizing: border-box;
padding: 6px 12px;
display: flex;
align-items: center;
margin-top: 8px;
// margin-right: -1px;
img {
width: 16px;
height: 16px;
}
.spl_line {
height: 12px;
width: 1px;
border: 1px solid #D6D6D6;
margin-left: 10px;
margin-right: 10px;
}
}
}
}
.card3 {
width: 300px;
height: 294px;
border-radius: 16px;
background-color: #fff;
box-sizing: border-box;
padding: 16px;
border: 1px solid transparent;
.c_top {
margin-bottom: 12px;
}
.c_bt {}
.cbt_it {
width: 268px;
height: 46px;
background: #EFF3FC;
border-radius: 8px 8px 8px 8px;
margin-bottom: 8px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px;
box-sizing: border-box;
.it_name {
font-size: 14px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #333333;
}
.book_btn {
width: 48px;
height: 24px;
background: linear-gradient(90deg, #6591FF 0%, #4379FF 100%);
border-radius: 22px 22px 22px 22px;
text-align: center;
line-height: 24px;
color: #fff;
}
}
}
.card4 {
width: 330px;
height: 605px;
border-radius: 16px;
background-color: #fff;
box-sizing: border-box;
padding: 16px;
border: 1px solid transparent;
.c_top {
margin-bottom: 12px;
}
.c_bt {
.switch {
display: flex;
align-items: center;
border-top: 1px #F1F1F1 solid;
font-size: 14px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #333333;
.sw_itm {
width: 50%;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.heng{
width: 21px;
height: 1px;
border: 1px solid transparent;
}
}
.sw_itm_slected {
font-weight: 600;
color: #4379FF;
.heng{
width: 21px;
height: 1px;
border: 1px solid #4379FF ;
}
}
/* .sw_itm_slected::before {
content: '';
display: block;
height: 1px;
width: 6px;
border: 1px solid #333;
} */
}
.helper {
background-color: #EFF3FC;
border-radius: 16px;
overflow: hidden;
margin-top: 8px;
.help_top {
background: linear-gradient(90deg, #6491FF 0%, #4379FF 100%);
padding-left: 16px;
color: #fff;
font-size: 14px;
}
.help_botom {
position: relative;
.card_top {
display: flex;
padding: 16px;
box-sizing: border-box;
img {
width: 50px;
height: 50px;
border-radius: 5px;
margin-right: 12px;
}
.desc {
.name {
.fullname {
font-size: 14px;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #333333;
line-height: 14px;
}
.workername {
font-size: 12px;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #666666;
margin-left: 8px;
}
}
.work_tag {
font-size: 12px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #999999;
display: flex;
align-items: center;
.xie {
width: 1px;
border: 1px solid #999999;
height: 12px;
margin: 0px 10px;
opacity: 0.5;
}
}
.source_tag {
font-size: 12px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #4379FF;
display: flex;
align-items: center;
justify-content: flex-start;
.tagitm {
border: 1px solid #4379FF;
padding: 0px 2px;
text-align: center;
height: 16px;
line-height: 16px;
}
}
.reson {
font-size: 12px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #666666;
display: flex;
align-items: center;
flex-wrap: wrap;
margin-top: 8px;
.fill_tag {
height: 16px;
background: #C2D2FC;
border-radius: 4px 4px 4px 4px;
font-size: 10px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #4379FF;
display: flex;
align-items: center;
justify-content: center;
padding: 4px;
margin-right: 2px;
}
.fill_tag_warn {
background-color: #FFD7C0;
color: #FF5D29;
border-radius: 4px 4px 4px 4px;
}
}
.detail {
font-size: 10px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 14px;
margin-top: 12px;
}
}
}
.book_btn {
width: 48px;
height: 24px;
background: linear-gradient(90deg, #6591FF 0%, #4379FF 100%);
border-radius: 22px 22px 22px 22px;
text-align: center;
line-height: 24px;
color: #fff;
position: absolute;
right: 16px;
top: 16px;
}
}
}
}
}
.card5 {
width: 280px;
height: 90px;
border-radius: 16px;
background-color: #fff;
position: relative;
.guid_img {
width: 28px;
height: 28px;
position: absolute;
top: 50%;
transform: translateY(-44%);
right: -35px;
img {
width: 100%;
height: 100%;
}
}
.card_container {
padding: 16px;
box-sizing: border-box;
display: flex;
.cd_l {
img {
width: 40px;
height: 40px;
}
}
.cd_r {
margin-left: 8px;
.hostbital_name {
font-size: 14px;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #333333;
}
.second {
display: flex;
color: #999999;
margin-bottom: 6px;
.howway {
display: flex;
align-items: center;
img {
width: 12px;
height: 12px;
}
span {
margin-right: 8px;
font-size: 12px;
}
}
.addr {
font-size: 12px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #999999;
}
}
.tag_wrp {
display: flex;
.tag {
font-size: 10px;
color: #4379FF;
// width: 48px;
padding: 0px 2px;
height: 16px;
text-align: center;
line-height: 16px;
border-radius: 2px 2px 2px 2px;
opacity: 1;
border: 1px solid #B8CCFF;
}
}
}
}
}
.txt {
min-height: 44px;
padding: 10px 16px;
font-size: 14px;
font-family: PingFang SC, PingFang SC;
box-sizing: border-box;
font-weight: 400;
}
.txt_l {
background: #fff;
border-radius: 0px 12px 12px 12px;
color: #333333;
}
.txt_r {
border-radius: 12px 12px 0px 12px;
background: #4F82FF;
color: #fff;
}
/* @media (min-width: 1024px) {
.about {
min-height: 100vh;
display: flex;
align-items: center;
}
} */
.c_body {
.message-container {
height: calc(100vh - 124px);
overflow: auto;
border: 1px transparent solid;
background-color: rgb(245, 245, 251);
position: relative;
padding-top: 20px;
padding-bottom: 45px;
.message {
/* width: 100%;
height: 100%; */
margin-bottom: 16px !important;
}
}
.c_bottom {
width: 100vw;
// height: 60px;
min-height: 60px;
background-color: #fff;
border: 1px solid transparent ;
position: absolute;
// bottom: 180px;
top: calc(100vh - 122px);
left: 0px;
display: flex;
align-items: center;
// justify-content: center;
// padding: 12px 16px;
img {
width: 36px;
height: 36px;
position: absolute;
bottom: 12px;
left: 16px;
}
.tips {
/* display: flex;
align-items: center;
justify-content: flex-start; */
border: 1px solid transparent;
// width: calc(100vw - 154px);
width: 16px;
height: 16px;
// height: 36px;
/* position: absolute;
left: 60px; */
background: #F5F5FB;
// z-index: -1;
.icon {
width: 16px;
height: 16px;
position: relative;
margin-left: 12px;
img {
width: 16px;
height: 16px;
position: absolute;
top: 0;
left: 0;
}
}
/* .cont {
color: #999999;
margin-left: 8px;
font-size: 14px;
} */
}
.w_icon {
width: 16px;
height: 16px;
position: absolute;
left: calc(100vw - 303px);
;
top: 22px;
z-index: 2;
img {
width: 16px;
height: 16px;
position: absolute;
top: 0;
left: 0;
}
}
.send {
width: 60px;
height: 36px;
background: linear-gradient(90deg, #4379FF 0%, #6D97FF 100%);
border-radius: 36px 36px 36px 36px;
opacity: 1;
color: #fff;
text-align: center;
line-height: 36px;
font-size: 14px;
font-family: PingFang SC, PingFang SC;
position: absolute;
bottom: 12px;
right: 16px;
}
}
}
</style>