123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423 |
- <!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: 110px;
- 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: 350px;
- height: 100px;
- line-height: 100px;
- background: #008CBA;
- border: 1px solid #CFCFCF;
- box-sizing: border-box;
- color: #FFFFFF;
- border-radius: 10px;
- font-size: 36px;
- }
- .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";
- }
- .abc {background:lightgreen;border:1px #000 solid;cursor:pointer;padding:10px 5px;}
- .draggable {min-width:50px;height:45px;display:inline-block;font-size:.9em;z-index:1;text-align:center;}
- .abc2 {background:white;border:1px #000 solid;cursor:pointer;padding:10px 5px;}
- .draggable2 {min-width:200px;height:200px;display:inline-block;font-size:.9em;z-index:1;text-align:center;}
- img:not(:first-child):hover {
- cursor: pointer;
- }
- #show_img {
- width:300px;
- height:400px;
- border:1px solid gray;
- }
- @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>
- var img_id = 0;
- $(function(){
- //判斷客戶如果是上傳圖片
- {% if params.path %}
- var path = '{{params.path}}';
- $("#farm_img").attr('src', path);
- $("#map-canvas").css('display', 'none');
- img_id = "farm_img";
- var node_div = document.getElementById('node-list');
- var i = 1;
- var num = 0;
- {% for node in params.nodes %}
- if(i < 10){
- i = "0" + i
- };
- if(i > 1){
- num = num + 50;
- };
- var div = document.createElement('div');
- var html = '';
- html += '<p style="font-weight: bold;">' + '{{node.node_name}}' + '</p>';
- div.innerHTML = html;
- div.setAttribute('id', 'a' + i);
- div.setAttribute('class', 'draggable abc');
- div.setAttribute('onclick', 'ShowImg("' + i + '")');
- div.style.position = 'relative';
- div.style.inset = '{{node.pos_lng}}px' + ' auto auto ' + (Number({{node.pos_lat}})-15-num) + 'px';
- node_div.appendChild(div);
- i ++;
- {% endfor %}
- //判斷用戶如果是輸入地址
- {% else %}
- img_id = "map-canvas";
- {% endif %}
- });
- function ShowImg(evt){
- if(Number(evt) < 10){
- evt = evt.toString();
- evt.substring(1);
- };
- var num = evt;
- Number(num);
- var node = document.getElementById('a' + evt);
- var show_img = document.getElementById('show_img');
- var node_imgs = {{params.nodeimg_paths|tojson}};
- console.log(node_imgs);
- var html = '';
- html += '<h1>節點' + evt + '</h1><img src="' + node_imgs[num-1] + '" style="width:300px;height:300px;" onclick="EnvInfo(' + evt + ');"><h5 style="color:blue;">可點擊圖片進入環境資訊</h5>';
- show_img.innerHTML = html;
- };
- function EnvInfo(evt){
- window.location.href='/env_info/' + evt;
- };
- <!--function img_error() {-->
- <!--//this.src='./inimage/psfi.jpg';-->
- <!--console.log(img_id);-->
- <!--document.getElementById(img_id).src="../static/img/psfi.jpg";-->
- <!--$('#a01').draggable('option','disabled', true);-->
- <!--$('#a01').css('background-color', 'red');-->
- <!--$('#a02').draggable('option','disabled', true);-->
- <!--$('#a02').css('background-color', 'red');-->
- <!--$('#a03').draggable('option','disabled', true);-->
- <!--$('#a03').css('background-color', 'red');-->
- <!--$('#a04').draggable('option','disabled', true);-->
- <!--$('#a04').css('background-color', 'red');-->
- <!--$('#a05').draggable('option','disabled', true);-->
- <!--$('#a05').css('background-color', 'red');-->
- <!--$('#a06').draggable('option','disabled', true);-->
- <!--$('#a06').css('background-color', 'red');-->
- <!--};-->
- </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="/env_info/1">環境資訊</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="#">報表輸出</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="#">RMA</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="#">故障紀錄</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="#">求助</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">
- <form method="" action="">
- {% if params.path %}
- <div class="container-fluid">
- {% else %}
- <div class="container">
- {% endif %}
- <div class="row">
- <div id="node-list" class="col-12" style="width:100%;"></div>
- <div class="col-9">
- <img id="farm_img" src="" style='width:1080px;height:650px;' onError="" ondragstart="return false;">
- </div>
- <div id="map-canvas" class="col-12" style="text-align:center;background-color:#f2f2f2;padding:280px;border:1px;border-radius: 35px;"></div>
- <div class="col-3" id="show_img" style="text-align:center;">
- <h2 style="color:blue;">請點擊感測點顯示圖片</h2>
- </div>
- </div>
- </div>
- </form>
- </div>
- </body>
- <script>
- {% if params.lat %}
- $("#farm_img").css('display', 'none');
- $("#show_img").css('display', 'none');
- function initialize() {
- var a = -1;
- var mapOptions = {
- center: { lat: {{params.lat}}, lng: {{params.lng}}},
- <!--center: { lat: 22.707340, lng: 120.531000},-->
- zoom: 19,
- mapTypeId: 'satellite',
- };
- var map = new google.maps.Map(
- document.getElementById('map-canvas'),
- mapOptions);
- var node_imgs = {{params.nodeimg_paths|tojson}};
- var i = 1;
- var s = 1;
- var num = 0;
- {% for node in params.nodes %}
- if(i < 10){
- i = "0" + i
- };
- var defineStr = "var position" + i.toString();
- var defineStr2 = "var marker" + i.toString();
- var defineStr3 = "var infowindow" + i.toString();
- //使用eval()函數執行字串
- eval(defineStr);
- eval(defineStr2);
- eval(defineStr3);
- //為position賦值
- eval("position" + i.toString() + " = " + "{lat:" + {{node.pos_lat}} + ",lng:" + {{node.pos_lng}} + "};");
- //為marker賦值
- eval("marker" + i.toString() + " = " + "new google.maps.Marker({position:" + ("position" + i.toString()) + ",map:map,label:'" + i + "'});");
- var contentString = '<h2>節點' + s + '</h2><img src="' + node_imgs[num] + '" style="width:200px;height:200px;" onclick="EnvInfo(' + s + ');"><h5 style="color:blue;">可點擊圖片進入環境資訊</h5>';
- //為Infowindow賦值
- eval("infowindow" + i.toString() + " = " + "new google.maps.InfoWindow({content: contentString, position:" + ("position" + i.toString()) + "});");
- //監聽marker點擊事件開啟資訊視窗
- eval("marker" + i.toString() + ".addListener('click',function(){infowindow" + i.toString() + ".open(map," + "marker" + i.toString() + ");});");
- <!--var contentString = '<h1>大家好我是資訊視窗</h1><button id="btn">點我</button>';-->
- <!--var infowindow = new google.maps.InfoWindow({-->
- <!--content: contentString,-->
- <!--position: position01-->
- <!--});-->
- i ++;
- num ++;
- s ++;
- {% endfor %}
- };
- <!--google.maps.event.addDomListener(-->
- <!--window, 'load', initialize);-->
- {% endif %}
- </script>
- <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDKVm-6LBJqxrDJLEzJujGjZLVTfK0RiAE&callback=initialize"></script>
- </html>
|