From 13aba62a3b2dd38ce5f1249ec50c02d8cdf6f566 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Fri, 15 Dec 2023 15:32:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E6=9F=A5=E8=AF=A6=E6=83=85=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spotCheckRoadDetail/index.jsx | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.jsx b/weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.jsx index fc52c940..0b39afad 100644 --- a/weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.jsx +++ b/weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.jsx @@ -15,6 +15,7 @@ function Index() { const [keyword, setKeyword] = useState('') const [roadDetailList, setRoadDetailList] = useState([]) + const [isNoData, setIsNoData] = useState(false) useDidShow(() => { getDetail() @@ -30,21 +31,17 @@ function Index() { } else { Taro.showToast({ title: '获取详情失败', icon: 'error' }) } + if (res.data?.length) { + setIsNoData(false) + } else { + setIsNoData(true) + } }) } } - return ( - setKeyword(v)} - onActionClick={getDetail} - /> - 抽查日期:{moment(spotItem.date).format('YYYY-MM-DD')} - - {roadDetailList.length ? roadDetailList.map(item => + const renderList = () => { + return roadDetailList.length ? roadDetailList.map(item => 道路类型:{item.road?.level ? (item.road?.level + '道') : '--'} 路线名称:{item.road?.routeName || '--'} @@ -71,7 +68,23 @@ function Index() { >调整 - ) : } + ) : + } + + const renderNoData = () => { + return + } + + return ( + setKeyword(v)} + onActionClick={getDetail} + /> + 抽查日期:{moment(spotItem.date).format('YYYY-MM-DD')} + {isNoData ? renderNoData() : renderList()} ) }