李志伟 vor 3 Jahren
Ursprung
Commit
ccda14a02d

+ 1
- 2
src/app.config.js Datei anzeigen

@@ -9,8 +9,7 @@ export default {
9 9
     'pages/login/login',
10 10
     'pages/shopKeeper/shopKeeper',
11 11
     'pages/spread/spreadMoney',
12
-    'pages/landlord/income/income',
13
-    'pages/landlord/houseManage/houseManage',
12
+    'pages/landlord/AllLandlord/AllLandlord',
14 13
     'pages/PayOrder/index',
15 14
     'pages/MineUserAll/ContactMe/index',
16 15
     'pages/MineUserAll/HomeLogo/index',

+ 39
- 0
src/components/CustTabBar/index.jsx Datei anzeigen

@@ -0,0 +1,39 @@
1
+
2
+import React from 'react'
3
+import './style.less'
4
+
5
+export default (props) => {
6
+  const { extClass = '', current, onChange, children } = props
7
+
8
+  const handleTabChange = (e, index) => {
9
+    if (e) {
10
+      e.detail = {
11
+        ...e.detail || {},
12
+        index,
13
+      }
14
+      // Object.assign(e.detail, { index })
15
+    }
16
+
17
+    if (onChange) {
18
+      onChange(e)
19
+    }
20
+  }
21
+
22
+  const className = `weui-tabbar cust-tabbar ${extClass}`
23
+
24
+  return (
25
+    <view className={className}>
26
+      {
27
+        React.Children.toArray(children).map((child, index) => {
28
+          const itemClass = `weui-tabbar__item cust-tabbar-item`
29
+
30
+          return (
31
+            <view className={itemClass} onClick={(e) => handleTabChange(e, index)}>
32
+              {child}
33
+            </view>
34
+          )
35
+        })
36
+      }
37
+    </view>
38
+  )
39
+}

+ 6
- 0
src/components/CustTabBar/style.less Datei anzeigen

@@ -0,0 +1,6 @@
1
+.cust-tabbar {
2
+  &-item {
3
+    font-size: 1em;
4
+    padding: 0;
5
+  }
6
+}

src/pages/landlord/houseManage/houseManage.jsx → src/components/Landlord/HouseManage/houseManage.jsx Datei anzeigen

@@ -1,7 +1,5 @@
1 1
 import Taro from '@tarojs/taro'
2 2
 import CustomNav from '@/components/CustomNav'
3
-import income from '../../../assets/icons/landlord/我的收入.png'
4
-import house from '../../../assets/icons/landlord/房源管理按下.png'
5 3
 import pImg from '../../../assets/icons/landlord/定位 位置.png'
6 4
 import see from '../../../assets/icons/landlord/查看入住人.png'
7 5
 import share from '../../../assets/icons/landlord/分享链接.png'
@@ -47,14 +45,6 @@ export default (props) => {
47 45
       <view className='addHouse'>
48 46
         <image className='addImg' src={addImg} />添加房源
49 47
       </view>
50
-      <view className='bottomTab'>
51
-          <view className='incometab' onClick={toIncome}>
52
-            <image className='incomes' src={income} /><text>我的收入</text>
53
-          </view>
54
-          <view className='housetab'>
55
-            <image className='house' src={house} /><text>房源管理</text>
56
-          </view>
57
-        </view>
58 48
     
59 49
       </view>
60 50
   )

src/pages/landlord/houseManage/houseManage.less → src/components/Landlord/HouseManage/houseManage.less Datei anzeigen

@@ -87,32 +87,3 @@
87 87
     top: 6px;
88 88
   }
89 89
 }
90
-.bottomTab{
91
-  width: 100%;
92
-  height: 98px;
93
-  background: #FFFFFF;
94
-  box-shadow: 0px -4px 6px 0px rgba(0, 0, 0, 0.08);
95
-  display: inline-block;
96
-  position: absolute;
97
-  bottom: 0;
98
-  line-height: 98px;
99
-  font-size: 30px;     
100
-  font-weight: bold;
101
-  color: #202020;
102
-  .incometab{
103
-    display: inline-block;
104
-    margin-left: 17%;
105
-    color: #666;
106
-  }
107
-  .housetab{
108
-    margin-right:17%;
109
-    float: right;
110
-  }
111
-  image{
112
-    width: 31px;
113
-    height: 31px;
114
-    position: relative;
115
-    top: 7px;
116
-    margin-right: 12px;
117
-  }
118
-}

src/pages/landlord/income/income.jsx → src/components/Landlord/Income/income.jsx Datei anzeigen

@@ -3,8 +3,6 @@ import CustomNav from '@/components/CustomNav'
3 3
 import './income.less'
4 4
 import eyes from '../../../assets/icons/shopKeeper/小眼睛.png'
5 5
 import ceyes from '../../../assets/icons/shopKeeper/小眼睛-闭上.png'
6
-import income from '../../../assets/icons/landlord/我的收入按下.png'
7
-import house from '../../../assets/icons/landlord/房源管理.png'
8 6
 import sImg from '../../../assets/icons/landlord/我的收入2.png'
9 7
 
10 8
 
@@ -92,15 +90,7 @@ export default (props) => {
92 90
           <view className='botton'>已经到底了~</view>
93 91
         </scroll-view>        
94 92
       </view>
95
-      <view className='bottomTab'>
96
-          <view className='incometab'>
97
-            <image className='incomes' src={income} /><text>我的收入</text>
98
-          </view>
99
-          <view className='housetab' onClick={toHouse}>
100
-            <image className='house' src={house} /><text>房源管理</text>
101
-          </view>
102
-        </view>
103
-    
93
+      
104 94
       </view>
105 95
   )
106 96
 }

src/pages/landlord/income/income.less → src/components/Landlord/Income/income.less Datei anzeigen

@@ -118,32 +118,3 @@
118 118
   text-align: center;
119 119
   padding:40px 0 100px 0;
120 120
 }
121
-.bottomTab{
122
-  width: 100%;
123
-  height: 98px;
124
-  background: #FFFFFF;
125
-  box-shadow: 0px -4px 6px 0px rgba(0, 0, 0, 0.08);
126
-  display: inline-block;
127
-  position: absolute;
128
-  bottom: 0;
129
-  line-height: 98px;
130
-  font-size: 30px;     
131
-  font-weight: bold;
132
-  color: #202020;
133
-  .incometab{
134
-    display: inline-block;
135
-    margin-left: 17%;
136
-  }
137
-  .housetab{
138
-    color: #666;
139
-    margin-right:17%;
140
-    float: right;
141
-  }
142
-  image{
143
-    width: 31px;
144
-    height: 31px;
145
-    position: relative;
146
-    top: 7px;
147
-    margin-right: 12px;
148
-  }
149
-}

+ 8
- 0
src/pages/landlord/AllLandlord/AllLandlord.config.js Datei anzeigen

@@ -0,0 +1,8 @@
1
+export default {
2
+  navigationBarTitleText: '十公里',
3
+  navigationStyle: 'custom',
4
+  styleIsolation: 'shared',
5
+  usingComponents: {
6
+    "mp-tabbar": "weui-miniprogram/tabbar/tabbar"
7
+  }
8
+}

+ 49
- 0
src/pages/landlord/AllLandlord/AllLandlord.jsx Datei anzeigen

@@ -0,0 +1,49 @@
1
+import React, { useState, useEffect } from 'react'
2
+import { useRouter } from '@tarojs/taro'
3
+import HouseManage from '@/components/Landlord/HouseManage/houseManage'
4
+import Income from '@/components/Landlord/Income/income'
5
+import TabBar from '@/components/CustTabBar'
6
+import incomeImg from '@/assets/icons/landlord/我的收入.png'
7
+import onincomeImg from '@/assets/icons/landlord/我的收入按下.png'
8
+import houseImg from '@/assets/icons/landlord/房源管理.png'
9
+import onhouseImg from '@/assets/icons/landlord/房源管理按下.png'
10
+import './AllLandlord.less'
11
+
12
+export default (props) => {
13
+  const { params } = useRouter()
14
+  const { tab } = params || {}
15
+
16
+  const [currentTab, setCurrentTab] = useState(0)
17
+
18
+  const handleTabChange = (e) => {
19
+    const { index } = e.detail
20
+    setCurrentTab(index)
21
+  }
22
+
23
+  useEffect(() => {
24
+    if (tab) {
25
+      setCurrentTab(tab - 0)
26
+    }
27
+  }, [tab])
28
+
29
+  return (
30
+    <view className='page-index'>
31
+      <view className='index-container'>
32
+        {currentTab === 0 && <Income />}
33
+        {currentTab === 1 && <HouseManage />}
34
+      </view>
35
+      <view className='index-tabbar'>
36
+        <TabBar extClass='custom-tabbar bottomTab' current={currentTab} onChange={handleTabChange}>
37
+          <view className={`${currentTab === 0 ? 'incomeTab' : ''}`}>
38
+            <image className='incomes' src={currentTab === 0 ? onincomeImg : incomeImg} /><text>我的收入</text>
39
+          </view>
40
+          <view className={`${currentTab === 1 ? 'houseTab' : ''}`}>
41
+            <image className='house' src={currentTab === 1 ? onhouseImg : houseImg} /><text>房源管理</text>
42
+          </view>
43
+        </TabBar>
44
+      </view>
45
+    </view>
46
+
47
+  )
48
+
49
+}

+ 20
- 0
src/pages/landlord/AllLandlord/AllLandlord.less Datei anzeigen

@@ -0,0 +1,20 @@
1
+.bottomTab{
2
+  height: 98px;
3
+  line-height: 98px;
4
+  font-size: 30px;     
5
+  font-weight: bold;
6
+  color: #202020;
7
+  .incomeTab{
8
+    color: #666;
9
+  }
10
+  .houseTab{
11
+    color: #666;
12
+  }
13
+  image{
14
+    width: 31px;
15
+    height: 31px;
16
+    position: relative;
17
+    top: 7px;
18
+    margin-right: 12px;
19
+  }
20
+}

+ 0
- 4
src/pages/landlord/houseManage/houseManage.config.js Datei anzeigen

@@ -1,4 +0,0 @@
1
-export default {
2
-  navigationBarTitleText: '十公里周边指南',
3
-  navigationStyle: 'custom',
4
-}

+ 0
- 4
src/pages/landlord/income/income.config.js Datei anzeigen

@@ -1,4 +0,0 @@
1
-export default {
2
-  navigationBarTitleText: '十公里',
3
-  navigationStyle: 'custom',
4
-}