import Taro from '@tarojs/taro' import { React, useState, useEffect } from 'react' import iconsearch from '@/assets/icons/housemantj/search.png' import locationimg from '@/assets/icons/housemantj/location.png' import Tip from '@/components/tip' import List from '@/components/List'; import { getIndexType, getResourceList } from '@/services/home' import Card from '../components/Card' import './less/Recommend.less' export default (props) => { const { router, person, location } = props const [activeTab, setActiveTab] = useState(0) const [typeList, setTypeList] = useState([]) const [queryParams, setQueryParams] = useState({ location: location, pageNum: 1, pageSize: 10, typeId: '' }) // 获取资源表信息 const [alllist, setAllList] = useState([]) //分类标签 const tabs = [{ title: '附近' }].concat(typeList.map(x => ({ ...x, title: x.typeName }))) //切换上面的标签 const handleTabChange = (e) => { const { index } = e.detail setActiveTab(index) const tab = tabs[index].typeId setQueryParams({ ...queryParams, typeId: tab }) if (index == 0) { setQueryParams({ location: location, pageNum: 1, pageSize: 10, typeId: '' }) } } useEffect(() => { //查询分类标签表 getIndexType({ pageSize: 20 }).then((res) => { setTypeList(res.records || []) }) }, []) const onSearch = () => { // 用绝对路径 Taro.navigateTo({ url: '/pages/search/search' }); } return ( 搜索 南京 { alllist.map((item) => ) } ) }