ソースを参照

小程序增加withLayout

李志伟 3 年 前
コミット
0150a0da44

+ 65
- 29
src/components/spreads/ShopKeeper/shopKeeper.jsx ファイルの表示

@@ -1,19 +1,43 @@
1
+import { React, useState, useEffect, } from 'react'
2
+import{ Taro,useRouter } from '@tarojs/taro'
1 3
 import CustomNav from '@/components/CustomNav'
2
-import './shopKeeper.less'
3 4
 import eyes from '@/assets/icons/shopKeeper/小眼睛.png'
4 5
 import ceyes from '@/assets/icons/shopKeeper/小眼睛-闭上.png'
5 6
 import iconsearch from '@/assets/icons/housemantj/search.png'
6 7
 import ms from '@/assets/icons/housemantj/ms3.jpg'
8
+import './shopKeeper.less'
7 9
 
8 10
 
9 11
 export default (props) => {
12
+
13
+  const [activeTab, setActiveTab] = useState(0)
14
+  const { params } = useRouter()
15
+  const { tabJump } = params || {}
16
+  useEffect(() => {
17
+    if (tabJump) {
18
+      setActiveTab(tabJump - 0)
19
+    }
20
+  }, [tabJump])
21
+  
22
+  const handleTabChange = (e) => {
23
+    const { index } = e.detail
24
+    setActiveTab(index)
25
+  }
26
+  const tabs = [
27
+      {
28
+        title: '未核销订单',
29
+      },
30
+      {
31
+        title: '已核销订单',  
32
+      },   
33
+    ]
34
+
35
+
10 36
   return (
11 37
     <view>
12 38
       <view>
13 39
         <CustomNav title='十公里' />
14 40
       </view>
15
-
16
-
17 41
       <view style={{ padding: '30rpx', height: '100%' }}>
18 42
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 120px)' }}>
19 43
           <view className='storexx'>
@@ -37,36 +61,46 @@ export default (props) => {
37 61
             </view>
38 62
           </view>
39 63
           <view className='search'>
40
-            <input className='searchInput' disabled />
64
+            <input className='searchInput'  />
41 65
             <image className='searchicon' src={iconsearch} />
42 66
             <view className="searchword">搜索订单(输入客户手机号码)</view>
43 67
           </view>
44
-          <view className='orderTab'>
45
-            <view className='unCheck'>未核销订单</view>
46
-            <view className='lClickLine'></view>
47
-            <view className='line' />
48
-            <view className='check'>已核销订单</view>
49
-            <view className='rClickLine'></view>
50
-          </view>
68
+          <view className='index-tabs'>
69
+          <mp-tabs
70
+              tabClass='tabs-Unselected'
71
+              swiperClass='tabs-swiper'
72
+              activeClass='tabs-Selected'
73
+              tabs={tabs}
74
+              current={activeTab}
75
+              onChange={handleTabChange}
76
+              activeTab={activeTab}
77
+            >
78
+            </mp-tabs>
79
+            </view>
80
+            
51 81
           <view>
52
-            <view className='orderCard'>
53
-              <view style={{ overflow: 'hidden' }}>
54
-                <view className='orderId'>订单编号:<text>ABC123456789</text></view>
55
-                <view className='orderTime'>下单日期:<text>2021-06-22 12:35</text></view>
56
-              </view>
57
-              <view className='order'>
58
-                <image className='orderImg' src={ms} mode='aspectFit' />
59
-                <view className='orderRight'>
60
-                  <view className='foodName'>【SEOUL.创意韩国料理】火爆全南京,
61
-                    新街口又开新店啦...</view>
62
-                  <view className='price'>合计金额:¥<text style={{ fontSize: '24rpx' }}>88</text>元 <text className='pnum'>数量:<text>1</text>张</text> </view>
63
-                  <view>已下单:等待客户上门就餐</view>
82
+            {activeTab === 0&&
83
+              <view className='orderCard'>
84
+                <view style={{ overflow: 'hidden' }}>
85
+                  <view className='orderId'>订单编号:<text>ABC123456789</text></view>
86
+                  <view className='orderTime'>下单日期:<text>2021-06-22 12:35</text></view>
64 87
                 </view>
65
-                <view className='line' />
66
-                <view className='phone'>客户手机:<text>136****9434</text></view>
67
-                <view className='tripTime'>客户行程日期:预计在<text>2021-06-21中下午10:30-16:30</text></view>
68
-              </view>
69
-            </view>
88
+                <view className='order'>
89
+                  <image className='orderImg' src={ms} mode='aspectFit' />
90
+                  <view className='orderRight'>
91
+                    <view className='foodName'>【SEOUL.创意韩国料理】火爆全南京,
92
+                      新街口又开新店啦...</view>
93
+                    <view className='price'>合计金额:¥<text style={{ fontSize: '24rpx' }}>88</text>元 <text className='pnum'>数量:<text>1</text>张</text> </view>
94
+                    <view>已下单:等待客户上门就餐</view>
95
+                  </view>
96
+                  <view className='line' />
97
+                  <view className='phone'>客户手机:<text>136****9434</text></view>
98
+                  <view className='tripTime'>客户行程日期:预计在<text>2021-06-21中下午10:30-16:30</text></view>
99
+                </view>
100
+              </view>              
101
+            }
102
+            {activeTab === 1&&
103
+            <>
70 104
             <view className='orderCard'>
71 105
               <view style={{ overflow: 'hidden' }}>
72 106
                 <view className='orderId'>订单编号:<text>ABC123456789</text></view>
@@ -103,7 +137,9 @@ export default (props) => {
103 137
                 <view className='tripTime'>客户行程日期:预计在<text>2021-06-21中下午10:30-16:30</text></view>
104 138
               </view>
105 139
             </view>
106
-          </view>
140
+          </>
141
+            }
142
+            </view>
107 143
           <view className='botton'>已经到底了~</view>
108 144
         </scroll-view>        
109 145
       </view>      

+ 20
- 46
src/components/spreads/ShopKeeper/shopKeeper.less ファイルの表示

@@ -107,55 +107,28 @@
107 107
     bottom: 60px;
108 108
   }
109 109
 }
110
-.orderTab{
111
-  background: #FFFFFF;
112
-  box-shadow: 0px 2px 18px 0px rgba(0, 0, 0, 0.08);
113
-  border-radius: 24px;
114
-  font-size: 28px;
115
-  font-weight: bold;
116
-  color: #C0C8D3;
117
-  line-height: 60px;
118
-  position: relative;
119
-  .unCheck{    
120
-    font-size: 32px;
121
-    color: #404040;
122
-    display: inline-block;
123
-    margin: 29px 0 33px 101px;
124
-    line-height: 35px;
125
-    height: 30px;
126
-  }
127
-  .lClickLine{
128
-    position: absolute;
129
-    width: 60px;
130
-    height: 6px;
131
-    background: #000;
132
-    left: 20%;
133
-    bottom: 0;
110
+.index-tabs {
111
+  width: 100%;
112
+  height: 91px;
113
+  .tabs-Unselected {
114
+    width: 50vw;
115
+    text-align: center;
116
+    height: 26px;
117
+    font-size: 28px;
118
+    font-weight: bold;
119
+    color: #c0c8d3;
134 120
   }
135
-  .line{
136
-    width: 2px;
137
-    height: 56px;
138
-    background: #000;
139
-    opacity: 0.1;
140
-    position: absolute;
141
-    left: 50%;
142
-    bottom: 20px;
121
+  .tabs-swiper {
122
+    max-height: 0px;
143 123
   }
144
-  .check{
145
-    display:inline-block;
146
-    line-height: 35px;
147
-    height: 27px;
124
+  .tabs-Selected {
125
+    height: 30px;
126
+    font-size: 32px;
148 127
     font-weight: bold;
149
-    font-size: 28px;
150
-    float: right;
151
-    margin: 33px 105px 32px 0;
152
-  }
153
-  .rClickLine{
154
-    position: absolute;
155
-    width: 60px;
156
-    height: 6px;
157
-    right: 20%;
158
-    bottom: 0;
128
+    color: #4c4c4c;
129
+    padding-top: 33px;
130
+    padding-bottom: 28px;
131
+    border-bottom: 5px solid black;
159 132
   }
160 133
 }
161 134
 .orderCard{
@@ -236,6 +209,7 @@
236 209
       margin-bottom: 30px;
237 210
     }
238 211
   }
212
+  
239 213
 }
240 214
 .botton{
241 215
   font-size: 28px;   

+ 5
- 2
src/hotel/pages/landlord/landlord.jsx ファイルの表示

@@ -8,8 +8,11 @@ import onincomeImg from '@/assets/icons/landlord/我的收入按下.png'
8 8
 import houseImg from '@/assets/icons/landlord/房源管理.png'
9 9
 import onhouseImg from '@/assets/icons/landlord/房源管理按下.png'
10 10
 import './landlord.less'
11
+import withLayout from '@/layouts'
11 12
 
12
-export default (props) => {
13
+
14
+export default withLayout((props) => {
15
+  const { router, person } = props
13 16
   const { params } = useRouter()
14 17
   const { tab } = params || {}
15 18
 
@@ -46,4 +49,4 @@ export default (props) => {
46 49
 
47 50
   )
48 51
 
49
-}
52
+})

+ 4
- 0
src/pages/MineUserAll/ContactMe/index.jsx ファイルの表示

@@ -7,6 +7,10 @@ import { Button, Text, Textarea } from '@tarojs/components'
7 7
 import './style.less'
8 8
 
9 9
 export default (props) => {
10
+  
11
+  const {location}=props
12
+  const {person}=location.query
13
+  console.log(person)
10 14
   const back = () => {
11 15
     Taro.navigateBack()
12 16
   }

+ 5
- 2
src/pages/details/foodDetails/foodDetails.jsx ファイルの表示

@@ -22,9 +22,12 @@ import glImage from '../../../assets/icons/housemantj/gl.jpg'
22 22
 import glTip from '../../../assets/icons/housemantj/gltip.png'
23 23
 import onlove from '../../../assets/icons/housemantj/爱心.png'
24 24
 import './foodDetails.less'
25
+import withLayout from '@/layouts'
25 26
 
26 27
 
27
-export default (props) => {
28
+export default withLayout((props) => {
29
+  const { router, person } = props
30
+
28 31
   return (
29 32
     <view className='page-index'>
30 33
       <view className='index-navbar'>
@@ -301,4 +304,4 @@ export default (props) => {
301 304
       </view>
302 305
     </view>
303 306
   )
304
-}
307
+})

+ 4
- 2
src/pages/details/mjDetails/sceneryDetails.jsx ファイルの表示

@@ -22,9 +22,11 @@ import share from '../../../assets/icons/housemantj/景点分享.png'
22 22
 import good from '../../../assets/icons/housemantj/景点爆赞.png'
23 23
 import collection from '../../../assets/icons/housemantj/景点收藏.png'
24 24
 import './sceneryDetails.less'
25
+import withLayout from '@/layouts'
25 26
 
26 27
 
27
-export default (props) => {
28
+export default withLayout((props) => {
29
+  const { router, person } = props
28 30
   return (
29 31
     <view className='page-index'>
30 32
       <view className='index-navbar'>
@@ -244,4 +246,4 @@ export default (props) => {
244 246
       
245 247
     </view>
246 248
   )
247
-}
249
+})

+ 12
- 42
src/pages/index/tabs/Recommend.jsx ファイルの表示

@@ -11,12 +11,14 @@ import mjTip from '@/assets/icons/housemantj/mjtip.png'
11 11
 import glTip from '@/assets/icons/housemantj/gltip.png'
12 12
 import onlove from '@/assets/icons/housemantj/onlove.png'
13 13
 import Taro,{useRouter } from '@tarojs/taro'
14
+import withLayout from '@/layouts'
14 15
 import { getIndexType, getIndexRecommender } from '@/services/home'
15 16
 
16 17
 import './less/Recommend.less'
17 18
 
18 19
 
19
-export default (props) => {
20
+export default withLayout((props) => {
21
+  const { router, person } = props
20 22
   const [activeTab, setActiveTab] = useState(0)
21 23
   const { params } = useRouter()
22 24
   const { tabJump } = params || {}
@@ -25,13 +27,16 @@ export default (props) => {
25 27
 
26 28
   const tabs = [{ title: '附近' }].concat(typeList.map(x => ({...x, title: x.typeName })))
27 29
   
30
+  const handleTabChange = (e) => {
31
+    const { index } = e.detail
32
+    setActiveTab(index)
33
+    const tab = tabs[index].typeId
34
+    // getIndexRecommender().then()
35
+  }
28 36
   useEffect(() => {
29
-    console.log('----------11111111111-------->')
30 37
     getIndexType({ pageSize: 20 }).then((res) => {
31
-      console.log('----------2222222------->')
32 38
       setTypeList(res.records || [])
33 39
     })
34
-
35 40
     getIndexRecommender().then((res) => {
36 41
       setList(res.records || [])
37 42
     })
@@ -39,35 +44,6 @@ export default (props) => {
39 44
       setActiveTab(tabJump - 0)
40 45
     }
41 46
   }, [tabJump])
42
-
43
-  // const tabs = [
44
-  //   {
45
-  //     title: '附近',
46
-  //   },
47
-  //   {
48
-  //     title: '全城',
49
-
50
-  //   },
51
-  //   {
52
-  //     title: '夫子庙',
53
-
54
-  //   },
55
-  //   {
56
-  //     title: '新街口',
57
-
58
-  //   },    
59
-  // ]
60
-  const handleTabChange = (e) => {
61
-    const { index } = e.detail
62
-    setActiveTab(index)
63
-
64
-    const tab = tabs[index].typeId
65
-    // getIndexRecommender().then()
66
-  }
67
-
68
-
69
-
70
-
71 47
   const onSearch = () => {
72 48
     // 用绝对路径
73 49
     Taro.navigateTo({ url: '/pages/search/search' });
@@ -82,15 +58,10 @@ export default (props) => {
82 58
   }
83 59
   const onLogin = () => {
84 60
     // 用绝对路径
85
-    Taro.navigateTo({ url: '/pages/login/login' });
61
+    Taro.navigateTo({ url: '/components/AuthPage/index' });
86 62
   }
87 63
   return (
88 64
     <view style={{ height: '100%', overflow: 'auto' }}>
89
-
90
-
91
-
92
-
93
-
94 65
       <view className='search' onClick={onSearch}>
95 66
         <input className='searchInput' disabled />
96 67
         <image className='searchicon' src={iconsearch} />
@@ -106,8 +77,7 @@ export default (props) => {
106 77
             <view className='city'>南京</view>
107 78
           <view className='line' />
108 79
         </view>
109
-        
110
-        <scroll-view scroll-x="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll">
80
+          <scroll-view scroll-x="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll">
111 81
 
112 82
         <mp-tabs
113 83
           tabClass='tabs-Unselected'
@@ -410,4 +380,4 @@ export default (props) => {
410 380
       </scroll-view>
411 381
     </view>
412 382
   )
413
-}
383
+})

+ 4
- 6
src/pages/search/search.jsx ファイルの表示

@@ -4,12 +4,10 @@ import './search.less'
4 4
 import CustomNav from '@/components/CustomNav'
5 5
 import '../index/index.less'
6 6
 import Taro from '@tarojs/taro'
7
+import withLayout from '@/layouts'
7 8
 
8
-
9
-
10
-
11
-
12
-export default (props) => {
9
+export default withLayout((props) => {
10
+    const { router, person } = props
13 11
     const goLook=()=>{
14 12
         Taro.navigateTo({ url:'/pages/searchResult/searchResult'});
15 13
     }
@@ -48,4 +46,4 @@ return (
48 46
 
49 47
         </view>
50 48
     )
51
-}
49
+})

+ 6
- 4
src/pages/searchResult/searchResult.jsx ファイルの表示

@@ -12,9 +12,13 @@ import onlove from '../../assets/icons/housemantj/onlove.png'
12 12
 import CustomNav from '@/components/CustomNav'
13 13
 import Taro, { useRouter } from '@tarojs/taro'
14 14
 import './searchResult.less'
15
+import withLayout from '@/layouts'
15 16
 
16 17
 
17
-export default (props) => {
18
+
19
+export default withLayout((props) => {
20
+  const { router, person } = props
21
+
18 22
   // 横向tab
19 23
   const [activeTab, setActiveTab] = useState(0)
20 24
   const { params } = useRouter()
@@ -23,8 +27,6 @@ export default (props) => {
23 27
     if (tabJump) {
24 28
       setActiveTab(tabJump - 0)
25 29
     }
26
-    console.log('---------------------', tabJump);
27
-
28 30
   }, [tabJump])
29 31
 
30 32
   const tabs = [
@@ -306,4 +308,4 @@ export default (props) => {
306 308
       </view>
307 309
     </view>
308 310
   )
309
-}
311
+})

+ 2
- 2
src/routes.js ファイルの表示

@@ -56,7 +56,7 @@ const mainPages = [
56 56
   },
57 57
 ];
58 58
 
59
-// 商户管理页面
59
+// 商户管理页面shop/pages/spread/spreadIndex
60 60
 const shopPages = [
61 61
   {
62 62
     title: '商铺管理',
@@ -65,7 +65,7 @@ const shopPages = [
65 65
   },
66 66
 ];
67 67
 
68
-// 民宿管理页面
68
+// 民宿管理页面hotel/pages/landlord/landlord
69 69
 const hotelPages = [
70 70
   {
71 71
     title: '民宿管理',

+ 2
- 1
src/shop/pages/spread/spreadIndex.config.js ファイルの表示

@@ -2,6 +2,7 @@ export default {
2 2
   navigationBarTitleText: '十公里',
3 3
   navigationStyle: 'custom',
4 4
   usingComponents: {
5
-    "mp-tabbar": "weui-miniprogram/tabbar/tabbar"
5
+    "mp-tabbar": "weui-miniprogram/tabbar/tabbar",
6
+    "mp-tabs": "../../../components/tabs/index"
6 7
   }
7 8
 }

+ 5
- 2
src/shop/pages/spread/spreadIndex.jsx ファイルの表示

@@ -8,8 +8,11 @@ import onShopImg from '@/assets/icons/shopKeeper/订单收入按下.png'
8 8
 import spareadImg from '@/assets/icons/shopKeeper/推广收入.png'
9 9
 import onSpareadImg from '@/assets/icons/shopKeeper/推广收入按下.png'
10 10
 import './spreadIndex.less'
11
+import withLayout from '@/layouts'
12
+
13
+export default withLayout((props) => {
14
+  const { router, person } = props
11 15
 
12
-export default (props) => {
13 16
   const { params } = useRouter()
14 17
   const { tab } = params || {}
15 18
 
@@ -46,4 +49,4 @@ export default (props) => {
46 49
 
47 50
   )
48 51
 
49
-}
52
+})