From e6a9ef6750e94944c16286711ec5d48cd57393f4 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <xltys1995> Date: 星期二, 22 二月 2022 17:01:17 +0800 Subject: [PATCH] # --- src/main/webapp/views/console.html | 70 +++++++++++++++++++---------------- 1 files changed, 38 insertions(+), 32 deletions(-) diff --git a/src/main/webapp/views/console.html b/src/main/webapp/views/console.html index 1acd2bc..e28905a 100644 --- a/src/main/webapp/views/console.html +++ b/src/main/webapp/views/console.html @@ -1219,46 +1219,53 @@ </body> </html> <script> - function getCodeData(){ - $.ajax({ - url:baseUrl +'/xgmwcs/console/barcode/output/site', - method:'GET', - success:function (res) { - console.log(res) - if(res.code === 200){ - tData = res.data - } - } - }) - } - setInterval(getCodeData(),1000) var tData = [] var tDate1 = [] var tDate2 = [] var tDate3 = [] - if(tData.length<=5){ - tData1 = tData - } else if (tData.length<=10){ - tDate1 = tData.slice(0,5) - tData.splice(0,5) - tDate2 = tData - console.log(tDate2) - } else if(tData.length<=15){ - tDate1 = tData.slice(0,5) - tDate2 = tData.slice(6,10) - tData.splice(0,10) - tDate3 = tData - console.log(tDate3) - } else { - tData = tData.slice(-15) - tDate1 = tData.slice(-15) - tDate2 = tData.slice(-10) - tDate3 = tData.slice(-5) + function getCodeData(){ + $.ajax({ + url:baseUrl +'/console/barcode/output/site', + method:'GET', + success:function (res) { + if(res.code === 200){ + tData = eval(res.data); + console.log(tData) + if(tData.length<=5){ + tData1 = tData + } else if (tData.length<=10){ + tDate1 = tData.slice(0,5) + tData.splice(0,5) + tDate2 = tData + console.log(tDate2) + } else if(tData.length<=15){ + tDate1 = tData.slice(0,5) + tDate2 = tData.slice(6,10) + tData.splice(0,10) + tDate3 = tData + console.log(tDate3) + } else { + tData = tData.slice(-15) + tDate1 = tData.slice(-15) + tDate2 = tData.slice(-10) + tDate3 = tData.slice(-5) + } + } + } + }) } + setInterval(function () { + getCodeData(); + renderBarCode(); + }, 1000) + + + function renderBarCode() { for (var i = 0;i<tDate1.length;i++){ + console.log(tDate1[i]) var str1 = '<li><span>' + tDate1[i].barcode + '</span><span class="right">' + tDate1[i].time + '</span></li>' $('#barcode1').append(str1) } @@ -1271,7 +1278,6 @@ $('#barcode3').append(str3) } } - setInterval(renderBarCode(),1000) </script> <script type="text/javascript"> // 寮圭獥绔欑偣淇℃伅 -- Gitblit v1.9.1