Sfoglia il codice sorgente

输出响应消耗时间

leo 9 mesi fa
parent
commit
872159dc73
1 ha cambiato i file con 12 aggiunte e 5 eliminazioni
  1. 12 5
      static/rtcEngine/js/WXtrialInterface.js

+ 12 - 5
static/rtcEngine/js/WXtrialInterface.js

@@ -102,14 +102,13 @@ const app = new Vue({
         layoutViewHeight: null,
         // 是否显示video
         isShowVideo: false,
-        plugFlowStartDate: null,
-        obtainCardInfoStartDate: null
+        plugFlowStartTime: null,
+        obtainCardInfoStartTime: null
     },
     created() {
         this.initConfig()
     },
     mounted() {
-        this.obtainCardInfoStartDate = + new Date()
         this.getUserCardInfo()
     },
     computed: {
@@ -175,7 +174,8 @@ const app = new Vue({
 
         // 连接webRTC
         connectWebRtc() {
-            this.plugFlowStartDate = +new Date()
+            console.time('获取推流响应消耗时间:')
+            this.plugFlowStartTime = +new Date()
             const { sn: topic, cardToken: authToken, internetHttps, internetHttp, webrtcTransferCmnet, webrtcTransferTelecom, webrtcTransferUnicom } = this.userCardInfoData;
             const isWss = location.protocol === 'https:'
             const url = `${isWss ? 'wss://' : 'ws://'}${isWss ? internetHttps : internetHttp}/nats`;
@@ -243,6 +243,9 @@ const app = new Vue({
                         this.isShowVideo = true
                         this.$refs.rtcMediaPlayer.muted = true
                         this.$refs.rtcMediaPlayer.play()
+                        let ms = +new Date - this.plugFlowStartTime
+                        console.timeEnd('获取推流响应消耗时间:')
+                        console.log(`获取推流响应消耗时间:${ms / 1000}秒`)
                         this.definitionFun(this.definitionValue)
                         this.pushflowPopup()
                         this.getResidueTime()
@@ -527,6 +530,8 @@ const app = new Vue({
                 duration: 0, // 持续展示 toast
                 message: '数据加载中...',
             });
+            this.obtainCardInfoStartTime = + new Date()
+            console.time('获取卡信息响应消耗时间:')
             let { userCardId } = this.parametersData
             userCardId = +userCardId
             const statusTips = {
@@ -559,7 +564,9 @@ const app = new Vue({
                             return
                         }
                         this.userCardInfoData = res.data
-                        let ms = + new Date() - this.obtainCardInfoStartDate
+                        let ms = + new Date() - this.obtainCardInfoStartTime
+                        console.timeEnd('获取卡信息响应消耗时间:')
+                        console.log(`获取卡信息响应消耗时间:${ms / 1000}秒`)
                         this.connectWebRtc()
                         return
                     case 5200: