Browse Source

fix:排队中取消机器人自动回复

tsz 3 years ago
parent
commit
a4677ecc64

+ 1 - 0
public/index.html

@@ -5,6 +5,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
+    <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
     <title>剑鱼标讯</title>
      <!-- 使用CDN的CSS文件 -->
     <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>

+ 3 - 3
src/components/action-list/index.vue

@@ -36,7 +36,7 @@
         >
           <span class="action-img attach"></span>
         </el-upload>
-        <span v-else-if="isRobot" class="action-img" :class="item.type" slot="reference" @click="onClick(item.type)"></span>
+        <span v-else-if="isRobot === 2" class="action-img" :class="item.type" slot="reference" @click="onClick(item.type)"></span>
       </el-popover>
     </div>
     <div v-if="isLink">
@@ -79,8 +79,8 @@ export default {
       default: false
     },
     isRobot: {
-      type: Boolean,
-      default: false
+      type: Number,
+      default: 0
     }
   },
   data () {

+ 1 - 1
src/components/summary/index.vue

@@ -54,7 +54,7 @@ export default {
     },
     handleRemark: {
       type: String,
-      default: '参考是是大V女生女女SV你多少VN苏打绿你打开本地测试女律师'
+      default: ''
     }
   },
   data () {

+ 4 - 2
src/views/ChatView.vue

@@ -173,8 +173,8 @@ export default {
       default: 'dark'
     },
     isShowNps: {
-      type: Boolean,
-      default: true
+      type: Number,
+      default: 0
     }
   },
   components: {
@@ -609,6 +609,8 @@ export default {
   padding: 0;
   .answer-box{
     max-width: 400px;
+    max-height: 264px;
+    overflow-y: auto;
   }
   .answer-list{
     display: flex;

+ 20 - 16
src/views/CustomerServiceView.vue

@@ -405,16 +405,18 @@ export default {
           }
         })
         if (sUserId === this.other.userId) {
-          this.msgList.push({
-            messageId: id,
-            fool: 2,
-            type: contentType,
-            content: contentType !== 1 ? JSON.parse(content) : content,
-            create_time: dateFormatter(new Date().getTime())
-          })
-          this.$nextTick(() => {
-            this.$refs.userSide?.setScrollTop()
-          })
+          setTimeout(() => {
+            this.msgList.push({
+              messageId: id,
+              fool: 2,
+              type: contentType,
+              content: contentType !== 1 ? JSON.parse(content) : content,
+              create_time: dateFormatter(new Date().getTime())
+            })
+            this.$nextTick(() => {
+              this.$refs.userSide?.setScrollTop()
+            })
+          }, 1000)
         }
       } else if (data.type === 9) {
         // 系统消息 人工客服自动回复语
@@ -446,12 +448,14 @@ export default {
             fool: 1,
             create_time: dateFormatter(new Date().getTime())
           }
-          this.msgList.push(params)
-          this.$nextTick(() => {
-            this.$refs?.userSide.setScrollTop()
-            this.showInfo = false
-            this.selectItem = '结束'
-          })
+          setTimeout(() => {
+            this.msgList.push(params)
+            this.$nextTick(() => {
+              this.$refs?.userSide.setScrollTop()
+              this.showInfo = false
+              this.selectItem = '结束'
+            })
+          }, 1000)
         }
         // 移除存储的会话标识
         const storageBadge = this.kfSessionBadge

+ 12 - 8
src/views/CustomerView.vue

@@ -106,7 +106,7 @@ export default {
       lastOutTimer: null,
       lastEndTimer: null,
       setIntervalTimer: null, // 定时查询聊天记录
-      isShowNps: true // 是否显示评价按钮
+      isShowNps: 0 // 0:机器人,1排队中,2会话中
     }
   },
   computed: {
@@ -288,6 +288,7 @@ export default {
       console.log('websocket接收的消息:' + JSON.stringify(data))
       if (data.type === 6) {
         const { rUserId, nickName, sessionId } = data.data
+        this.isShowNps = 2
         // 客服端认领后回复建立会话的消息 返回客服昵称、userId(entId)、sessionId
         if (this.other.userId === rUserId) {
           this.other.isRobot = false
@@ -418,6 +419,7 @@ export default {
       } else if (data.type === 10) {
         // 收到系统消息-关闭会话
         // 系统关闭会话消息由服务端保存 前端只更新列表
+        this.isShowNps = 0
         const { rUserId, content, id } = data.data
         const params = {
           messageId: id,
@@ -453,7 +455,7 @@ export default {
           this.$refs?.userSide.setScrollTop()
         })
         this.getUserListFn()
-        this.isShowNps = false
+        this.isShowNps = 0
         this.other.isRobot = true
       } else if (data.type === 11) {
         // 获取用户聊天状态 type 1:排队中 2:会话中
@@ -463,19 +465,19 @@ export default {
           // this.other.isRobot = false
           // this.getFindMessage()
           // 需要创建会话
-          this.isShowNps = true
+          this.isShowNps = 1
           this.other.isRobot = true
           console.log('需要走创建会话逻辑')
           this.createSessionFn()
         } else if (type === 2) {
           // 会话中
-          this.isShowNps = true
+          this.isShowNps = 2
           this.other.isRobot = false
           this.getFindMessage()
           this.other.sessionId = sessionId
         } else {
           // 需要创建会话
-          this.isShowNps = false
+          this.isShowNps = 0
           this.other.isRobot = true
           console.log('需要走创建会话逻辑')
           this.createSessionFn()
@@ -484,8 +486,8 @@ export default {
     },
     // 转人工
     onTurnPeople (content = '') {
-      // clearTimeout(this.lastEndTimer)
-      // clearTimeout(this.lastOutTimer)
+      clearTimeout(this.lastEndTimer)
+      clearTimeout(this.lastOutTimer)
       this.webSocketSend({
         type: 2,
         content: content,
@@ -623,7 +625,9 @@ export default {
           }
           const socketParams = {}
           this.onSendCommon({ apiParams, socketParams }, false)
-          this.robotOvertimeReply()
+          if (this.isShowNps === 0) {
+            this.robotOvertimeReply()
+          }
         }
       }
     },