123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Aisky-Sixth</title>
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <!-- 新 Bootstrap4 核心 CSS 文件 -->
- <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
- <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
- <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
- <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
- <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
- <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
- <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
- <!--可用來建立使用者小圖示-->
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
- <style>
- body {
- margin:0;
- }
- .navbar-dark .navbar-nav .nav-link {
- color: white;
- cursor: pointer;
- text-decoration:none;
- width: 130px;
- height: 46px;
- }
- .nav-top {
- line-height:40px;
- background-color: #C4C4C4;
- }
- .website_title{
- font-family: Roboto;
- font-style: normal;
- font-weight: normal;
- font-size: 30px;
- color: #000000;
- }
- .navbar-nav > li{
- float: none;
- display: inline-block;
- width: 110px;
- margin: 0 auto;
- text-align: center;
- }
- .navbar-nav > li a{
- font-size: 20px;
- }
- .main-page {
- margin-top: 150px;
- }
- .page-title {
- font-family: Roboto;
- font-style: normal;
- font-weight: bold;
- font-size: 36px;
- }
- .flex {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- justify-content: center;
- }
- .set-link {
- display: inline-block;
- width: 200px;
- height: 70px;
- line-height: 70px;
- background: #008CBA;
- border: 1px solid #CFCFCF;
- box-sizing: border-box;
- color: #FFFFFF;
- border-radius: 10px;
- font-size: 25px;
- }
- .fa{
- display: inline-block;
- font: normal normal normal 14px/1 FontAwesome;
- font-size: inherit;
- text-rendering: auto;
- -webkit-font-smoothing: antialiased;
- }
- .fa-user-o:before{
- content: "\f2c0";
- }
- button {
- cursor: pointer;
- }
- @media(max-width:373px){
- .card {
- margin-right: 0px;
- }
- }
- @media(max-width:577px){
- }
- @media(min-width:576px){
- }
- @media(min-width:768px){
- .navbar-nav > li {
- margin-left: 0px;
- }
- .navbar-nav .li-block {
- display:none;
- }
- }
- @media(min-width:991px){
- .navbar-nav > li {
- margin-left: 20px;
- }
- .navbar-nav .li-block {
- display:none;
- }
- }
- @media(min-width:1200px){
- .navbar-nav > li {
- margin-left: 35px;
- }
- .navbar-nav .li-block {
- display: inline-block;
- width: 100px;
- }
- }
- @media(min-width:1400px){
- .navbar-nav .li-block {
- display: inline-block;
- width: 200px;
- }
- }
- @media(min-width:1689px) {
- .navbar-nav > li {
- margin-left: 50px;
- }
- .navbar-nav .li-block {
- display: inline-block;
- width: 500px;
- }
- }
- </style>
- <style>
- html, body, #map-canvas{
- width:100%;
- height: 100%;
- }
- </style>
- <script>
- //燒錄程式函數
- function BurnProgram(en_name, ch_name){
- if(!confirm("你確定要燒錄" + ch_name + "嗎?")){
- return false;
- };
-
- var sensor_name = {en_name:'1'};
- console.log("sensor_name: " + sensor_name);
- // $.post('/burn_program',en_name,function(resText){
- $.post('/burn_program', sensor_name, function(resText){
- if(resText.status){
- alert("燒錄成功!");
- };
- },'json');
- };
- //驗證token,如果不符合或過期就登出回登入頁
- var str = localStorage.getItem('Hello');
- $.ajax({
- type: "GET",
- url: "/auth",
- headers: {'Authorization': 'Bearer ' + str},
- success: function(result){
- console.log(result.identity);
- },
- error: function(result){
- window.location.href='/logout';
- }
- });
- $(function(){
- var sensor_list = $("#sensor_list");
- var html = '';
- // var sensor_list = '{{params.sensor_list|tojson}}';
- // console.log("TT: " + sensor_list);
- // {"ch_name": "空氣溫度", "en_name": "airTem", "version": "v1.0"}
- $.each({{params.sensor_list|tojson}},function(index, obj){
- html += '<div class="col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="margin-right: 20px ;margin-left: 20px; margin-top:50px; margin-bottom:50px;">';
- html += ' <div class="page-title text-center">';
- html += ' <button class="set-link" name="' + obj.en_name + '" type="button" onclick="BurnProgram(' + '\'' + obj.en_name + '\',\'' + obj.ch_name + ' ' + obj.version + '\')">' + obj.ch_name + ' ' + obj.version + '</button>';
- html += ' </div>';
- html += '</div>';
- });
- sensor_list.html(html);
- });
- </script>
- </head>
- <body>
- <nav class="fixed-top">
- <nav class="navbar navbar-expand-md nav-top justify-content-center">
- <div>
- <span class="website_title">感測器燒錄</span>
- </div>
- </nav>
- <nav class="navbar navbar-expand-md bg-dark navbar-dark nav-bottom">
- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
- <span class="navbar-toggler-icon"></span>
- </button>
- <div class="collapse navbar-collapse" id="collapsibleNavbar">
- <ul class="navbar-nav">
- <li class="nav-item">
- <a class="nav-link" href="/">首頁</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/incoming_check">進貨檢測</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/burn_program">感測器燒錄</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/modify_permissions">權限設置</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/add_sensor">新增感測器</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/add_server">伺服器建置</a>
- </li>
- <li class="li-block"></li>
- <li class="nav-item">
- <a class="nav-link" href="#"><i class="fa fa-user-o"></i> {{params.username}}</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/logout">Logout</a>
- </li>
- </ul>
- </div>
- </nav>
- </nav>
- <div class="main-page">
- <div class="container-fluid">
- <div class="row">
- <div class="col-12 text-center"><h3 style="color:red;">請點擊以下感測器進行燒錄</h3></div>
- <div id="sensor_list" class="col flex" style="margin: auto; ">
- <!--<div class="col-xl-3 col-lg-4 col-md-5 col-sm-8 col-xs-8" style="margin-right: 20px ;margin-left: 20px; margin-top:50px; margin-bottom:50px;">-->
- <!--<div class="page-title text-center">-->
- <!--<button class="set-link" name="airTem" type="button" onclick="BurnProgram('airTem')">空氣溫度</button>-->
- <!--</div>-->
- <!--</div>-->
- <!--<div class="col-xl-3 col-lg-4 col-md-5 col-sm-8 col-xs-8" style="margin-right: 20px ;margin-left: 20px; margin-top:50px; margin-bottom:50px;">-->
- <!--<div class="page-title text-center">-->
- <!--<button class="set-link" name="airHum" type="button" onclick="BurnProgram('airHum')">空氣濕度</button>-->
- <!--</div>-->
- <!--</div>-->
- <!--<div class="col-xl-3 col-lg-4 col-md-5 col-sm-8 col-xs-8" style="margin-right: 20px ;margin-left: 20px; margin-top:50px; margin-bottom:50px;">-->
- <!--<div class="page-title text-center">-->
- <!--<button class="set-link" name="dewPoint" type="button" onclick="BurnProgram('dewPoint')">露點</button>-->
- <!--</div>-->
- <!--</div>-->
- <!--<div class="col-xl-3 col-lg-4 col-md-5 col-sm-8 col-xs-8" style="margin-right: 20px ;margin-left: 20px; margin-top:50px; margin-bottom:50px;">-->
- <!--<div class="page-title text-center">-->
- <!--<button class="set-link" name="sun" type="button" onclick="BurnProgram('sun')">日照</button>-->
- <!--</div>-->
- <!--</div>-->
- <!--<div class="col-xl-3 col-lg-4 col-md-5 col-sm-8 col-xs-8" style="margin-right: 20px ;margin-left: 20px; margin-top:50px; margin-bottom:50px;">-->
- <!--<div class="page-title text-center">-->
- <!--<button class="set-link" name="soilHum" type="button" onclick="BurnProgram('soilHum')">土壤含水率</button>-->
- <!--</div>-->
- <!--</div>-->
- <!--<div class="col-xl-3 col-lg-4 col-md-5 col-sm-8 col-xs-8" style="margin-right: 20px ;margin-left: 20px; margin-top:50px; margin-bottom:50px;">-->
- <!--<div class="page-title text-center">-->
- <!--<button class="set-link" name="soilTem" type="button" onclick="BurnProgram('soilTem')">土壤溫度</button>-->
- <!--</div>-->
- <!--</div>-->
- <!--<div class="col-xl-3 col-lg-4 col-md-5 col-sm-8 col-xs-8" style="margin-right: 20px ;margin-left: 20px; margin-top:50px; margin-bottom:50px;">-->
- <!--<div class="page-title text-center">-->
- <!--<button class="set-link" name="soilEC" type="button" onclick="BurnProgram('soilEC')">土壤EC值</button>-->
- <!--</div>-->
- <!--</div>-->
- <!--<div class="col-xl-3 col-lg-4 col-md-5 col-sm-8 col-xs-8" style="margin-right: 20px ;margin-left: 20px; margin-top:50px; margin-bottom:50px;">-->
- <!--<div class="page-title text-center">-->
- <!--<button class="set-link" name="windSpd" type="button" onclick="BurnProgram('windSpd')">風速</button>-->
- <!--</div>-->
- <!--</div>-->
- <!--<div class="col-xl-3 col-lg-4 col-md-5 col-sm-8 col-xs-8" style="margin-right: 20px ;margin-left: 20px; margin-top:50px; margin-bottom:50px;">-->
- <!--<div class="page-title text-center">-->
- <!--<button class="set-link" name="windDin" type="button" onclick="BurnProgram('windDin')">風向</button>-->
- <!--</div>-->
- <!--</div>-->
- <!--<div class="col-xl-3 col-lg-4 col-md-5 col-sm-8 col-xs-8" style="margin-right: 20px ;margin-left: 20px; margin-top:50px; margin-bottom:50px;">-->
- <!--<div class="page-title text-center">-->
- <!--<button class="set-link" name="rain" type="button" onclick="BurnProgram('rain')">降雨量</button>-->
- <!--</div>-->
- <!--</div>-->
- <!--<div class="col-xl-3 col-lg-4 col-md-5 col-sm-8 col-xs-8" style="margin-right: 20px ;margin-left: 20px; margin-top:50px; margin-bottom:50px;">-->
- <!--<div class="page-title text-center">-->
- <!--<button class="set-link" name="atmosphere" type="button" onclick="BurnProgram('atmosphere')">大氣壓</button>-->
- <!--</div>-->
- <!--</div>-->
- </div>
- </div>
- </div>
- </div>
- </body>
- </html>
|