From 8bae1dc75fbe2f45a72666a30d7899590b01da21 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 13 十一月 2020 16:51:16 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/crn.html     |   63 +++++++++++++++++++++++++++++++
 src/main/webapp/static/css/crn.css |    2 
 2 files changed, 63 insertions(+), 2 deletions(-)

diff --git a/src/main/webapp/static/css/crn.css b/src/main/webapp/static/css/crn.css
index 97ae7d0..ea974b0 100644
--- a/src/main/webapp/static/css/crn.css
+++ b/src/main/webapp/static/css/crn.css
@@ -40,7 +40,7 @@
 .crn-command-item input {
     vertical-align: middle;
     outline: none;
-    width: 70%;
+    width: 60%;
 }
 
 /* 鍙� */
diff --git a/src/main/webapp/views/crn.html b/src/main/webapp/views/crn.html
index d3f4602..5d08665 100644
--- a/src/main/webapp/views/crn.html
+++ b/src/main/webapp/views/crn.html
@@ -13,7 +13,31 @@
     <script type="text/javascript" src="../static/js/common.js"></script>
     <script type="text/javascript" src="../static/js/layer/layer.js"></script>
     <style>
+        .demoBtn {
+            vertical-align: middle;
+            width: 20%;
+            height: 25px;
+            left: 0;
+            top: 0;
+            text-shadow: inherit;
+            font-size: 15px;
+            margin-left: 5px;
+            margin-right: 5px;
+            display: inline-block;
+            background-color: #FF5722;
+            border: none;
+            color: #FFF;
+            box-shadow: 1px 1px 5px #B6B6B6;
+            border-radius: 3px;
+            cursor: pointer;
+        }
 
+        .demoBtn:hover {
+            opacity: 0.8
+        }
+        .demoBtn:focus {
+            outline: 0;
+        }
     </style>
 </head>
 <body>
@@ -24,7 +48,8 @@
         <h2>鎵ц涓殑鍛戒护</h2>
         <div class="crn-command-item">
             <label>1#</label>
-            <span>&nbsp;</span>
+            <button id="demoBtn-1" class="demoBtn" onclick="demoSwitch(this.id)">婕旂ず</button>
+            <!--            <span>&nbsp;</span>-->
             <input id="crn1" disabled="disabled">
         </div>
     </div>
@@ -519,5 +544,41 @@
         crnOutputDom.scrollTop = crnOutputDom.scrollHeight;
     }
 
+    function demoSwitch(el) {
+        var crnId = el.split("-")[1];
+        layer.prompt({title: '璇疯緭鍏ュ彛浠わ紝骞跺紑濮�'+crnId+"鍙峰爢鍨涙満婕旂ず", formType: 1, shadeClose: true}, function (pass, idx) {
+            layer.close(idx);
+            doDemo(crnId, pass); // 鍋滄wcs绯荤粺
+        });
+    }
+
+    function doDemo(crnId, password) {
+        // 鍔犺浇tips
+        var index = layer.load(1, {
+            shade: [0.1,'#fff']
+        });
+        $.ajax({
+            url: baseUrl+ "/crn/demo/switch",
+            headers: {'token': localStorage.getItem('token')},
+            // async: false,
+            data: {
+                crnId: Number(crnId),
+                password: password
+            },
+            method: 'POST',
+            success: function (res) {
+                layer.close(index);
+                if (res.code === 200){
+                    layer.msg(res.msg, {icon: 1});
+                } else if (res.code === 403){
+                    window.location.href = baseUrl+"/login";
+                }  else {
+                    layer.msg(res.msg, {icon: 2});
+                }
+            }
+        });
+
+    }
+
 </script>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1