index_128_256_laiche.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8"/>
  5. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  6. <title>智慧交通</title>
  7. <style>
  8. *{
  9. margin: 0px;
  10. padding: 0px;
  11. }
  12. @font-face{
  13. font-family:"led regular";
  14. src:url('/fonts/DS-DIGI.TTF');
  15. }
  16. .wrapper{
  17. width:128px;
  18. height:256px;
  19. background: #020202;
  20. }
  21. .wrap-head{
  22. width:100%;
  23. height:20px;
  24. line-height: 20px;
  25. color:#fff;
  26. }
  27. .wrap-head h2{
  28. font-size:14px;
  29. color:#fff;
  30. height:20px;
  31. line-height: 20px;
  32. text-align:center;
  33. font-weight: normal;
  34. }
  35. .wrap-content{
  36. width:100%;
  37. position:relative;
  38. }
  39. .temperature-box{
  40. width:62px;
  41. height:41px;
  42. border:1px solid #fff;
  43. /*background: #f44f21;*/
  44. color:#fff;
  45. }
  46. .temperature-box p{
  47. font-size:11px;
  48. margin-left:7px;
  49. padding-top:2px;
  50. }
  51. .temperature-box h2{
  52. font-size:20px;
  53. color:red;
  54. font-weight: normal;
  55. text-align:center;
  56. font-family:"led regular";
  57. }
  58. .air-qua{
  59. width:100%;
  60. height:49px;
  61. color:#fff;
  62. border-top:1px solid #fff;
  63. /*background: #0cc75f;*/
  64. position:relative;
  65. }
  66. .air-qua p{
  67. margin-left:6px;
  68. font-size:13px;
  69. padding-top:3px;
  70. }
  71. .air-qua h2{
  72. margin-left:8px;
  73. font-weight:normal;
  74. color:red;
  75. font-size:25px;
  76. font-family:"led regular";
  77. }
  78. .air-level{
  79. position:absolute;
  80. left:75px;
  81. width:39px;
  82. /*top:10px;*/
  83. bottom:2px;
  84. text-align: center;
  85. border:2px solid #fff;
  86. font-size:10px;
  87. border-radius:12px;
  88. padding:1px 3px;
  89. color:#00e400;
  90. }
  91. .humidity{
  92. position: absolute;
  93. top:0;
  94. right:1px;
  95. /*background: #81b906;*/
  96. }
  97. .pm25{
  98. position: absolute;
  99. bottom:2px;
  100. left:0;
  101. /*background: #03a5f0;*/
  102. }
  103. .pm10{
  104. position: absolute;
  105. bottom:2px;
  106. right:1px;
  107. /*background: #f9b91e;*/
  108. }
  109. /*第二个*/
  110. .wrap-head2{
  111. width:74%;
  112. margin:0 auto;
  113. height:160px;
  114. color:#0de408;
  115. text-align:center;
  116. }
  117. .tips-txt{
  118. color:#0de408;
  119. font-size:30px;
  120. line-height: 46px;
  121. text-align:center;
  122. padding-right:0;
  123. }
  124. .tips-txt span{
  125. letter-spacing:15px;
  126. }
  127. /*第四个 status4*/
  128. .speed-box{
  129. width:40px;
  130. height:40px;
  131. margin:0 auto;
  132. margin-top:15px;
  133. text-align:center;
  134. line-height:40px;
  135. font-size:50px;
  136. font-family:"led regular";
  137. src:url('/fonts/DS-DIGI.TTF');
  138. }
  139. .chaosu .tips-txt{
  140. color:#e40808 ;
  141. }
  142. .chaosu .speed-box{
  143. color:#e40808 ;
  144. border-color:#e40808;
  145. font-family:"led regular";
  146. src:url('/fonts/DS-DIGI.TTF');
  147. }
  148. #status4, #status2, #status3 {
  149. display: none;
  150. }
  151. </style>
  152. </head>
  153. <body>
  154. <div class="wrapper" id="status1" >
  155. <div class="wrap-head">
  156. <h2 id="time">09:48</h2>
  157. </div>
  158. <div class="wrap-content">
  159. <div class="air-qua">
  160. <p>空气质量</p>
  161. <h2 id="aqi">25</h2>
  162. <div class="air-level" id="zs"><span>优</span></div>
  163. </div>
  164. <div style="position:relative;height:87px;margin-top:4px">
  165. <div class="temperature-box">
  166. <p>温度</p>
  167. <h2 id="wd">25C</h2>
  168. </div>
  169. <div class="temperature-box humidity">
  170. <p>湿度</p>
  171. <h2 id="sd">25%</h2>
  172. </div>
  173. <div class="temperature-box pm25">
  174. <p>PM2.5</p>
  175. <h2 id="pm25">28</h2>
  176. </div>
  177. <div class="temperature-box pm10">
  178. <p>PM10</p>
  179. <h2 id="pm10">28</h2>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. <div class="wrapper" id="status2" >
  185. <div class="wrap-head2">
  186. <p class="tips-txt"><span>前</span>注<span>方</span>意<span>弯</span>安<span>道</span>全</p>
  187. <div class="speed-box" id="cs2" style="border:0;border-radius:0;height:40px;line-height:40px;">
  188. </div>
  189. </div>
  190. </div>
  191. <div class="wrapper" id="status3" >
  192. <div class="wrap-head2">
  193. <p class="tips-txt"><span>前</span>注<span>方</span>意<span>来</span>安<span>车</span>全</p>
  194. <div class="speed-box" id="cs3" style="color:#ff0808;">
  195. 50
  196. </div>
  197. </div>
  198. </div>
  199. <div class="wrapper chaosu" id="status4">
  200. <div class="wrap-head2">
  201. <p class="tips-txt"><span>速</span>注<span>度</span>意<span>过</span>控<span>快</span>速</p>
  202. <div class="speed-box" id="cs4">
  203. </div>
  204. </div>
  205. </div>
  206. </div>
  207. </body>
  208. <script src="/js/jquery.min.js"></script>
  209. <script>
  210. var flag = 0;
  211. var speed = 0;
  212. var csfz = 0;
  213. function fn(){
  214. var myDate=new Date;
  215. var month = myDate.getMonth() + 1 < 10 ? "0" + (myDate.getMonth() + 1) : myDate.getMonth() + 1;
  216. var date = myDate.getDate() < 10 ? "0" + myDate.getDate():myDate.getDate();
  217. var h=myDate.getHours() < 10 ? ('0' + myDate.getHours()) : myDate.getHours();
  218. var m=myDate.getMinutes() < 10 ? ('0' + myDate.getMinutes()) : myDate.getMinutes();
  219. var s=myDate.getSeconds() < 10 ? ('0' + myDate.getSeconds()) : myDate.getSeconds();
  220. var newTime = month + '-' + date +' ' + h + ':' + m + ':' + s;
  221. document.getElementById('time').innerHTML = newTime;
  222. }
  223. fn();
  224. setInterval(fn,1000);
  225. function fn3(){
  226. if (speed == 0) {
  227. if (flag > 1) { // 0
  228. $('#status1').show();
  229. $('#status2').hide();
  230. $('#status3').hide();
  231. $('#status4').hide();
  232. flag = 1; // 0
  233. } else {
  234. $('#status1').hide();
  235. $('#status2').hide();
  236. $('#status3').show();
  237. $('#status4').hide();
  238. flag = 3;
  239. }
  240. }
  241. };
  242. setInterval('fn3()',5000);
  243. function fn2(){
  244. $.ajax({
  245. type : "GET",
  246. url : "/getdata",
  247. dataType : "json",
  248. data : {"code":"ZPDY430102ONVS5R"},
  249. success:function(res){
  250. speed = res.data.cs;
  251. //speed = 50; //00
  252. console.log(speed)
  253. $('#aqi').text(res.data.aqi);
  254. $('#wd').text(res.data.wd);
  255. $('#sd').text(res.data.sd);
  256. $('#pm25').text(res.data.pm25);
  257. $('#pm10').text(res.data.pm10);
  258. $('#zs').text(res.data.zs);
  259. $('#cs3').text(res.data.csfz);
  260. if (res.data.csfz > 0 ) {
  261. csfz = res.data.csfz;
  262. }
  263. if(speed > 0 && speed <= csfz){
  264. $('#cs2').text(speed);
  265. }else if(speed > csfz){
  266. $('#cs4').text(speed);
  267. }
  268. if(speed > 0 && speed <= csfz){
  269. $('#status1').hide();
  270. $('#status2').show();
  271. $('#status3').hide();
  272. $('#status4').hide();
  273. flag = 2;
  274. }else if(speed > csfz){
  275. $('#status1').hide();
  276. $('#status2').hide();
  277. $('#status3').hide();
  278. $('#status4').show();
  279. flag = 4;
  280. }
  281. if(res.data.aqi <=50 && res.data.aqi >0){
  282. $('#zs').css('color','#00e400')
  283. }else if(res.data.aqi> 50 && res.data.aqi <=100 ){
  284. $('#zs').css('color','#ffbb17')
  285. }else if(res.data.aqi> 100 && res.data.aqi <=150 ){
  286. $('#zs').css('color','#ff7e00')
  287. }else if(res.data.aqi> 150 && res.data.aqi <=200 ){
  288. $('#zs').css('color','#ff0000')
  289. }else if(res.data.aqi> 200 && res.data.aqi <=300 ){
  290. $('#zs').css('color','#99004c')
  291. }else if(res.data.aqi > 300){
  292. $('#zs').css('color','#7e0023')
  293. }
  294. }
  295. })
  296. }
  297. fn2();
  298. setInterval(fn2,500);
  299. </script>
  300. </html>