diff --git a/src/basePage/iot/index.tsx b/src/basePage/iot/index.tsx
index bc20f5f..f6b6c87 100644
--- a/src/basePage/iot/index.tsx
+++ b/src/basePage/iot/index.tsx
@@ -20,11 +20,12 @@ const getDeviceList = (data) => {
const UrlMap = {
'气象监测': '/iotManager/weatherStation/index?id=1',
'土壤监测': '/iotManager/soilMoisture/index?id=1',
- '虫情监测': '',
- '环境检测': '',
+ '虫情监测': '/iotManager/bugMonitor/index',
+ '环境检测': '/iotManager/envMonitor/index',
'其他摄像头': '',
'棚内环境监测': '/iotManager/envMonitor/index?id=1',
- '设备监控': '/iotManager/deviceMonitor/index?id=1'
+ '设备监控': '/iotManager/deviceMonitor/index?id=1',
+ '增氧设备': '/iotManager/deviceMonitor/index'
}
const getDeviceInfoCard = () => {
@@ -52,6 +53,8 @@ const Iot = () => {
return new Promise((resolve, reject) => {
if (selectedMenuId === 'all') {
getDeviceInfoCard().then(({ data }) => {
+ console.log('物联网列表all->', data);
+
if (Array.isArray(data.category)) {
setDataList(data.category.map((item, index) => ({
id: index,
@@ -70,6 +73,7 @@ const Iot = () => {
}
if (!selectedMenuId) return;
getDeviceList({ parkId: selectedMenuId }).then(({ data }) => {
+ console.log('物联网列表part->', data);
setDataList(data.map((item, index) => ({
id: index,
title: item.categoryName,
diff --git a/src/components/iot/basicStatus.tsx b/src/components/iot/basicStatus.tsx
index 41ed1f2..950b70f 100644
--- a/src/components/iot/basicStatus.tsx
+++ b/src/components/iot/basicStatus.tsx
@@ -1,6 +1,6 @@
import { View } from "@tarojs/components"
-const BasicStatus = (status = true) => {
+const BasicStatus = ({status = true}) => {
return (
{
Taro.showLoading({ title: '加载中...' })
Taro.request({
diff --git a/src/iotManager/deviceMonitor/index.tsx b/src/iotManager/deviceMonitor/index.tsx
index f8bf617..495a773 100644
--- a/src/iotManager/deviceMonitor/index.tsx
+++ b/src/iotManager/deviceMonitor/index.tsx
@@ -1,69 +1,82 @@
import { View, Image } from "@tarojs/components";
import PageWrapper from "../../components/customized/pageWrapper";
-import { useState } from "react";
+import { useEffect, useState } from "react";
+import { request } from "../../config/axios";
+import BasicStatus from "../../components/iot/basicStatus";
+
+const getMonitorDevices = (data) => {
+ return request({
+ url: '/agriculture/big-screen/monitorDeviceByPark',
+ method: 'GET',
+ data
+ })
+}
const DeviceInfoCard = ({ title, info, status, imgSrc }) => {
return (
-
-
+
+
{ title }
{ info }
- { status }
+
+
+
- 查看监控
+ 查看监控
)
}
const DeviceMonitor = () => {
- const [curDeviceId, setCurDeviceId] = useState('1')
- const deviceList = [
- {
- id: '1',
- title: '设备1'
- },
- {
- id: '2',
- title: '设备2'
- },
- {
- id: '3',
- title: '设备3'
- },
- ]
+ const [dataList, setDataList] = useState>([])
+ const getDataList = async () => {
+ const { data } = await getMonitorDevices({
+ belongPark: '1769896538700668928',
+ belongPlot: '1769908355099721728'
+ })
+ console.log('getDataList', data);
+ setDataList(data)
+ }
+ useEffect(() => { getDataList() }, [])
return (
-
+
{
- deviceList.map(item => {
+ dataList.map(item => {
return (
- setCurDeviceId(item.id)}
- >{ item.title }
+
)
})
}
-
-
-
-
-
)
diff --git a/src/iotManager/envMonitor/index.tsx b/src/iotManager/envMonitor/index.tsx
index b96e39c..55946bd 100644
--- a/src/iotManager/envMonitor/index.tsx
+++ b/src/iotManager/envMonitor/index.tsx
@@ -29,7 +29,7 @@ const BasicInfoCard = ({ title, info, status, imgSrc }) => {
{ title }
{ info }
- { status ? BasicStatus() : '' }
+ { status ? : '' }
)
diff --git a/src/iotManager/soilMoisture/index.tsx b/src/iotManager/soilMoisture/index.tsx
index 55639f9..33ab70f 100644
--- a/src/iotManager/soilMoisture/index.tsx
+++ b/src/iotManager/soilMoisture/index.tsx
@@ -30,7 +30,7 @@ const BasicInfoCard = ({ title, info, status, imgSrc }) => {
{ title }
{ info }
- { status ? BasicStatus() : '' }
+ { status ? : '' }
)
diff --git a/src/iotManager/weatherStation/index.tsx b/src/iotManager/weatherStation/index.tsx
index b6eaf20..6327c9e 100644
--- a/src/iotManager/weatherStation/index.tsx
+++ b/src/iotManager/weatherStation/index.tsx
@@ -29,7 +29,7 @@ const BasicInfoCard = ({ title, info, status, imgSrc }) => {
{ title }
{ info }
- { status ? BasicStatus() : '' }
+ { status ? : '' }
)