增加客服组件

This commit is contained in:
龙运模
2024-11-09 17:04:46 +08:00
parent 0b9b5e2aef
commit 372ca89f07
6 changed files with 436 additions and 54 deletions
+228
View File
@@ -0,0 +1,228 @@
<template>
<div class="customerBox">
<el-image class="img" @click="openCustomer" src="/img/CustomerService.svg"></el-image>
<div class="customerView" v-if="customerShow">
<span class="arrow"></span>
<div class="viewBody">
<div class="title">智能客服
<el-icon class="close" size="18" @click="closeCustomer"><el-icon-Close/></el-icon>
</div>
<div class="bodyMain">
<el-scrollbar>
<div class="tagList">
<div class="tagItem" v-for="(item,index) in tagList" :key="index">{{item.name}}</div>
</div>
<div class="msgList">
<div class="msgItem" :class="item.type === 2?'msgRightItem':''" v-for="(item,index) in msgList" :key="index">
<div class="avatar" v-if="item.type === 1">
<el-avatar :size="36" :src="item.avatar" fit="contain">
<img src="https://cube.elemecdn.com/e/fd/0fc7d20532fdaf769a25683617711png.png"/>
</el-avatar>
</div>
<div class="msgText">
<div class="msgTitle">{{item.title}}</div>
<div class="textCom">{{item.msg}}</div>
</div>
<div class="avatar" v-if="item.type === 2">
<el-avatar :size="36" :src="item.avatar" fit="contain">
<img src="https://cube.elemecdn.com/e/fd/0fc7d20532fdaf769a25683617711png.png"/>
</el-avatar>
</div>
</div>
</div>
</el-scrollbar>
</div>
<div class="footer">
<el-input class="customTextarea" v-model="params.text" resize="none" type="textarea" :row="2" placeholder="请简短描述您的问题"></el-input>
<div class="saveBtn" :class="params.text!==''?'saveActive':''">发 送</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "index",
data(){
return{
customerShow:false,
params:{
text:''
},
tagList:[
{name:'搜索引擎和数据查询'},
{name:'用户体验和设计'},
{name:'技术和兼容性'},
{name:'质量问题'},
{name:'其他'},
],
msgList:[
{type:1,avatar:"https://dm-auto.oss-cn-shanghai.aliyuncs.com/xw_cloud/image/login_logo.png",title:"在线客服",msg:"您好,请问您需要什么帮助?"},
{type:1,avatar:"https://dm-auto.oss-cn-shanghai.aliyuncs.com/xw_cloud/image/login_logo.png",title:"在线客服",msg:"我是您的智能在线客服,您可以把你的问题告诉我,我会尽我所能帮助您。"},
{type:2,avatar:"https://dm-auto.oss-cn-shanghai.aliyuncs.com/xw_cloud/5.gif",title:"龙隆",msg:"怎么能快速的挣够一百万"}
]
}
},
mounted() {
},
methods:{
openCustomer(){
this.customerShow = !this.customerShow;
},
closeCustomer(){
this.customerShow = false;
},
}
}
</script>
<style scoped lang="scss">
.customerBox{
position: fixed;
right: 40px;
bottom: 80px;
z-index: 10;
.img{
width: 56px;
height: 56px;
}
.customerView{
width: 300px;
height: 430px;
position: absolute;
right: 0;
bottom: 70px;
background: #fff;
box-shadow: 0 4px 4px rgba(19,103,193,0.3);
border: 1px solid #B7D7F9;
border-radius: 8px;
.viewBody{
display: flex;
flex-direction: column;
height: 100%;
.title{
padding: 15px 10px;
border-bottom: 1px solid #F6F6F6;
font-size: 14px;
font-weight: 500;
display: flex;
align-items: center;
justify-content: space-between;
.close{
cursor: pointer;
}
}
.bodyMain{
flex: 1;
overflow: hidden;
.tagList{
display: flex;
flex-wrap: wrap;
padding: 0 10px;
.tagItem{
background: #F4F4F4;
padding: 10px;
border-radius: 4px;
margin: 10px 10px 0 0;
color: #555;
}
}
.msgList{
padding: 10px;
.msgItem{
display: flex;
margin-bottom: 8px;
.avatar{
padding-right: 10px;
}
.msgText{
.msgTitle{
padding: 6px 0;
color: #555;
}
.textCom{
background: #f5f5f5;
border-radius: 4px;
padding: 10px;
}
}
}
.msgRightItem{
justify-content: flex-end;
.avatar{
padding-left: 10px;
padding-right: 0;
}
.msgText{
.msgTitle{
text-align: right;
}
.textCom{
background: var(--el-color-primary);
color: var(--el-color-white);
}
}
}
}
}
.footer{
padding: 10px;
border-top: 1px solid #F6F6F6;
position: relative;
.customTextarea{
font-size:13px;
::v-deep .el-textarea__inner{
box-shadow: none;
border: 0;
padding-right: 60px;
}
::v-deep .el-textarea__inner::-webkit-scrollbar{
width: 0;
}
}
.saveBtn{
position: absolute;
bottom:22px;
right: 10px;
z-index: 10;
padding: 7px 15px;
background: #f4f4f5;
color: #A8ABB2;
border-radius: 3px;
cursor: not-allowed;
}
.saveActive{
cursor: pointer;
background: var(--el-color-primary);
color: var(--el-color-white);
}
}
}
}
.arrow{
position: absolute;
bottom: -5px;
right: 12px;
z-index: 1;
}
.arrow:before{
content: "";
position: absolute;
bottom: 0;
right: 12px;
z-index:1;
width: 8px;
height: 8px;
border: 1px solid #B7D7F9;
border-left-color:transparent;
border-top-color:transparent;
transform:rotate(45deg);
background: #fff;
}
}
</style>