add_sensor.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Aisky-Sixth</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. <!-- 新 Bootstrap4 核心 CSS 文件 -->
  8. <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
  9. <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
  10. <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  11. <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
  12. <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
  13. <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
  14. <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  15. <!--可用來建立使用者小圖示-->
  16. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  17. <style>
  18. body {
  19. margin:0;
  20. }
  21. .navbar-dark .navbar-nav .nav-link {
  22. color: white;
  23. cursor: pointer;
  24. text-decoration:none;
  25. width: 130px;
  26. height: 46px;
  27. }
  28. .nav-top {
  29. line-height:40px;
  30. background-color: #C4C4C4;
  31. }
  32. .website_title{
  33. font-family: Roboto;
  34. font-style: normal;
  35. font-weight: normal;
  36. font-size: 30px;
  37. color: #000000;
  38. }
  39. .navbar-nav > li{
  40. float: none;
  41. display: inline-block;
  42. width: 110px;
  43. margin: 0 auto;
  44. text-align: center;
  45. }
  46. .navbar-nav > li a{
  47. font-size: 20px;
  48. }
  49. .main-page {
  50. margin-top: 150px;
  51. }
  52. .page-title {
  53. font-family: Roboto;
  54. font-style: normal;
  55. font-weight: bold;
  56. font-size: 36px;
  57. }
  58. .flex {
  59. display: flex;
  60. flex-direction: row;
  61. flex-wrap: wrap;
  62. justify-content: center;
  63. }
  64. .set-link {
  65. display: inline-block;
  66. width: 350px;
  67. height: 100px;
  68. line-height: 100px;
  69. background: #008CBA;
  70. border: 1px solid #CFCFCF;
  71. box-sizing: border-box;
  72. color: #FFFFFF;
  73. border-radius: 10px;
  74. font-size: 36px;
  75. }
  76. .page-bottom {
  77. margin-top: 70px;
  78. }
  79. .form-control {
  80. background: #008CBA;
  81. border: 1px solid #CFCFCF;
  82. box-sizing: border-box;
  83. border-radius: 5px;
  84. width: 120px;
  85. height: 58px;
  86. text-align: center;
  87. line-height: 50px;
  88. font-size:20px;
  89. color: #FFFFFF;
  90. display: inline-block;
  91. cursor: pointer;
  92. }
  93. .fa{
  94. display: inline-block;
  95. font: normal normal normal 14px/1 FontAwesome;
  96. font-size: inherit;
  97. text-rendering: auto;
  98. -webkit-font-smoothing: antialiased;
  99. }
  100. .fa-user-o:before{
  101. content: "\f2c0";
  102. }
  103. button {
  104. cursor: pointer;
  105. }
  106. @media(max-width:373px){
  107. .card {
  108. margin-right: 0px;
  109. }
  110. }
  111. @media(max-width:577px){
  112. }
  113. @media(min-width:576px){
  114. }
  115. @media(min-width:768px){
  116. .navbar-nav > li {
  117. margin-left: 0px;
  118. }
  119. .navbar-nav .li-block {
  120. display:none;
  121. }
  122. }
  123. @media(min-width:991px){
  124. .navbar-nav > li {
  125. margin-left: 20px;
  126. }
  127. .navbar-nav .li-block {
  128. display:none;
  129. }
  130. }
  131. @media(min-width:1200px){
  132. .navbar-nav > li {
  133. margin-left: 35px;
  134. }
  135. .navbar-nav .li-block {
  136. display: inline-block;
  137. width: 100px;
  138. }
  139. }
  140. @media(min-width:1400px){
  141. .navbar-nav .li-block {
  142. display: inline-block;
  143. width: 200px;
  144. }
  145. }
  146. @media(min-width:1689px) {
  147. .navbar-nav > li {
  148. margin-left: 50px;
  149. }
  150. .navbar-nav .li-block {
  151. display: inline-block;
  152. width: 500px;
  153. }
  154. }
  155. </style>
  156. <script>
  157. //驗證token,如果不符合或過期就登出回登入頁
  158. var str = localStorage.getItem('Hello');
  159. $.ajax({
  160. type: "GET",
  161. url: "/auth",
  162. headers: {'Authorization': 'Bearer ' + str},
  163. success: function(result){
  164. console.log(result.identity);
  165. },
  166. error: function(result){
  167. window.location.href='/logout';
  168. }
  169. });
  170. $(function(){
  171. $("#add_btn").click(function (){
  172. if($("#ch_name").val() == '' || $("#en_name").val() == '' || $("#version").val() == ''){
  173. alert("請輸入完整資訊!");
  174. return false;
  175. };
  176. var data = {"ch_name":$("#ch_name").val(), "en_name":$("#en_name").val(), "version":$("#version").val()};
  177. $.ajax({
  178. url: '/add_sensor',
  179. type: 'post',
  180. data: data,
  181. dataType: 'text',
  182. success: function(msg){
  183. alert(msg);
  184. $("#ch_name").val('');
  185. $("#en_name").val('');
  186. $("#version").val('');
  187. },
  188. error: function(msg){
  189. alert(msg);
  190. },
  191. });
  192. });
  193. });
  194. </script>
  195. </head>
  196. <body>
  197. <nav class="fixed-top">
  198. <nav class="navbar navbar-expand-md nav-top justify-content-center">
  199. <div>
  200. <span class="website_title">新增感測器</span>
  201. </div>
  202. </nav>
  203. <nav class="navbar navbar-expand-md bg-dark navbar-dark nav-bottom">
  204. <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
  205. <span class="navbar-toggler-icon"></span>
  206. </button>
  207. <div class="collapse navbar-collapse" id="collapsibleNavbar">
  208. <ul class="navbar-nav">
  209. <li class="nav-item">
  210. <a class="nav-link" href="/">首頁</a>
  211. </li>
  212. <li class="nav-item">
  213. <a class="nav-link" href="/incoming_check">進貨檢測</a>
  214. </li>
  215. <li class="nav-item">
  216. <a class="nav-link" href="/burn_program">感測器燒錄</a>
  217. </li>
  218. <li class="nav-item">
  219. <a class="nav-link" href="/modify_permissions">權限設置</a>
  220. </li>
  221. <li class="nav-item">
  222. <a class="nav-link" href="/add_sensor">新增感測器</a>
  223. </li>
  224. <li class="nav-item">
  225. <a class="nav-link" href="/add_server">伺服器建置</a>
  226. </li>
  227. <li class="li-block"></li>
  228. <li class="nav-item">
  229. <a class="nav-link" href="#"><i class="fa fa-user-o"></i> {{params.username}}</a>
  230. </li>
  231. <li class="nav-item">
  232. <a class="nav-link" href="/logout">Logout</a>
  233. </li>
  234. </ul>
  235. </div>
  236. </nav>
  237. </nav>
  238. <div class="main-page">
  239. <div class="container-fluid">
  240. <div class="row">
  241. <div class="col flex" style="margin: auto; ">
  242. <form action="/add_sensor" method="post">
  243. <table class="table table-bordered" style="font-size:23px;margin-top:70px;">
  244. <tbody>
  245. <tr>
  246. <td>1.</td>
  247. <td>請輸入要新增感測器的中文名:</td>
  248. <td>
  249. <input type="text" id="ch_name" name="ch_name">
  250. </td>
  251. </tr>
  252. <tr>
  253. <td>2.</td>
  254. <td>請輸入要新增感測器的英文名:</td>
  255. <td>
  256. <input type="text" id="en_name" name="en_name">
  257. </td>
  258. </tr>
  259. <tr>
  260. <td>3.</td>
  261. <td>請輸入版本號:</td>
  262. <td>
  263. <input type="text" id="version" name="version" placeholder="例:v1.0">
  264. </td>
  265. </tr>
  266. </tbody>
  267. </table>
  268. <div class="row page-bottom">
  269. <div class="col"></div>
  270. <div class="col-xl-8 col-lg-8 col-md-8 col-sm-10 col-xs-10" style="text-align:center;">
  271. <div class="form-group">
  272. <input type="reset" class="form-control" value="重設" style="margin-right:70px;">
  273. <input id="add_btn" type="button" class="form-control" value="送出">
  274. </div>
  275. </div>
  276. <div class="col"></div>
  277. </div>
  278. </form>
  279. </div>
  280. </div>
  281. </div>
  282. </div>
  283. </body>
  284. </html>