|
@@ -4,7 +4,7 @@ import iconsearch from '../../assets/icons/housemantj/search.png'
|
4
|
4
|
import CustomNav from '@/components/CustomNav'
|
5
|
5
|
import Taro from '@tarojs/taro'
|
6
|
6
|
import Card from '../index/components/Card'
|
7
|
|
-import {getResourceList } from '@/services/home'
|
|
7
|
+import { getResourceList } from '@/services/home'
|
8
|
8
|
import List from '@/components/List';
|
9
|
9
|
import './searchResult.less'
|
10
|
10
|
import withLayout from '@/layouts'
|
|
@@ -12,12 +12,12 @@ import withLayout from '@/layouts'
|
12
|
12
|
|
13
|
13
|
|
14
|
14
|
export default withLayout((props) => {
|
15
|
|
- const { router, person,location } = props
|
16
|
|
- const { q} = props.router.params
|
|
15
|
+ const { router, person, location } = props
|
|
16
|
+ const { q } = props.router.params
|
17
|
17
|
|
18
|
18
|
// 横向tab
|
19
|
19
|
const [activeTab, setActiveTab] = useState(0)
|
20
|
|
- const [queryParams, setQueryParams] = useState({q:q, location: location, pageNum: 1, pageSize: 10, typeId: '' })
|
|
20
|
+ const [queryParams, setQueryParams] = useState({ q: q, location: location, pageNum: 1, pageSize: 10, typeId: '' })
|
21
|
21
|
|
22
|
22
|
// 获取资源表信息
|
23
|
23
|
const [alllist, setAllList] = useState([])
|
|
@@ -36,13 +36,13 @@ export default withLayout((props) => {
|
36
|
36
|
const { index } = e.detail
|
37
|
37
|
setActiveTab(index)
|
38
|
38
|
if (index == 0) {
|
39
|
|
- setQueryParams({q:q, location: location, pageNum: 1, pageSize: 10, typeId: '' })
|
|
39
|
+ setQueryParams({ q: q, location: location, pageNum: 1, pageSize: 10, typeId: '' })
|
40
|
40
|
}
|
41
|
|
- else if(index==1){
|
42
|
|
- setQueryParams({q:q,targetType:'shop', location: location, pageNum: 1, pageSize: 10, typeId: '' })
|
|
41
|
+ else if (index == 1) {
|
|
42
|
+ setQueryParams({ q: q, targetType: 'shop', location: location, pageNum: 1, pageSize: 10, typeId: '' })
|
43
|
43
|
}
|
44
|
|
- else{
|
45
|
|
- setQueryParams({q:q,targetType:'tourist', location: location, pageNum: 1, pageSize: 10, typeId: '' })
|
|
44
|
+ else {
|
|
45
|
+ setQueryParams({ q: q, targetType: 'tourist', location: location, pageNum: 1, pageSize: 10, typeId: '' })
|
46
|
46
|
}
|
47
|
47
|
}
|
48
|
48
|
|
|
@@ -52,13 +52,7 @@ export default withLayout((props) => {
|
52
|
52
|
// 用绝对路径
|
53
|
53
|
Taro.navigateTo({ url: '/pages/search/search' });
|
54
|
54
|
}
|
55
|
|
- const [total,setTotal]=useState()
|
56
|
55
|
|
57
|
|
- useEffect(() => {
|
58
|
|
- getResourceList(queryParams).then((res) => {
|
59
|
|
- setTotal(res.total)
|
60
|
|
- })
|
61
|
|
- }, [queryParams])
|
62
|
56
|
|
63
|
57
|
|
64
|
58
|
|
|
@@ -85,20 +79,17 @@ export default withLayout((props) => {
|
85
|
79
|
</mp-tabs>
|
86
|
80
|
</view>
|
87
|
81
|
<List
|
88
|
|
- style={{ height: 'calc(100% - 160px)' }}
|
89
|
|
- request={getResourceList}
|
90
|
|
- params={queryParams}
|
91
|
|
- onDataChange={setAllList}
|
92
|
|
- >
|
93
|
|
- <view className='waterfall'>
|
94
|
|
- {
|
95
|
|
- alllist.map((item) => <Card key={item.resourceNo} item={item} />)
|
96
|
|
- }
|
97
|
|
- </view>
|
98
|
|
- <view className='botton' style={{display:alllist.length==total?'none':''}}>已经到底了~</view>
|
99
|
|
- </List>
|
100
|
|
-
|
101
|
|
-
|
|
82
|
+ style={{ height: 'calc(100% - 160px)' }}
|
|
83
|
+ request={getResourceList}
|
|
84
|
+ params={queryParams}
|
|
85
|
+ onDataChange={setAllList}
|
|
86
|
+ >
|
|
87
|
+ <view className='waterfall'>
|
|
88
|
+ {
|
|
89
|
+ alllist.map((item) => <Card key={item.resourceNo} item={item} />)
|
|
90
|
+ }
|
|
91
|
+ </view>
|
|
92
|
+ </List>
|
102
|
93
|
</view>
|
103
|
94
|
</view>
|
104
|
95
|
)
|