huangxiaojing 3 yıl önce
ebeveyn
işleme
913f2e1b2b

+ 2 - 24
screenAndroid/WXdraw.js

@@ -68,15 +68,7 @@ function doConnect() {
     wsss.close();
     throttle(doConnect, 100);
     if (errorTime > 1000) {
-      if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-        tt.miniProgram.switchTab({
-          url: '/pages/home/home'
-        })
-      } else {
-        wx.miniProgram.switchTab({
-          url: '/pages/home/home'
-        })
-      }
+      quit();
     }
   };
   wsss.onmessage = function (res) {
@@ -98,21 +90,7 @@ function doConnect() {
           }, function () {
             isControl = false;
             //点击取消后的回调函数
-            if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-              tt.miniProgram.switchTab({
-                url: '/pages/home/home'
-              })
-            } else if (window.__wxjs_environment === 'miniprogram') {
-              wx.miniProgram.switchTab({
-                url: '/pages/home/home'
-              })
-            } else {
-              document.addEventListener('UniAppJSBridgeReady', function () {
-                uni.navigateTo({
-                  url: '/pages/index/index'
-                });
-              })
-            }
+            quit();
           });
         } else {
           $.confirm("当前云手机正在授控,是否请求获取云手机控制权?", function () {

+ 34 - 66
screenAndroid/WXtrialInterface.html

@@ -35,14 +35,14 @@
   <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.3/style/weui.min.css" />
   <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.1/css/jquery-weui.min.css" />
   <style>
-    .try-use-wrap, .buy-phone-wrap, .look-wrap{
-        width: 100%;
-        height: 100%;
-        position: fixed;
-        top: 0;
-        left: 0;
-        z-index: 9999;
-        background: rgba(0, 0, 0, 0.5);
+    .try-use-wrap, .buy-phone-wrap, .look-wrap {
+      width: 100%;
+      height: 100%;
+      position: fixed;
+      top: 0;
+      left: 0;
+      z-index: 9999;
+      background: rgba(0, 0, 0, 0.5);
       display: none;
     }
 
@@ -354,15 +354,7 @@
         } else {
           clearInterval(intervaler);
           $.toast("画面异常,请重新进入", "text");
-          if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-            tt.miniProgram.switchTab({
-              url: '/pages/home/home'
-            })
-          } else {
-            wx.miniProgram.switchTab({
-              url: '/pages/home/home'
-            })
-          }
+          quit();
         }
       }, 3000);
 
@@ -380,15 +372,7 @@
         if (errorTime > 1000) {
           $.toast("画面异常,请重新进入", "text");
           wsss.close();
-          if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-            tt.miniProgram.switchTab({
-              url: '/pages/home/home'
-            })
-          } else {
-            wx.miniProgram.switchTab({
-              url: '/pages/home/home'
-            })
-          }
+          quit();
         }
       });
       ws.addEventListener('message', function (event) {
@@ -439,7 +423,7 @@
       });
     }
 
-    var hidden, visibilityChange; 
+    var hidden, visibilityChange;
     if (typeof document.hidden !== "undefined") { // Opera 12.10 and Firefox 18 and later support 
       hidden = "hidden";
       visibilityChange = "visibilitychange";
@@ -455,21 +439,7 @@
     document.addEventListener("visibilitychange", function () {
       console.log(document[hidden]);
       if (document[hidden]) {
-        if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-          tt.miniProgram.switchTab({
-            url: '/pages/home/home'
-          })
-        } else if (window.__wxjs_environment === 'miniprogram') {
-          wx.miniProgram.switchTab({
-            url: '/pages/home/home'
-          })
-        } else {
-          document.addEventListener('UniAppJSBridgeReady', function () {
-            uni.webView.navigateTo({
-              url: '/pages/index/index'
-            });
-          })
-        }
+        quit();
       }
     }, false);
 
@@ -490,6 +460,24 @@
       $('.mask').hide();
     }
 
+    function quit() {
+      if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+        tt.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else if (window.__wxjs_environment === 'miniprogram') {
+        wx.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else {
+        document.addEventListener('UniAppJSBridgeReady', function () {
+          uni.webView.navigateTo({
+            url: '/pages/index/index'
+          });
+        })
+      }
+    }
+
     function decodeAAC(data) {
       var retPtr = Module._malloc(4 * 5 * 1024); // 接收的数据
       var inputPtr = Module._malloc(4 * data.length); // 输入数据
@@ -549,15 +537,7 @@
             clearInterval(intervaler);
             ws.close();
             wsss.close();
-            if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-              tt.miniProgram.switchTab({
-                url: '/pages/home/home'
-              })
-            } else {
-              wx.miniProgram.switchTab({
-                url: '/pages/home/home'
-              })
-            }
+            quit();
           }
         }
         if (input[23] == 0x05) { //横竖屏标识
@@ -927,15 +907,7 @@
       clearInterval(intervaler);
       ws.close();
       wsss.close();
-      if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-        tt.miniProgram.switchTab({
-          url: '/pages/home/home'
-        })
-      } else {
-        wx.miniProgram.switchTab({
-          url: '/pages/home/home'
-        })
-      }
+      quit();
     })
 
     function selectText(x) {
@@ -1108,9 +1080,7 @@
       $('.buy-phone-wrap').eq(0).hide();
       if (disconnectionFlag || getDate) {//设置了断线时间,取消直接退出
         systemBuriedPoint('激活码-断线-取消');
-        wx.miniProgram.switchTab({
-          url: '/pages/home/home'
-        })
+        quit();
         return
       }
       let pointName = '';
@@ -1157,9 +1127,7 @@
       } else {
         systemBuriedPoint('激活码-强制关闭-放弃');
       }
-      wx.miniProgram.switchTab({
-        url: '/pages/home/home'
-      })
+      quit();
     })
     // 继续观看
     $('.looking')[0].addEventListener('click', () => {

+ 2 - 30
screenIos/WXdraw.js

@@ -77,21 +77,7 @@ function doConnect() {
     wsss.close();
     throttle(doConnect, 100);
     if (errorTime > 1000) {
-      if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-        tt.miniProgram.switchTab({
-          url: '/pages/home/home'
-        })
-      } else if (window.__wxjs_environment === 'miniprogram') {
-        wx.miniProgram.switchTab({
-          url: '/pages/home/home'
-        })
-      } else {
-        document.addEventListener('UniAppJSBridgeReady', function () {
-          uni.navigateTo({
-            url: '/pages/index/index'
-          });
-        })
-      }
+      quit();
     }
   };
   wsss.onmessage = function (res) {
@@ -113,21 +99,7 @@ function doConnect() {
           }, function () {
             isControl = false;
             //点击取消后的回调函数
-            if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-              tt.miniProgram.switchTab({
-                url: '/pages/home/home'
-              })
-            } else if (window.__wxjs_environment === 'miniprogram') {
-              wx.miniProgram.switchTab({
-                url: '/pages/home/home'
-              })
-            } else {
-              document.addEventListener('UniAppJSBridgeReady', function () {
-                uni.navigateTo({
-                  url: '/pages/index/index'
-                });
-              })
-            }
+            quit();
           });
         } else {
           $.confirm("当前云手机正在授控,是否请求获取云手机控制权?", function () {

+ 23 - 67
screenIos/WXtrialInterface.html

@@ -674,24 +674,7 @@
       decodeWoker.postMessage('close');
       decodeWoker.terminate();
       webSocketWorker.terminate();
-      if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-        tt.miniProgram.switchTab({
-          url: '/pages/home/home'
-        })
-      } else if (window.__wxjs_environment === 'miniprogram') {
-        wx.miniProgram.switchTab({
-          url: '/pages/home/home'
-        })
-      } else {
-        location.href = 'http://14.18.190.141:1280/cloud/phone/web/#/pages/index/index'
-        // 动态设置有问题 https://ask.dcloud.net.cn/question/96060
-        // document.addEventListener('UniAppJSBridgeReady', function() {
-        //   console.log(222)
-        //   uni.navigateTo({
-        //     url: '/pages/index/index'
-        //   });
-        // })
-      }
+      quit();
     })
 
     function handleClose() {
@@ -807,22 +790,7 @@
             decodeWoker.postMessage('close');
             decodeWoker.terminate();
             webSocketWorker.terminate();
-            if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-              tt.miniProgram.switchTab({
-                url: '/pages/home/home'
-              })
-            } else if (window.__wxjs_environment === 'miniprogram') {
-              wx.miniProgram.switchTab({
-                url: '/pages/home/home'
-              })
-            } else {
-              location.href = `${baseUrl}/cloud/phone/web/#/pages/index/index`
-              // document.addEventListener('UniAppJSBridgeReady', function() {
-              //   uni.navigateTo({
-              //     url: '/pages/index/index'
-              //   });
-              // })
-            }
+            quit();
           }
         }
         if (input[23] == 0x05) { //横竖屏标识
@@ -847,22 +815,7 @@
         decodeWoker.postMessage('close');
         decodeWoker.terminate();
         webSocketWorker.terminate();
-        if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-          tt.miniProgram.switchTab({
-            url: '/pages/home/home'
-          })
-        } else if (window.__wxjs_environment === 'miniprogram') {
-          wx.miniProgram.switchTab({
-            url: '/pages/home/home'
-          })
-        } else {
-          location.href = `${baseUrl}/cloud/phone/web/#/pages/index/index`
-          // document.addEventListener('UniAppJSBridgeReady', function() {
-          //   uni.navigateTo({
-          //     url: '/pages/index/index'
-          //   });
-          // })
-        }
+        quit();
       }
     }
 
@@ -1024,9 +977,7 @@
       $('.buy-phone-wrap').eq(0).hide();
       if (disconnectionFlag || getDate) {//设置了断线时间,取消直接退出
         systemBuriedPoint('激活码-断线-取消');
-        wx.miniProgram.switchTab({
-          url: '/pages/home/home'
-        })
+        quit();
         return
       }
       let pointName = '';
@@ -1073,9 +1024,7 @@
       } else {
         systemBuriedPoint('激活码-强制关闭-放弃');
       }
-      wx.miniProgram.switchTab({
-        url: '/pages/home/home'
-      })
+      quit();
     })
     // 继续观看
     $('.looking')[0].addEventListener('click', () => {
@@ -1150,21 +1099,28 @@
     // 处理页面可见属性的改变
     document.addEventListener("visibilitychange", function () {
       if (document[hidden]) {
-        if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-          tt.miniProgram.switchTab({
-            url: '/pages/home/home'
-          })
-        } else if (window.__wxjs_environment === 'miniprogram') {
-          wx.miniProgram.switchTab({
-            url: '/pages/home/home'
-          })
-        } else {
+        quit();
+      }
+    }, false);
+
+    function quit() {
+      if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+        tt.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else if (window.__wxjs_environment === 'miniprogram') {
+        wx.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else {
+        document.addEventListener('UniAppJSBridgeReady', function () {
           uni.webView.navigateTo({
             url: '/pages/index/index'
           });
-        }
+        })
       }
-    }, false);
+    }
+    
     window.onbeforeunload = function () {
       wsss.close();
       decodeWoker.postMessage('close');