Explorar el Código

Merge branch 'dev' of http://git.ycjcjy.com/shigongli/miniapp-v2 into dev

吃个甘蔗嚼一年 hace 3 años
padre
commit
5131550d51

+ 2
- 2
src/components/List/index.jsx Ver fichero

@@ -17,11 +17,11 @@ export default (props) => {
17 17
   const [payload, setPayload] = useState({})
18 18
   const [list, setList] = useState([])
19 19
   const pageRef = useRef({ current: 1, pages: 0 })
20
+  const hasMore = pageRef.current.current < pageRef.current.pages
20 21
 
21 22
   // 滚动
22 23
   const handleScrollToLower = (e) => {
23 24
     const loading = loadingRef.current
24
-    const hasMore = pageRef.current.current < pageRef.current.pages
25 25
 
26 26
     if (!loading && hasMore) {
27 27
       setPayload({
@@ -46,7 +46,6 @@ export default (props) => {
46 46
     loadingRef.current = true
47 47
     request(payload).then((res) => {
48 48
       const { records, ...pageInfo } = res || {}
49
-
50 49
       const lst = pageInfo.current === 1 ? records || [] : list.concat(records || [])
51 50
       setList(lst)
52 51
       if (onDataChange) {
@@ -76,6 +75,7 @@ export default (props) => {
76 75
           ? props.children
77 76
           : list.map((item, index) => render({ item, index }))
78 77
       }
78
+      <view className='botton' style={{display:hasMore?'none':''}}>已经到底了~</view>
79 79
     </ScrollView>
80 80
   )
81 81
 }

+ 2
- 2
src/hotel/components/HouseManage/houseManage.jsx Ver fichero

@@ -115,9 +115,9 @@ export default React.forwardRef((props, ref) => {
115 115
         <ShareCard showCutover={showCard} onClose={onClose} />
116 116
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 244px)' }}>
117 117
           {
118
-            detail?.map((item) =>
118
+            (detail || []).map((item) =>
119 119
               <view className='houseCard'>
120
-                <view className='houseName'>{item.roomName}</view>
120
+                <view className='houseName'>{item.roomName||''}</view>
121 121
                 <view className='operation'>
122 122
                   <view onClick={() => handelOrder(item)}><image src={see} />查看入住人</view>
123 123
                   <view onClick={() => ShowMoldeOn(item)}><image src={share} />分享链接</view>

+ 1
- 1
src/hotel/components/Income/income.jsx Ver fichero

@@ -62,7 +62,7 @@ export default (props) => {
62 62
           
63 63
           <view className='title' >{accountlog.length!=''?'推广收入记录':'暂无推广收入'}</view>
64 64
             {
65
-              accountlog?.map((item) => 
65
+              (accountlog || []).map((item) => 
66 66
                 <view className='spreadCard'>
67 67
                   <view className='card'>
68 68
                     <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>{formatTime(item.createDate,'yyyy/MM/dd hh:mm:ss')}</text></view>

+ 2
- 2
src/hotel/pages/landlord/roomOrder/roomOrder.jsx Ver fichero

@@ -49,10 +49,10 @@ export default withLayout((props) => {
49 49
 
50 50
         {
51 51
           detail.length==0?<View className='houseCard'>暂无入住人数据</View>
52
-           :detail?.map((item) =>
52
+           :detail.map((item) =>
53 53
             <View className='houseCard'>
54 54
               {
55
-                item.personList?.map((item2) =>
55
+                (item.personList||[]).map((item2) =>
56 56
                   <View className='operation'>
57 57
                     <View style={{display:'inline-block'}} onClick={()=>CopyName(item2.customerName)}>
58 58
                       <Label>{item2.customerName}</Label>

+ 1
- 1
src/pages/MineUserAll/RefundMoney/CheckRefund/index.jsx Ver fichero

@@ -127,7 +127,7 @@ export default withLayout((props) => {
127 127
       </view>
128 128
       {/* 商品信息结束 */}
129 129
       <view>
130
-        {list?.map((item) => {
130
+        {(list||[]).map((item) => {
131 131
           return (
132 132
             <view class="wrapper" key={item.orderId}>
133 133
               <view class="left-complete-one">

+ 1
- 1
src/pages/MineUserAll/RefundMoney/index.jsx Ver fichero

@@ -86,7 +86,7 @@ export default withLayout((props) => {
86 86
         onscrolltolower={pageLoadMore}
87 87
       >
88 88
         <view>
89
-          {list?.map((item) => {
89
+          {(list||[]).map((item) => {
90 90
             return (
91 91
               <view class="wrapper" key={item.orderId}>
92 92
                 <view class="left-complete-one">

+ 1
- 1
src/pages/PayOrder/index.jsx Ver fichero

@@ -216,7 +216,7 @@ export default withLayout((props) => {
216 216
         </view>
217 217
       </Popup>
218 218
       <view class="coupon-list">
219
-        {list?.map((item) => {
219
+        {(list||[]).map((item) => {
220 220
           return (
221 221
             <view class="wrapper">
222 222
               <view class="left-complete-one">

+ 1
- 1
src/pages/TobeShop/index.jsx Ver fichero

@@ -147,7 +147,7 @@ export default withLayout((props) => {
147 147
           <text className="shop-title-title">请选择你要核销的套餐</text>
148 148
         </view>
149 149
         <view>
150
-          {list?.map((item) => {
150
+          {(list||[]).map((item) => {
151 151
 
152 152
             return (
153 153
               <view class="wrapper" key={item.verifyNo} onClick={() => setChecked(item.verifyNo)}>

+ 2
- 2
src/pages/details/foodDetails/foodDetails.jsx Ver fichero

@@ -181,7 +181,7 @@ export default withLayout((props) => {
181 181
             <view className='title'>
182 182
               <image src={titlezs} /><text>返现套餐</text>
183 183
             </view>
184
-            {spackage?.map((item) => <Cards star={star} item={item} />)}
184
+            {(spackage||[]).map((item) => <Cards star={star} item={item} />)}
185 185
             <view className='showMore' style={{ display: newpgNum == AllpgNum ? 'none' : '' }} onClick={pgMore}>
186 186
               <view>查看更多</view>
187 187
               <image src={showMore} className='moreTip' />
@@ -192,7 +192,7 @@ export default withLayout((props) => {
192 192
               <image src={titlezs} />
193 193
               <text>本店指南</text>
194 194
             </view>
195
-            {extend?.map((item) => <Extend item={item} />)}
195
+            {(extend||[]).map((item) => <Extend item={item} />)}
196 196
             <view className='showMore' style={{ display: newextNum == AllextNum ? 'none' : '' }} onClick={extendMore}>
197 197
               <view>查看更多</view>
198 198
               <image src={showMore} className='moreTip' />

+ 11
- 6
src/pages/details/mjDetails/sceneryDetails.jsx Ver fichero

@@ -23,8 +23,8 @@ import './sceneryDetails.less'
23 23
 
24 24
 
25 25
 export default withLayout((props) => {
26
-  const { router, person } = props
27
-  const { id, distance, location } = props.router.params
26
+  const { router, person ,location } = props
27
+  const { id, distance, loc } = props.router.params
28 28
   const [detail, setDetail] = useState({})
29 29
   const [isSaved, toggleSave] = useSave(detail.isSaved, 'tourist', id)
30 30
   const [isLike, toggleLike] = useLike(detail.isLike, 'tourist', id)
@@ -66,7 +66,8 @@ export default withLayout((props) => {
66 66
   }
67 67
   const log = useRef('')
68 68
   const lat = useRef('')
69
-
69
+  const [queryParams, setQueryParams] = useState({ location: location, pageNum: 1, pageSize: 10, typeId: '',targetId:id  })
70
+  const [nloction,setNLoction]=useState()
70 71
 
71 72
   useEffect(() => {
72 73
     getTouristDetail(id).then((res) => {
@@ -81,9 +82,13 @@ export default withLayout((props) => {
81 82
       setAllextNum(res.total)
82 83
       setNewextNum(res.records.length)
83 84
     })
84
-    getRecommendList({ location: location }).then((res) => {
85
+    getRecommendList({ location: loc }).then((res) => {
85 86
       setRecommend(res || [])
86 87
     })
88
+    getResourceList(queryParams).then((res)=>{
89
+      console.log(queryParams)
90
+      console.log(res)
91
+    })
87 92
   }, [])
88 93
   
89 94
   // 分享
@@ -148,7 +153,7 @@ export default withLayout((props) => {
148 153
             <view className='title'>
149 154
               <image src={titlejd} />景点介绍
150 155
             </view>
151
-            {extend?.map((item) => <Extend item={item} />)}
156
+            {(extend||[]).map((item) => <Extend item={item} />)}
152 157
             <view className='showMore' style={{ display: newextNum == AllextNum ? 'none' : '' }} onClick={extendMore}>
153 158
               <view>点击查看更多</view>
154 159
               <image src={showMore} className='moreTip' />
@@ -158,7 +163,7 @@ export default withLayout((props) => {
158 163
             <view className='title'>
159 164
               <image src={titlems} />老板推荐好吃的
160 165
             </view>
161
-            {recommend?.map((item) => <Cards item={item} />)}
166
+            {(recommend||[]).map((item) => <Cards item={item} />)}
162 167
           </view>
163 168
           <view className='bottom'>已经到底了~</view>
164 169
         </scroll-view>

+ 1
- 1
src/pages/index/components/Card.js Ver fichero

@@ -16,7 +16,7 @@ export default (props) => {
16 16
   const Detail = () => {
17 17
     if (item.targetType == 'tourist') {
18 18
       let loc = item.lng + ',' + item.lat
19
-      Taro.navigateTo({ url: `/pages/details/mjDetails/sceneryDetails?id=${item.targetId}&distance=${(item.distance / 1000).toFixed(2)}&location=${loc}` });
19
+      Taro.navigateTo({ url: `/pages/details/mjDetails/sceneryDetails?id=${item.targetId}&distance=${(item.distance / 1000).toFixed(2)}&loc=${loc}` });
20 20
     }
21 21
     else {
22 22
       Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.targetId}` })

+ 2
- 2
src/pages/index/tabs/Guide.jsx Ver fichero

@@ -245,7 +245,7 @@ export default (props) => {
245 245
                   <image mode='scaleToFill' className='title-image-cup' src={BlackSpot} />
246 246
                   <text className='title-title-boss' >更多指引</text>
247 247
                 </view>
248
-                {extend?.map((item, index) => <MoreGuide key={(index)} item={item} />)}
248
+                {(extend||[]).map((item, index) => <MoreGuide key={(index)} item={item} />)}
249 249
 
250 250
                 <view className='showMore' style={{ display: newextNum == AllextNum ? 'none' : '' }} onClick={extendMore}>
251 251
                   <view>点击查看更多</view>
@@ -261,7 +261,7 @@ export default (props) => {
261 261
             <text className='title-title-boss' >老板推荐好吃的</text>
262 262
           </view>
263 263
         </view>
264
-        {spackage?.map((item, index) => <BossCard cardNavigateTo={cardNavigateTo} key={(index)} item={item} />)}
264
+        {(spackage||[]).map((item, index) => <BossCard cardNavigateTo={cardNavigateTo} key={(index)} item={item} />)}
265 265
         {/* 卡片------------- */}
266 266
         {/* <view className='Guide-Content-box-two'>
267 267
           <view className='title-image-two'>

+ 4
- 3
src/pages/index/tabs/Recommend.jsx Ver fichero

@@ -34,13 +34,14 @@ export default (props) => {
34 34
       setQueryParams({ location: location, pageNum: 1, pageSize: 10, typeId: '' })
35 35
     }
36 36
   }
37
-
38 37
   useEffect(() => {
39 38
     //查询分类标签表
40 39
     getIndexType({ pageSize: 20 }).then((res) => {
41 40
       setTypeList(res.records || [])
42
-    })    
41
+    })
43 42
   }, [])
43
+
44
+
44 45
   const onSearch = () => {
45 46
     // 用绝对路径
46 47
     Taro.navigateTo({ url: '/pages/search/search' });
@@ -75,7 +76,7 @@ export default (props) => {
75 76
       </view>
76 77
 
77 78
       <List
78
-        style={{ height: 'calc(100% - 160px)' }}
79
+        style={{ height: 'calc(100% - 145px)' }}
79 80
         request={getResourceList}
80 81
         params={queryParams}
81 82
         onDataChange={setAllList}

+ 1
- 1
src/pages/search/search.jsx Ver fichero

@@ -35,7 +35,7 @@ export default withLayout((props) => {
35 35
                 <view className='hotSearch'>热门搜索</view>
36 36
                 <view className='hotSearchtip'>
37 37
                     {
38
-                        hotList?.map((item) => <view onClick={()=>hotSearch(item.word)}>{item.word}</view>)
38
+                        (hotList||[]).map((item) => <view onClick={()=>hotSearch(item.word)}>{item.word}</view>)
39 39
                     }
40 40
                 </view>
41 41
             </view>

+ 19
- 20
src/pages/searchResult/searchResult.jsx Ver fichero

@@ -4,19 +4,20 @@ 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
+import List from '@/components/List';
8 9
 import './searchResult.less'
9 10
 import withLayout from '@/layouts'
10 11
 
11 12
 
12 13
 
13 14
 export default withLayout((props) => {
14
-  const { router, person,location } = props
15
-  const { q} = props.router.params
15
+  const { router, person, location } = props
16
+  const { q } = props.router.params
16 17
 
17 18
   // 横向tab
18 19
   const [activeTab, setActiveTab] = useState(0)
19
-  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: '' })
20 21
 
21 22
   // 获取资源表信息
22 23
   const [alllist, setAllList] = useState([])
@@ -35,13 +36,13 @@ export default withLayout((props) => {
35 36
     const { index } = e.detail
36 37
     setActiveTab(index)
37 38
     if (index == 0) {
38
-      setQueryParams({q:q, location: location, pageNum: 1, pageSize: 10, typeId: '' })
39
+      setQueryParams({ q: q, location: location, pageNum: 1, pageSize: 10, typeId: '' })
39 40
     }
40
-    else if(index==1){
41
-      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: '' })
42 43
     }
43
-    else{
44
-      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: '' })
45 46
     }
46 47
   }
47 48
 
@@ -52,11 +53,6 @@ export default withLayout((props) => {
52 53
     Taro.navigateTo({ url: '/pages/search/search' });
53 54
   }
54 55
 
55
-  useEffect(() => {
56
-    getResourceList(queryParams).then((res) => {
57
-      setAllList(res.records || [])
58
-    })
59
-  }, [queryParams])
60 56
 
61 57
 
62 58
 
@@ -82,15 +78,18 @@ export default withLayout((props) => {
82 78
           >
83 79
           </mp-tabs>
84 80
         </view>
85
-
86
-        <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{height:'100vh'}} >
87
-          <view className="waterfall">
81
+        <List
82
+          style={{ height: 'calc(100% - 90px)' }}
83
+          request={getResourceList}
84
+          params={queryParams}
85
+          onDataChange={setAllList}
86
+        >
87
+          <view className='waterfall'>
88 88
             {
89
-              alllist?.map((item) => <Card key={item.resourceNo} item={item} />)
89
+              alllist.map((item) => <Card key={item.resourceNo} item={item} />)
90 90
             }
91 91
           </view>
92
-          <view className='botton'>已经到底了~</view>
93
-        </scroll-view>
92
+        </List>
94 93
       </view>
95 94
     </view>
96 95
   )