Quellcode durchsuchen

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

李志伟 vor 3 Jahren
Ursprung
Commit
68e64b2526

+ 12
- 0
src/app.less Datei anzeigen

@@ -35,3 +35,15 @@
35 35
     }
36 36
   }
37 37
 }
38
+
39
+.purebtn {
40
+  margin: 0;
41
+  padding: 0;
42
+  background: transparent;
43
+  border: none;
44
+  outline: none;
45
+
46
+  &::after {
47
+    border: none;
48
+  }
49
+}

+ 0
- 1
src/components/CompoentsOrder/complete/index.jsx Datei anzeigen

@@ -84,7 +84,6 @@ export default (props) => {
84 84
     // 触发页面刷新
85 85
     setNumber({ pageNum: 1 })
86 86
     setShowCutover(false)
87
-    console.log('------------------handleFinishEvaluate------------------------------');
88 87
   }
89 88
 
90 89
   return (

+ 14
- 0
src/components/HorTabbar/TabIcon.jsx Datei anzeigen

@@ -0,0 +1,14 @@
1
+import React from 'react'
2
+import { View, Image, Text } from '@tarojs/components'
3
+import './style.less'
4
+
5
+export default (props) => {
6
+  const { icon, text, onClick } = props
7
+
8
+  return (
9
+    <View className='htab-icon' onClick={onClick}>
10
+      <Image src={icon} />
11
+      <Text>{text}</Text>
12
+    </View>
13
+  )
14
+}

+ 0
- 0
src/components/HorTabbar/index.jsx Datei anzeigen


+ 20
- 0
src/components/HorTabbar/style.less Datei anzeigen

@@ -0,0 +1,20 @@
1
+
2
+.htab-icon {
3
+  height: 88px;
4
+
5
+  & > image {
6
+    width: 32px;
7
+    height: 32px;
8
+    display: inline-block;
9
+    vertical-align: middle;
10
+    margin-right: 12px;
11
+  }
12
+
13
+  & > text {
14
+    font-size: 28px;
15
+    font-weight: bold;
16
+    color: #202020;
17
+    line-height: 88px;
18
+    vertical-align: middle;
19
+  }
20
+}

+ 9
- 0
src/components/MasonryLayout/hooks.js Datei anzeigen

@@ -0,0 +1,9 @@
1
+import { useRef, useState } from "react";
2
+
3
+export function useList() {
4
+  const [lst, setList] = useState([])
5
+  const lstRef = useRef(lst)
6
+  lstRef.current = lst
7
+
8
+  return [lst, lstRef, setList]
9
+}

+ 101
- 0
src/components/MasonryLayout/index.jsx Datei anzeigen

@@ -0,0 +1,101 @@
1
+import React, { useEffect, useMemo, useRef, useState } from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View } from '@tarojs/components';
4
+import { useList } from './hooks';
5
+import { classNames, getRect } from './utils';
6
+
7
+export default (props) => {
8
+  const { className, itemClassName, style, gutter = 0, list = [], render, ...leftProps } = props
9
+
10
+  const leftBottom = useRef(0)
11
+  const rightBottom = useRef(0)
12
+  const [leftList, leftRef, setLeftList] = useList()
13
+  const [rightList, rightRef, setRightList] = useList()
14
+  const vidRef = useRef()
15
+  const [cursor, setCursor] = useState(-1)
16
+
17
+  const listRef = useRef([])
18
+  listRef.current = list
19
+    
20
+  useEffect(() => {
21
+    if (list && list.length) {
22
+      setCursor(0)
23
+      setLeftList([])
24
+      setRightList([])
25
+      console.log('----------useEffect--------')
26
+    } else {
27
+      setCursor(-1)
28
+    }
29
+  }, [list])
30
+
31
+  useEffect(() => {
32
+    const len = !listRef.current ? 0 : listRef.current.length;
33
+
34
+    if (!len || cursor >= len) return;
35
+
36
+    const item = listRef.current[cursor] || {}
37
+    item.__vid = `f-${Math.random().toString(36).substring(2)}`
38
+    vidRef.current = item.__vid
39
+
40
+    console.log('----------leftRef.current--------', leftRef.current, rightRef.current)
41
+
42
+    if (leftBottom.current <= rightBottom.current) {
43
+      setLeftList([...leftRef.current, item])
44
+    } else {
45
+      setRightList([...rightRef.current, item])
46
+    }
47
+  }, [cursor])
48
+
49
+  
50
+  console.log('---------dddddddd------', vidRef.current, leftRef.current.length, leftList)
51
+
52
+  useEffect(() => {
53
+    const setHeight = (rect) => {
54
+      console.log('---------rect------', rect)
55
+      const { bottom } = rect
56
+      if (cursor % 2 === 0) {
57
+        leftBottom.current = bottom
58
+      } else {
59
+        rightBottom.current = bottom
60
+      }
61
+      setCursor(cursor + 1)
62
+    }
63
+
64
+    const calcHeight = () => {
65
+      getRect(`.${vidRef.current}`).then((res) => {
66
+        if (!res || !res.length) {
67
+          const t = setTimeout(() => {
68
+            clearTimeout(t)
69
+            calcHeight()
70
+          }, 300)
71
+        } else {
72
+          setHeight(res[0])
73
+        }
74
+      })
75
+    }
76
+
77
+    calcHeight()
78
+  })
79
+
80
+  return (
81
+    <View
82
+      className={classNames(className, 'masonry-layout')}
83
+      style={style}
84
+    >
85
+      <View className='masonry-column'>
86
+        {
87
+          leftList.map((item) => (
88
+            <View key={item.__vid} className={classNames(itemClassName, 'masonry-item', item.__vid)}>{render(item)}</View>
89
+          ))
90
+        }
91
+      </View>
92
+      <View className='masonry-column'>
93
+        {
94
+          rightList.map((item) => (
95
+            <View key={item.__vid} className={classNames(itemClassName, 'masonry-item', item.__vid)}>{render(item)}</View>
96
+          ))
97
+        }
98
+      </View>
99
+    </View>
100
+  )
101
+}

+ 15
- 0
src/components/MasonryLayout/style.less Datei anzeigen

@@ -0,0 +1,15 @@
1
+
2
+.masonry-layout {
3
+  box-sizing: border-box;
4
+  width: 100%;
5
+  display: flex;
6
+
7
+  .masonry-column {
8
+    flex: 1;
9
+  }
10
+
11
+  .masonry-item {
12
+    width: 100%;
13
+    overflow-x: hidden;
14
+  }
15
+}

+ 13
- 0
src/components/MasonryLayout/utils.js Datei anzeigen

@@ -0,0 +1,13 @@
1
+import Taro from '@tarojs/taro';
2
+
3
+export function classNames(...args) {
4
+  return args.filter(Boolean).join(' ')
5
+}
6
+
7
+export function getRect(selector) {
8
+  return new Promise((resolve) => {
9
+    Taro.nextTick(() => {
10
+      Taro.createSelectorQuery().select(selector).boundingClientRect(rect => resolve(rect)).exec()
11
+    })
12
+  })
13
+}

+ 6
- 6
src/pages/PayOrder/index.jsx Datei anzeigen

@@ -27,8 +27,6 @@ export default withLayout((props) => {
27 27
   const [BuyNumber, setBuyNumber] = useState(1);
28 28
   const [detail, setDetail] = useState({});
29 29
   const [showDialog, setShowDialog] = useState(false);
30
-  // 监控金额变化
31
-  const preActPrice = usePrevious(totalPrice?.actualPrice || 0)
32 30
 
33 31
   const ShowMoldeOn = (e) => {
34 32
     if (packageId) {
@@ -81,19 +79,21 @@ export default withLayout((props) => {
81 79
           icon: "none",
82 80
           duration: 2000,
83 81
         });
82
+        // 跳转到待支付
83
+        Taro.navigateTo({
84
+          url: `/pages/MineUserAll/AllOrder/index?tabJump=1`
85
+        })
84 86
       },
85 87
     });
86 88
   };
87 89
 
88 90
   const onShowPay = (e) => {
89 91
     if (agreement) {
90
-      const actPrice = totalPrice?.actualPrice || 0
91
-      const isOrderChanged = actPrice !== preActPrice
92
-
93
-      if (payInfo && !isOrderChanged) {
92
+      if (payInfo) {
94 93
         requestPayment(payInfo);
95 94
         return;
96 95
       }
96
+
97 97
       Taro.showLoading({
98 98
         title: '支付中',
99 99
       })

+ 8
- 13
src/pages/details/foodDetails/foodDetails.jsx Datei anzeigen

@@ -13,6 +13,7 @@ import Star from "@/components/Star/Star.jsx";
13 13
 import NoData from '@/components/NoData'
14 14
 import Cards from "@/components/foodCards/foodCards.jsx";
15 15
 import SpinBox from "@/components/Spin/SpinBox";
16
+import TabIcon from "@/components/HorTabbar/TabIcon";
16 17
 import ax from "@/assets/icons/housemantj/onlove.png";
17 18
 import yysj from "@/assets/icons/housemantj/openTime.png";
18 19
 import dw from "@/assets/icons/housemantj/loc.png";
@@ -272,21 +273,15 @@ export default withLayout((props) => {
272 273
           }
273 274
         </scroll-view>
274 275
       </SpinBox>
275
-      <view className='index-tabber bottomTab'>
276
-        <Button openType='share' className='sharebtn'>
277
-          分享
278
-        </Button>
279
-        <view className='tab'>
280
-          <image className='share' src={share} />
281
-          分享
276
+      <view className='index-tabber weui-tabbar' style={{ background: '#fff' }}>
277
+        <view className='weui-tabbar__item'>
278
+          <Button openType='share' className='purebtn'><TabIcon icon={share} text='分享' /></Button>
282 279
         </view>
283
-        <view className='tab' onClick={toggleLike}>
284
-          <image className='good' style={{ top: '1px' }} src={isLike > 0 ? baozan : weibaozan} />
285
-          {isLike > 0 ? "已爆赞" : "爆赞"}
280
+        <view className='weui-tabbar__item' onClick={toggleLike}>
281
+          <TabIcon icon={isLike > 0 ? baozan : weibaozan} text={isLike > 0 ? "已爆赞" : "爆赞"} />
286 282
         </view>
287
-        <view className='tab' onClick={toggleSave}>
288
-          <image className='collection' src={isSaved > 0 ? ax : good} />
289
-          {isSaved > 0 ? "已收藏" : "加入收藏"}
283
+        <view className='weui-tabbar__item' onClick={toggleSave}>
284
+          <TabIcon icon={isSaved > 0 ? ax : good} text={isSaved > 0 ? "已收藏" : "加入收藏"} />
290 285
         </view>
291 286
       </view>
292 287
     </view>

+ 1
- 30
src/pages/details/foodDetails/foodDetails.less Datei anzeigen

@@ -181,33 +181,4 @@
181 181
   text-align: center;
182 182
   padding: 40px 0 68px 0;
183 183
   background-color: #f8f8f8;
184
-}
185
-.bottomTab {
186
-  background: #fff;
187
-  border-radius: 12px;
188
-  column-count: 3;
189
-  text-align: center;
190
-  height: 23vw;
191
-
192
-  .sharebtn {
193
-    position: absolute;
194
-    width: 260px;
195
-    opacity: 0;
196
-    bottom: 15px;
197
-  }
198
-  .tab {
199
-    line-height: 96px;
200
-    font-size: 28px;
201
-    font-weight: bold;
202
-    color: #202020;
203
-    position: relative;
204
-    top: 15px;
205
-    image {
206
-      width: 31px;
207
-      height: 31px;
208
-      position: relative;
209
-      top: 7px;
210
-      margin-right: 12px;
211
-    }
212
-  }
213
-}
184
+}

+ 9
- 8
src/pages/details/mjDetails/sceneryDetails.jsx Datei anzeigen

@@ -11,6 +11,7 @@ import weibaozan from '@/assets/icons/housemantj/unLike.png'
11 11
 import zhuandao from "@/assets/icons/housemantj/backTop.png";
12 12
 import withLayout from '@/layouts'
13 13
 import SpinBox from "@/components/Spin/SpinBox";
14
+import TabIcon from '@/components/HorTabbar/TabIcon'
14 15
 import { useState, useEffect } from 'react'
15 16
 import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'
16 17
 import { Swiper, SwiperItem, Button } from '@tarojs/components';
@@ -176,16 +177,16 @@ export default withLayout((props) => {
176 177
           <view className='bottom'>这是我的底线</view>
177 178
         </scroll-view>
178 179
       </SpinBox>
179
-      <view className='index-tabber bottomTab'>
180
-        <Button openType='share' className='sharebtn'>分享</Button>
181
-        <view className='tab'>
182
-          <image className='share' src={share} />分享
180
+      
181
+      <view className='index-tabber weui-tabbar' style={{ background: '#fff' }}>
182
+        <view className='weui-tabbar__item'>
183
+          <Button openType='share' className='purebtn'><TabIcon icon={share} text='分享' /></Button>
183 184
         </view>
184
-        <view className='tab' onClick={toggleLike}>
185
-          <image className='good' style={{ top: '1px' }} src={isLike > 0 ? baozan : weibaozan} />{isLike > 0 ? '已爆赞' : '爆赞'}
185
+        <view className='weui-tabbar__item' onClick={toggleLike}>
186
+          <TabIcon icon={isLike > 0 ? baozan : weibaozan} text={isLike > 0 ? "已爆赞" : "爆赞"} />
186 187
         </view>
187
-        <view className='tab' onClick={toggleSave}>
188
-          <image className='collection' src={isSaved > 0 ? ax : good} />{isSaved > 0 ? '已收藏' : '加入收藏'}
188
+        <view className='weui-tabbar__item' onClick={toggleSave}>
189
+          <TabIcon icon={isSaved > 0 ? ax : good} text={isSaved > 0 ? "已收藏" : "加入收藏"} />
189 190
         </view>
190 191
       </view>
191 192
     </view>

+ 0
- 30
src/pages/details/mjDetails/sceneryDetails.less Datei anzeigen

@@ -148,33 +148,3 @@
148 148
   padding: 40px 0 60px 0;
149 149
   background-color: #f8f8f8;
150 150
 }
151
-
152
-.bottomTab {
153
-  background: #fff;
154
-  border-radius: 12px;
155
-  column-count: 3;
156
-  text-align: center;
157
-  height: 23vw;
158
-
159
-  .sharebtn {
160
-    position: absolute;
161
-    width: 260px;
162
-    opacity: 0;
163
-    bottom: 15px;
164
-  }
165
-  .tab {
166
-    line-height: 96px;
167
-    font-size: 28px;
168
-    font-weight: bold;
169
-    color: #202020;
170
-    position: relative;
171
-    top: 15px;
172
-    image {
173
-      width: 31px;
174
-      height: 31px;
175
-      position: relative;
176
-      top: 7px;
177
-      margin-right: 12px;
178
-    }
179
-  }
180
-}

+ 35
- 23
src/pages/index/tabs/Guide.jsx Datei anzeigen

@@ -107,7 +107,8 @@ export default (props) => {
107 107
     }
108 108
   })
109 109
 
110
-
110
+  const parkingGps = taRoomContent?.parkingLocation
111
+  const roomGps = taRoomContent?.location
111 112
   useEffect(() => {
112 113
 
113 114
     if (roomId) {
@@ -208,33 +209,44 @@ export default (props) => {
208 209
                 </view>
209 210
               </view>
210 211
               {/* --------房屋位置-------- */}
211
-
212
-              <view className='room-box-info-HouLocation'>
213
-                <view className='room-bi-name-HouLocation' >
214
-                  <view className='room-bin-title-HouLocation'>房屋位置</view>
215
-                  <view className='room-bint-nameInfo-HouLocation'>
216
-                    <view className='room-bint-nameInfo-bool-HouLocation' >{taRoomContent?.address}</view>
217
-                    <view className='room-bintn-button-HouLocation' onClick={() => { goRoomMap() }} style={{ display: wifiButtonStyle }}>
218
-                      <image className='room-bintn-image-HouLocation' src={GPS} />
219
-                      <text className='room-bintn-text-HouLocation'>去这里</text>
212
+              {
213
+                !roomGps ? <view></view>
214
+                  :
215
+                  <view className='room-box-info-HouLocation'>
216
+                    <view className='room-bi-name-HouLocation' >
217
+                      <view className='room-bin-title-HouLocation'>房屋位置</view>
218
+                      <view className='room-bint-nameInfo-HouLocation'>
219
+                        <view className='room-bint-nameInfo-bool-HouLocation' >{taRoomContent?.address}</view>
220
+                        <view className='room-bintn-button-HouLocation' onClick={() => { goRoomMap() }} style={{ display: wifiButtonStyle }}>
221
+                          <image className='room-bintn-image-HouLocation' src={GPS} />
222
+                          <text className='room-bintn-text-HouLocation'>去这里</text>
223
+                        </view>
224
+                      </view>
220 225
                     </view>
221 226
                   </view>
222
-                </view>
223
-              </view>
224
-              {/* --------停车场-------- */}
225 227
 
226
-              <view className='room-box-info-Parking'>
227
-                <view className='room-bi-name-Parking' >
228
-                  <view className='room-bin-title-Parking'>停车位置</view>
229
-                  <view className='room-bint-nameInfo-Parking'>
230
-                    <view className='room-bint-nameInfo-bool-Parking' >{taRoomContent?.parkingAddress}</view>
231
-                    <view className='room-bintn-button-Parking' onClick={() => { goParkMap() }} style={{ display: wifiButtonStyle }}>
232
-                      <image className='room-bintn-image-Parking' src={GPS} />
233
-                      <text className='room-bintn-text-Parking'>去这里</text>
228
+              }
229
+
230
+
231
+              {/* --------停车场-------- */}
232
+              {
233
+                !parkingGps ? <view></view>
234
+                  :
235
+                  <view className='room-box-info-Parking'>
236
+                    <view className='room-bi-name-Parking' >
237
+                      <view className='room-bin-title-Parking'>停车位置</view>
238
+                      <view className='room-bint-nameInfo-Parking'>
239
+                        <view className='room-bint-nameInfo-bool-Parking' >{taRoomContent?.parkingAddress}</view>
240
+                        <view className='room-bintn-button-Parking' onClick={() => { goParkMap() }} style={{ display: wifiButtonStyle }}>
241
+                          <image className='room-bintn-image-Parking' src={GPS} />
242
+                          <text className='room-bintn-text-Parking'>去这里</text>
243
+                        </view>
244
+                      </view>
234 245
                     </view>
235 246
                   </view>
236
-                </view>
237
-              </view>
247
+
248
+              }
249
+
238 250
 
239 251
               {/* --------无线网-------- */}
240 252
               <view className='room-box-info-WIFIContent'>

+ 8
- 2
src/pages/index/tabs/Recommend.jsx Datei anzeigen

@@ -1,13 +1,14 @@
1 1
 import Taro, { useDidShow } from '@tarojs/taro'
2 2
 import { React, useState, useEffect, useRef } from 'react'
3
+import { View } from '@tarojs/components';
3 4
 import iconsearch from '@/assets/icons/housemantj/search.png'
4 5
 import locationimg from '@/assets/icons/housemantj/location.png'
5 6
 import Tip from '@/components/tip'
6 7
 import List from '@/components/List';
8
+import NoData from '@/components/NoData'
9
+import MasonryLayout from '@/components/MasonryLayout';
7 10
 import { getIndexType, getResourceList } from '@/services/home'
8
-import { View } from '@tarojs/components';
9 11
 import Card from '../components/Card'
10
-import NoData from '@/components/NoData'
11 12
 import './less/Recommend.less'
12 13
 
13 14
 
@@ -107,6 +108,11 @@ export default (props) => {
107 108
         params={queryParams}
108 109
         onDataChange={setAllList}
109 110
       >
111
+        {/* <MasonryLayout
112
+          list={alllist}
113
+          render={item => <Card item={item} />}
114
+        /> */}
115
+
110 116
         {
111 117
           alllist.length == 0 ?
112 118
             <NoData /> :