吃个甘蔗嚼一年 3 years ago
parent
commit
012591232e
3 changed files with 103 additions and 121 deletions
  1. 1
    1
      config/dev.js
  2. 82
    93
      src/pages/index/tabs/Guide.jsx
  3. 20
    27
      src/pages/index/tabs/Recommend.jsx

+ 1
- 1
config/dev.js View File

4
   },
4
   },
5
   defineConstants: {
5
   defineConstants: {
6
     // HOST: '"http://192.168.89.147:8080"',
6
     // HOST: '"http://192.168.89.147:8080"',
7
-    HOST: '"https://sgl-v2.njyunzhi.com"',
7
+    HOST: '"https://sgl-v2-test.njyunzhi.com"',
8
   },
8
   },
9
   mini: {},
9
   mini: {},
10
   h5: {}
10
   h5: {}

+ 82
- 93
src/pages/index/tabs/Guide.jsx View File

34
   const trackClick = useTrackClick(router)
34
   const trackClick = useTrackClick(router)
35
 
35
 
36
   const [taRoomContent, setTaRoomContent] = useState([])
36
   const [taRoomContent, setTaRoomContent] = useState([])
37
-  const RoomLocation = taRoomContent?.location
38
   //没有停车 wifi的就不显示按钮
37
   //没有停车 wifi的就不显示按钮
39
   const [wifiButtonStyle, setWifiButtonStyle] = useState('')
38
   const [wifiButtonStyle, setWifiButtonStyle] = useState('')
40
   const [parkingButtonStyle, setParkingButtonStyle] = useState('')
39
   const [parkingButtonStyle, setParkingButtonStyle] = useState('')
41
   const [guideStyle, setGuideStyle] = useState('')
40
   const [guideStyle, setGuideStyle] = useState('')
42
-  const parkingGps = taRoomContent?.parkingLocation
43
-  const roomGps = taRoomContent?.location
41
+  const parkingGps = taRoomContent.parkingLocation || []
42
+  const roomGps = taRoomContent.location || []
44
 
43
 
45
 
44
 
46
 
45
 
82
       setLoading(true)
81
       setLoading(true)
83
       // 点击’去这里‘跳转导航
82
       // 点击’去这里‘跳转导航
84
       getTaRoom(roomId).then((res) => {
83
       getTaRoom(roomId).then((res) => {
85
-        // Roomlog.current = (!res.location).toString().split(',')[0]
86
-        // Roomlat.current = (!res.location).toString().split(',')[1]
87
-        // Parklog.current = (!res.parkingLocation).toString().split(',')[0]
88
-        // Parklat.current = (!res.parkingLocation).toString().split(',')[1]
89
         setTaRoomContent(res || [])
84
         setTaRoomContent(res || [])
90
         setLoading(false)
85
         setLoading(false)
91
       })
86
       })
92
       //更多指引
87
       //更多指引
93
       geiZy()
88
       geiZy()
94
-
95
-      getRecommendList({ location: location }).then((res) => {
89
+      getRecommendList({ location: roomGps }).then((res) => {
96
         setPackage(res || [])
90
         setPackage(res || [])
97
         setLoading(false)
91
         setLoading(false)
98
-
99
       })
92
       })
100
-      // setLoading(false)
101
-
102
     } else {
93
     } else {
103
       setLoading(true)
94
       setLoading(true)
104
-
105
       getRecommendList({ location: location }).then((res) => {
95
       getRecommendList({ location: location }).then((res) => {
106
         setPackage(res || [])
96
         setPackage(res || [])
107
         setLoading(false)
97
         setLoading(false)
115
     if (taRoomContent?.parkingAddress === "") {
105
     if (taRoomContent?.parkingAddress === "") {
116
       setParkingButtonStyle('none')
106
       setParkingButtonStyle('none')
117
     }
107
     }
118
-  }, [roomId, RoomLocation, taRoomContent?.wifiPassword, taRoomContent?.parkingAddress, location])
108
+  }, [roomId, roomGps, taRoomContent?.wifiPassword, taRoomContent?.parkingAddress, location])
119
 
109
 
120
 
110
 
121
   const goRoomMap = () => {
111
   const goRoomMap = () => {
161
 
151
 
162
   return (
152
   return (
163
     <scroll-view scrollY style={{ height: '100%' }}  >
153
     <scroll-view scrollY style={{ height: '100%' }}  >
164
-        <view className='Guide-Home-box'>
165
-          {
166
-            ifroomId === 'havenot' && (
167
-              <view className='Guide-image-text-box'>
168
-                <image className='Guide-images' src={sleep} />
169
-                <view className='Guide-text'>您还没有入住订单哟~</view>
170
-              </view>
171
-            )
172
-          }
173
-          {/* 有民宿的情况下 */}
174
-          {
175
-            ifroomId === 'reality' && (
176
-              <SpinBox loading={loading}>
177
-                <view className='room-box-info-ROOM'>
178
-                  <view className='room-bi-name-ROOM' >
179
-                    <view className='room-bin-title-ROOM'>房屋名称</view>
180
-                    <view className='room-bint-nameInfo-ROOM'>{taRoomContent?.roomName}
181
-                    </view>
154
+      <view className='Guide-Home-box'>
155
+        {
156
+          ifroomId === 'havenot' && (
157
+            <view className='Guide-image-text-box'>
158
+              <image className='Guide-images' src={sleep} />
159
+              <view className='Guide-text'>您还没有入住订单哟~</view>
160
+            </view>
161
+          )
162
+        }
163
+        {/* 有民宿的情况下 */}
164
+        {
165
+          ifroomId === 'reality' && (
166
+            <SpinBox loading={loading}>
167
+              <view className='room-box-info-ROOM'>
168
+                <view className='room-bi-name-ROOM' >
169
+                  <view className='room-bin-title-ROOM'>房屋名称</view>
170
+                  <view className='room-bint-nameInfo-ROOM'>{taRoomContent?.roomName}
182
                   </view>
171
                   </view>
183
                 </view>
172
                 </view>
184
-                {/* --------房屋位置-------- */}
185
-                {
186
-                  !roomGps ? <view></view>
187
-                    :
188
-                    <view className='room-box-info-HouLocation'>
189
-                      <view className='room-bi-name-HouLocation' >
190
-                        <view className='room-bin-title-HouLocation'>房屋位置</view>
191
-                        <view className='room-bint-nameInfo-HouLocation'>
192
-                          <view className='room-bint-nameInfo-bool-HouLocation' >{taRoomContent?.address}</view>
193
-                          <view className='room-bintn-button-HouLocation' onClick={() => { goRoomMap() }} style={{ display: wifiButtonStyle }}>
194
-                            <image className='room-bintn-image-HouLocation' src={GPS} />
195
-                            <text className='room-bintn-text-HouLocation'>去这里</text>
196
-                          </view>
173
+              </view>
174
+              {/* --------房屋位置-------- */}
175
+              {
176
+                !roomGps ? <view></view>
177
+                  :
178
+                  <view className='room-box-info-HouLocation'>
179
+                    <view className='room-bi-name-HouLocation' >
180
+                      <view className='room-bin-title-HouLocation'>房屋位置</view>
181
+                      <view className='room-bint-nameInfo-HouLocation'>
182
+                        <view className='room-bint-nameInfo-bool-HouLocation' >{taRoomContent?.address}</view>
183
+                        <view className='room-bintn-button-HouLocation' onClick={() => { goRoomMap() }} style={{ display: wifiButtonStyle }}>
184
+                          <image className='room-bintn-image-HouLocation' src={GPS} />
185
+                          <text className='room-bintn-text-HouLocation'>去这里</text>
197
                         </view>
186
                         </view>
198
                       </view>
187
                       </view>
199
                     </view>
188
                     </view>
189
+                  </view>
200
 
190
 
201
-                }
202
-
203
-
204
-                {/* --------停车场-------- */}
205
-                {
206
-                  !parkingGps ? <view></view>
207
-                    :
208
-                    <view className='room-box-info-Parking'>
209
-                      <view className='room-bi-name-Parking' >
210
-                        <view className='room-bin-title-Parking'>停车位置</view>
211
-                        <view className='room-bint-nameInfo-Parking'>
212
-                          <view className='room-bint-nameInfo-bool-Parking' >{taRoomContent?.parkingAddress}</view>
213
-                          <view className='room-bintn-button-Parking' onClick={() => { goParkMap() }} style={{ display: wifiButtonStyle }}>
214
-                            <image className='room-bintn-image-Parking' src={GPS} />
215
-                            <text className='room-bintn-text-Parking'>去这里</text>
216
-                          </view>
191
+              }
192
+
193
+
194
+              {/* --------停车场-------- */}
195
+              {
196
+                !parkingGps ? <view></view>
197
+                  :
198
+                  <view className='room-box-info-Parking'>
199
+                    <view className='room-bi-name-Parking' >
200
+                      <view className='room-bin-title-Parking'>停车位置</view>
201
+                      <view className='room-bint-nameInfo-Parking'>
202
+                        <view className='room-bint-nameInfo-bool-Parking' >{taRoomContent?.parkingAddress}</view>
203
+                        <view className='room-bintn-button-Parking' onClick={() => { goParkMap() }} style={{ display: wifiButtonStyle }}>
204
+                          <image className='room-bintn-image-Parking' src={GPS} />
205
+                          <text className='room-bintn-text-Parking'>去这里</text>
217
                         </view>
206
                         </view>
218
                       </view>
207
                       </view>
219
                     </view>
208
                     </view>
209
+                  </view>
220
 
210
 
221
-                }
211
+              }
222
 
212
 
223
 
213
 
224
-                {/* --------无线网-------- */}
225
-                <view className='room-box-info-WIFIContent'>
226
-                  <view className='room-bi-name-WIFIContent' >
227
-                    <view className='room-bin-title-WIFIContent'>WiFi信息</view>
228
-                    <view className='room-bint-nameInfo-WIFIContent'>
229
-                      <view className='room-bint-nameInfo-bool-WIFIContent-wifi' >名称:{taRoomContent?.wifiName}</view>
230
-                      <view className='room-bint-nameInfo-bool-WIFIContent-password' >密码:{taRoomContent?.wifiPassword}</view>
231
-                      <view className='room-bintn-button-WIFIContent' onClick={() => { wifiCopy() }} style={{ display: wifiButtonStyle }}>
232
-                        <image className='room-bintn-image-WIFIContent' src={copy_logo} />
233
-                        <text className='room-bintn-text-WIFIContent'>复制</text>
234
-                      </view>
214
+              {/* --------无线网-------- */}
215
+              <view className='room-box-info-WIFIContent'>
216
+                <view className='room-bi-name-WIFIContent' >
217
+                  <view className='room-bin-title-WIFIContent'>WiFi信息</view>
218
+                  <view className='room-bint-nameInfo-WIFIContent'>
219
+                    <view className='room-bint-nameInfo-bool-WIFIContent-wifi' >名称:{taRoomContent?.wifiName}</view>
220
+                    <view className='room-bint-nameInfo-bool-WIFIContent-password' >密码:{taRoomContent?.wifiPassword}</view>
221
+                    <view className='room-bintn-button-WIFIContent' onClick={() => { wifiCopy() }} style={{ display: wifiButtonStyle }}>
222
+                      <image className='room-bintn-image-WIFIContent' src={copy_logo} />
223
+                      <text className='room-bintn-text-WIFIContent'>复制</text>
235
                     </view>
224
                     </view>
236
                   </view>
225
                   </view>
237
                 </view>
226
                 </view>
227
+              </view>
238
 
228
 
239
-                <view className='Guide-Content-box'  >
240
-                  <view className='title-image' style={{ display: guideStyle }} >
241
-                    <image mode='scaleToFill' className='title-image-cup' src={BlackSpot} />
242
-                    <text className='title-title-boss' >更多指引</text>
243
-                  </view>
244
-                  <view style={{ padding: '0 30rpx', boxSizing: 'border-box' }}>
245
-                    {(extend || []).map((item, index) => <MoreGuide key={(index)} item={item} />)}
246
-                  </view>
229
+              <view className='Guide-Content-box'  >
230
+                <view className='title-image' style={{ display: guideStyle }} >
231
+                  <image mode='scaleToFill' className='title-image-cup' src={BlackSpot} />
232
+                  <text className='title-title-boss' >更多指引</text>
247
                 </view>
233
                 </view>
248
-              </SpinBox>
249
-            )
250
-          }
251
-          <view className='Guide-Content-box'>
252
-            <view className='title-image'>
253
-              <image mode='scaleToFill' className='title-image-cup' src={Cup} />
254
-              <text className='title-title-boss' >老板推荐好吃的</text>
255
-            </view>
256
-          </view>
257
-          <view style={{ marginTop: '10rpx', marginBottom: '60rpx' }}>
258
-            {(spackage || []).map((item, index) => <BossCard det={item} st={parseFloat(item.score.toFixed(1))} key={(index)} trackClick={trackClick} taRoomContent={taRoomContent} item={item} />)}
234
+                <view style={{ padding: '0 30rpx', boxSizing: 'border-box' }}>
235
+                  {(extend || []).map((item, index) => <MoreGuide key={(index)} item={item} />)}
236
+                </view>
237
+              </view>
238
+            </SpinBox>
239
+          )
240
+        }
241
+        <view className='Guide-Content-box'>
242
+          <view className='title-image'>
243
+            <image mode='scaleToFill' className='title-image-cup' src={Cup} />
244
+            <text className='title-title-boss' >老板推荐好吃的</text>
259
           </view>
245
           </view>
260
-
261
         </view>
246
         </view>
247
+        <view style={{ marginTop: '10rpx', marginBottom: '60rpx' }}>
248
+          {(spackage || []).map((item, index) => <BossCard det={item} st={parseFloat(item.score.toFixed(1))} key={(index)} trackClick={trackClick} taRoomContent={taRoomContent} item={item} />)}
249
+        </view>
250
+      </view>
262
     </scroll-view>
251
     </scroll-view>
263
   )
252
   )
264
 }
253
 }

+ 20
- 27
src/pages/index/tabs/Recommend.jsx View File

27
   // 获取资源表信息
27
   // 获取资源表信息
28
   // const [alllist, setAllList] = useState([])
28
   // const [alllist, setAllList] = useState([])
29
   const [listData, setListData] = useState({ list: [], rfTimes: 0 })
29
   const [listData, setListData] = useState({ list: [], rfTimes: 0 })
30
+  const { isSaved } = listData
31
+
30
 
32
 
31
   //分类标签
33
   //分类标签
32
   const tabs = [{ title: '附近' }].concat(typeList.map(x => ({ ...x, title: x.typeName })))
34
   const tabs = [{ title: '附近' }].concat(typeList.map(x => ({ ...x, title: x.typeName })))
55
     setListData({ list: value, rfTimes: rfTimes.current })
57
     setListData({ list: value, rfTimes: rfTimes.current })
56
   }
58
   }
57
 
59
 
60
+
58
   useEffect(() => {
61
   useEffect(() => {
59
     //查询分类标签表
62
     //查询分类标签表
60
     getIndexType({ pageSize: 20 }).then((res) => {
63
     getIndexType({ pageSize: 20 }).then((res) => {
66
     // 用绝对路径
69
     // 用绝对路径
67
     Taro.navigateTo({ url: '/pages/search/search' });
70
     Taro.navigateTo({ url: '/pages/search/search' });
68
   }
71
   }
69
-  // // 联动收藏
70
-  // const likeLook = () => {
71
-  //   getResourceList().then(e => {
72
-  //     setAllList(e.records)
73
-  //   })
74
-
75
-  // }
76
 
72
 
77
-  // useDidShow(() => {
78
-  //   likeLook()
79
-  // })
80
 
73
 
81
   return (
74
   return (
82
     // <view style={{ height: '100%', overflow: 'hidden',display:'flex',flexDirection:'column' }}>
75
     // <view style={{ height: '100%', overflow: 'hidden',display:'flex',flexDirection:'column' }}>
107
         </scroll-view>
100
         </scroll-view>
108
       </view>
101
       </view>
109
       {/* <View style={{ flex:'auto' }}> */}
102
       {/* <View style={{ flex:'auto' }}> */}
110
-        <List
111
-          ref={listRef}
112
-          style={listStyle}
113
-          request={getResourceList}
114
-          params={queryParams}
115
-          onDataChange={handleDataChange}
116
-        >
117
-          <view style={{ padding: '30rpx 15rpx' }}>
118
-            <MasonryLayout
119
-              itemKey='resourceNo'
120
-              listData={listData}
121
-              render={(item, callback) => <Card item={item} onImageLoad={callback} />}
122
-            />
123
-          </view>
124
-
125
-          {/* {
103
+      <List
104
+        ref={listRef}
105
+        style={listStyle}
106
+        request={getResourceList}
107
+        params={queryParams}
108
+        onDataChange={handleDataChange}
109
+      >
110
+        <view style={{ padding: '30rpx 15rpx' }}>
111
+          <MasonryLayout
112
+            itemKey='resourceNo'
113
+            listData={listData}
114
+            render={(item, callback) => <Card item={item} onImageLoad={callback} />}
115
+          />
116
+        </view>
117
+
118
+        {/* {
126
             alllist.length == 0 ?
119
             alllist.length == 0 ?
127
               <NoData /> :
120
               <NoData /> :
128
               <view className='waterfall'>
121
               <view className='waterfall'>
131
                 }
124
                 }
132
               </view>
125
               </view>
133
           } */}
126
           } */}
134
-        </List>
127
+      </List>
135
       {/* </View> */}
128
       {/* </View> */}
136
     </view>
129
     </view>
137
   )
130
   )