2023-10-27 11:53:48 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>温湿度</title>
|
2023-10-27 19:58:27 +08:00
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
font-family: Arial, sans-serif;
|
|
|
|
background-color: #f0f0f0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tablecenter {
|
|
|
|
display: flex;
|
|
|
|
/* justify-content: center; */
|
|
|
|
/* align-items: center; */
|
|
|
|
height: 100vh;
|
|
|
|
}
|
|
|
|
|
|
|
|
table {
|
|
|
|
border-collapse: collapse;
|
|
|
|
width: 100%;
|
|
|
|
/* width: 700px; */
|
2023-10-28 14:26:40 +08:00
|
|
|
height: 20px;
|
2023-10-27 19:58:27 +08:00
|
|
|
background-color: #fff;
|
|
|
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
|
|
}
|
|
|
|
|
|
|
|
th,
|
|
|
|
td {
|
|
|
|
padding: 10px;
|
|
|
|
text-align: center;
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
height: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
th {
|
|
|
|
background-color: #f0f0f0;
|
|
|
|
}
|
|
|
|
|
2023-10-28 14:26:40 +08:00
|
|
|
tr {
|
2023-10-27 19:58:27 +08:00
|
|
|
height: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
tbody tr:nth-child(even) {
|
|
|
|
background-color: #f9f9f9;
|
|
|
|
}
|
|
|
|
|
|
|
|
tbody tr:hover {
|
|
|
|
background-color: #e0e0e0;
|
|
|
|
}
|
|
|
|
</style>
|
2023-10-27 11:53:48 +08:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div class="tablecenter">
|
2023-10-27 19:58:27 +08:00
|
|
|
<table id="arpTable">
|
2023-10-27 11:53:48 +08:00
|
|
|
<thead>
|
|
|
|
<th>温度</th>
|
|
|
|
<th>湿度</th>
|
|
|
|
<th>时间</th>
|
|
|
|
</thead>
|
2023-10-27 19:58:27 +08:00
|
|
|
<tbody id="greenTableBody">
|
2023-10-27 11:53:48 +08:00
|
|
|
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2023-10-28 15:20:52 +08:00
|
|
|
<!-- 下一页,上一页按钮
|
|
|
|
<div class="page">
|
|
|
|
<button onclick="prevPage()" id="prevPage">上一页</button>
|
|
|
|
<button onclick="nextPage()" id="nextPage">下一页</button>
|
|
|
|
</div> -->
|
2023-10-27 19:58:27 +08:00
|
|
|
|
|
|
|
<script>
|
|
|
|
function loadBlackData() {
|
|
|
|
var blackData;
|
|
|
|
fetch("../cgi-bin/green_house_info_show.cgi")
|
2023-10-28 15:20:52 +08:00
|
|
|
// fetch("../cgi-bin/green_house_info_show.cgi?page="+currentPage+"&limit=10")
|
2023-10-27 19:58:27 +08:00
|
|
|
.then(resp => resp.json())
|
|
|
|
.then(data => {
|
|
|
|
blackData = data;
|
|
|
|
greenTableBody.innerHTML = "";
|
|
|
|
data.forEach(rowData => {
|
|
|
|
let tr = document.createElement("tr");
|
|
|
|
let td1 = document.createElement("td");
|
|
|
|
let td2 = document.createElement("td");
|
|
|
|
let td3 = document.createElement("td");
|
|
|
|
|
|
|
|
td1.innerText = rowData.temperature;
|
|
|
|
td2.innerText = rowData.humidity;
|
|
|
|
td3.innerText = rowData.th_date_time;
|
|
|
|
|
|
|
|
tr.append(td1, td2, td3);
|
|
|
|
greenTableBody.append(tr);
|
|
|
|
});
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
window.onload = function () {
|
|
|
|
loadBlackData();
|
|
|
|
}
|
2023-10-28 15:20:52 +08:00
|
|
|
|
|
|
|
// // HTML 页面中的按钮点击事件处理程序
|
|
|
|
// function nextPage() {
|
|
|
|
// currentPage++; // 增加当前页码
|
|
|
|
// loadBlackData(); // 重新加载数据
|
|
|
|
// }
|
|
|
|
|
|
|
|
// function prevPage() {
|
|
|
|
// currentPage--; // 减少当前页码
|
|
|
|
// loadBlackData(); // 重新加载数据
|
|
|
|
// }
|
2023-10-27 19:58:27 +08:00
|
|
|
</script>
|
2023-10-27 11:53:48 +08:00
|
|
|
</body>
|
2023-10-27 19:58:27 +08:00
|
|
|
|
2023-10-28 14:26:40 +08:00
|
|
|
</html>
|