From c7187e038c284acc051a439c5eda16582bdb9b7a Mon Sep 17 00:00:00 2001
From: lixuliang <lixuliang_hd@126.com>
Date: 星期六, 14 九月 2024 10:16:13 +0800
Subject: [PATCH] 更新

---
 src/assets/js/mapMsg.js |   34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/src/assets/js/mapMsg.js b/src/assets/js/mapMsg.js
index 35923a9..b78b359 100644
--- a/src/assets/js/mapMsg.js
+++ b/src/assets/js/mapMsg.js
@@ -4,7 +4,7 @@
 window.mapMsg = {
     setTimeInterval: null,
     testMsg(res) {
-        // console.log(res);
+        console.log(res);
         this.setMsgMatching({
             message: res,
             baidu_keys: {
@@ -17,21 +17,33 @@
     init() {
         var that = this;
         window.addEventListener("message", res => {
-            // if (res.data.status === "ok") {
-            //     that.setMsgMatching(res.data.params);
-            // }
             if (res.data.type === "command") {
-                let info = res.data.params
+                let info = res.data.params;
+                let resIndex = '';
                 if (info.includes("瀹氫綅鍒�")) {
-                    info.search("銆�") != -1 ? mapMsg.testMsg(info.slice(3, -1)) : mapMsg.testMsg(info.slice(3))
+                    resIndex = info.search('瀹氫綅鍒�') + 3;
                 } else if (info.includes("瀹氫綅")) {
-                    info.search("銆�") != -1 ? mapMsg.testMsg(info.slice(2, -1)) : mapMsg.testMsg(info.slice(2))
+                    resIndex = info.search('瀹氫綅') + 2;
                 } else {
-                    info.search("銆�") != -1 ? mapMsg.testMsg(info.slice(0, -1)) : mapMsg.testMsg(info.slice(0))
-                    // mapMsg.testMsg(info.slice(0, -1))//鏈夊彞鍙�
-                    // mapMsg.testMsg(info.slice(0))//娌″彞鍙�
+                    resIndex = info.search('') + 0;
                 }
+                info.search("銆�") != -1 ? mapMsg.testMsg(info.slice(resIndex, -1)) : mapMsg.testMsg(info.slice(resIndex));
             }
+            // // if (res.data.status === "ok") {
+            // //     that.setMsgMatching(res.data.params);
+            // // }
+            // if (res.data.type === "command") {
+            //     let info = res.data.params
+            //     if (info.includes("瀹氫綅鍒�")) {
+            //         info.search("銆�") != -1 ? mapMsg.testMsg(info.slice(3, -1)) : mapMsg.testMsg(info.slice(3))
+            //     } else if (info.includes("瀹氫綅")) {
+            //         info.search("銆�") != -1 ? mapMsg.testMsg(info.slice(2, -1)) : mapMsg.testMsg(info.slice(2))
+            //     } else {
+            //         info.search("銆�") != -1 ? mapMsg.testMsg(info.slice(0, -1)) : mapMsg.testMsg(info.slice(0))
+            //         // mapMsg.testMsg(info.slice(0, -1))//鏈夊彞鍙�
+            //         // mapMsg.testMsg(info.slice(0))//娌″彞鍙�
+            //     }
+            // }
         });
     },
     // clearTime() {
@@ -63,7 +75,7 @@
         var rom = mapData.msgMach.lineRoam;//'婕父', '瀵艰埅'
         var closeRomData = mapData.msgMach.closeRoam;//'鍋滄婕父', '鍋滄瀵艰埅'
         // var acceptData = mapData.msgMach.acceptMsg;
-        
+
         // 鍦板浘澶嶄綅
         var valRest = rest.filter((rs) => {
             if (param.indexOf(rs) > -1) {

--
Gitblit v1.9.3