diff --git a/html/config.html b/html/config.html index c2a5c7d..40cd3b9 100644 --- a/html/config.html +++ b/html/config.html @@ -122,6 +122,18 @@ + +
+
+
+ 自动跳转: + + +
+
+
+
+
跳转数据: @@ -140,8 +152,6 @@
-
-
@@ -155,22 +165,28 @@ var carListener = null; var pageListener = null; var fixListener = null; + var jumpListener = null; var weiListener = null; var btlListener = null; var userPicker; var pagePicker; var fixPicker; + var jumpPicker; var weiPicker; var btlPicker; var pickData = []; var btnArray = ['取消', '确认']; var pageData = [] var fixData = [] + var jumpData = [] var weiData = [] var btlData = [] fixData.push({value: 0, text: "需要"}) fixData.push({value: 1, text: "不需要"}) + jumpData.push({value: 0, text: "自动跳转"}) + jumpData.push({value: 1, text: "不自动跳转"}) + pageData.push({value: "index", text: "首页"}) pageData.push({value: "index1", text: "装料页面"}) pageData.push({value: "collection", text: "剩料收集页面"}) @@ -274,6 +290,7 @@ muiInit(); muiInitPage() muiInitFix() + muiInitJump() muiInitWeightSize() muiInitBtl() var indexPage = api.getPrefs({ @@ -301,6 +318,18 @@ }) } + var requireJump = api.getPrefs({ + sync: true, + key: 'jump' + }); + if (requireJump) { + jumpData.forEach(p => { + if (requireJump == p.value) { + document.getElementById('jump').innerHTML = p.text + } + }) + } + var weightSize = api.getPrefs({ sync: true, key: 'weightSize' @@ -436,6 +465,34 @@ })(mui, document); } + function muiInitJump() { + (function ($, doc) { + $.init(); + $.ready(function () { + var _getParam = function _getParam(obj, param) { + return obj[param] || ''; + }; + if (jumpPicker) { + } else { + jumpPicker = new $.PopPicker(); + var showJumpPickerButton = doc.getElementById('jump'); + jumpListener = null; + jumpListener = showJumpPickerButton.addEventListener('tap', function (event) { + jumpPicker.show(function (items) { + document.getElementById('isJump').value = items[0].value; + showJumpPickerButton.innerHTML = items[0].text; + if (items[0].text){ + jump() + } + }); + }, false); + } + jumpPicker.setData(jumpData); + }); + })(mui, document); + } + + function muiInitWeightSize() { (function ($, doc) { $.init(); @@ -549,6 +606,18 @@ mui.alert('装料前校准"' + name + '"设置成功'); } } + function jump(){ + var value = document.getElementById('isJump').value; + if (value) { + console.log(value) + api.setPrefs({ + key: 'jump', + value: value + }); + var name = document.getElementById('jump').innerHTML; + mui.alert(name + '"设置成功'); + } + } \ No newline at end of file diff --git a/html/index1.html b/html/index1.html index 4b84341..79da46d 100644 --- a/html/index1.html +++ b/html/index1.html @@ -282,11 +282,18 @@ if (fixbeforeload){ weightBeforefix = fixbeforeload; } + var jump = api.getPrefs({ + sync: true, + key: 'jump' + }); + if (jump){ + autoJump = jump; + } + var btl = api.getPrefs({sync: true,key: 'btl'}) if (btl && !isNaN(btl)){ shujubao = Number(btl) } - console.log("weightBeforefix"+weightBeforefix) ble = api.require('ble'); zfk = api.require("moduleDemo"); clearInterval(resultInterval); diff --git a/script/ble.js b/script/ble.js index 571424a..42b9f68 100644 --- a/script/ble.js +++ b/script/ble.js @@ -55,6 +55,7 @@ function scan(param) { } var weightBeforefix = '1'; +var autoJump = '1'; function stopScan(){ ble.stopScan() @@ -384,9 +385,12 @@ function discoverService(param) { }, 500) } } + if (autoJump==='0'){ + console.log("自动跳转") + } // console.log(weightStabilization("weightStabilization"+nowWeight)) // 在误差范围内 - if (feedErr <= allow && (allowAuto || weightBeforefix === '1')) { + if (autoJump==='0' && feedErr <= allow && (allowAuto || weightBeforefix === '1')) { // 重量稳定计数 var filteredValue = weightDataFilter.filter(nowWeight); // 重量稳定自动跳转 @@ -396,7 +400,7 @@ function discoverService(param) { remark = '自动跳转' document.getElementById('submitData').click(); } - }else if(_feedNum > _planSum && (allowAuto || weightBeforefix === '1')){ + }else if(autoJump==='0' && _feedNum > _planSum && (allowAuto || weightBeforefix === '1')){ // 重量稳定计数 var filteredValue = weightDataFilter.filter(nowWeight); // 重量稳定自动跳转