feat:武隆鲁渝协作示范村数字化赋能 移动端 消息中心研发

This commit is contained in:
Zxuyoubin 2024-03-27 17:41:40 +08:00
parent c2b58175b4
commit 92cd25d7be
2 changed files with 51 additions and 99 deletions

View File

@ -1,84 +1,26 @@
import { View,Image } from "@tarojs/components" import { View,Image } from "@tarojs/components"
import { useState } from "react" import { useEffect, useState } from "react"
import warn from './assets/warn.png'
import rang from './assets/rang.png' import rang from './assets/rang.png'
import './index.css' import './index.css'
import Taro from "@tarojs/taro" import Taro from "@tarojs/taro"
import TabWrapper from "../../components/customized/tabWrapper" import TabWrapper from "../../components/customized/tabWrapper"
import { request } from "../../config/axios/index"
const MsgCenter = () => { const MsgCenter = () => {
const [selectedMenuId, setSelectedMenuId] = useState('all') const [selectedMenuId, setSelectedMenuId] = useState('all')
let contList=[ const getList = () => {
{ return request({
title:'土壤EC值预警', url: '/agriculture/warning-record-big-screen/warningRecordInfo',
time:'2024/3/13 16:30', method: 'GET',
url:'./assets/rang.png', })
message:'1号基地土壤EC值低于0.4阈值报警', }
id:'1' const [contList, setContList] = useState([])
}, useEffect(() => {
{ //获取列表
title:'棚内温度报警', getList().then(res=>{
url:'./assets/rang.png', setContList(res.data)
time:'2024/3/1 10:30', })
message:'3号棚内温度39度,超过阈值37度,建议打开放风机', }, [])
id:'2'
},
{
title:'系统通知',
url:'./assets/warn.png',
time:'2024/3/13 8:30',
message:'今日设备巡检结果尚未填报',
id:'0'
},
{
title:'虫情预警',
url:'./assets/rang.png',
time:'2024/3/13 6:30',
message:'1号棚内虫害数量接近阈值预警',
id:'1'
},
{
title:'虫情预警',
url:'./assets/rang.png',
time:'2024/3/13 6:30',
message:'1号棚内虫害数量接近阈值预警',
id:'1'
},
{
title:'虫情预警',
url:'./assets/rang.png',
time:'2024/3/13 6:30',
message:'1号棚内虫害数量接近阈值预警',
id:'1'
},
{
title:'虫情预警',
url:'./assets/rang.png',
time:'2024/3/13 6:30',
message:'1号棚内虫害数量接近阈值预警',
id:'1'
},
{
title:'虫情预警',
url:'./assets/rang.png',
time:'2024/3/13 6:30',
message:'1号棚内虫害数量接近阈值预警',
id:'1'
},
{
title:'虫情预警',
url:'./assets/rang.png',
time:'2024/3/13 6:30',
message:'1号棚内虫害数量接近阈值预警',
id:'1'
},
{
title:'虫情预警',
url:'./assets/rang.png',
time:'2024/3/13 6:30',
message:'1号棚内虫害数量接近阈值预警',
id:'1'
},
]
const topMenus = [ const topMenus = [
{ {
id: 'all', id: 'all',
@ -93,7 +35,6 @@ const MsgCenter = () => {
title: '通知' title: '通知'
}, },
] ]
const dataList = [ const dataList = [
{ {
id: '1', id: '1',
@ -102,15 +43,6 @@ const MsgCenter = () => {
id: '2', id: '2',
}, },
] ]
let val=0
let val2=0
contList.forEach(item => {
if(item.id=='1'){
val++
}else if(item.id=='0'){
val2++
}
});
return ( return (
<View className="px-1 h-full"> <View className="px-1 h-full">
<View className="h-full flex flex-col justify-start"> <View className="h-full flex flex-col justify-start">
@ -119,14 +51,14 @@ const MsgCenter = () => {
{ {
contList.map((item,index)=>{ contList.map((item,index)=>{
return ( return (
<View className='rounded-md shadow-xl cont' key={index} onClick={() => { Taro.navigateTo({ url: '/msgManager/msgDetail/index' }) }}> <View className='rounded-md shadow-xl cont' key={index} onClick={() => { Taro.navigateTo({ url: `/msgManager/msgDetail/index?id=${item.id}` }) }}>
<Image src={item.id=='1'|| item.id=='2'?rang:warn} className='w-11 h-11' style={{marginTop:'-10px'}}></Image> <Image src={rang} className='w-11 h-11' style={{marginTop:'-10px'}}></Image>
<View className='right'> <View className='right'>
<View className='right-top'> <View className='right-top'>
<View className='top-left'>{item.title}</View> <View className='top-left'>{item.warnType}</View>
<View className='top-right'>{item.time}</View> <View className='top-right'>{new Date().toLocaleString(item.warnTime)}</View>
</View> </View>
<View className={item.id=='1'|| item.id=='2'?'rang':'warn'}>{item.message}</View> <View className='rang'>{item.warnInfo}</View>
</View> </View>
</View> </View>

View File

@ -1,18 +1,38 @@
import { View,Image } from "@tarojs/components" import { View,Image } from "@tarojs/components"
import { useEffect, useState } from "react"
import rang from './assets/rang.png' import rang from './assets/rang.png'
import yxImg from './assets/yxImg.png' import yxImg from './assets/yxImg.png'
import image from './assets/image.png' import image from './assets/image.png'
import "./index.css" import "./index.css"
import PageWrapper from "../../components/customized/pageWrapper" import PageWrapper from "../../components/customized/pageWrapper"
import { request } from "../../config/axios/index"
import Taro, { useRouter } from '@tarojs/taro';
const MsgDetail = () => { const MsgDetail = () => {
let router=useRouter()
let id:any=router.params.id
const getList=(data)=>{
return request({
url: '/agriculture/warning-record-big-screen/getRecordInfo',
method: 'GET',
data
})
}
const [ obj ,setObj]=useState({})
useEffect(()=>{
getList({id}).then(res=>{
console.log(res,'获取详情信息');
setObj(res.data)
})
},[])
return ( return (
<PageWrapper title="消息详情"> <PageWrapper title="消息详情">
<View className="h-full flex flex-col px-3 py-3"> <View className="h-full flex flex-col px-3 py-3">
<View className='detail rounded-md shadow-xl' style={{backgroundColor:'#fff'}}> <View className='detail rounded-md shadow-xl' style={{backgroundColor:'#fff'}}>
<View className='detailTop'> <View className='detailTop'>
<Image src={rang} className='w-12 h-12'></Image> <Image src={rang} className='w-12 h-12'></Image>
<View style={{marginLeft:'20px',fontWeight:700}}>EC值预警</View> <View style={{marginLeft:'20px',fontWeight:700}}>{obj.warnInfo}</View>
</View> </View>
<View style={{marginTop:'15px'}}> <View style={{marginTop:'15px'}}>
<View style={{marginTop:'10px',fontWeight:600,fontSize:'12px'}}> 1</View> <View style={{marginTop:'10px',fontWeight:600,fontSize:'12px'}}> 1</View>