张延森 hace 5 años
padre
commit
a5e47bed43

+ 4
- 0
config/index.js Ver fichero

@@ -49,6 +49,10 @@ const config = {
49 49
   },
50 50
   copy: {
51 51
     patterns: [
52
+      {
53
+        from: 'src/onlineSelling/assets/',
54
+        to: 'dist/onlineSelling/assets/'
55
+      }
52 56
     ],
53 57
     options: {
54 58
     }

+ 2
- 16
project.config.json Ver fichero

@@ -48,24 +48,10 @@
48 48
 			"list": [
49 49
 				{
50 50
 					"id": -1,
51
-					"name": "pages/im/list/index",
52
-					"pathName": "pages/im/list/index",
51
+					"name": "pages/houseList/index",
52
+					"pathName": "onlineSelling/pages/houseList/index",
53 53
 					"query": "",
54 54
 					"scene": null
55
-				},
56
-				{
57
-					"id": -1,
58
-					"name": "pages/activity/detail/assistance",
59
-					"pathName": "pages/activity/detail/assistance",
60
-					"query": "id=85",
61
-					"scene": null
62
-				},
63
-				{
64
-					"id": -1,
65
-					"name": "pages/project/detail/index",
66
-					"pathName": "pages/project/detail/index",
67
-					"query": "id=93e6d86b8b48e3ea359084e3ceaf2d03",
68
-					"scene": null
69 55
 				}
70 56
 			]
71 57
 		}

BIN
src/onlineSelling/assets/explain.png Ver fichero


BIN
src/onlineSelling/assets/norecord.png Ver fichero


BIN
src/onlineSelling/assets/notice.png Ver fichero


BIN
src/onlineSelling/assets/record.png Ver fichero


BIN
src/onlineSelling/assets/screen.png Ver fichero


BIN
src/onlineSelling/assets/share.png Ver fichero


+ 1
- 1
src/onlineSelling/components/HouseGrid/unit.scss Ver fichero

@@ -1,6 +1,6 @@
1 1
 .unit {
2 2
   .head {
3
-    margin: 20rpx 0;
3
+    margin-bottom: 20rpx;
4 4
     padding: 0 30rpx;
5 5
     font-size: 32rpx;
6 6
     line-height: 1.8em;

+ 10
- 0
src/onlineSelling/components/NamedIcon/index.js Ver fichero

@@ -0,0 +1,10 @@
1
+import { Text } from "@tarojs/components";
2
+import './index.scss'
3
+
4
+export default function NamedIcon(props) {
5
+  const bg = `background: url(../../assets/${props.name}.png); background-size:cover;`
6
+  const size = props.size || 48
7
+  const bound = `width: ${size}rpx; height: ${size}rpx;`
8
+
9
+  return <Text className="namedicon" style={`${bg} ${bound}`}></Text>
10
+}

+ 4
- 0
src/onlineSelling/components/NamedIcon/index.scss Ver fichero

@@ -0,0 +1,4 @@
1
+.namedicon {
2
+  display: inline-block;
3
+  vertical-align: middle;
4
+}

+ 47
- 28
src/onlineSelling/components/TimeTicker/index.js Ver fichero

@@ -1,28 +1,47 @@
1
-import { useState, useEffect } from '@tarojs/taro'
2
-import { View, Text } from '@tarojs/components'
3
-import dayjs from 'dayjs'
4
-import './style.scss'
5
-
6
-export default function TimeTicker(props) {
7
-    const [tm, setTm] = useState(0)
8
-
9
-    useEffect(() => {
10
-        const now = dayjs()
11
-        const end = dayjs(props.endTime || now)
12
-
13
-        const tk = end.isAfter(now) ? setInterval(() => {
14
-            setTm(end.diff(now))
15
-        }, props.interval || 60000) : undefined
16
-
17
-        return () => clearInterval(tk)
18
-    }, props.endTime)
19
-
20
-    const tips = props.translate(tm)
21
-
22
-    return (
23
-        <View className="timeticker">
24
-            <Text></Text>
25
-            <Text>{tips}</Text>
26
-        </View>
27
-    )
28
-}
1
+import Taro, { Component } from '@tarojs/taro'
2
+import { View, Text } from '@tarojs/components'
3
+import dayjs from 'dayjs'
4
+import { formateLeftTime } from '@/utils/tools'
5
+import './index.scss'
6
+
7
+export default class TimeTicker extends Component {
8
+
9
+    state = {
10
+      tips: '',
11
+    }
12
+
13
+    tk = undefined
14
+
15
+    componentWillMount() {
16
+      this.tk = setInterval(() => {
17
+        const now = dayjs()
18
+        const start = dayjs(this.props.startTime || now)
19
+        const end = dayjs(this.props.endTime || now)
20
+
21
+        const tm = end.diff(start)
22
+        const translate = this.props.translate || (x => formateLeftTime(x, 'min'))
23
+
24
+        if (tm >= 0) {
25
+          this.setState({
26
+            tips: translate(tm)
27
+          })
28
+        }
29
+
30
+      }, this.props.interval || 1000)
31
+    }
32
+
33
+    componentWillUnmount() {
34
+      if (tk) {
35
+        clearInterval(tk)
36
+      }
37
+    }
38
+
39
+    render() {
40
+        return (
41
+            <View className="timeticker">
42
+                <Text></Text>
43
+                <Text>{tips}</Text>
44
+            </View>
45
+        )
46
+    }
47
+}

src/onlineSelling/components/TimeTicker/style.scss → src/onlineSelling/components/TimeTicker/index.scss Ver fichero


+ 36
- 7
src/onlineSelling/pages/houseList/index.js Ver fichero

@@ -1,7 +1,8 @@
1 1
 import Taro, { Component } from '@tarojs/taro'
2
-import { View } from '@tarojs/components'
2
+import { View, ScrollView, Button } from '@tarojs/components'
3 3
 import TimeTicker from '../../components/TimeTicker'
4 4
 import Unit from '../../components/HouseGrid/Unit'
5
+import NamedIcon from '../../components/NamedIcon'
5 6
 import { formateLeftTime } from '@/utils/tools'
6 7
 
7 8
 import './index.scss'
@@ -186,7 +187,7 @@ export default class HouseList extends Component {
186 187
   }
187 188
 
188 189
   formateTM (dt) {
189
-    return `距离预选结束还有${formateLeftTime(dt)}`
190
+    return `距离预选结束还有 ${formateLeftTime(dt, 'min')}`
190 191
   }
191 192
 
192 193
   renderBar () {
@@ -196,8 +197,12 @@ export default class HouseList extends Component {
196 197
           <TimeTicker endTime="2020-02-12" translate={this.formateTM.bind(this)} />
197 198
         </View>
198 199
         <View className="action">
199
-          <View>帮助</View>
200
-          <View>过滤</View>
200
+          <View>
201
+            <NamedIcon name="explain" size={50} />
202
+          </View>
203
+          <View>
204
+            <NamedIcon name="screen" size={50} />
205
+          </View>
201 206
         </View>
202 207
       </View>
203 208
     )
@@ -207,21 +212,45 @@ export default class HouseList extends Component {
207 212
     const { testData } = this.state
208 213
 
209 214
     return (
210
-      <View>
215
+      <ScrollView className="container" scrollY scrollWithAnimation>
211 216
       {
212 217
         testData.map((item) => {
213 218
           return <Unit key={item.unitId} dataset={item} />
214 219
         })
215 220
       }
221
+      </ScrollView>
222
+    )
223
+  }
224
+
225
+  renderBlank() {
226
+    return (
227
+      <View className="container">
228
+        <View className="blank"></View>
229
+      </View>      
230
+    )
231
+  }
232
+
233
+  renderBottom() {
234
+    return (
235
+      <View className="bottombar">
236
+        <Button className="btn record">
237
+          <NamedIcon name="record" size="42"/>
238
+          <Text className="txt">选房记录</Text>
239
+        </Button>
240
+        <Button className="btn share">
241
+          <NamedIcon name="share" size="42"/>
242
+          <Text className="txt">分享</Text>
243
+        </Button>
216 244
       </View>
217 245
     )
218 246
   }
219 247
 
220 248
   render () {
221 249
     return (
222
-      <View>
250
+      <View className="houselist">
223 251
         {this.renderBar()}
224
-        {this.renderHouses()}
252
+        {this.renderBlank()}
253
+        {this.renderBottom()}
225 254
       </View>
226 255
     )
227 256
   }

+ 71
- 17
src/onlineSelling/pages/houseList/index.scss Ver fichero

@@ -1,22 +1,76 @@
1
-.topbar {
2
-  height: 64rpx;
3
-  font-size: 24rpx;
4
-  line-height: 64rpx;
5
-  display: flex;
6
-  margin-top: 24px;
1
+.houselist {
2
+  height: 100vh;
7 3
 
8
-  .body {
9
-    flex: auto;
10
-    color: #999;
11
-    background:rgba(248,248,248,1);
12
-    padding-left: 30rpx;
4
+  .topbar {
5
+    height: 64rpx;
13 6
     font-size: 24rpx;
7
+    line-height: 64rpx;
8
+    display: flex;
9
+    margin: 24px 0;
10
+  
11
+    .body {
12
+      flex: auto;
13
+      color: #999;
14
+      background:rgba(248,248,248,1);
15
+      padding-left: 30rpx;
16
+      font-size: 24rpx;
17
+    }
18
+  
19
+    .action {
20
+      flex: none;
21
+      width: 30%;
22
+      display: flex;
23
+      justify-content: space-around;
24
+    }
14 25
   }
15
-
16
-  .action {
17
-    flex: none;
18
-    width: 30%;
26
+  
27
+  .bottombar {
28
+    height: 168rpx;
29
+    box-shadow:0px 16px 48px 0px rgba(0, 0, 0, 0.12);
30
+    width: 100%;
31
+    padding: 0 35rpx;
32
+    overflow: hidden;
19 33
     display: flex;
20
-    justify-content: space-around;
34
+    align-items: center;
35
+
36
+    .btn {
37
+      height: 88rpx;
38
+      flex: none;
39
+      border-radius: 10rpx;
40
+
41
+      .txt {
42
+        display: inline-block;
43
+        padding-left: 10rpx;
44
+        font-size: 30rpx;
45
+        line-height: 88rpx;
46
+        text-align: center;
47
+      }
48
+    }
49
+
50
+    .record {
51
+      background: #f2f2f2;
52
+      color: #333;
53
+      width: 58%;
54
+    }
55
+
56
+    .share {
57
+      background: #BB9C79;
58
+      color: #fff;
59
+      width: 32%;
60
+    }
61
+  }
62
+
63
+  .container {
64
+    // top + margin + bottom
65
+    height: calc(100% - 280rpx);
66
+
67
+    .blank {
68
+      width: 280rpx;
69
+      height: 220rpx;
70
+      background: url('../../assets/norecord.png');
71
+      background-size: cover;
72
+      transform: translateY(50%);
73
+      margin: 0 auto;
74
+    }
21 75
   }
22
-}
76
+}

+ 7
- 2
src/utils/tools.js Ver fichero

@@ -139,7 +139,7 @@ export function parseQueryString(queryString) {
139 139
  * 格式化剩余时间为 xx天xx小时xx分xx秒
140 140
  * @param {int} leftTime 时间毫秒数
141 141
  */
142
-export function formateLeftTime(leftTime) {
142
+export function formateLeftTime(leftTime, unit) {
143 143
   const nd = 1000 * 24 * 60 * 60;
144 144
   const nh = 1000 * 60 * 60;
145 145
   const nm = 1000 * 60;
@@ -150,7 +150,12 @@ export function formateLeftTime(leftTime) {
150 150
   const min = Math.floor(leftTime % nd % nh / nm);
151 151
   const sec = Math.floor(leftTime % nd % nh % nm / ns);
152 152
 
153
-  return `${day}天${hour}小时${min}分${sec}秒`
153
+  switch (unit) {
154
+    case 'min':
155
+      return `${day}天${hour}小时${min}分`
156
+    default:
157
+      return `${day}天${hour}小时${min}分${sec}秒`
158
+  }
154 159
 }
155 160
 
156 161
 export function getDownloadURL(url, type) {