whychdw
2019-10-23 c8ea2ab1a12506b566653eb93dd61c4d87ca9e0f
修改实时请求
2个文件已修改
34 ■■■■ 已修改文件
platforms/android/app/src/main/assets/www/pages/testdata/testdata.js 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
www/pages/testdata/testdata.js 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platforms/android/app/src/main/assets/www/pages/testdata/testdata.js
@@ -247,6 +247,11 @@
                // 获取参数
                this.getTestData();
                // 设置实时请求
                this.getTestDataTimer = setInterval(function() {
                    self.getTestData();
                }, 4000);
                // 监控获取测试数据返回结果
                this.getTestDataWorker.onmessage = function(res) {
@@ -254,18 +259,13 @@
                    if(rs.code == 1) {
                        self.testData = rs.data;
                    }
                    // 设置延时请求
                    self.getTestDataTimer = setTimeout(function() {
                        self.getTestData();
                    }, 4000);
                }
                
                // 监控启动测试返回结果
                this.startTestWorker.onmessage = function(res) {
                    // 关闭等待框
                    self.loading.hide();
                    var rs = res.data;
                    var rs = res.data(res);
                    if(rs.code == 1) {
                        bui.alert('启动成功!');
                    }else {
@@ -277,7 +277,7 @@
                this.stopTestWorker.onmessage = function(res) {
                    // 关闭等待框
                    self.loading.hide();
                    var rs = res.data;
                    var rs = res.data(res);
                    if(rs.code == 1) {
                        bui.alert('停止成功!');
                    }else {
@@ -289,7 +289,7 @@
                this.pauseTestWorker.onmessage = function(res) {
                    // 关闭等待框
                    self.loading.hide();
                    var rs = res.data;
                    var rs = res.data(res);
                    if(rs.code == 1) {
                        bui.alert('暂停成功!');
                    }else {
@@ -304,8 +304,8 @@
                this.stopTestWorker.terminate();
                this.pauseTestWorker.terminate();
                
                // 关闭延时请求
                clearTimeout(this.getTestDataTimer);
                // 关闭实时请求
                clearInterval(this.getTestDataTimer);
            }
        });
    },
www/pages/testdata/testdata.js
@@ -247,6 +247,11 @@
                // 获取参数
                this.getTestData();
                // 设置实时请求
                this.getTestDataTimer = setInterval(function() {
                    self.getTestData();
                }, 4000);
                // 监控获取测试数据返回结果
                this.getTestDataWorker.onmessage = function(res) {
@@ -254,11 +259,6 @@
                    if(rs.code == 1) {
                        self.testData = rs.data;
                    }
                    // 设置延时请求
                    self.getTestDataTimer = setTimeout(function() {
                        self.getTestData();
                    }, 4000);
                }
                
                // 监控启动测试返回结果
@@ -304,8 +304,8 @@
                this.stopTestWorker.terminate();
                this.pauseTestWorker.terminate();
                
                // 关闭延时请求
                clearTimeout(this.getTestDataTimer);
                // 关闭实时请求
                clearInterval(this.getTestDataTimer);
            }
        });
    },