huangxiaojing преди 2 години
родител
ревизия
15cbc4a203
променени са 4 файла, в които са добавени 34 реда и са изтрити 1 реда
  1. 16 0
      static/screenAndroid/WXtrialInterface.html
  2. 1 0
      static/screenAndroid/timer.js
  3. 15 0
      static/screenIos/WXtrialInterface.html
  4. 2 1
      static/screenIos/timer.js

+ 16 - 0
static/screenAndroid/WXtrialInterface.html

@@ -376,6 +376,19 @@
       };
     }
 
+    // 根据id删除数据
+    function deleteDB(db, storeName, id) {
+      let request = db.transaction([storeName], 'readwrite').objectStore(storeName).delete(id)
+   
+      request.onsuccess = function() {
+        console.log('数据删除成功')
+      }
+   
+      request.onerror = function() {
+        console.log('数据删除失败')
+      }
+    }
+
     // 由于打开indexDB是异步的加个定时器避免 db对象还没获取到值导致 报错
     setTimeout(() => {
       getDataByKey(db, storeName, userCardId);
@@ -563,6 +576,7 @@
           }
           $('#countView').hide();
           $('.countdown-wrap').hide();
+          downline();
           $.toast('画面异常,请重新进入', 'text');
           setTimeout(() => {
             clearInterval(intervaler);
@@ -615,6 +629,7 @@
         } else {
           $('#countView').hide();
           $('.countdown-wrap').hide();
+          downline();
           $.toast('画面异常,请重新进入', 'text');
           setTimeout(() => {
             clearInterval(intervaler);
@@ -637,6 +652,7 @@
           if (errorTime > 1000) {
             $('#countView').hide();
             $('.countdown-wrap').hide();
+            downline();
             $.toast('画面异常,请重新进入', 'text');
             setTimeout(() => {
               wsss.close();

+ 1 - 0
static/screenAndroid/timer.js

@@ -33,6 +33,7 @@ function downline() {
       if (res.status === 0) {
         ws.close();
         wsss.close();
+        deleteDB(db, storeName, userCardId);
         quit();
       } else {
         $.toast(res.msg, 'text');

+ 15 - 0
static/screenIos/WXtrialInterface.html

@@ -470,6 +470,19 @@
       };
     }
 
+    // 根据id删除数据
+    function deleteDB(db, storeName, id) {
+      let request = db.transaction([storeName], 'readwrite').objectStore(storeName).delete(id)
+   
+      request.onsuccess = function() {
+        console.log('数据删除成功')
+      }
+   
+      request.onerror = function() {
+        console.log('数据删除失败')
+      }
+    }
+
     // 由于打开indexDB是异步的加个定时器避免 db对象还没获取到值导致 报错
     setTimeout(() => {
       getDataByKey(db, storeName, userCardId);
@@ -584,6 +597,7 @@
           }
           $('#countView').hide();
           $('.countdown-wrap').hide();
+          downline();
           $.toast('画面异常,请重新进入', 'text');
           setTimeout(() => {
             quit();
@@ -1202,6 +1216,7 @@
         if (event.data === 'close') {
           $('#countView').hide();
           $('.countdown-wrap').hide();
+          downline();
           $.toast('画面异常,请重新进入', 'text');
           setTimeout(() => {
             decodeWoker.postMessage('close');

+ 2 - 1
static/screenIos/timer.js

@@ -33,6 +33,7 @@ function downline() {
       if (res.status === 0) {
         decodeWoker.postMessage('close');
         decodeWoker.terminate();
+        deleteDB(db, storeName, userCardId)
         quit();
       } else {
         $.toast(res.msg, 'text');
@@ -70,7 +71,7 @@ function handleclose() {
     success: function (res) {
       if (res.status === 0) {
         clearInterval(residueTimer);
-        $("#countView").hide()
+        $("#countView").hide();
       } else {
         $.toast(res.msg, 'text');
       }