huangxiaojing před 3 roky
rodič
revize
e1178f0d27
2 změnil soubory, kde provedl 78 přidání a 58 odebrání
  1. 39 31
      static/screenAndroid/timer.js
  2. 39 27
      static/screenIos/timer.js

+ 39 - 31
static/screenAndroid/timer.js

@@ -1,35 +1,41 @@
 function handleQuit() {
-  $.actions({
-    actions: [{
-      text: "退出",
-      onClick: function () {
-        decodeWoker.postMessage('close');
-        decodeWoker.terminate();
-        quit();
-      }
-    }, {
-      text: "退出并下机",
-      onClick: function () {
-        $.ajax({
-          url: baseUrl + '/api/resources/yearMember/downline?userCardId=' + userCardId,
-          headers: {
-            Authorization: token
-          },
-          type: 'get',
-          dataType: 'json',
-          function(res) {
-            if (res.status === 0) {
-              decodeWoker.postMessage('close');
-              decodeWoker.terminate();
-              quit();
-            } else {
-              $.toast(res.msg, 'text');
-            }
-          },
-        });
-      }
-    }]
-  });
+  if (sourceType === 5) {
+    $.actions({
+      actions: [{
+        text: "退出",
+        onClick: function () {
+          ws.close();
+          wsss.close();
+          quit();
+        }
+      }, {
+        text: "退出并下机",
+        onClick: function () {
+          $.ajax({
+            url: baseUrl + '/api/resources/yearMember/downline?userCardId=' + userCardId,
+            headers: {
+              Authorization: token
+            },
+            type: 'get',
+            dataType: 'json',
+            function(res) {
+              if (res.status === 0) {
+                ws.close();
+                wsss.close();
+                quit();
+              } else {
+                $.toast(res.msg, 'text');
+              }
+            },
+          });
+        }
+      }]
+    });
+  } else {
+    ws.close();
+    wsss.close();
+    quit();
+  }
 }
 var residueTime = 0, residueTimer, isShowCountdown = +parameters['isShowCountdown'], isShowRule = +parameters['isShowRule'];
 if (isShowCountdown) {
@@ -56,6 +62,8 @@ if (sourceType === 5) {
             $('.count').text(residueTimeStamp(residueTime))
           } else {
             clearInterval(residueTimer);
+            ws.close();
+            wsss.close();
             quit();
           }
         }, 1000);

+ 39 - 27
static/screenIos/timer.js

@@ -1,31 +1,41 @@
 function handleQuit() {
-  $.actions({
-    actions: [{
-      text: "退出",
-      onClick: function () {
-        quit();
-      }
-    }, {
-      text: "退出并下机",
-      onClick: function () {
-        $.ajax({
-          url: baseUrl + '/api/resources/yearMember/downline?userCardId=' + userCardId,
-          headers: {
-            Authorization: token
-          },
-          type: 'get',
-          dataType: 'json',
-          function(res) {
-            if (res.status === 0) {
-              quit();
-            } else {
-              $.toast(res.msg, 'text');
-            }
-          },
-        });
-      }
-    }]
-  });
+  if (sourceType === 5) {
+    $.actions({
+      actions: [{
+        text: "退出",
+        onClick: function () {
+          decodeWoker.postMessage('close');
+          decodeWoker.terminate();
+          quit();
+        }
+      }, {
+        text: "退出并下机",
+        onClick: function () {
+          $.ajax({
+            url: baseUrl + '/api/resources/yearMember/downline?userCardId=' + userCardId,
+            headers: {
+              Authorization: token
+            },
+            type: 'get',
+            dataType: 'json',
+            function(res) {
+              if (res.status === 0) {
+                decodeWoker.postMessage('close');
+                decodeWoker.terminate();
+                quit();
+              } else {
+                $.toast(res.msg, 'text');
+              }
+            },
+          });
+        }
+      }]
+    });
+  } else {
+    decodeWoker.postMessage('close');
+    decodeWoker.terminate();
+    quit();
+  }
 }
 var residueTime = 0, residueTimer, isShowCountdown = +parameters['isShowCountdown'], isShowRule = +parameters['isShowRule'];
 if (isShowCountdown) {
@@ -52,6 +62,8 @@ if (sourceType === 5) {
             $('.count').text(residueTimeStamp(residueTime))
           } else {
             clearInterval(residueTimer);
+            decodeWoker.postMessage('close');
+            decodeWoker.terminate();
             quit();
           }
         }, 1000);