xdd před 19 hodinami
rodič
revize
9ec263f03e
1 změnil soubory, kde provedl 18 přidání a 8 odebrání
  1. 18 8
      pages/index/index.vue

+ 18 - 8
pages/index/index.vue

@@ -49,9 +49,8 @@
   </view>
 </template>
 <script>
-import Clipboard from 'clipboard' // 引入Clipboard
+// 引入Clipboard
 import {getTemplateByNo, getTemplateById, callback, youkuClickCallback, iqiyiClickCallback} from '../../api/api.js'
-import {clicks} from '../../common/common.js'
 import agentAvatar from '../../static/customer.png'
 import userAvatar from '../../static/profile.png'
 
@@ -242,7 +241,7 @@ export default {
       })
     },
     // 加载聊天组件的消息
-    loadChatMessage() {
+    async loadChatMessage() {
       let h5ChatItem = this.json.filter(e => e.type === 'h5-chat')[0]
       h5ChatItem.messages = []
 
@@ -254,19 +253,29 @@ export default {
 
         if (!msg.options || msg.options.length === 0) {
           isOutputWelcome = 1
-          setTimeout(() => {
-            h5ChatItem.messages.push(msg)
-          }, 1000)
+          await this.delay(1000)
+          h5ChatItem.messages.push(msg)
+
         } else {
           if ((isOutputWelcome === 1) || (isOutputWelcome === 0)) {
             isOutputWelcome = 2
-            setTimeout(() => {
+            await this.delay(2000)
               h5ChatItem.messages.push(msg)
-            }, 3000)
             break;
           }
         }
       }
+
+      if (h5ChatItem.agentMsg.length === 0) {
+        await this.delay(1000);
+        h5ChatItem.messages.push({
+          id: this.getChatMsgIdMax(),
+          sender: 'agent',
+          text: "好的,已经为您分配专业老师。<span style='color:red'>【点击下方按钮】</span>添加老师,获取免费上课链接。!",
+          options: []
+        });
+      }
+
     },
     startCountdown(item) {
       if (!item.active) {
@@ -363,6 +372,7 @@ export default {
       }
     },
     getAgentAvatar(item) {
+      console.log(item.style.avatar)
       if (item.style.avatar) {
         return item.style.avatar
       }