|
|
@@ -22,11 +22,11 @@
|
|
|
<i v-if="(selNum + tokNum) >= 4" @click="ejectEvl(10)" class="sc pointer" :class="selType?'scActy':''">
|
|
|
</i>
|
|
|
<div v-if="showleaveIcon" style="float: right" class="pointer" @click="leaveMsg()">
|
|
|
- <span style="font-size: 25px; color: #b3c1e7; margin-top: 13px" @click="back()"
|
|
|
+ <span style="font-size: 25px; color: #b3c1e7; vertical-align: middle;" @click="back()"
|
|
|
class="el-icon-chat-line-round"></span>
|
|
|
</div>
|
|
|
<div v-if="!showleaveIcon" style="float: right; cursor: not-allowed">
|
|
|
- <span style="font-size: 25px; color: #d6d1c4; margin-top: 13px"
|
|
|
+ <span style="font-size: 25px; color: #d6d1c4; vertical-align: middle;"
|
|
|
class="el-icon-chat-line-round"></span>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -133,7 +133,7 @@
|
|
|
|
|
|
<!-- 机器人回答 -->
|
|
|
<div class="conversationBox" v-else-if='item.type == "service"'>
|
|
|
- <div class=" row">
|
|
|
+ <div class="row">
|
|
|
<div class="conversation row">
|
|
|
<div class="headImg">
|
|
|
<img src="./../assets/st-img/headAdvent.png" alt="">
|
|
|
@@ -354,8 +354,7 @@
|
|
|
<el-col>
|
|
|
<!-- 发送图和表情按钮 -->
|
|
|
<div style="height:18px; display:flex;">
|
|
|
- <el-popover placement="top-start" width="200" trigger="hover"
|
|
|
- style="margin-top: -2px;">
|
|
|
+ <el-popover id="pop" placement="top-start" width="200" trigger="hover">
|
|
|
<ul>
|
|
|
<li class="emoticon" v-for="(item,index) in frceArr" :key="item.id">
|
|
|
<img class="pointer" :src="require(`@/assets/st-img/${index}.gif`)"
|
|
|
@@ -376,7 +375,7 @@
|
|
|
|
|
|
<div class="row center allAlignment chattingBox">
|
|
|
<div style="height:44px;width:300px;">
|
|
|
- <textarea name=""
|
|
|
+ <textarea name=""
|
|
|
id="information"
|
|
|
v-model.trim="information"
|
|
|
cols="30"
|
|
|
@@ -424,7 +423,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="headPortrait">
|
|
|
- <img :src="require('@/assets/st-img/kf.png')" alt="">
|
|
|
+ <img :src="require('@/assets/st-img/headPortrait.png')" alt="">
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col class="autograph pd20">
|
|
|
@@ -478,7 +477,7 @@
|
|
|
|
|
|
</div>
|
|
|
<!-- 评价框 -->
|
|
|
- <el-card class="box-card" v-if="evlShow">
|
|
|
+ <el-card id="box_card" class="box-card" v-if="evlShow">
|
|
|
<div class="close"><i @click="closeEvl()"></i></div>
|
|
|
<div class="tit">
|
|
|
<span>感谢您的咨询,请对我们的服务做出评价</span>
|
|
|
@@ -503,6 +502,20 @@
|
|
|
</el-card>
|
|
|
|
|
|
<div class="zzBox" v-if="zzShow"></div>
|
|
|
+
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ :close-on-click-modal="true"
|
|
|
+ :close-on-press-escape ="true"
|
|
|
+ title="是否发送图片"
|
|
|
+ :visible.sync="dialogPaste"
|
|
|
+ width="35%">
|
|
|
+ <el-image :src="pasteUrl" :fit="fit"></el-image>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogPaste = false">取 消</el-button>
|
|
|
+ <el-button type="primary" style="color: #333" @click="handleClose()">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -533,7 +546,7 @@
|
|
|
error: false,
|
|
|
emlError: false,
|
|
|
artAndLeave: 0, // 默认为100,转人工为10,人工不在转留言为100
|
|
|
- chatCont: [], // 客户会话数据
|
|
|
+ chatCont: [], // 机器人会话数据
|
|
|
imageUrl: [],//上传图片
|
|
|
img: '', //上传的单个图片路径
|
|
|
dialogVisible: false, //图片放大
|
|
|
@@ -607,7 +620,11 @@
|
|
|
waitingText: "", // 等待内容
|
|
|
|
|
|
service_on:true, // 现在状态
|
|
|
- avatarImg: fk
|
|
|
+ avatarImg: fk,
|
|
|
+
|
|
|
+ dialogPaste: false,
|
|
|
+ pasteUrl:'',//截屏图片
|
|
|
+ fit:'contain', // 图片样式
|
|
|
}
|
|
|
},
|
|
|
filters: {
|
|
|
@@ -630,6 +647,137 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+
|
|
|
+ /***qq截图粘贴************/
|
|
|
+ paste(){
|
|
|
+ let _this = this;
|
|
|
+ var imgReader = function(item){
|
|
|
+ var blob = item.getAsFile(),reader = new FileReader();
|
|
|
+ // 读取文件后将其显示在网页中
|
|
|
+ reader.onload = function( e ){
|
|
|
+ var img = new Image();
|
|
|
+
|
|
|
+ img.src = e.target.result;
|
|
|
+ _this.dialogPaste =true;
|
|
|
+ _this.pasteUrl = e.target.result;
|
|
|
+ // console.log(img.src)
|
|
|
+ //document.body.appendChild( img );
|
|
|
+ };
|
|
|
+ // 读取文件
|
|
|
+ reader.readAsDataURL( blob );
|
|
|
+ };
|
|
|
+ document.getElementById('information').addEventListener('paste',function( e ){
|
|
|
+ // 添加到事件对象中的访问系统剪贴板的接口
|
|
|
+ let clipboardData = e.clipboardData,
|
|
|
+ i = 0,
|
|
|
+ items, item, types;
|
|
|
+
|
|
|
+ if( clipboardData ){
|
|
|
+ items = clipboardData.items;
|
|
|
+ if( !items ){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ item = items[0];
|
|
|
+ // 保存在剪贴板中的数据类型
|
|
|
+ types = clipboardData.types || [];
|
|
|
+ for( ; i < types.length; i++ ){
|
|
|
+ if( types[i] === 'Files' ){
|
|
|
+ item = items[i];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 判断是否为图片数据
|
|
|
+ if( item && item.kind === 'file' && item.type.match(/^image\//i) ){
|
|
|
+ imgReader( item );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /*****发送截图******/
|
|
|
+ handleClose(done) {
|
|
|
+ this.dialogPaste = false;
|
|
|
+ let blob = this.$public.dataURItoBlob(this.pasteUrl)
|
|
|
+ let self = this;
|
|
|
+ var formData = new FormData();
|
|
|
+ formData.append("file", blob);
|
|
|
+ self.upImg(formData);
|
|
|
+ },
|
|
|
+
|
|
|
+ upImg(formData){
|
|
|
+ let self = this;
|
|
|
+ // 数据结构请求
|
|
|
+ this.$axios.post('/api/index/upload/uploadImg', formData).then(res => {
|
|
|
+ console.log(res.data.data)
|
|
|
+ console.log(res.data.data.src);
|
|
|
+ let str = this.information;
|
|
|
+ let formatStr = str.replace(/\n/g, '<br/>');
|
|
|
+ if (res.data.code == 1) {
|
|
|
+ let isFirst = true;
|
|
|
+ let str = this.information;
|
|
|
+ let formatStr = str.replace(/\n/g, '<br/>');
|
|
|
+ // 给机器人发送文本消息
|
|
|
+ if (this.machineAndAtl == 10) {
|
|
|
+ //给机器人发送文本消息-本地储存
|
|
|
+ let datas = {
|
|
|
+ time: '',
|
|
|
+ chat: this.turnFace(this.shieldingKeyword(formatStr)),
|
|
|
+ imgUrl: res.data.data.src,
|
|
|
+ type: 'user'
|
|
|
+ }
|
|
|
+ this.chatCont.push(datas)
|
|
|
+ //消息发送-机器人
|
|
|
+ this.websocketsend(JSON.stringify({
|
|
|
+ type: 'toRobot',
|
|
|
+ data: {
|
|
|
+ groups_id: '1',
|
|
|
+ robot_name: this.shieldingKeyword(formatStr),
|
|
|
+ webTime: this.webTime,
|
|
|
+ robotgroups_id: '1',
|
|
|
+ }
|
|
|
+ }))
|
|
|
+ } else if (this.machineAndAtl == 100) { //人工聊天
|
|
|
+ // 人工聊天超时隐藏
|
|
|
+ this.willOverTime = false;
|
|
|
+ //发送给客服消息-本地储存
|
|
|
+ this.customerSviceChat.push({
|
|
|
+ time: '',
|
|
|
+ content: this.turnFace(this.shieldingKeyword(formatStr)),
|
|
|
+ imgUrl: res.data.data.src,
|
|
|
+ type: 'user',
|
|
|
+ });
|
|
|
+
|
|
|
+ //消息发送-客服
|
|
|
+ this.websocketsend(JSON.stringify({
|
|
|
+ type: 'chatMessage',
|
|
|
+ data: {
|
|
|
+ from_name: this.user_info.name,
|
|
|
+ from_avatar: this.user_info.avatar,
|
|
|
+ from_id: this.user_info.id,
|
|
|
+ content: JSON.stringify({
|
|
|
+ text: formatStr,
|
|
|
+ img: res.data.data.src,
|
|
|
+ type: 'user'
|
|
|
+ }),
|
|
|
+ webTime: this.webTime,
|
|
|
+ to_id: this.service.kf_id,
|
|
|
+ to_name: this.service.kf_name,
|
|
|
+ sensitiveNumber: this.sensitiveNumber,
|
|
|
+ conversationId: this.service.conversationId
|
|
|
+ }
|
|
|
+ }))
|
|
|
+ this.tokNum++;
|
|
|
+ }
|
|
|
+ // 发送之后清空发送数据
|
|
|
+ this.img = '';
|
|
|
+ this.information = '';
|
|
|
+ //高度自动向上滑动
|
|
|
+ this.automaticRolling();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
// 退出聊天
|
|
|
exit(){
|
|
|
this.websocketsend(JSON.stringify({
|
|
|
@@ -1487,9 +1635,13 @@
|
|
|
this.getSensitive();
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+ this.paste();
|
|
|
},
|
|
|
// 组件挂载阶段
|
|
|
-
|
|
|
+ beforeDestroy(){
|
|
|
+ document.getElementById('information').removeEventListener('paste')
|
|
|
+ },
|
|
|
destroyed() {
|
|
|
this.websock.close() //离开路由之后断开websocket连接
|
|
|
this.lockReconnect = true;
|