Commit 06ec2364 by 李伟康

Merge branch 'v1.0.7' of http://192.168.3.233:8090/glsx/gl_tape into v1.0.7

2 parents b5f981cf 0eb86439
import { getOssToken } from "@/utils/ossUploadFile/uploadFile.js"; import { getOssToken } from "@/utils/ossUploadFile/uploadFile.js";
import Queue from "@/utils/Queue.js"; import Queue from "@/utils/Queue.js";
const interval = 6
export default { export default {
onLoad() {}, onLoad() {},
data() { data() {
...@@ -221,25 +222,29 @@ export default { ...@@ -221,25 +222,29 @@ export default {
polling() { polling() {
console.log(this.snapshot.size, "this.snapshot.size"); console.log(this.snapshot.size, "this.snapshot.size");
if (this.snapshot === null) return; if (this.snapshot === null) return;
uni.$isNetWork().then(() => {
if (this.snapshot.size == 0) { if (this.snapshot.size == 0) {
this.enQueue(); this.enQueue();
setTimeout(() => { this.pollingLater(interval);
this.polling();
}, 1000 * 60);
} else { } else {
console.log(this.snapshot, "this.snapshot");
const record = this.snapshot.dequeue(); const record = this.snapshot.dequeue();
console.log(record);
this.uploadRecord(record); this.uploadRecord(record);
} }
}).catch(() => {
this.pollingLater(interval);
});
}, },
stopPolling() { stopPolling() {
this.snapshot.clear(); this.snapshot.clear();
this.snapshot = null; this.snapshot = null;
}, },
pollingLater(interval = 60 * 10) {
setTimeout(() => {
this.polling();
}, interval * 1000);
}, },
beforeDestroy() { beforeDestroy() {
console.log("stopPolling"); console.log("stopPolling");
this.stopPolling(); this.stopPolling();
}, }
}; };
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!