[baozhangchao] 3 年之前
父節點
當前提交
2e7d54a83b

+ 3
- 3
src/components/BottomMoadl/index.jsx 查看文件

3
 import WeChatPay from '@/assets/BottomMoadlImags/WeChatPay.png'
3
 import WeChatPay from '@/assets/BottomMoadlImags/WeChatPay.png'
4
 import Alipay from '@/assets/BottomMoadlImags/Alipay.png'
4
 import Alipay from '@/assets/BottomMoadlImags/Alipay.png'
5
 import userRight from '@/assets/mineImgaes/userRight.png'
5
 import userRight from '@/assets/mineImgaes/userRight.png'
6
-
6
+import withLayout from '@/layouts'
7
 import './style.css'
7
 import './style.css'
8
 
8
 
9
 
9
 
10
-export default (props) => {
10
+export default withLayout((props) => {
11
   const { frameTitle, flag } = props
11
   const { frameTitle, flag } = props
12
 
12
 
13
   let wrapAnimate = 'wrap wrapAnimate'
13
   let wrapAnimate = 'wrap wrapAnimate'
64
       </view>
64
       </view>
65
     </view>
65
     </view>
66
   )
66
   )
67
-}
67
+})

+ 1
- 0
src/components/ButtontWX/index.jsx 查看文件

1
 
1
 
2
 import { View, Text, Button } from '@tarojs/components'
2
 import { View, Text, Button } from '@tarojs/components'
3
+import withLayout from '@/layouts'
3
 import './style.less'
4
 import './style.less'
4
 
5
 
5
 export default (props) => {
6
 export default (props) => {

+ 3
- 2
src/components/CarsListContent/index.jsx 查看文件

3
 import { useEffect, useState, useMemo } from "react"
3
 import { useEffect, useState, useMemo } from "react"
4
 import Taro, { useReachBottom } from "@tarojs/taro"
4
 import Taro, { useReachBottom } from "@tarojs/taro"
5
 import ButtontWX from '@/components/ButtontWX'
5
 import ButtontWX from '@/components/ButtontWX'
6
+import withLayout from '@/layouts'
6
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
7
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
7
 
8
 
8
 import { getMachinery, } from "@/services/homes"
9
 import { getMachinery, } from "@/services/homes"
10
 
11
 
11
 import './style.less'
12
 import './style.less'
12
 
13
 
13
-export default (props) => {
14
+export default withLayout((props) => {
14
   const location = Taro.getStorageSync('location')
15
   const location = Taro.getStorageSync('location')
15
   // const { carsList } = props
16
   // const { carsList } = props
16
 
17
 
74
 
75
 
75
     </>
76
     </>
76
   )
77
   )
77
-}
78
+})

+ 11
- 38
src/components/CustomNav/index.jsx 查看文件

1
 
1
 
2
-import { useState, useEffect, useMemo } from 'react'
3
 import Taro from '@tarojs/taro'
2
 import Taro from '@tarojs/taro'
4
-import homeBlack from '@/assets/icons/comm/home.png'
5
-import homeWhite from '@/assets/icons/comm/home_white.png'
3
+import { View } from '@tarojs/components'
6
 import gobackBlack from '@/assets/icons/comm/goback.png'
4
 import gobackBlack from '@/assets/icons/comm/goback.png'
7
-import gobackWhite from '@/assets/icons/comm/goback_white.png'
5
+import { useState, useEffect, useMemo } from 'react'
8
 
6
 
9
 import './style.less'
7
 import './style.less'
10
 
8
 
11
 export default (props) => {
9
 export default (props) => {
12
-  const { bgImg, logo, title = '首页', home, noback } = props
10
+  const { logo, title = '首页', home, noback } = props
13
 
11
 
14
   // 菜单胶囊
12
   // 菜单胶囊
15
   const menuBound = useMemo(() => Taro.getMenuButtonBoundingClientRect(), [])
13
   const menuBound = useMemo(() => Taro.getMenuButtonBoundingClientRect(), [])
17
   const navStyle = useMemo(() => {
15
   const navStyle = useMemo(() => {
18
     return {
16
     return {
19
       height: `${menuBound.bottom + 8}px`,
17
       height: `${menuBound.bottom + 8}px`,
20
-      backgroundImage: bgImg ? `url(${bgImg})` : 'none',
21
     }
18
     }
22
-  }, [menuBound.bottom, bgImg])
19
+  }, [menuBound.bottom])
23
   // 导航栏
20
   // 导航栏
24
   const navBarStyle = useMemo(() => {
21
   const navBarStyle = useMemo(() => {
25
     return {
22
     return {
41
     const screenWidth = menuBound.right + 8;
38
     const screenWidth = menuBound.right + 8;
42
     return {
39
     return {
43
       width: `${screenWidth - menuBound.width * 2 - 16}px`,
40
       width: `${screenWidth - menuBound.width * 2 - 16}px`,
44
-      color: bgImg ? '#fff' : '#333',
45
       lineHeight: `${menuBound.height}px`,
41
       lineHeight: `${menuBound.height}px`,
46
       height: `${menuBound.height}px`,
42
       height: `${menuBound.height}px`,
47
       paddingLeft: '8px',
43
       paddingLeft: '8px',
48
       paddingRight: '8px',
44
       paddingRight: '8px',
49
     }
45
     }
50
-  }, [menuBound.width, menuBound.height, menuBound.right, bgImg])
51
-  // logo
52
-  const logoStyle = useMemo(() => {
53
-    return {
54
-      width: `${menuBound.height}px`,
55
-      height: `${menuBound.height}px`,
56
-    }
57
-  }, [menuBound.height])
46
+  }, [menuBound.width, menuBound.height, menuBound.right])
58
 
47
 
59
   const handleAction = () => {
48
   const handleAction = () => {
60
     if (home || logo) return;
49
     if (home || logo) return;
64
     }
53
     }
65
   }
54
   }
66
 
55
 
67
-  const goHome = () => {
68
-    Taro.reLaunch({
69
-      url: '/pages/index/index'
70
-    })
71
-  }
72
-
73
   useEffect(() => {
56
   useEffect(() => {
74
     if (title) {
57
     if (title) {
75
       Taro.setNavigationBarTitle({ title })
58
       Taro.setNavigationBarTitle({ title })
80
     <view className='custom-nav' style={navStyle}>
63
     <view className='custom-nav' style={navStyle}>
81
       <view className='custom-nav-bar' style={navBarStyle}>
64
       <view className='custom-nav-bar' style={navBarStyle}>
82
         <view className='custom-nav-bar-action' style={actionStyle}>
65
         <view className='custom-nav-bar-action' style={actionStyle}>
83
-          {
84
-            !!logo && <image src={logo} className='custom-nav-bar-logo' mode='aspectFit' style={logoStyle} />
85
-          }
86
           {
66
           {
87
             !logo && !home && (
67
             !logo && !home && (
88
-              <view className='custom-nav-bar-action-btns'>
89
-                {
90
-                  !noback && (
91
-                    <view className='custom-nav-bar-action-part' onClick={handleAction}>
92
-                      <image src={bgImg ? gobackWhite : gobackBlack} mode='aspectFit' />
93
-                    </view>
94
-                  )
95
-                }
96
-                <view className='custom-nav-bar-action-part' onClick={goHome}>
97
-                  <image src={bgImg ? homeWhite : homeBlack} mode='aspectFit' />
98
-                </view>
99
-              </view>
68
+              !noback && (
69
+                <View style={{ width: '100%', height: '100%' }} onClick={handleAction}>
70
+                  <image className='goback' src={gobackBlack} />
71
+                </View>
72
+              )
100
             )
73
             )
101
           }
74
           }
102
         </view>
75
         </view>
104
       </view>
77
       </view>
105
     </view>
78
     </view>
106
   )
79
   )
107
-}
80
+}

+ 9
- 27
src/components/CustomNav/style.less 查看文件

13
       flex: none;
13
       flex: none;
14
       box-sizing: border-box;
14
       box-sizing: border-box;
15
 
15
 
16
-      image {
17
-        display: inline-block;
18
-        border: 0;
16
+      .goback {
17
+        width: 19px;
18
+        height: 35px;
19
+        position: absolute;
20
+        left: 30px;
21
+        top: 14.5px;
19
       }
22
       }
20
-
21
-      &-btns {
22
-        width: 100%;
23
-        height: 100%;
24
-        display: flex;
25
-
26
-        & > view {
27
-          flex: auto;
28
-          width: 50%;
29
-          text-align: center;
30
-
31
-          image {
32
-            width: 100%;
33
-            height: 30px;
34
-          }
35
-        }
36
-      }
37
-    }
38
-
39
-    &-logo {
40
-      display: block !important;
41
-      border-radius: 50%;
42
-      margin: 0 auto;
43
     }
23
     }
44
 
24
 
45
     &-content {
25
     &-content {
46
       flex: none;
26
       flex: none;
47
       text-align: center;
27
       text-align: center;
48
-      font-size: 32px;
28
+      font-size: 34px;
29
+      font-weight: bold;
30
+      color: #333;
49
       cursor: none;
31
       cursor: none;
50
       pointer-events: none;
32
       pointer-events: none;
51
       text-overflow: ellipsis;
33
       text-overflow: ellipsis;

+ 22
- 3
src/layouts/index.jsx 查看文件

1
 
1
 
2
 
2
 
3
 import useRouter from '@/utils/hooks/useRouter'
3
 import useRouter from '@/utils/hooks/useRouter'
4
-import { getPageBy, getIndexPageOf } from '../routes'
4
+import Taro from '@tarojs/taro'
5
+import { useEffect } from 'react'
6
+import { useModel } from '@/store'
5
 
7
 
6
-export default (Child) => (props) => {
7
 
8
 
8
-  // const { person } = useModel('person')
9
+export default (Child) => (props) => {
10
+  const { person } = useModel('userData')
9
   const router = useRouter()
11
   const router = useRouter()
10
 
12
 
13
+  const { path } = router
14
+
15
+  useEffect(() => {
16
+    if (!person?.phone) {
17
+      if (path != '/pages/index/index' && path !== '/pages/UserLogin/index') {
18
+        Taro.navigateTo({ url: `/pages/UserLogin/index?id${1}` })
19
+      }
20
+    }
21
+    console.log("🚀 ~ file: index.jsx ~ line 11 ~ person", person, path)
22
+
23
+    // if (path != '/pages/index/index' && !person?.phone) {
24
+    //   Taro.navigateTo({ url: `/pages/userInfo/index?id${1}` })
25
+    // }
26
+  }, [path, person?.phone])
27
+
28
+
29
+
11
 
30
 
12
 
31
 
13
   return <Child {...props} router={router} />
32
   return <Child {...props} router={router} />

+ 4
- 2
src/pages/AboutUsPage/index.jsx 查看文件

1
 import { View, Image } from "@tarojs/components"
1
 import { View, Image } from "@tarojs/components"
2
 import CustomNav from "@/components/CustomNav"
2
 import CustomNav from "@/components/CustomNav"
3
 import decorate from "@/assets/icons/comm/decorate.png"
3
 import decorate from "@/assets/icons/comm/decorate.png"
4
+import withLayout from '@/layouts'
5
+
4
 
6
 
5
 import './style.less'
7
 import './style.less'
6
 
8
 
7
 
9
 
8
 
10
 
9
-export default (props) => {
11
+export default withLayout((props) => {
10
 
12
 
11
   return (
13
   return (
12
     <View className='page-index'>
14
     <View className='page-index'>
46
       </scroll-view>
48
       </scroll-view>
47
     </View>
49
     </View>
48
   )
50
   )
49
-}
51
+})

+ 12
- 9
src/pages/CheckDetails/index.jsx 查看文件

2
 import { Image, View, Text, Swiper, SwiperItem } from "@tarojs/components"
2
 import { Image, View, Text, Swiper, SwiperItem } from "@tarojs/components"
3
 import Taro from "@tarojs/taro"
3
 import Taro from "@tarojs/taro"
4
 import CustomNav from "@/components/CustomNav"
4
 import CustomNav from "@/components/CustomNav"
5
-
5
+import withLayout from '@/layouts'
6
 import ButtontWX from "@/components/ButtontWX"
6
 import ButtontWX from "@/components/ButtontWX"
7
 import decorate from "@/assets/icons/comm/decorate.png"
7
 import decorate from "@/assets/icons/comm/decorate.png"
8
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
8
 import addresss from '@/assets/mineImgaes/addresss.png'//地址
14
 
14
 
15
 
15
 
16
 
16
 
17
-export default (props) => {
17
+export default withLayout((props) => {
18
   console.log("🚀 ~ file: index.jsx ~ line 14 ~ props", props)
18
   console.log("🚀 ~ file: index.jsx ~ line 14 ~ props", props)
19
 
19
 
20
   const $instance = Taro.getCurrentInstance()
20
   const $instance = Taro.getCurrentInstance()
26
 
26
 
27
 
27
 
28
   useEffect(() => {
28
   useEffect(() => {
29
+    if (id) {
30
+      getMachineryInfo(id, { location: location, attached: true }).then((e) => {
31
+        setImagesList(e.imagesList)
32
+        setContentList(e.contentList)
33
+        setCarsInfo(e)
34
+
35
+        console.log('e', e);
36
+      })
37
+    }
29
 
38
 
30
-    getMachineryInfo(id, { location: location, attached: true }).then((e) => {
31
-      setImagesList(e.imagesList)
32
-      setContentList(e.contentList)
33
-      setCarsInfo(e)
34
 
39
 
35
-      console.log('e', e);
36
-    })
37
 
40
 
38
   }, [$instance.router.params, id, location])
41
   }, [$instance.router.params, id, location])
39
 
42
 
116
 
119
 
117
     </View >
120
     </View >
118
   )
121
   )
119
-}
122
+})

+ 2
- 2
src/pages/CheckMap/index.jsx 查看文件

10
 import './style.less'
10
 import './style.less'
11
 
11
 
12
 
12
 
13
-export default (props) => {
13
+export default withLayout((props) => {
14
 
14
 
15
 
15
 
16
   const $instance = Taro.getCurrentInstance()
16
   const $instance = Taro.getCurrentInstance()
117
       </scroll-view>
117
       </scroll-view>
118
     </View>
118
     </View>
119
   )
119
   )
120
-}
120
+})

+ 4
- 2
src/pages/FeedbackText/index.jsx 查看文件

3
 import CustomNav from "@/components/CustomNav"
3
 import CustomNav from "@/components/CustomNav"
4
 import ButtontWX from "@/components/ButtontWX"
4
 import ButtontWX from "@/components/ButtontWX"
5
 import { feedback } from "@/services/mine"
5
 import { feedback } from "@/services/mine"
6
+import withLayout from '@/layouts'
7
+
6
 import Taro from "@tarojs/taro"
8
 import Taro from "@tarojs/taro"
7
 
9
 
8
 import './style.less'
10
 import './style.less'
9
 
11
 
10
 
12
 
11
 
13
 
12
-export default (props) => {
14
+export default withLayout((props) => {
13
 
15
 
14
   const [textAreaValue, setTextAreaValue] = useState('')
16
   const [textAreaValue, setTextAreaValue] = useState('')
15
   const [loading, setLoading] = useState(false)
17
   const [loading, setLoading] = useState(false)
66
       </View>
68
       </View>
67
     </View>
69
     </View>
68
   )
70
   )
69
-}
71
+})

+ 3
- 2
src/pages/HelpCenterInfo/index.jsx 查看文件

1
 import { View, Image } from "@tarojs/components"
1
 import { View, Image } from "@tarojs/components"
2
 import CustomNav from "@/components/CustomNav"
2
 import CustomNav from "@/components/CustomNav"
3
 
3
 
4
+import withLayout from '@/layouts'
4
 
5
 
5
 import './style.less'
6
 import './style.less'
6
 
7
 
7
 
8
 
8
 
9
 
9
-export default (props) => {
10
+export default withLayout((props) => {
10
 
11
 
11
   return (
12
   return (
12
     <View className='page-index'>
13
     <View className='page-index'>
53
       </scroll-view>
54
       </scroll-view>
54
     </View>
55
     </View>
55
   )
56
   )
56
-}
57
+})

+ 3
- 2
src/pages/MoreCars/index.jsx 查看文件

10
 import searchs from '@/assets/homesImgaes/searchs.png'//搜索图片
10
 import searchs from '@/assets/homesImgaes/searchs.png'//搜索图片
11
 import { getMachineryType } from "@/services/homes"
11
 import { getMachineryType } from "@/services/homes"
12
 import CarsListContent from "@/components/CarsListContent"
12
 import CarsListContent from "@/components/CarsListContent"
13
+import withLayout from '@/layouts'
13
 
14
 
14
 import './style.less'
15
 import './style.less'
15
 
16
 
16
 
17
 
17
 
18
 
18
 
19
 
19
-export default (props) => {
20
+export default withLayout((props) => {
20
   const [activeTab, setActiveTab] = useState(1)
21
   const [activeTab, setActiveTab] = useState(1)
21
 
22
 
22
 
23
 
79
       </scroll-view>
80
       </scroll-view>
80
     </View>
81
     </View>
81
   )
82
   )
82
-}
83
+})

+ 3
- 2
src/pages/MyAddressList/AddressInfos/index.jsx 查看文件

3
 import CustomNav from "@/components/CustomNav"
3
 import CustomNav from "@/components/CustomNav"
4
 import ButtontWX from '@/components/ButtontWX'
4
 import ButtontWX from '@/components/ButtontWX'
5
 import { addressSave, getAddress, addressDelete, addressUpdate } from "@/services/address"
5
 import { addressSave, getAddress, addressDelete, addressUpdate } from "@/services/address"
6
+import withLayout from '@/layouts'
6
 
7
 
7
 import './style.less'
8
 import './style.less'
8
 import { useEffect } from "react"
9
 import { useEffect } from "react"
10
 
11
 
11
 
12
 
12
 
13
 
13
-export default (props) => {
14
+export default withLayout((props) => {
14
   console.log("🚀 ~ file: index.jsx ~ line 14 ~ props", props)
15
   console.log("🚀 ~ file: index.jsx ~ line 14 ~ props", props)
15
 
16
 
16
   const $instance = Taro.getCurrentInstance()
17
   const $instance = Taro.getCurrentInstance()
87
       </View>
88
       </View>
88
     </View>
89
     </View>
89
   )
90
   )
90
-}
91
+})

+ 3
- 2
src/pages/MyAddressList/index.jsx 查看文件

4
 import CustomNav from "@/components/CustomNav"
4
 import CustomNav from "@/components/CustomNav"
5
 import edit from "@/assets/icons/comm/edit.png"
5
 import edit from "@/assets/icons/comm/edit.png"
6
 import userRight from '@/assets/mineImgaes/userRight.png'
6
 import userRight from '@/assets/mineImgaes/userRight.png'
7
+import withLayout from '@/layouts'
7
 
8
 
8
 import deletes from "@/assets/icons/comm/deletes.png"
9
 import deletes from "@/assets/icons/comm/deletes.png"
9
 import ButtontWX from '@/components/ButtontWX'
10
 import ButtontWX from '@/components/ButtontWX'
15
 
16
 
16
 
17
 
17
 
18
 
18
-export default (props) => {
19
+export default withLayout((props) => {
19
   const [addresList, setAddresList] = useState([])
20
   const [addresList, setAddresList] = useState([])
20
 
21
 
21
   const addAddress = () => {
22
   const addAddress = () => {
150
       </scroll-view>
151
       </scroll-view>
151
     </View >
152
     </View >
152
   )
153
   )
153
-}
154
+})
154
 
155
 
155
 
156
 

+ 3
- 2
src/pages/NewVersionUpdatePage/index.jsx 查看文件

1
 import { View, Image } from "@tarojs/components"
1
 import { View, Image } from "@tarojs/components"
2
 import CustomNav from "@/components/CustomNav"
2
 import CustomNav from "@/components/CustomNav"
3
 import decorate from "@/assets/icons/comm/decorate.png"
3
 import decorate from "@/assets/icons/comm/decorate.png"
4
+import withLayout from '@/layouts'
4
 
5
 
5
 import './style.less'
6
 import './style.less'
6
 
7
 
7
 
8
 
8
 
9
 
9
 
10
 
10
-export default (props) => {
11
+export default withLayout((props) => {
11
 
12
 
12
   return (
13
   return (
13
     <View className='page-index'>
14
     <View className='page-index'>
29
       </scroll-view>
30
       </scroll-view>
30
     </View>
31
     </View>
31
   )
32
   )
32
-}
33
+})

+ 4
- 2
src/pages/OrderConfirmation/index.jsx 查看文件

1
 import { View, Text } from "@tarojs/components"
1
 import { View, Text } from "@tarojs/components"
2
 import Taro from "@tarojs/taro"
2
 import Taro from "@tarojs/taro"
3
 import { useState } from "react"
3
 import { useState } from "react"
4
+import withLayout from '@/layouts'
5
+
4
 import CustomNav from '@/components/CustomNav'
6
 import CustomNav from '@/components/CustomNav'
5
 import ButtontWX from '@/components/ButtontWX'
7
 import ButtontWX from '@/components/ButtontWX'
6
 // import BottomMoadl from '@/components/BottomMoadl/index'
8
 // import BottomMoadl from '@/components/BottomMoadl/index'
12
 
14
 
13
 import './style.less'
15
 import './style.less'
14
 
16
 
15
-export default (props) => {
17
+export default withLayout((props) => {
16
   //底部弹窗
18
   //底部弹窗
17
   // const [showFrame, setShowFrame] = useState(false)
19
   // const [showFrame, setShowFrame] = useState(false)
18
   // const setRecommend = () => {
20
   // const setRecommend = () => {
46
       </View>
48
       </View>
47
     </View>
49
     </View>
48
   )
50
   )
49
-}
51
+})

+ 3
- 2
src/pages/OrderInfo/index.jsx 查看文件

4
 import CustomNav from '@/components/CustomNav'
4
 import CustomNav from '@/components/CustomNav'
5
 import ButtontWX from '@/components/ButtontWX'
5
 import ButtontWX from '@/components/ButtontWX'
6
 import formatTimes from "@/utils/codeSegment"
6
 import formatTimes from "@/utils/codeSegment"
7
+import withLayout from '@/layouts'
7
 
8
 
8
 import { generateOrder, orderDelete, orderInfo } from "@/services/order"
9
 import { generateOrder, orderDelete, orderInfo } from "@/services/order"
9
 // import BottomMoadl from '@/components/BottomMoadl/index'
10
 // import BottomMoadl from '@/components/BottomMoadl/index'
15
 
16
 
16
 import './style.less'
17
 import './style.less'
17
 
18
 
18
-export default (props) => {
19
+export default withLayout((props) => {
19
 
20
 
20
   const $instance = Taro.getCurrentInstance()
21
   const $instance = Taro.getCurrentInstance()
21
   const { orderId } = $instance.router.params
22
   const { orderId } = $instance.router.params
114
       </View>
115
       </View>
115
     </View>
116
     </View>
116
   )
117
   )
117
-}
118
+})

+ 4
- 3
src/pages/UserLogin/index.jsx 查看文件

10
 import unselectedImg from '@/assets/lolginImages/unselectedImg.png'
10
 import unselectedImg from '@/assets/lolginImages/unselectedImg.png'
11
 import { useModel } from '@/store'
11
 import { useModel } from '@/store'
12
 
12
 
13
+import withLayout from '@/layouts'
13
 
14
 
14
 import './style.less'
15
 import './style.less'
15
 
16
 
16
 
17
 
17
-export default (props) => {
18
+export default withLayout((props) => {
18
 
19
 
19
   const { person, setUserPhoneInfo } = useModel('userData')
20
   const { person, setUserPhoneInfo } = useModel('userData')
20
 
21
 
113
   return (
114
   return (
114
     <View className='page-index'>
115
     <View className='page-index'>
115
       <View className='index-navbar'>
116
       <View className='index-navbar'>
116
-        <CustomNav title='登陆' />
117
+        <CustomNav title='登陆' home />
117
       </View>
118
       </View>
118
       <View className='loginBackImg-box' >
119
       <View className='loginBackImg-box' >
119
         <Image src={require("@/assets/lolginImages/backLogin.png")} />
120
         <Image src={require("@/assets/lolginImages/backLogin.png")} />
149
 
150
 
150
     </View>
151
     </View>
151
   )
152
   )
152
-}
153
+})

+ 17
- 4
src/pages/index/index.jsx 查看文件

2
 import Taro, { useDidShow } from '@tarojs/taro'
2
 import Taro, { useDidShow } from '@tarojs/taro'
3
 import withLayout from '@/layouts'
3
 import withLayout from '@/layouts'
4
 import CustomNav from '@/components/CustomNav'
4
 import CustomNav from '@/components/CustomNav'
5
+import { useModel } from '@/store'
6
+
5
 import tabList from './tabbar'
7
 import tabList from './tabbar'
6
 import Homes from './tabs/Homes'
8
 import Homes from './tabs/Homes'
7
 import Orders from './tabs/Orders'
9
 import Orders from './tabs/Orders'
12
 
14
 
13
 export default withLayout((props) => {
15
 export default withLayout((props) => {
14
   const { router } = props
16
   const { router } = props
17
+  const { person } = useModel('userData')
18
+  console.log("🚀 ~ file: index.jsx ~ line 18 ~ withLayout ~ person", person)
15
 
19
 
16
   const { params, path } = router
20
   const { params, path } = router
17
   const { tab } = params || {}
21
   const { tab } = params || {}
29
     if (tab) {
33
     if (tab) {
30
       setCurrentTab(tab - 0)
34
       setCurrentTab(tab - 0)
31
     }
35
     }
32
-  }, [tab])
36
+  }, [tab,])
33
 
37
 
34
 
38
 
35
   const handleTabChange = (e) => {
39
   const handleTabChange = (e) => {
36
-    const { index } = e.detail
37
-    setCurrentTab(index)
40
+    if (!person?.phone) {
41
+      Taro.navigateTo({ url: `/pages/UserLogin/index?id${1}` })
42
+
43
+    } else {
44
+      if (person?.phone) {
45
+        const { index } = e.detail
46
+        setCurrentTab(index)
47
+      }
48
+
49
+    }
50
+
38
   }
51
   }
39
 
52
 
40
 
53
 
42
     <view className='page-index'>
55
     <view className='page-index'>
43
 
56
 
44
       <view className='index-navbar'>
57
       <view className='index-navbar'>
45
-        <CustomNav title='首页' />
58
+        <CustomNav title='首页' home />
46
       </view>
59
       </view>
47
       <view className='index-container'>
60
       <view className='index-container'>
48
         {currentTab === 0 && <Homes />}
61
         {currentTab === 0 && <Homes />}

+ 36
- 36
src/pages/index/tabs/Homes.jsx 查看文件

7
 import carsListImga from '@/assets/homesImgaes/carsListImga.png'//农机列表图片
7
 import carsListImga from '@/assets/homesImgaes/carsListImga.png'//农机列表图片
8
 import CarsListContent from "@/components/CarsListContent"
8
 import CarsListContent from "@/components/CarsListContent"
9
 import { getHomeBanner, getMachinery, } from "@/services/homes"
9
 import { getHomeBanner, getMachinery, } from "@/services/homes"
10
+import withLayout from '@/layouts'
11
+
10
 import { useModel } from "@/store"
12
 import { useModel } from "@/store"
11
 import './HomesCss/style.less'
13
 import './HomesCss/style.less'
12
 
14
 
13
-export default (props) => {
15
+export default withLayout((props) => {
14
   const location = Taro.getStorageSync('location')
16
   const location = Taro.getStorageSync('location')
15
   const [bannerHome, setBannerHome] = useState([])
17
   const [bannerHome, setBannerHome] = useState([])
16
   const [carsList, setCarsList] = useState([])
18
   const [carsList, setCarsList] = useState([])
47
 
49
 
48
   return (
50
   return (
49
     <scroll-view className='scrollView' scrollY style='height: 100%;' >
51
     <scroll-view className='scrollView' scrollY style='height: 100%;' >
50
-      {
51
-        person?.phone !== '' ? <>
52
-          <View className='heads-top-box'>
53
-            <View className='heads-top-box-left'>
54
-              <Image src={addresss} className='heads-top-box-left-addresssImg' />
55
-              <Text>邓州市</Text>
56
-              <View className='heads-top-box-left-addresssImg-DownIcon' />
57
-            </View>
58
-            <View className='heads-content-searchClass'>
59
-              <Input type='text' className='heads-content-searchClass-searchInput' onBlur={handleSearch} placeholder='搜索关键字查询订单' />
60
-              <Image src={searchs} className='heads-content-searchClass-searchInput-searchImg' />
61
-            </View>
62
-          </View>
63
-          <Swiper
64
-            circular
65
-            autoplay
66
-            className='swiper-box'
67
-          >
68
-            {bannerHome.map((item, inx) => (
69
-              <SwiperItem key={inx}>
70
-                <Image src={item.thumb} mode='widthFix' className='storeImage' />
71
-              </SwiperItem>
72
-            ))}
73
-          </Swiper>
74
-          <View className='content-header-box'>
75
-            <View className='content-header-box-liftCentent'>
76
-              <Image src={carsListImga} />
77
-              <View>农机列表</View>
78
-            </View>
79
-            <View onClick={goToCarsList} className='content-header-box-rightCentent'>更多&gt;&gt;</View>
80
-          </View>
81
-          <CarsListContent carsList={carsList} />
82
-        </> : <View>未登录,请先登陆</View>
83
-      }
52
+
53
+      <View className='heads-top-box'>
54
+        <View className='heads-top-box-left'>
55
+          <Image src={addresss} className='heads-top-box-left-addresssImg' />
56
+          <Text>邓州市</Text>
57
+          <View className='heads-top-box-left-addresssImg-DownIcon' />
58
+        </View>
59
+        <View className='heads-content-searchClass'>
60
+          <Input type='text' className='heads-content-searchClass-searchInput' onBlur={handleSearch} placeholder='搜索关键字查询订单' />
61
+          <Image src={searchs} className='heads-content-searchClass-searchInput-searchImg' />
62
+        </View>
63
+      </View>
64
+      <Swiper
65
+
66
+        mode='scaleToFill'
67
+        className='swiper-box'
68
+      >
69
+        {bannerHome.map((item, inx) => (
70
+          <SwiperItem key={inx}>
71
+            <Image src={item.thumb} mode='widthFix' className='storeImage' />
72
+          </SwiperItem>
73
+        ))}
74
+      </Swiper>
75
+      <View className='content-header-box'>
76
+        <View className='content-header-box-liftCentent'>
77
+          <Image src={carsListImga} />
78
+          <View>农机列表</View>
79
+        </View>
80
+        <View onClick={goToCarsList} className='content-header-box-rightCentent'>更多&gt;&gt;</View>
81
+      </View>
82
+      <CarsListContent carsList={carsList} />
83
+
84
 
84
 
85
     </scroll-view>
85
     </scroll-view>
86
   )
86
   )
87
-}
87
+})

+ 4
- 3
src/pages/index/tabs/HomesCss/style.less 查看文件

46
 }
46
 }
47
 
47
 
48
 .swiper-box {
48
 .swiper-box {
49
-  height: calc(calc(100vw-60px) * 0.62);
49
+  height: calc(calc(100vh - 50vh) * 0.62);
50
   text-align: center;
50
   text-align: center;
51
-  margin: 30px;
51
+  margin-top: 1em;
52
+
52
   .storeImage {
53
   .storeImage {
53
-    height: 100%;
54
+    width: 95vw;
54
   }
55
   }
55
 }
56
 }
56
 
57
 

+ 4
- 3
src/pages/index/tabs/Mine.jsx 查看文件

11
 import userMoren from '@/assets/mineImgaes/userMoren.png'//默认头像
11
 import userMoren from '@/assets/mineImgaes/userMoren.png'//默认头像
12
 import userRight from '@/assets/mineImgaes/userRight.png'
12
 import userRight from '@/assets/mineImgaes/userRight.png'
13
 import { useModel } from "@/store"
13
 import { useModel } from "@/store"
14
+import withLayout from '@/layouts'
14
 
15
 
15
 import { getAddress } from "@/services/address"
16
 import { getAddress } from "@/services/address"
16
 
17
 
19
 import './MineCss/style.less'
20
 import './MineCss/style.less'
20
 
21
 
21
 
22
 
22
-export default (props) => {
23
+export default withLayout((props) => {
23
   const { person } = useModel('userData')
24
   const { person } = useModel('userData')
24
   const [isLoginBox, setIsLoginBox] = useState(false)
25
   const [isLoginBox, setIsLoginBox] = useState(false)
25
   const [addresInfo, setAddresInfo] = useState('')
26
   const [addresInfo, setAddresInfo] = useState('')
38
     console.log($instance.router.params, '$instance.router.params路由')
39
     console.log($instance.router.params, '$instance.router.params路由')
39
     if ($instance.router.params.userOk || person.phone) {
40
     if ($instance.router.params.userOk || person.phone) {
40
       setIsLoginBox(true)
41
       setIsLoginBox(true)
41
-      return { phone: person.phone, nickName: person.nickName, avatar: person.avatar }
42
+      return { phone: person?.phone, nickName: person?.nickName, avatar: person?.avatar }
42
     }
43
     }
43
 
44
 
44
   }, [$instance.router.params, person])
45
   }, [$instance.router.params, person])
160
       </View>
161
       </View>
161
     </scroll-view>
162
     </scroll-view>
162
   )
163
   )
163
-}
164
+})

+ 4
- 3
src/pages/index/tabs/Orders.jsx 查看文件

8
 import { getOrder } from "@/services/order"
8
 import { getOrder } from "@/services/order"
9
 import formatTimes from "@/utils/codeSegment"
9
 import formatTimes from "@/utils/codeSegment"
10
 import { useModel } from "@/store"
10
 import { useModel } from "@/store"
11
+import withLayout from '@/layouts'
11
 
12
 
12
 import './OrdersCss/style.less'
13
 import './OrdersCss/style.less'
13
 
14
 
14
 
15
 
15
-export default (props) => {
16
+export default withLayout((props) => {
16
 
17
 
17
   const [ourderList, setOrderList] = useState([])
18
   const [ourderList, setOrderList] = useState([])
18
 
19
 
88
     <scroll-view scrollY style='height: 100%;' >
89
     <scroll-view scrollY style='height: 100%;' >
89
 
90
 
90
       {
91
       {
91
-        person?.phone !== '' ? <>
92
+        person?.phone ? <>
92
           <View className='content-header-box-orders'>
93
           <View className='content-header-box-orders'>
93
             <View className='content-header-box-orders-liftCentent'>
94
             <View className='content-header-box-orders-liftCentent'>
94
               <Image src={ordersListImga} />
95
               <Image src={ordersListImga} />
123
 
124
 
124
     </scroll-view>
125
     </scroll-view>
125
   )
126
   )
126
-}
127
+})

+ 4
- 2
src/pages/userInfo/index.jsx 查看文件

5
 import CustomNav from '@/components/CustomNav'
5
 import CustomNav from '@/components/CustomNav'
6
 import ButtontWX from '@/components/ButtontWX'
6
 import ButtontWX from '@/components/ButtontWX'
7
 import { updateInfo } from "@/services/login"
7
 import { updateInfo } from "@/services/login"
8
+import withLayout from '@/layouts'
9
+
8
 // import banner1 from '@/assets/banner/1.jpg'
10
 // import banner1 from '@/assets/banner/1.jpg'
9
 // import resetImg from '@/assets/user/cancel.png'
11
 // import resetImg from '@/assets/user/cancel.png'
10
 import './style.less'
12
 import './style.less'
11
 
13
 
12
-export default (props) => {
14
+export default withLayout((props) => {
13
 
15
 
14
   const { person, setPerson } = useModel('userData')
16
   const { person, setPerson } = useModel('userData')
15
 
17
 
109
       </View>
111
       </View>
110
     </View>
112
     </View>
111
   )
113
   )
112
-}
114
+})

+ 1
- 0
src/utils/hooks/useRouter.js 查看文件

2
 // import { parseQueryString, random } from '@/utils'
2
 // import { parseQueryString, random } from '@/utils'
3
 // import { useModel } from '@/store'
3
 // import { useModel } from '@/store'
4
 import { useEffect, useRef, useState } from 'react'
4
 import { useEffect, useRef, useState } from 'react'
5
+import { useModel } from '@/store'
5
 
6
 
6
 export default () => {
7
 export default () => {
7
   const router = useRouter()
8
   const router = useRouter()