From 8c728223a1aae91ff37a5326d961ad45823ba865 Mon Sep 17 00:00:00 2001 From: zuoxiao <zuoxiao> Date: 星期五, 08 八月 2025 15:27:19 +0800 Subject: [PATCH] 添加综合站监测功能,更新首页逻辑以支持登录检查并跳转至监测页面;在app.json中添加新页面和插件配置。 --- images/flow.svg | 3 images/fertilizer.svg | 1 pages/home/home.js | 41 ++ images/soil.svg | 1 images/humidity.svg | 3 images/offline.svg | 4 images/temperature.svg | 3 pages/stationMonitor/stationMonitor.json | 6 pages/stationMonitor/stationMonitor.wxml | 121 ++++++ pages/stationMonitor/stationMonitor.wxss | 429 +++++++++++++++++++++ images/camera.svg | 1 app.json | 9 images/pressure.svg | 5 images/stop.svg | 3 pages/stationMonitor/stationMonitor.js | 517 +++++++++++++++++++++++++ images/pause.svg | 3 images/monitor.svg | 1 pages/home/home.wxml | 6 images/play.svg | 3 images/weather.svg | 1 images/water-level.svg | 4 21 files changed, 1,163 insertions(+), 2 deletions(-) diff --git a/app.json b/app.json index aa6ca15..a29ee14 100644 --- a/app.json +++ b/app.json @@ -2,6 +2,7 @@ "pages": [ "pages/home/home", + "pages/stationMonitor/stationMonitor", "pages/valveList/valveList", "pages/feedback/feedback", "pages/wxlogin/wxlogin", @@ -29,5 +30,11 @@ }, "componentFramework": "glass-easel", "sitemapLocation": "sitemap.json", - "lazyCodeLoading": "requiredComponents" + "lazyCodeLoading": "requiredComponents", + "plugins": { + "ezplayer": { + "version": "1.0.13", + "provider": "wxf2b3a0262975d8c2" + } +} } \ No newline at end of file diff --git a/images/camera.svg b/images/camera.svg new file mode 100644 index 0000000..8bdb030 --- /dev/null +++ b/images/camera.svg @@ -0,0 +1 @@ +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1754548431492" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16574" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M1024.2 480L861.9 710c-9.3 13.2-21.5 23.7-35.4 30.9-13.9 7.2-29.5 11.1-45.7 11.1-18.7 0-37-5.3-52.8-15.2L98.4 341.5C87.8 334.8 79.2 325.6 73.3 315c-5.9-10.7-9.1-22.8-9.1-35.3 0-15.3 4.8-30.3 13.8-42.8l117.6-163c9.3-12.9 21.4-23.1 35.1-30.1 13.7-7 29.1-10.8 45-10.8 18.4 0 36.4 5.1 52.1 14.8L1024.2 480zM754.1 768c-11.1 0-22-1.5-32.6-4.5-10.6-3-20.7-7.4-30.2-13.2l-611.8-373c-6.7-4.1-15.3 0.7-15.3 8.6v22.6c0 14.6 7.6 28.2 20 35.8l182.5 112.3C241.2 572 224.2 600 224.2 632c0 20.2 6.8 38.8 18.3 53.7a62.518 62.518 0 0 1-44.2 18.3H64.2v-46.8c0-29-19.5-54.4-47.6-61.9L0.2 591l-0.2 369 28.8-14.3c21.7-10.8 35.5-33 35.5-57.3V768h135.5c25.9 0 50.8-10.3 69.2-28.7l3.1-3.1c10.6-10.6 25-16.3 40-16.3h0.2c46.4 0 84.4-35.9 87.8-81.4L674.2 807.2c9.2 5.7 19.9 8.7 30.7 8.7 9.8 0 19.3-2.5 27.7-6.9 8.4-4.5 15.7-11 21.1-19.2l6.8-10.1c3.2-5-0.4-11.7-6.4-11.7zM312.2 656c-13.2 0-24-10.8-24-24s10.8-24 24-24 24 10.8 24 24-10.8 24-24 24z" p-id="16575" fill="#707070"></path></svg> \ No newline at end of file diff --git a/images/fertilizer.svg b/images/fertilizer.svg new file mode 100644 index 0000000..1711a26 --- /dev/null +++ b/images/fertilizer.svg @@ -0,0 +1 @@ +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1754548404907" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="15411" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M789.650286 57.161143a99.620571 99.620571 0 0 1 100.352 95.341714v707.584a50.176 50.176 0 0 1 0 100.352H87.076571a50.176 50.176 0 1 1 0-100.352H287.817143V257.901714H187.465143v105.398857a53.357714 53.357714 0 0 1-50.176 45.165715 47.542857 47.542857 0 0 1-50.176-50.176V252.891429a103.350857 103.350857 0 0 1 100.352-95.341715H287.817143a99.620571 99.620571 0 0 1 95.341714-100.388571z m0 702.573714H388.169143v100.352h401.481143zM137.252571 508.818286a47.542857 47.542857 0 0 1 50.176 50.176v150.564571a50.176 50.176 0 0 1-100.352 0v-150.564571a47.542857 47.542857 0 0 1 50.176-50.176z m652.397715-351.268572H388.169143v131.437715h401.481143z" fill="#707070" p-id="15412"></path></svg> \ No newline at end of file diff --git a/images/flow.svg b/images/flow.svg new file mode 100644 index 0000000..87f009b --- /dev/null +++ b/images/flow.svg @@ -0,0 +1,3 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 14H9v-4h2v4zm4 0h-2V9h2v8zm4 0h-2V7h2v10z" fill="currentColor"/> +</svg> \ No newline at end of file diff --git a/images/humidity.svg b/images/humidity.svg new file mode 100644 index 0000000..e135fb4 --- /dev/null +++ b/images/humidity.svg @@ -0,0 +1,3 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M12 2l-4.09 4.09L12 10.18l4.09-4.09L12 2zm0 16.36c-2.76 0-5-2.24-5-5 0-1.38.56-2.63 1.46-3.54L12 6.27l3.54 3.55c.9.9 1.46 2.16 1.46 3.54 0 2.76-2.24 5-5 5z" fill="currentColor"/> +</svg> \ No newline at end of file diff --git a/images/monitor.svg b/images/monitor.svg new file mode 100644 index 0000000..d252592 --- /dev/null +++ b/images/monitor.svg @@ -0,0 +1 @@ +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1754546726528" class="icon" viewBox="0 0 1033 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10882" xmlns:xlink="http://www.w3.org/1999/xlink" width="201.7578125" height="200"><path d="M608 291.2h233.6c12.8 0 25.6-12.8 25.6-25.6 0-16-12.8-25.6-25.6-25.6H608c-12.8 0-25.6 12.8-25.6 25.6-3.2 12.8 9.6 25.6 25.6 25.6z m310.4 73.6H704c-12.8 0-25.6 12.8-25.6 25.6 0 16 12.8 25.6 25.6 25.6h214.4c12.8 0 25.6-12.8 25.6-25.6s-12.8-25.6-25.6-25.6z m-291.2 0H608c-12.8 0-25.6 12.8-25.6 25.6 0 16 12.8 25.6 25.6 25.6h19.2c12.8 0 25.6-12.8 25.6-25.6s-12.8-25.6-25.6-25.6z m291.2 89.6H704c-12.8 0-25.6 12.8-25.6 25.6 0 16 12.8 25.6 25.6 25.6h214.4c12.8 0 25.6-12.8 25.6-25.6s-12.8-25.6-25.6-25.6z m-291.2 0H608c-12.8 0-25.6 12.8-25.6 25.6 0 16 12.8 25.6 25.6 25.6h19.2c12.8 0 25.6-12.8 25.6-25.6s-12.8-25.6-25.6-25.6z m291.2 89.6H704c-12.8 0-25.6 12.8-25.6 25.6 0 16 12.8 25.6 25.6 25.6h214.4c12.8 0 25.6-12.8 25.6-25.6s-12.8-25.6-25.6-25.6z m-291.2 0H608c-12.8 0-25.6 12.8-25.6 25.6 0 16 12.8 25.6 25.6 25.6h19.2c12.8 0 25.6-12.8 25.6-25.6s-12.8-25.6-25.6-25.6z m-236.8-124.8H320v-96c0-12.8-9.6-22.4-22.4-22.4-12.8 0-22.4 9.6-22.4 22.4V448l3.2 3.2v3.2c3.2 6.4 9.6 9.6 19.2 9.6h92.8c12.8 0 22.4-9.6 22.4-22.4 0-12.8-9.6-22.4-22.4-22.4zM297.6 224C246.4 224 198.4 246.4 160 281.6c-38.4 38.4-57.6 86.4-57.6 137.6 0 51.2 19.2 102.4 57.6 137.6 38.4 38.4 86.4 57.6 137.6 57.6 51.2 0 102.4-19.2 137.6-57.6 38.4-38.4 57.6-86.4 57.6-137.6s-19.2-102.4-57.6-137.6C400 246.4 348.8 224 297.6 224z m0 345.6c-41.6 0-76.8-16-105.6-44.8-28.8-28.8-44.8-67.2-44.8-105.6 0-41.6 16-76.8 44.8-105.6 28.8-28.8 67.2-44.8 105.6-44.8 41.6 0 76.8 16 105.6 44.8 28.8 28.8 44.8 67.2 44.8 105.6 0 41.6-16 76.8-44.8 105.6-25.6 28.8-64 44.8-105.6 44.8zM1027.2 124.8c0-32-12.8-60.8-54.4-64-19.2-3.2-38.4-3.2-57.6-3.2H163.2c-38.4 0-76.8 0-115.2 3.2C22.4 64 6.4 86.4 3.2 112c0 19.2-3.2 35.2-3.2 54.4v604.8c0 28.8 19.2 44.8 44.8 51.2 19.2 3.2 35.2 3.2 54.4 3.2h323.2v54.4c0 16 0 22.4-12.8 25.6H272c-6.4 0-9.6 9.6-9.6 19.2v22.4c0 9.6 3.2 19.2 9.6 19.2h483.2c6.4 0 9.6-9.6 9.6-19.2v-22.4c0-9.6-3.2-19.2-9.6-19.2h-137.6c-16 0-12.8-3.2-12.8-28.8v-16-35.2h364.8c9.6 0 22.4-3.2 32-9.6 25.6-12.8 32-35.2 32-60.8v-281.6c-6.4-112-6.4-230.4-6.4-348.8zM486.4 752c0-16 12.8-25.6 25.6-25.6s25.6 12.8 25.6 25.6c0 16-12.8 25.6-25.6 25.6-12.8 3.2-25.6-9.6-25.6-25.6z m480-396.8v320c0 16-9.6 22.4-25.6 25.6H96c-28.8 0-38.4-6.4-38.4-35.2v-131.2-172.8-185.6c0-25.6 6.4-32 32-32h844.8c19.2 0 25.6 6.4 25.6 25.6v92.8c6.4 28.8 6.4 60.8 6.4 92.8z" fill="#3F8BFD" p-id="10883"></path></svg> \ No newline at end of file diff --git a/images/offline.svg b/images/offline.svg new file mode 100644 index 0000000..3fd9fb6 --- /dev/null +++ b/images/offline.svg @@ -0,0 +1,4 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" fill="currentColor" opacity="0.3"/> + <path d="M3 3l18 18-1.41 1.41L3 4.41 3 3z" fill="currentColor"/> +</svg> \ No newline at end of file diff --git a/images/pause.svg b/images/pause.svg new file mode 100644 index 0000000..49da9ae --- /dev/null +++ b/images/pause.svg @@ -0,0 +1,3 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M6 4h4v16H6V4zm8 0h4v16h-4V4z" fill="currentColor"/> +</svg> \ No newline at end of file diff --git a/images/play.svg b/images/play.svg new file mode 100644 index 0000000..a61d335 --- /dev/null +++ b/images/play.svg @@ -0,0 +1,3 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M8 5v14l11-7L8 5z" fill="currentColor"/> +</svg> \ No newline at end of file diff --git a/images/pressure.svg b/images/pressure.svg new file mode 100644 index 0000000..09219bc --- /dev/null +++ b/images/pressure.svg @@ -0,0 +1,5 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z" fill="currentColor"/> + <path d="M12 6c-.55 0-1 .45-1 1v5c0 .55.45 1 1 1s1-.45 1-1V7c0-.55-.45-1-1-1z" fill="currentColor"/> + <circle cx="12" cy="16" r="1" fill="currentColor"/> +</svg> \ No newline at end of file diff --git a/images/soil.svg b/images/soil.svg new file mode 100644 index 0000000..bc18fd6 --- /dev/null +++ b/images/soil.svg @@ -0,0 +1 @@ +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1754548305051" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="14084" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M981.369394 925.762065l-152.807226-541.729033A70.689032 70.689032 0 0 0 761.572748 330.322581H620.921394v360.051613c0 58.268903-43.668645 105.703226-97.445162 105.703225s-97.379097-47.434323-97.379097-105.703225V330.322581H272.695329a70.755097 70.755097 0 0 0-66.593032 52.389161l-163.047226 541.729032A80.532645 80.532645 0 0 0 52.766555 992.619355a67.782194 67.782194 0 0 0 56.881548 31.380645h804.797936a67.848258 67.848258 0 0 0 56.286967-30.786065 80.400516 80.400516 0 0 0 10.636388-67.45187z" p-id="14085" fill="#707070"></path><path d="M523.872619 766.348387c39.110194 0 70.887226-35.278452 70.887226-78.616774V78.616774C594.495587 35.278452 562.982813 0 523.872619 0S453.051458 35.278452 453.051458 78.616774v608.850581c0 43.338323 31.777032 78.881032 70.821161 78.881032zM494.407845 78.616774a29.662968 29.662968 0 1 1 58.995613 0V112.309677H535.037523a9.909677 9.909677 0 0 0-9.909678 9.909678v3.303226a9.909677 9.909677 0 0 0 9.909678 9.909677h18.101677v85.223226H535.037523a9.909677 9.909677 0 0 0-9.909678 9.909677v3.303226a9.909677 9.909677 0 0 0 9.909678 9.909678h18.101677v85.223225H535.037523a9.909677 9.909677 0 0 0-9.909678 9.909678v3.303226a9.909677 9.909677 0 0 0 9.909678 9.909677h18.101677v85.223226H535.037523a9.909677 9.909677 0 0 0-9.909678 9.909677v3.303226a9.909677 9.909677 0 0 0 9.909678 9.909677h18.101677v85.223226H535.037523a9.909677 9.909677 0 0 0-9.909678 9.909678v3.303225a9.909677 9.909677 0 0 0 9.909678 9.909678h18.101677V654.03871H535.037523a9.909677 9.909677 0 0 0-9.909678 9.909677v3.303226a9.909677 9.909677 0 0 0 9.909678 9.909677h18.101677v10.306065a29.662968 29.662968 0 1 1-58.995613 0z" p-id="14086" fill="#707070"></path></svg> \ No newline at end of file diff --git a/images/stop.svg b/images/stop.svg new file mode 100644 index 0000000..284b421 --- /dev/null +++ b/images/stop.svg @@ -0,0 +1,3 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M6 6h12v12H6V6z" fill="currentColor"/> +</svg> \ No newline at end of file diff --git a/images/temperature.svg b/images/temperature.svg new file mode 100644 index 0000000..ea72fdf --- /dev/null +++ b/images/temperature.svg @@ -0,0 +1,3 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M15 13V5c0-1.66-1.34-3-3-3S9 3.34 9 5v8c-1.21.91-2 2.37-2 4 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.09-2-4zm-4-8c0-.55.45-1 1-1s1 .45 1 1h-2v1h2v1h-2v1h2v4.51c-.6-.29-1.29-.51-2-.51s-1.4.22-2 .51V5z" fill="currentColor"/> +</svg> \ No newline at end of file diff --git a/images/water-level.svg b/images/water-level.svg new file mode 100644 index 0000000..982f279 --- /dev/null +++ b/images/water-level.svg @@ -0,0 +1,4 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M12 2C8.13 2 5 5.13 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.87-3.13-7-7-7zm0 12.5c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z" fill="currentColor"/> + <path d="M12 7c-1.1 0-2 .9-2 2v2c0 .55.45 1 1 1s1-.45 1-1V9c0-.55-.45-1-1-1z" fill="currentColor"/> +</svg> \ No newline at end of file diff --git a/images/weather.svg b/images/weather.svg new file mode 100644 index 0000000..9b365fc --- /dev/null +++ b/images/weather.svg @@ -0,0 +1 @@ +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1754548228637" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12830" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M624.870875 191.348713H461.322593V82.375927C461.322593 36.755267 498.062669 0.000342 542.421038 0.000342a82.21223 82.21223 0 0 1 82.449837 82.375585zM966.951569 464.44895h-136.861979v-114.051649a49.481783 49.481783 0 0 1 49.422381-49.422381h36.740076a49.481783 49.481783 0 0 1 49.422381 49.422381v114.051649z" p-id="12831" fill="#707070"></path><path d="M515.808986 163.474371h54.486393v191.363222h-54.486393z" p-id="12832" fill="#707070"></path><path d="M461.307743 287.668894h163.474029V819.746566H461.307743z" p-id="12833" fill="#707070"></path><path d="M461.307743 737.534336h163.474029v286.465664H461.307743zM624.781772 465.07267h368.766997v40.556647H624.781772zM119.152797 690.651386h491.684379v40.556647H119.152797z" p-id="12834" fill="#707070"></path><path d="M119.152797 655.173601h40.556647v43.081228H119.152797zM30.450909 354.837593c0 9.949818 20.790665 19.157113 54.486393 24.132022a398.631302 398.631302 0 0 0 108.987637 0c33.725429-4.974909 54.501244-14.182204 54.501243-24.132022 0-15.399943-48.798661-27.889192-108.987636-27.889192S30.450909 339.43765 30.450909 354.837593z m0 0M30.450909 594.346055c0 9.949818 20.790665 19.157113 54.486393 24.132022a398.631302 398.631302 0 0 0 108.987637 0c33.725429-4.974909 54.501244-14.182204 54.501243-24.132022 0-15.399943-48.798661-27.889192-108.987636-27.889192S30.450909 578.946112 30.450909 594.346055z m0 0" p-id="12835" fill="#707070"></path><path d="M44.395505 396.656531h191.392923v27.874342H44.395505z m0 45.605809h191.392923v27.889192H44.395505z m0 45.63551h191.392923v27.904042H44.395505z m0 45.620659h191.392923v27.874342H44.395505z m46.88295 95.043041h96.305331v34.156092H91.278455zM624.870875 82.375927h128.872423v40.541797h-128.872423z m-337.432494 0h172.592221v40.541797H287.364128z m63.708538 0" p-id="12836" fill="#707070"></path><path d="M214.210688 102.646825a62.089836 62.089836 0 1 0 31.037493-53.77357 62.104687 62.104687 0 0 0-31.037493 53.77357z m0 0M809.803841 163.474371a62.104687 62.104687 0 0 1 0-124.194523c32.953204 1.277141 32.953204 124.194523 0 124.194523zM119.167647 342.155287h40.541797v287.668553h-40.541797z m0 0" p-id="12837" fill="#707070"></path></svg> \ No newline at end of file diff --git a/pages/home/home.js b/pages/home/home.js index a7d4ac1..9c4b282 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -496,6 +496,47 @@ icon: 'none' }) }, + // 缁煎悎绔欑洃娴� + monitor() { + const app = getApp(); + // 妫�鏌ュ綋鍓嶉」鐩槸鍚﹂渶瑕佺櫥褰� + const currentProject = app.globalData.selectedProject; + if (currentProject && PROJECT_CONFIG[currentProject] && PROJECT_CONFIG[currentProject].needLogin) { + // 闇�瑕佺櫥褰曠殑椤圭洰锛屾鏌ユ槸鍚﹀凡鐧诲綍 + if (!app.globalData.isLoggedIn) { + // 鏈櫥褰曪紝鏄剧ず鎻愮ず骞堕樆姝㈡搷浣� + wx.showToast({ + title: '璇峰厛鐧诲綍', + icon: 'error', + duration: 2000 + }); + + // 鑾峰彇椤圭洰閰嶇疆 + const projectConfig = PROJECT_CONFIG[currentProject]; + if (projectConfig) { + // 璇㈤棶鐢ㄦ埛鏄惁鍓嶅線鐧诲綍 + wx.showModal({ + title: '鎻愮ず', + content: '鎮ㄩ渶瑕佺櫥褰曞悗鎵嶈兘浣跨敤缁煎悎绔欑洃娴嬪姛鑳斤紝鏄惁绔嬪嵆鐧诲綍锛�', + confirmText: '鍓嶅線鐧诲綍', + cancelText: '鍙栨秷', + success: (res) => { + if (res.confirm) { + // 鐢ㄦ埛鐐瑰嚮纭锛岀洿鎺ヨ皟鐢╳xLogin鏂规硶 + this.wxLogin(); + } + } + }); + } + return; + } + } + + // 宸茬櫥褰曟垨涓嶉渶瑕佺櫥褰曠殑椤圭洰锛岃烦杞埌缁煎悎绔欑洃娴嬮〉闈� + wx.navigateTo({ + url: '/pages/stationMonitor/stationMonitor', + }) + }, //瑙g粦鐢ㄦ埛 unbind() { // 妫�鏌ュ綋鍓嶉」鐩槸鍚﹂渶瑕佺櫥褰� diff --git a/pages/home/home.wxml b/pages/home/home.wxml index c3df698..3629ebc 100644 --- a/pages/home/home.wxml +++ b/pages/home/home.wxml @@ -30,9 +30,13 @@ </view> <view class="center-wrapper"> - <view class="center-view" bind:tap="recharge"> + <!-- <view class="center-view" bind:tap="recharge"> <image src="/images/wallet.svg" /> <text>鍏呭��</text> + </view> --> + <view class="center-view" bind:tap="monitor"> + <image src="/images/monitor.svg" /> + <text>缁煎悎绔欑洃娴�</text> </view> <view class="center-view" bind:tap="openValve"> <image src="/images/valva.svg" /> diff --git a/pages/stationMonitor/stationMonitor.js b/pages/stationMonitor/stationMonitor.js new file mode 100644 index 0000000..73b4fef --- /dev/null +++ b/pages/stationMonitor/stationMonitor.js @@ -0,0 +1,517 @@ +// pages/stationMonitor/stationMonitor.js +const { get } = require('../../api/request.js'); + +Page({ + + /** + * 椤甸潰鐨勫垵濮嬫暟鎹� + */ + data: { + activeTab: 'weather', // 榛樿閫変腑姘旇薄绔� + cameraList: [], + isLoading: false + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 + */ + onLoad(options) { + // 椤甸潰鍔犺浇鏃惰幏鍙栨憚鍍忓ご淇℃伅 + this.getCameraList(); + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 + */ + onReady() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず + */ + onShow() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 + */ + onHide() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 + */ + onUnload() { + + }, + + /** + * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 + */ + onPullDownRefresh() { + // 涓嬫媺鍒锋柊鏃堕噸鏂拌幏鍙栨憚鍍忓ご鍒楄〃 + if (this.data.activeTab === 'camera') { + this.getCameraList(); + } + wx.stopPullDownRefresh(); + }, + + /** + * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� + */ + onReachBottom() { + + }, + + /** + * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� + */ + onShareAppMessage() { + + }, + + /** + * 鍒囨崲閫夐」鍗� + */ + switchTab(e) { + const tab = e.currentTarget.dataset.tab; + console.log('鍒囨崲鍒�:', tab); + this.setData({ + activeTab: tab + }); + + // 濡傛灉鍒囨崲鍒版憚鍍忓ご閫夐」鍗★紝纭繚鏈夋暟鎹� + if (tab === 'camera' && this.data.cameraList.length === 0) { + this.getCameraList(); + } + }, + + /** + * 鑾峰彇鎽勫儚澶村垪琛� + */ + getCameraList() { + const app = getApp(); + + // 妫�鏌ョ櫥褰曠姸鎬� + if (!app.globalData.isLoggedIn) { + wx.showToast({ + title: '璇峰厛鐧诲綍', + icon: 'error' + }); + return; + } + + this.setData({ + isLoading: true + }); + + // 妯℃嫙鎺ュ彛杩斿洖鏁版嵁 + setTimeout(() => { + const mockResponse = { + "code": "0001", + "content": { + "itemTotal": 4, + "obj": [ + { + "id": "2025070715040300007", + "name": "姘戝嫟01", + "videoUrl4PcLive": "https://open.ys7.com/console/jssdk/pc.html?url=ezopen://open.ys7.com/FX6737162/1.live&accessToken=at.2o04glgs0q36cjugbvddqujz7tqrghx1-1ovr6lmf3k-03pij3c-304ziif7e&themeId=pcLive&env=&date=", + "videoUrl4Security": "https://open.ys7.com/console/jssdk/pc.html?accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&url=ezopen://open.ys7.com/FY4056878/1.live&themeId=security&date=", + "videoUrl4Simple": "https://open.ys7.com/console/jssdk/pc.html?accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&url=ezopen://open.ys7.com/FY4056878/1.live&themeId=simple&date=", + "videoUrl4Standard": "https://open.ys7.com/console/jssdk/pc.html?accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&url=ezopen://open.ys7.com/FY4056878/1.live&themeId=standard&date=" + }, + { + "id": "2025070715040300008", + "name": "姘戝嫟02", + "videoUrl4PcLive": "https://open.ys7.com/console/jssdk/pc.html?url=ezopen://open.ys7.com/FY4056879/1.live&accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&themeId=pcLive&env=&date=", + "videoUrl4Security": "https://open.ys7.com/console/jssdk/pc.html?accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&url=ezopen://open.ys7.com/FY4056879/1.live&themeId=security&date=", + "videoUrl4Simple": "https://open.ys7.com/console/jssdk/pc.html?accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&url=ezopen://open.ys7.com/FY4056879/1.live&themeId=simple&date=", + "videoUrl4Standard": "https://open.ys7.com/console/jssdk/pc.html?accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&url=ezopen://open.ys7.com/FY4056879/1.live&themeId=standard&date=" + }, + { + "id": "2025070715040300009", + "name": "姘戝嫟03", + "videoUrl4PcLive": "https://open.ys7.com/console/jssdk/pc.html?url=ezopen://open.ys7.com/FY4056880/1.live&accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&themeId=pcLive&env=&date=", + "videoUrl4Security": "https://open.ys7.com/console/jssdk/pc.html?accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&url=ezopen://open.ys7.com/FY4056880/1.live&themeId=security&date=", + "videoUrl4Simple": "https://open.ys7.com/console/jssdk/pc.html?accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&url=ezopen://open.ys7.com/FY4056880/1.live&themeId=simple&date=", + "videoUrl4Standard": "https://open.ys7.com/console/jssdk/pc.html?accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&url=ezopen://open.ys7.com/FY4056880/1.live&themeId=standard&date=" + }, + { + "id": "2025070715040300010", + "name": "姘戝嫟04", + "videoUrl4PcLive": "https://open.ys7.com/console/jssdk/pc.html?url=ezopen://open.ys7.com/FY4056881/1.live&accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&themeId=pcLive&env=&date=", + "videoUrl4Security": "https://open.ys7.com/console/jssdk/pc.html?accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&url=ezopen://open.ys7.com/FY4056881/1.live&themeId=security&date=", + "videoUrl4Simple": "https://open.ys7.com/console/jssdk/pc.html?accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&url=ezopen://open.ys7.com/FY4056881/1.live&themeId=simple&date=", + "videoUrl4Standard": "https://open.ys7.com/console/jssdk/pc.html?accessToken=at.87a8u4z04s3gom0o6i0cpgz35kuhu8xh-67xrfkiy90-0nnbl6z-r0v9mckp3&url=ezopen://open.ys7.com/FY4056881/1.live&themeId=standard&date=" + } + ], + "pageCurr": 1, + "pageSize": 4, + "pageTotal": 1 + }, + "msg": "璇锋眰鎴愬姛", + "success": true + }; + + console.log('妯℃嫙鎺ュ彛杩斿洖鏁版嵁:', mockResponse); + + if (mockResponse.success && mockResponse.code === '0001') { + // 澶勭悊杩斿洖鐨勬憚鍍忓ご鏁版嵁 + const cameraList = mockResponse.content.obj.map(item => { + // 浠庤悿鐭充簯URL涓彁鍙栬澶囦俊鎭苟鐢熸垚RTMP鍦板潃 + let rtmpUrl = ''; + + if (item.videoUrl4PcLive) { + // 鎻愬彇璁惧搴忓垪鍙峰拰閫氶亾鍙� + const ezopenMatch = item.videoUrl4PcLive.match(/ezopen:\/\/open\.ys7\.com\/([^\/]+)\/(\d+)\.live/); + const tokenMatch = item.videoUrl4PcLive.match(/accessToken=([^&]+)/); + + if (ezopenMatch && tokenMatch) { + const deviceSerial = ezopenMatch[1]; // 璁惧搴忓垪鍙� + const channelNo = ezopenMatch[2]; // 閫氶亾鍙� + const accessToken = tokenMatch[1]; // 璁块棶浠ょ墝 + + // 鐢熸垚RTMP鍦板潃 + rtmpUrl = `rtmp://open.ys7.com:1935/live/${deviceSerial}/${channelNo}?accessToken=${accessToken}`; + + // 澶囩敤HLS鍦板潃 + const hlsUrl = `https://open.ys7.com:443/live/${deviceSerial}/${channelNo}.m3u8?accessToken=${accessToken}`; + + console.log('鐢熸垚鐨凴TMP鍦板潃:', rtmpUrl); + console.log('鐢熸垚鐨凥LS鍦板潃:', hlsUrl); + } + } + + return { + id: item.id, + name: item.name, + online: true, // 榛樿鍦ㄧ嚎锛屽疄闄呴」鐩腑鍙兘闇�瑕侀澶栫殑鐘舵�佹鏌� + thumbnail: '/images/camera-thumb1.jpg', // 榛樿缂╃暐鍥� + lastUpdate: new Date().toLocaleString(), // 褰撳墠鏃堕棿浣滀负鏈�鍚庢洿鏂版椂闂� + isPlaying: false, // 瑙嗛鎾斁鐘舵�� + rtmpUrl: rtmpUrl, // RTMP娴佸湴鍧� + videoUrl4PcLive: item.videoUrl4PcLive, // 鍘熷PC鎾斁鍦板潃 + videoUrl4Security: item.videoUrl4Security, + videoUrl4Simple: item.videoUrl4Simple, + videoUrl4Standard: item.videoUrl4Standard + }; + }); + + this.setData({ + cameraList: cameraList, + isLoading: false + }); + + console.log('澶勭悊鍚庣殑鎽勫儚澶村垪琛�:', cameraList); + } else { + console.error('鑾峰彇鎽勫儚澶村垪琛ㄥけ璐�:', mockResponse.msg); + this.setData({ + isLoading: false + }); + wx.showToast({ + title: mockResponse.msg || '鑾峰彇鎽勫儚澶村垪琛ㄥけ璐�', + icon: 'none' + }); + } + }, 1000); // 妯℃嫙缃戠粶寤惰繜1绉� + }, + + /** + * 鎾斁瑙嗛 + */ + playVideo(e) { + const camera = e.currentTarget.dataset.camera; + console.log('鎾斁鎽勫儚澶�:', camera.name); + + if (!camera.online) { + wx.showToast({ + title: '鎽勫儚澶寸绾�', + icon: 'error' + }); + return; + } + + // 妫�鏌ヨ棰慤RL鏄惁鏈夋晥 + if (!camera.videoUrl4PcLive) { + wx.showToast({ + title: '瑙嗛鍦板潃鏃犳晥', + icon: 'error' + }); + return; + } + + console.log('瑙嗛URL:', camera.videoUrl4PcLive); + + // 鏇存柊瑙嗛鎾斁鐘舵�� + const cameraList = this.data.cameraList.map(item => { + if (item.id === camera.id) { + return { ...item, isPlaying: true }; + } + return item; + }); + + this.setData({ + cameraList: cameraList + }); + + // 寤惰繜涓�涓嬭live-player缁勪欢鏇存柊 + setTimeout(() => { + console.log('寮�濮嬫挱鏀剧洿鎾�:', camera.videoUrl4PcLive); + }, 100); + }, + + /** + * 鏆傚仠瑙嗛 + */ + pauseVideo(e) { + const camera = e.currentTarget.dataset.camera; + console.log('鏆傚仠鎽勫儚澶�:', camera.name); + + // 鏇存柊瑙嗛鎾斁鐘舵�� + const cameraList = this.data.cameraList.map(item => { + if (item.id === camera.id) { + return { ...item, isPlaying: false }; + } + return item; + }); + + this.setData({ + cameraList: cameraList + }); + }, + + /** + * 鍋滄瑙嗛 + */ + stopVideo(e) { + const camera = e.currentTarget.dataset.camera; + console.log('鍋滄鎽勫儚澶�:', camera.name); + + // 鏇存柊瑙嗛鎾斁鐘舵�� + const cameraList = this.data.cameraList.map(item => { + if (item.id === camera.id) { + return { ...item, isPlaying: false }; + } + return item; + }); + + this.setData({ + cameraList: cameraList + }); + }, + + /** + * 娴嬭瘯瑙嗛URL + */ + testVideoUrl(e) { + const camera = e.currentTarget.dataset.camera; + console.log('娴嬭瘯瑙嗛URL:', camera.name); + console.log('鍘熷URL:', camera.videoUrl4PcLive); + console.log('RTMP URL:', camera.rtmpUrl); + + // 鏄剧ずURL淇℃伅 + wx.showModal({ + title: '瑙嗛URL淇℃伅', + content: `鎽勫儚澶�: ${camera.name}\n鍘熷URL: ${camera.videoUrl4PcLive}\nRTMP URL: ${camera.rtmpUrl}`, + showCancel: false, + confirmText: '纭畾' + }); + }, + + /** + * 鐩存挱鎾斁鍣ㄧ姸鎬佸彉鍖� + */ + onLivePlayerStateChange(e) { + const camera = e.currentTarget.dataset.camera; + console.log('鐩存挱鎾斁鍣ㄧ姸鎬佸彉鍖�:', camera.name, e.detail); + + const { code } = e.detail; + + // 鏄剧ず鐘舵�佷俊鎭粰鐢ㄦ埛 + let statusText = ''; + let isPlaying = false; + + switch (code) { + case 2001: + statusText = '宸茬粡杩炴帴鏈嶅姟鍣�'; + break; + case 2002: + statusText = '宸茬粡杩炴帴 RTMP 鏈嶅姟鍣�,寮�濮嬫媺娴�'; + isPlaying = true; + break; + case 2003: + statusText = '缃戠粶鎺ユ敹鍒伴涓棰戞暟鎹寘(IDR)'; + isPlaying = true; + break; + case 2004: + statusText = '瑙嗛鎾斁寮�濮�'; + isPlaying = true; + break; + case 2005: + statusText = '瑙嗛鎾斁杩涘害'; + isPlaying = true; + break; + case 2006: + statusText = '瑙嗛鎾斁缁撴潫'; + isPlaying = false; + break; + case 2007: + statusText = '瑙嗛鎾斁Loading'; + isPlaying = true; + break; + case 2008: + statusText = '瑙g爜鍣ㄥ惎鍔�'; + isPlaying = true; + break; + case 2009: + statusText = '瑙嗛鍒嗚鲸鐜囨敼鍙�'; + isPlaying = true; + break; + case 2101: + statusText = '缃戠粶鏂繛锛屼笖缁忓娆¢噸杩炴姠鏁戞棤鏁�'; + isPlaying = false; + break; + case 2102: + statusText = '鑾峰彇鍔犻�熸媺娴佸湴鍧�澶辫触'; + isPlaying = false; + break; + case 2103: + statusText = '褰撳墠瑙嗛甯цВ鐮佸け璐�'; + isPlaying = false; + break; + case 2104: + statusText = '缃戠粶鏂繛, 宸插惎鍔ㄨ嚜鍔ㄩ噸杩�'; + isPlaying = false; + break; + case 2105: + statusText = '缃戠粶鏉ユ柇杩�, 涓旂粡澶氭閲嶈繛鎶㈡晳鏃犳晥'; + isPlaying = false; + break; + case 2106: + statusText = '缃戠粶鏉ユ柇杩�, 涓旂粡澶氭閲嶈繛鎶㈡晳鏃犳晥'; + isPlaying = false; + break; + default: + statusText = `鏈煡鐘舵�佺爜: ${code}`; + break; + } + + console.log(`鎽勫儚澶� ${camera.name} 鐘舵��: ${statusText}`); + + // 鏇存柊鎾斁鐘舵�� + const cameraList = this.data.cameraList.map(item => { + if (item.id === camera.id) { + return { ...item, isPlaying: isPlaying }; + } + return item; + }); + + this.setData({ + cameraList: cameraList + }); + }, + + /** + * 鐩存挱鎾斁鍣ㄧ綉缁滅姸鎬� + */ + onLivePlayerNetStatus(e) { + const camera = e.currentTarget.dataset.camera; + console.log('鐩存挱鎾斁鍣ㄧ綉缁滅姸鎬�:', camera.name, e.detail); + }, + + /** + * 鐩存挱鎾斁鍣ㄩ敊璇� + */ + onLivePlayerError(e) { + const camera = e.currentTarget.dataset.camera; + console.error('鐩存挱鎾斁鍣ㄩ敊璇�:', camera.name, e.detail); + + wx.showToast({ + title: '鐩存挱鎾斁澶辫触', + icon: 'error' + }); + + // 鏇存柊鎾斁鐘舵�� + const cameraList = this.data.cameraList.map(item => { + if (item.id === camera.id) { + return { ...item, isPlaying: false }; + } + return item; + }); + + this.setData({ + cameraList: cameraList + }); + }, + + /** + * 鍏ㄥ睆鎾斁瑙嗛 + */ + fullscreenVideo(e) { + const camera = e.currentTarget.dataset.camera; + console.log('鍏ㄥ睆鎾斁:', camera.name); + + if (!camera.online) { + wx.showToast({ + title: '鎽勫儚澶寸绾�', + icon: 'error' + }); + return; + } + + // 浣跨敤PC鐩存挱URL杩涜鍏ㄥ睆鎾斁 + if (camera.videoUrl4PcLive) { + console.log('鍏ㄥ睆瑙嗛URL:', camera.videoUrl4PcLive); + + wx.showModal({ + title: '鍏ㄥ睆鎾斁', + content: `鍗冲皢鍏ㄥ睆鎾斁 ${camera.name} 鐨勮棰戞祦`, + confirmText: '寮�濮嬫挱鏀�', + success: (res) => { + if (res.confirm) { + // 杩欓噷鍙互璺宠浆鍒板叏灞忚棰戞挱鏀鹃〉闈� + wx.showToast({ + title: '姝e湪鍔犺浇鍏ㄥ睆瑙嗛...', + icon: 'loading' + }); + + // 妯℃嫙鍏ㄥ睆瑙嗛鍔犺浇 + setTimeout(() => { + wx.showToast({ + title: '鍏ㄥ睆鎾斁涓�', + icon: 'success' + }); + }, 1500); + } + } + }); + } else { + wx.showToast({ + title: '鍏ㄥ睆瑙嗛鍦板潃鏃犳晥', + icon: 'error' + }); + } + }, + + /** + * 鎽勫儚澶磋缃� + */ + cameraSettings(e) { + const camera = e.currentTarget.dataset.camera; + console.log('鎽勫儚澶磋缃�:', camera.name); + + wx.showActionSheet({ + itemList: ['浜戝彴鎺у埗', '褰曞儚璁剧疆', '鐢昏川璋冭妭', '鎶ヨ璁剧疆'], + success: (res) => { + const actions = ['浜戝彴鎺у埗', '褰曞儚璁剧疆', '鐢昏川璋冭妭', '鎶ヨ璁剧疆']; + wx.showToast({ + title: `${actions[res.tapIndex]}鍔熻兘寮�鍙戜腑`, + icon: 'none' + }); + } + }); + } +}) \ No newline at end of file diff --git a/pages/stationMonitor/stationMonitor.json b/pages/stationMonitor/stationMonitor.json new file mode 100644 index 0000000..01eb0ad --- /dev/null +++ b/pages/stationMonitor/stationMonitor.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "缁煎悎绔欑洃娴�", + "usingComponents": { + "ezplayer": "plugin://ezplayer/ezplayer" +} +} \ No newline at end of file diff --git a/pages/stationMonitor/stationMonitor.wxml b/pages/stationMonitor/stationMonitor.wxml new file mode 100644 index 0000000..0807f36 --- /dev/null +++ b/pages/stationMonitor/stationMonitor.wxml @@ -0,0 +1,121 @@ +<!--pages/stationMonitor/stationMonitor.wxml--> +<view class="container"> + <!-- 椤堕儴閫夐」鍗� --> + <view class="tab-container"> + <view class="tab-item {{activeTab === 'weather' ? 'active' : ''}}" bind:tap="switchTab" data-tab="weather"> + <image class="tab-icon" src="/images/weather.svg" /> + <text class="tab-name">姘旇薄绔�</text> + </view> + + <view class="tab-item {{activeTab === 'soil' ? 'active' : ''}}" bind:tap="switchTab" data-tab="soil"> + <image class="tab-icon" src="/images/soil.svg" /> + <text class="tab-name">鍦熷¥澧掓儏绔�</text> + </view> + + <view class="tab-item {{activeTab === 'fertilizer' ? 'active' : ''}}" bind:tap="switchTab" data-tab="fertilizer"> + <image class="tab-icon" src="/images/fertilizer.svg" /> + <text class="tab-name">姘磋偉鏈�</text> + </view> + + <view class="tab-item {{activeTab === 'camera' ? 'active' : ''}}" bind:tap="switchTab" data-tab="camera"> + <image class="tab-icon" src="/images/camera.svg" /> + <text class="tab-name">鎽勫儚澶�</text> + </view> + </view> + + <!-- 鍐呭鍖哄煙 --> + <view class="content-area"> + <!-- 姘旇薄绔欏唴瀹� --> + <view wx:if="{{activeTab === 'weather'}}" class="tab-content"> + <text class="content-title">姘旇薄绔欑洃娴�</text> + <!-- 鍦ㄨ繖閲屾坊鍔犳皵璞$珯鐩稿叧鍐呭 --> + </view> + + <!-- 鍦熷¥澧掓儏绔欏唴瀹� --> + <view wx:elif="{{activeTab === 'soil'}}" class="tab-content"> + <text class="content-title">鍦熷¥澧掓儏绔欑洃娴�</text> + <!-- 鍦ㄨ繖閲屾坊鍔犲湡澹ゅ鎯呯珯鐩稿叧鍐呭 --> + </view> + + <!-- 姘磋偉鏈哄唴瀹� --> + <view wx:elif="{{activeTab === 'fertilizer'}}" class="tab-content"> + <text class="content-title">姘磋偉鏈虹洃娴�</text> + <!-- 鍦ㄨ繖閲屾坊鍔犳按鑲ユ満鐩稿叧鍐呭 --> + </view> + + <!-- 鎽勫儚澶村唴瀹� --> + <view wx:elif="{{activeTab === 'camera'}}" class="tab-content"> + + + <!-- 鎽勫儚澶村垪琛� --> + <view class="camera-list"> + <view wx:for="{{cameraList}}" wx:key="id" class="camera-item"> + <!-- 鎽勫儚澶村悕绉� --> + <view class="camera-header"> + <text class="camera-name">{{item.name}}</text> + <view class="camera-status {{item.online ? 'online' : 'offline'}}"> + <text>{{item.online ? '鍦ㄧ嚎' : '绂荤嚎'}}</text> + </view> + </view> + + <!-- 鎽勫儚澶磋棰� --> + <view class="camera-video-container"> + <view wx:if="{{item.online}}" class="video-wrapper"> + <!-- 鐩存挱鎾斁鍣ㄧ粍浠� --> + <ezplayer id="ezplayer" accessToken="at.2o04glgs0q36cjugbvddqujz7tqrghx1-1ovr6lmf3k-03pij3c-304ziif7e" url="rtmp://open.ys7.com/BA7248908/1/live" plugins="talk,voice,capture" recPlayTime="" width="360" height="300" watermark="shuiyin" theme="{{ { showFullScreenBtn: true, showHdBtn: true, showTimeLine: true } }}" bind:handleError="handleError" bind:onControlEvent="onControlEvent" /> + + <!-- 澶囩敤HLS鎾斁鍣� --> + <video wx:if="{{item.isPlaying && !item.rtmpUrl}}" class="live-player" src="{{item.hlsUrl}}" autoplay="{{true}}" muted="{{true}}" controls="{{false}}" object-fit="contain" bind:load="onVideoLoad" bind:play="onVideoPlay" bind:pause="onVideoPause" bind:ended="onVideoEnded" bind:error="onVideoError" data-camera="{{item}}" /> + + <!-- 瑙嗛鎺у埗瑕嗙洊灞� --> + <view class="video-overlay" wx:if="{{!item.isPlaying}}"> + <view class="play-overlay" bind:tap="playVideo" data-camera="{{item}}"> + <image class="play-icon" src="/images/play.svg" /> + </view> + </view> + + <!-- 瑙嗛淇℃伅 --> + <view class="video-info"> + <text class="video-time">{{item.lastUpdate}}</text> + <text class="video-status">{{item.isPlaying ? '鐩存挱涓�' : '宸插仠姝�'}}</text> + </view> + + <!-- 鎾斁鎺у埗鎸夐挳 --> + <view class="video-controls" wx:if="{{item.isPlaying}}"> + <view class="control-btn" bind:tap="pauseVideo" data-camera="{{item}}"> + <image class="control-icon" src="/images/pause.svg" /> + </view> + <view class="control-btn" bind:tap="stopVideo" data-camera="{{item}}"> + <image class="control-icon" src="/images/stop.svg" /> + </view> + </view> + + <!-- 璋冭瘯鎸夐挳 --> + <view class="debug-controls"> + <view class="debug-btn" bind:tap="testVideoUrl" data-camera="{{item}}"> + <text>娴嬭瘯URL</text> + </view> + </view> + </view> + + <!-- 绂荤嚎鐘舵�� --> + <view wx:else class="video-offline"> + <image class="offline-icon" src="/images/offline.svg" /> + <text class="offline-text">鎽勫儚澶寸绾�</text> + </view> + </view> + + <!-- 鎽勫儚澶存搷浣滄寜閽� --> + <view class="camera-actions"> + <button class="action-btn {{item.online ? 'primary' : 'disabled'}}" disabled="{{!item.online}}" bind:tap="fullscreenVideo" data-camera="{{item}}"> + 鍏ㄥ睆鎾斁 + </button> + <button class="action-btn secondary" bind:tap="cameraSettings" data-camera="{{item}}"> + 璁剧疆 + </button> + </view> + </view> + </view> + </view> + </view> +</view> \ No newline at end of file diff --git a/pages/stationMonitor/stationMonitor.wxss b/pages/stationMonitor/stationMonitor.wxss new file mode 100644 index 0000000..b43ab1f --- /dev/null +++ b/pages/stationMonitor/stationMonitor.wxss @@ -0,0 +1,429 @@ +/* pages/stationMonitor/stationMonitor.wxss */ + +/* 閲嶇疆椤甸潰榛樿鏍峰紡 */ +page { + margin: 0; + padding: 0; + width: 100%; + box-sizing: border-box; +} + +.container { + padding: 0; + margin: 0; + background-color: #f5f5f5; + min-height: 100vh; + width: 100%; + box-sizing: border-box; +} + +/* 閫夐」鍗″鍣� */ +.tab-container { + display: flex; + width: 100%; + background: white; + box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1); + position: sticky; + top: 0; + z-index: 100; + margin: 0; + padding: 0; + box-sizing: border-box; +} + +/* 閫夐」鍗¢」 */ +.tab-item { + flex: 1; + width: 25%; /* 鏄庣‘璁剧疆姣忎釜閫夐」鍗″崰25%瀹藉害 */ + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 20rpx 5rpx; + position: relative; + transition: all 0.3s ease; + box-sizing: border-box; +} + +.tab-item.active { + background-color: #f0f8ff; +} + +.tab-item.active::after { + content: ''; + position: absolute; + bottom: 0; + left: 50%; + transform: translateX(-50%); + width: 60rpx; + height: 4rpx; + background-color: #1890FF; + border-radius: 2rpx; +} + +/* 閫夐」鍗″浘鏍� */ +.tab-icon { + width: 48rpx; + height: 48rpx; + margin-bottom: 8rpx; + transition: all 0.3s ease; +} + +.tab-item.active .tab-icon { + transform: scale(1.1); + filter: brightness(0) saturate(100%) invert(41%) sepia(96%) saturate(1408%) hue-rotate(200deg) brightness(96%) contrast(103%); +} + +.tab-item:not(.active) .tab-icon { + filter: brightness(0) saturate(100%) invert(60%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(95%) contrast(85%); +} + +/* 閫夐」鍗℃枃瀛� */ +.tab-name { + font-size: 22rpx; + color: #666; + text-align: center; + line-height: 1.2; + transition: color 0.3s ease; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 100%; +} + +.tab-item.active .tab-name { + color: #1890FF; + font-weight: 600; +} + +/* 鍐呭鍖哄煙 */ +.content-area { + padding: 0; + margin: 0; + width: 100%; + min-height: calc(100vh - 140rpx); + box-sizing: border-box; +} + +/* 閫夐」鍗″唴瀹� */ +.tab-content { + width: 100%; + background: white; + border-radius: 0; + padding: 20rpx 0; + box-shadow: none; + animation: fadeIn 0.3s ease-in-out; + box-sizing: border-box; + margin: 0; + display: block; +} + +@keyframes fadeIn { + from { + opacity: 0; + transform: translateY(20rpx); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +/* 鍐呭鏍囬 */ +.content-title { + font-size: 32rpx; + font-weight: 600; + color: #333; + margin: 0 20rpx 20rpx 20rpx; + display: block; + width: calc(100% - 40rpx); + box-sizing: border-box; +} + +/* 鍝嶅簲寮忛�傞厤 */ +@media (max-width: 400px) { + .tab-name { + font-size: 20rpx; + } + + .tab-icon { + width: 40rpx; + height: 40rpx; + } + + .tab-item { + padding: 16rpx 2rpx; + width: 25%; /* 纭繚灏忓睆骞曚笅涔熷潎鍒� */ + } +} + +/* 瓒呭皬灞忓箷閫傞厤 */ +@media (max-width: 320px) { + .tab-name { + font-size: 18rpx; + } + + .tab-icon { + width: 36rpx; + height: 36rpx; + } + + .tab-item { + padding: 12rpx 1rpx; + } +} + +/* 鎽勫儚澶村垪琛ㄦ牱寮� */ +.camera-list { + display: flex; + flex-direction: column; + gap: 0; + margin: 0; + width: 100%; +} + +.camera-item { + width: 100vw; + background: #f8f9fa; + border-radius: 0; + padding: 20rpx; + box-shadow: none; + box-sizing: border-box; + margin: 0 0 2rpx 0; + position: relative; + left: 0; + right: 0; +} + +/* 鎽勫儚澶村ご閮� */ +.camera-header { + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 16rpx; + box-sizing: border-box; +} + +.camera-name { + font-size: 28rpx; + font-weight: 600; + color: #333; +} + +.camera-status { + padding: 8rpx 16rpx; + border-radius: 20rpx; + font-size: 22rpx; +} + +.camera-status.online { + background-color: #f6ffed; + color: #52c41a; + border: 1rpx solid #b7eb8f; +} + +.camera-status.offline { + background-color: #fff2f0; + color: #ff4d4f; + border: 1rpx solid #ffccc7; +} + +/* 瑙嗛瀹瑰櫒 */ +.camera-video-container { + position: relative; + width: 100%; + height: 400rpx; + border-radius: 0; + overflow: hidden; + margin-bottom: 16rpx; + box-sizing: border-box; +} + +.video-wrapper { + position: relative; + width: 100%; + height: 100%; +} + +.live-player { + width: 100%; + height: 100%; + background-color: #000; + border-radius: 0; +} + +.video-overlay { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.3); + display: flex; + align-items: center; + justify-content: center; + z-index: 10; +} + +.play-overlay { + width: 80rpx; + height: 80rpx; + background: rgba(0, 0, 0, 0.6); + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + transition: all 0.3s ease; +} + +.play-overlay:active { + transform: scale(0.9); +} + +.play-icon { + width: 40rpx; + height: 40rpx; + filter: brightness(0) invert(1); +} + +.video-info { + position: absolute; + bottom: 0; + left: 0; + right: 0; + background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); + padding: 20rpx 16rpx 16rpx; + color: white; + display: flex; + justify-content: space-between; + align-items: center; +} + +.video-time { + font-size: 24rpx; + opacity: 0.9; +} + +.video-status { + font-size: 22rpx; + opacity: 0.8; + color: #52c41a; +} + +/* 鎾斁鎺у埗鎸夐挳 */ +.video-controls { + position: absolute; + top: 16rpx; + right: 16rpx; + display: flex; + gap: 12rpx; + z-index: 20; +} + +.control-btn { + width: 60rpx; + height: 60rpx; + background: rgba(0, 0, 0, 0.6); + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + transition: all 0.3s ease; +} + +.control-btn:active { + transform: scale(0.9); + background: rgba(0, 0, 0, 0.8); +} + +.control-icon { + width: 32rpx; + height: 32rpx; + filter: brightness(0) invert(1); +} + +/* 璋冭瘯鎸夐挳 */ +.debug-controls { + position: absolute; + bottom: 16rpx; + right: 16rpx; + z-index: 20; +} + +.debug-btn { + padding: 8rpx 16rpx; + background: rgba(255, 0, 0, 0.7); + border-radius: 20rpx; + font-size: 20rpx; + color: white; +} + +/* 绂荤嚎鐘舵�� */ +.video-offline { + width: 100%; + height: 100%; + background-color: #f5f5f5; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + border-radius: 12rpx; +} + +.offline-icon { + width: 60rpx; + height: 60rpx; + opacity: 0.5; + margin-bottom: 16rpx; +} + +.offline-text { + font-size: 24rpx; + color: #999; +} + +/* 鎿嶄綔鎸夐挳 */ +.camera-actions { + width: 100%; + display: flex; + gap: 16rpx; + box-sizing: border-box; +} + +.action-btn { + flex: 1; + height: 64rpx; + border-radius: 32rpx; + font-size: 26rpx; + border: none; + display: flex; + align-items: center; + justify-content: center; + transition: all 0.3s ease; +} + +.action-btn.primary { + background-color: #1890FF; + color: white; +} + +.action-btn.primary:active { + background-color: #0050b3; +} + +.action-btn.secondary { + background-color: white; + color: #1890FF; + border: 1rpx solid #1890FF; +} + +.action-btn.secondary:active { + background-color: #f0f8ff; +} + +.action-btn.disabled { + background-color: #f5f5f5; + color: #bfbfbf; + cursor: not-allowed; +} \ No newline at end of file -- Gitblit v1.8.0