|
|
@ -1,9 +1,11 @@ |
|
|
|
import React, { useState } from 'react' |
|
|
|
import React, { useState, useEffect } from 'react' |
|
|
|
import Taro, { useDidShow } from '@tarojs/taro' |
|
|
|
import { View, Picker, Input, Image } from '@tarojs/components' |
|
|
|
import moment from 'moment' |
|
|
|
import './index.scss' |
|
|
|
import NoData from '@/components/no-data/noData' |
|
|
|
import request from '@/services/request' |
|
|
|
import { getReportList } from '@/services/api'; |
|
|
|
import chevronDown from '../../static/img/patrolView/chevron-down.png' |
|
|
|
import searchIcon from '../../static/img/patrolView/search.png' |
|
|
|
import cardImg from '../../static/img/patrolView/card-img.png' |
|
|
@ -22,6 +24,8 @@ function Index() { |
|
|
|
const [num, setNum] = useState(Math.random()) |
|
|
|
const [systemInfo, setSystemInfo] = useState('') |
|
|
|
|
|
|
|
const userInfo = Taro.getStorageSync('userInfo') || {}; |
|
|
|
|
|
|
|
const data = [ |
|
|
|
{ |
|
|
|
place: { |
|
|
@ -34,6 +38,28 @@ function Index() { |
|
|
|
} |
|
|
|
] |
|
|
|
|
|
|
|
function dealError(error) { |
|
|
|
Taro.showToast({ |
|
|
|
title: error, |
|
|
|
icon: 'none', |
|
|
|
duration: 1500 |
|
|
|
}); |
|
|
|
throw new Error(error); |
|
|
|
} |
|
|
|
useEffect(() => { |
|
|
|
request.get(getReportList(), {}, { hideErrorToast: true, hideLoading: true }).then(res => { |
|
|
|
if (res.statusCode == 200) { |
|
|
|
console.log(res); |
|
|
|
setListData(res.data) |
|
|
|
return res.data; |
|
|
|
} else { |
|
|
|
dealError(res.data.message || '请求出错'); |
|
|
|
} |
|
|
|
}, err => { |
|
|
|
dealError(err.message || '请求出错'); |
|
|
|
}); |
|
|
|
}, []) |
|
|
|
|
|
|
|
useDidShow(() => { |
|
|
|
let refresh = Taro.getStorageSync('refresh'); // 返回列表需要刷新 |
|
|
|
if (refresh) { |
|
|
@ -102,15 +128,15 @@ function Index() { |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
|
|
|
|
<View style={{ marginTop: '70px' }}> |
|
|
|
<View style={{ marginTop: '110px' }}> |
|
|
|
{ |
|
|
|
data && data.length > 0 ? data && data.map((e, index) => { |
|
|
|
listData && listData.length > 0 ? listData && listData.map((e, index) => { |
|
|
|
return ( |
|
|
|
<View className='cardBox' key={index} onClick={() => handleDetail(index)}> |
|
|
|
<View className='card-item' > |
|
|
|
<Image className='card-bg' src={cardImg} /> |
|
|
|
<View className='card-position'> |
|
|
|
<View className='card-title'>{e.place.name}</View> |
|
|
|
<View className='card-title'>{e.road}</View> |
|
|
|
<View style={{ float: 'left', width: '100%', fontSize: '28rpx', marginTop: '16rpx' }}> |
|
|
|
<View style={{ float: 'left' }}>填报人:</View> |
|
|
|
<View style={{ float: 'left' }}>{e.user.name}</View> |
|
|
|