|
@@ -1,7 +1,6 @@
|
1
|
1
|
import { React, useState, useEffect, } from 'react'
|
2
|
2
|
// .就是当前路径
|
3
|
3
|
import iconsearch from '../../assets/icons/housemantj/search.png'
|
4
|
|
-import location from '../../assets/icons/housemantj/location.png'
|
5
|
4
|
import msImage from '../../assets/icons/housemantj/ms.jpg'
|
6
|
5
|
import mjImage from '../../assets/icons/housemantj/mj.jpg'
|
7
|
6
|
import glImage from '../../assets/icons/housemantj/gl.jpg'
|
|
@@ -10,45 +9,44 @@ import mjTip from '../../assets/icons/housemantj/mjtip.png'
|
10
|
9
|
import glTip from '../../assets/icons/housemantj/gltip.png'
|
11
|
10
|
import onlove from '../../assets/icons/housemantj/onlove.png'
|
12
|
11
|
import CustomNav from '@/components/CustomNav'
|
13
|
|
-import Taro, { useRouter } from '@tarojs/taro'
|
|
12
|
+import Taro from '@tarojs/taro'
|
|
13
|
+import Card from '../index/components/Card'
|
|
14
|
+
|
14
|
15
|
import './searchResult.less'
|
15
|
16
|
import withLayout from '@/layouts'
|
16
|
17
|
|
17
|
18
|
|
18
|
19
|
|
19
|
20
|
export default withLayout((props) => {
|
20
|
|
- const { router, person } = props
|
|
21
|
+ const { router, person,location } = props
|
|
22
|
+ const { q} = props.router.params
|
21
|
23
|
|
|
24
|
+console.log(location,q)
|
22
|
25
|
// 横向tab
|
23
|
26
|
const [activeTab, setActiveTab] = useState(0)
|
24
|
|
- const { params } = useRouter()
|
25
|
|
- const { tabJump } = params || {}
|
26
|
|
- useEffect(() => {
|
27
|
|
- if (tabJump) {
|
28
|
|
- setActiveTab(tabJump - 0)
|
29
|
|
- }
|
30
|
|
- }, [tabJump])
|
|
27
|
+ const [queryParams, setQueryParams] = useState({q:q, location: location, pageNum: 1, pageSize: 10, typeId: '' })
|
31
|
28
|
|
|
29
|
+ // 获取资源表信息
|
|
30
|
+ const [alllist, setAllList] = useState([])
|
32
|
31
|
const tabs = [
|
33
|
32
|
{
|
34
|
33
|
title: '全部',
|
35
|
34
|
},
|
36
|
35
|
{
|
37
|
36
|
title: '美食',
|
38
|
|
-
|
39
|
37
|
},
|
40
|
38
|
{
|
41
|
39
|
title: '景点',
|
42
|
|
-
|
43
|
|
- },
|
44
|
|
- {
|
45
|
|
- title: '攻略',
|
46
|
|
-
|
47
|
40
|
},
|
48
|
41
|
]
|
49
|
42
|
const handleTabChange = (e) => {
|
50
|
43
|
const { index } = e.detail
|
51
|
44
|
setActiveTab(index)
|
|
45
|
+ if (index == 0) {
|
|
46
|
+ setQueryParams({q:q, location: location, pageNum: 1, pageSize: 10, typeId: '' })
|
|
47
|
+ }
|
|
48
|
+ // else if(index==1){}
|
|
49
|
+ // else{}
|
52
|
50
|
}
|
53
|
51
|
|
54
|
52
|
|
|
@@ -58,7 +56,11 @@ export default withLayout((props) => {
|
58
|
56
|
Taro.navigateTo({ url: '/pages/search/search' });
|
59
|
57
|
}
|
60
|
58
|
|
61
|
|
-
|
|
59
|
+ useEffect(() => {
|
|
60
|
+ getResourceList(queryParams).then((res) => {
|
|
61
|
+ setAllList(res.records || [])
|
|
62
|
+ })
|
|
63
|
+ }, [queryParams])
|
62
|
64
|
|
63
|
65
|
|
64
|
66
|
|
|
@@ -87,221 +89,9 @@ export default withLayout((props) => {
|
87
|
89
|
|
88
|
90
|
<scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" >
|
89
|
91
|
<view className="waterfall">
|
90
|
|
-
|
91
|
|
- {activeTab === 0 && <>
|
92
|
|
- <view className='contentCard'>
|
93
|
|
- <view className='cardTop'>
|
94
|
|
- <image mode='widthFix' src={msImage} className='cCardimg' />
|
95
|
|
- <image className='lefttips' src={msTip} />
|
96
|
|
- <image src={onlove} className='loveharde'></image>
|
97
|
|
- </view>
|
98
|
|
- <view className='bContent'>
|
99
|
|
- <view className='cCword'>
|
100
|
|
- 超划算套餐?这么便宜也是第一次见6荤6素1...
|
101
|
|
- </view>
|
102
|
|
- <view className='cCleft'>
|
103
|
|
- <image src={location} className='cCicon'></image>
|
104
|
|
- <view className='distance'><text>9.99</text>公里</view>
|
105
|
|
- </view>
|
106
|
|
- <view className='cCright'>
|
107
|
|
- <view className='money'>¥</view>
|
108
|
|
- <view className='price'><text>999</text>/人</view>
|
109
|
|
- </view>
|
110
|
|
- </view>
|
111
|
|
- </view>
|
112
|
|
- <view className='contentCard'>
|
113
|
|
- <view className='cardTop'>
|
114
|
|
- <image mode='widthFix' src={mjImage} className='cCardimg' />
|
115
|
|
- <image className='lefttips' src={mjTip} />
|
116
|
|
- <image src={onlove} className='loveharde'></image>
|
117
|
|
- </view>
|
118
|
|
- <view className='bContent'>
|
119
|
|
- <view className='cCword'>
|
120
|
|
- 超划算套餐?这么便宜也是第一次见6荤6素1...
|
121
|
|
- </view>
|
122
|
|
- <view className='cCleft'>
|
123
|
|
- <image src={location} className='cCicon'></image>
|
124
|
|
- <view className='distance'><text>9.99</text>公里</view>
|
125
|
|
- </view>
|
126
|
|
- <view className='cCright'>
|
127
|
|
- <view className='money'>¥</view>
|
128
|
|
- <view className='price'><text>999</text>/人</view>
|
129
|
|
- </view>
|
130
|
|
- </view>
|
131
|
|
- </view>
|
132
|
|
- <view className='contentCard'>
|
133
|
|
- <view className='cardTop'>
|
134
|
|
- <image mode='widthFix' src={glImage} className='cCardimg' />
|
135
|
|
- <image className='lefttips' src={glTip} />
|
136
|
|
- <image src={onlove} className='loveharde'></image>
|
137
|
|
- </view>
|
138
|
|
- <view className='bContent'>
|
139
|
|
- <view className='cCword'>
|
140
|
|
- 超划算套餐?这么便宜也是第一次见6荤6素1...
|
141
|
|
- </view>
|
142
|
|
- <view className='cCleft'>
|
143
|
|
- <image src={location} className='cCicon'></image>
|
144
|
|
- <view className='distance'><text>9.99</text>公里</view>
|
145
|
|
- </view>
|
146
|
|
- <view className='cCright'>
|
147
|
|
- <view className='money'>¥</view>
|
148
|
|
- <view className='price'><text>999</text>/人</view>
|
149
|
|
- </view>
|
150
|
|
- </view>
|
151
|
|
- </view>
|
152
|
|
- <view className='contentCard'>
|
153
|
|
- <view className='cardTop'>
|
154
|
|
- <image mode='widthFix' src={mjImage} className='cCardimg' />
|
155
|
|
- <image className='lefttips' src={mjTip} />
|
156
|
|
- <image src={onlove} className='loveharde'></image>
|
157
|
|
- </view>
|
158
|
|
- <view className='bContent'>
|
159
|
|
- <view className='cCword'>
|
160
|
|
- 超划算套餐?这么便宜也是第一次见6荤6素1...
|
161
|
|
- </view>
|
162
|
|
- <view className='cCleft'>
|
163
|
|
- <image src={location} className='cCicon'></image>
|
164
|
|
- <view className='distance'><text>9.99</text>公里</view>
|
165
|
|
- </view>
|
166
|
|
- <view className='cCright'>
|
167
|
|
- <view className='money'>¥</view>
|
168
|
|
- <view className='price'><text>999</text>/人</view>
|
169
|
|
- </view>
|
170
|
|
- </view>
|
171
|
|
- </view>
|
172
|
|
-
|
173
|
|
- </>}
|
174
|
|
- {activeTab === 1 && <>
|
175
|
|
- <view className='contentCard'>
|
176
|
|
- <view className='cardTop'>
|
177
|
|
- <image mode='widthFix' src={msImage} className='cCardimg' />
|
178
|
|
- <image className='lefttips' src={msTip} />
|
179
|
|
- <image src={onlove} className='loveharde'></image>
|
180
|
|
- </view>
|
181
|
|
- <view className='bContent'>
|
182
|
|
- <view className='cCword'>
|
183
|
|
- 超划算套餐?这么便宜也是第一次见6荤6素1...
|
184
|
|
- </view>
|
185
|
|
- <view className='cCleft'>
|
186
|
|
- <image src={location} className='cCicon'></image>
|
187
|
|
- <view className='distance'><text>9.99</text>公里</view>
|
188
|
|
- </view>
|
189
|
|
- <view className='cCright'>
|
190
|
|
- <view className='money'>¥</view>
|
191
|
|
- <view className='price'><text>999</text>/人</view>
|
192
|
|
- </view>
|
193
|
|
- </view>
|
194
|
|
- </view>
|
195
|
|
-
|
196
|
|
- </>}
|
197
|
|
- {activeTab === 2 && <>
|
198
|
|
- <view className='contentCard'>
|
199
|
|
- <view className='cardTop'>
|
200
|
|
- <image mode='widthFix' src={mjImage} className='cCardimg' />
|
201
|
|
- <image className='lefttips' src={mjTip} />
|
202
|
|
- <image src={onlove} className='loveharde'></image>
|
203
|
|
- </view>
|
204
|
|
- <view className='bContent'>
|
205
|
|
- <view className='cCword'>
|
206
|
|
- 超划算套餐?这么便宜也是第一次见6荤6素1...
|
207
|
|
- </view>
|
208
|
|
- <view className='cCleft'>
|
209
|
|
- <image src={location} className='cCicon'></image>
|
210
|
|
- <view className='distance'><text>9.99</text>公里</view>
|
211
|
|
- </view>
|
212
|
|
- <view className='cCright'>
|
213
|
|
- <view className='money'>¥</view>
|
214
|
|
- <view className='price'><text>999</text>/人</view>
|
215
|
|
- </view>
|
216
|
|
- </view>
|
217
|
|
- </view>
|
218
|
|
- <view className='contentCard'>
|
219
|
|
- <view className='cardTop'>
|
220
|
|
- <image mode='widthFix' src={msImage} className='cCardimg' />
|
221
|
|
- <image className='lefttips' src={msTip} />
|
222
|
|
- <image src={onlove} className='loveharde'></image>
|
223
|
|
- </view>
|
224
|
|
- <view className='bContent'>
|
225
|
|
- <view className='cCword'>
|
226
|
|
- 超划算套餐?这么便宜也是第一次见6荤6素1...
|
227
|
|
- </view>
|
228
|
|
- <view className='cCleft'>
|
229
|
|
- <image src={location} className='cCicon'></image>
|
230
|
|
- <view className='distance'><text>9.99</text>公里</view>
|
231
|
|
- </view>
|
232
|
|
- <view className='cCright'>
|
233
|
|
- <view className='money'>¥</view>
|
234
|
|
- <view className='price'><text>999</text>/人</view>
|
235
|
|
- </view>
|
236
|
|
- </view>
|
237
|
|
- </view>
|
238
|
|
-
|
239
|
|
- </>}
|
240
|
|
- {activeTab === 3 && <>
|
241
|
|
- <view className='contentCard'>
|
242
|
|
- <view className='cardTop'>
|
243
|
|
- <image mode='widthFix' src={mjImage} className='cCardimg' />
|
244
|
|
- <image className='lefttips' src={mjTip} />
|
245
|
|
- <image src={onlove} className='loveharde'></image>
|
246
|
|
- </view>
|
247
|
|
- <view className='bContent'>
|
248
|
|
- <view className='cCword'>
|
249
|
|
- 超划算套餐?这么便宜也是第一次见6荤6素1...
|
250
|
|
- </view>
|
251
|
|
- <view className='cCleft'>
|
252
|
|
- <image src={location} className='cCicon'></image>
|
253
|
|
- <view className='distance'><text>9.99</text>公里</view>
|
254
|
|
- </view>
|
255
|
|
- <view className='cCright'>
|
256
|
|
- <view className='money'>¥</view>
|
257
|
|
- <view className='price'><text>999</text>/人</view>
|
258
|
|
- </view>
|
259
|
|
- </view>
|
260
|
|
- </view>
|
261
|
|
- <view className='contentCard'>
|
262
|
|
- <view className='cardTop'>
|
263
|
|
- <image mode='widthFix' src={msImage} className='cCardimg' />
|
264
|
|
- <image className='lefttips' src={msTip} />
|
265
|
|
- <image src={onlove} className='loveharde'></image>
|
266
|
|
- </view>
|
267
|
|
- <view className='bContent'>
|
268
|
|
- <view className='cCword'>
|
269
|
|
- 超划算套餐?这么便宜也是第一次见6荤6素1...
|
270
|
|
- </view>
|
271
|
|
- <view className='cCleft'>
|
272
|
|
- <image src={location} className='cCicon'></image>
|
273
|
|
- <view className='distance'><text>9.99</text>公里</view>
|
274
|
|
- </view>
|
275
|
|
- <view className='cCright'>
|
276
|
|
- <view className='money'>¥</view>
|
277
|
|
- <view className='price'><text>999</text>/人</view>
|
278
|
|
- </view>
|
279
|
|
- </view>
|
280
|
|
- </view>
|
281
|
|
- <view className='contentCard'>
|
282
|
|
- <view className='cardTop'>
|
283
|
|
- <image mode='widthFix' src={mjImage} className='cCardimg' />
|
284
|
|
- <image className='lefttips' src={mjTip} />
|
285
|
|
- <image src={onlove} className='loveharde'></image>
|
286
|
|
- </view>
|
287
|
|
- <view className='bContent'>
|
288
|
|
- <view className='cCword'>
|
289
|
|
- 超划算套餐?这么便宜也是第一次见6荤6素1...
|
290
|
|
- </view>
|
291
|
|
- <view className='cCleft'>
|
292
|
|
- <image src={location} className='cCicon'></image>
|
293
|
|
- <view className='distance'><text>9.99</text>公里</view>
|
294
|
|
- </view>
|
295
|
|
- <view className='cCright'>
|
296
|
|
- <view className='money'>¥</view>
|
297
|
|
- <view className='price'><text>999</text>/人</view>
|
298
|
|
- </view>
|
299
|
|
- </view>
|
300
|
|
- </view>
|
301
|
|
-
|
302
|
|
- </>}
|
303
|
|
-
|
304
|
|
-
|
|
92
|
+ {
|
|
93
|
+ alllist?.map((item) => <Card key={item.resourceNo} item={item} />)
|
|
94
|
+ }
|
305
|
95
|
</view>
|
306
|
96
|
<view className='botton'>已经到底了~</view>
|
307
|
97
|
</scroll-view>
|