From 13b5d9eef0131ebe7bd8692cd5e3873673a2b92c Mon Sep 17 00:00:00 2001
From: vincent <1341870251@qq.com>
Date: 星期二, 02 六月 2020 17:20:59 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/console.html |   87 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 73 insertions(+), 14 deletions(-)

diff --git a/src/main/webapp/views/console.html b/src/main/webapp/views/console.html
index 8b0fb49..930628f 100644
--- a/src/main/webapp/views/console.html
+++ b/src/main/webapp/views/console.html
@@ -21,8 +21,8 @@
 <header>
     <!-- 绯荤粺杩愯鐘舵�� -->
     <div class="system-state">
-        <div class="system-icon"></div>
-        <span>绯荤粺杩愯涓�...</span>
+        <div id="system-icon" class="system-icon-open" onclick="systemSwitch()"></div>
+        <span id="system-run-desc">绯荤粺杩愯涓�...</span>
     </div>
 
     <!-- 淇℃伅灞曠ず -->
@@ -399,14 +399,10 @@
             <span class="row-no">1#</span>
         </div>
     </div>
-
-    <!-- 鍙宠緭閫佺嚎 -->
-    <!--<input id="val" type="text">-->
-    <!--<button id="animate">animate</button>-->
 </main>
 </body>
 <script>
-
+    var systemRunning = true;
     var crn1Position = 0;
     var crn2Position = 0;
     // 鍒濆鍖�
@@ -414,9 +410,58 @@
     getCrnInfo();
     // 瀹炴椂璁块棶
     setInterval(function () {
-        getSitesInfo();
         getCrnInfo();
-    }, 1000);
+    }, 500);
+    setInterval(function () {
+        getSitesInfo();
+    }, 3000);
+
+    // 绯荤粺杩愯寮�鍏�
+    function systemSwitch() {
+        if (systemRunning){
+            layer.prompt({title: '璇疯緭鍏ュ彛浠わ紝骞跺仠姝� WCS 绯荤粺', formType: 1}, function(pass, idx){
+                layer.close(idx);
+                if ("123"!==pass){
+                    alert("鍙d护閿欒");
+                    return;
+                }
+                var index = null;
+                index = layer.load(1, {
+                    shade: [0.1,'#fff']
+                });
+                setTimeout(function () {
+                    if (systemRunning){
+                        $('#system-icon').attr("class", "system-icon-close");
+                        $('#system-run-desc').html("绯荤粺宸插仠姝�!");
+                        systemRunning = false;
+                    } else {
+                        $('#system-icon').attr("class", "system-icon-open");
+                        $('#system-run-desc').html("绯荤粺杩愯涓�...");
+                        systemRunning = true;
+                    }
+                    layer.close(index);
+                }, 2000);
+            });
+
+        } else {
+            var index = null;
+            index = layer.load(1, {
+                shade: [0.1,'#fff']
+            });
+            setTimeout(function () {
+                if (systemRunning){
+                    $('#system-icon').attr("class", "system-icon-close");
+                    $('#system-run-desc').html("绯荤粺宸插仠姝�!");
+                    systemRunning = false;
+                } else {
+                    $('#system-icon').attr("class", "system-icon-open");
+                    $('#system-run-desc').html("绯荤粺杩愯涓�...");
+                    systemRunning = true;
+                }
+                layer.close(index);
+            }, 2000);
+        }
+    }
 
     // 杈撻�佽澶囧疄鏃舵暟鎹幏鍙�
     function getSitesInfo(){
@@ -448,10 +493,27 @@
             success: function (res) {
                 if (res.code === 200){
                     var crns = res.data;
-                    console.log(crns);
                     for (var i = 0; i < crns.length; i++){
                         crnAnimate(crns[i].crnId, crns[i].offset);
                     }
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/login";
+                }  else {
+                    alert(res.msg);
+                }
+            }
+        });
+    }
+
+    // 鎵爜鍣ㄥ疄鏃舵暟鎹幏鍙�
+    function getBarcodeInfo(){
+        $.ajax({
+            url: baseUrl+ "/console/latest/data/barcode",
+            headers: {'token': localStorage.getItem('token')},
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200){
+
                 } else if (res.code === 403){
                     top.location.href = baseUrl+"/login";
                 }  else {
@@ -477,16 +539,13 @@
         }
     }
 
-
+    // 璐ф灦鐐瑰嚮浜嬩欢
     $('.item').on('click', function () {
         layer.open({
             type: 1,
             shadeClose: true, //鐐瑰嚮閬僵鍏抽棴灞�
             content: 'text'
         });
-    });
-    $('#animate').click(function () {
-        crnAnimate(1, $('#val').val());
     });
 
 </script>

--
Gitblit v1.9.1