| | |
| | | const [filteredPendingList, setFilteredPendingList] = useState<any[]>([]); // 过滤后的开放城市列表 |
| | | const [openCityList, setOpenCityList] = useState<any[]>([]); // 开放城市列表 |
| | | const [searchResultList, setSearchResultList] = useState<any[]>([]); // 搜索结果列表 |
| | | const [isLoading, setIsLoading] = useState(true); |
| | | |
| | | useEffect(() => { |
| | | const city = Taro.getStorageSync('selectedCity'); |
| | |
| | | } |
| | | |
| | | // 并行请求:获取开通城市列表和所有城市列表 |
| | | setIsLoading(true); |
| | | Promise.all([ |
| | | getOpenCity(), |
| | | getCityList({ isOpen: 0 }) // 0代表待开通 |
| | |
| | | |
| | | }).catch(err => { |
| | | console.error('获取城市数据失败', err); |
| | | }).finally(() => { |
| | | setIsLoading(false); |
| | | }); |
| | | }, []) |
| | | |
| | |
| | | placeholderClass='placeholder-class' |
| | | /> |
| | | </View> |
| | | { |
| | | isLoading && |
| | | <View className='city-content skeleton'> |
| | | <View className='skeleton-service'> |
| | | <View className='skeleton-title'></View> |
| | | <View className='skeleton-chip-list'> |
| | | {Array.from({ length: 6 }).map((_, index) => ( |
| | | <View className='skeleton-chip' key={index}></View> |
| | | ))} |
| | | </View> |
| | | </View> |
| | | <View className='skeleton-non-operational'> |
| | | <View className='skeleton-title'></View> |
| | | <View className='skeleton-line-group'> |
| | | {Array.from({ length: 8 }).map((_, index) => ( |
| | | <View className='skeleton-line' key={index}></View> |
| | | ))} |
| | | </View> |
| | | </View> |
| | | <View className='skeleton-shortcut'> |
| | | {Array.from({ length: 6 }).map((_, index) => ( |
| | | <View className='skeleton-shortcut-item' key={index}></View> |
| | | ))} |
| | | </View> |
| | | </View> |
| | | } |
| | | {!isLoading && ( |
| | | <> |
| | | {/* 搜索前 */} |
| | | { |
| | | !searchValue && |
| | |
| | | } |
| | | </View> |
| | | } |
| | | </> |
| | | )} |
| | | </View> |
| | | ) |
| | | } |