张延森 5 年之前
父節點
當前提交
87d7fbb26c
共有 3 個文件被更改,包括 71 次插入2 次删除
  1. 21
    0
      src/components/Loading/index.js
  2. 41
    0
      src/components/Loading/index.scss
  3. 9
    2
      src/onlineSelling/pages/houseList/index.js

+ 21
- 0
src/components/Loading/index.js 查看文件

@@ -0,0 +1,21 @@
1
+import { View } from "@tarojs/components";
2
+
3
+import './index.scss'
4
+
5
+export default function Loading(props) {
6
+  const size = props.size || '200';
7
+  const color = props.color || '#333';
8
+
9
+  const boxStyle = `width: ${size}px; height: ${size}px;`
10
+  const loadingStyle = `border-color: transparent ${color} transparent ${color};`
11
+  const textStyle = `color: ${color};`
12
+
13
+  const text = props.text || 'LOADING';
14
+
15
+  return (
16
+    <View className="loading-box" style={boxStyle}>
17
+      <View className="loading" style={loadingStyle}></View>
18
+      <View className="loading-text" style={textStyle}>{text}</View>
19
+    </View>
20
+  )
21
+}

+ 41
- 0
src/components/Loading/index.scss 查看文件

@@ -0,0 +1,41 @@
1
+.loading-box {
2
+  // width: 200px;
3
+  // height: 200px;
4
+  position: relative;
5
+  margin: 0 auto;
6
+
7
+  .loading {
8
+    width: calc(100% - 4px);
9
+    height: calc(100% - 4px);
10
+    border-radius: 100%;
11
+    border: 4px solid transparent;
12
+    border-color: transparent #333 transparent #333;
13
+    animation: rotate-loading 1.5s linear 0s infinite normal;
14
+    transform-origin: 50% 50%;
15
+  }
16
+
17
+  .loading-text {
18
+    width: calc(100% - 4px);
19
+    animation: loading-text-opacity 2s linear 0s infinite normal;
20
+    color: #333;
21
+    font-size: 20px;
22
+    font-weight: bold;
23
+    margin-top: 40%;
24
+    opacity: 0;
25
+    position: absolute;
26
+    text-align: center;
27
+    top: 0;
28
+  }
29
+
30
+  @keyframes rotate-loading {
31
+    0%  {transform: rotate(0deg);}
32
+    100% {transform: rotate(360deg);}
33
+  }
34
+
35
+  @keyframes loading-text-opacity {
36
+    0%  {opacity: 0}
37
+    20% {opacity: 0}
38
+    50% {opacity: 1}
39
+    100%{opacity: 0}
40
+  }
41
+}

+ 9
- 2
src/onlineSelling/pages/houseList/index.js 查看文件

@@ -22,6 +22,7 @@ import { getCanvasConfig } from '@/utils/tools'
22 22
 import { getCardDetail } from '@/services/card'
23 23
 import Consultant from '@/components/consultant'
24 24
 import './index.scss'
25
+import { Loading } from '@/components/Loading'
25 26
 
26 27
 @connect(s => s.user)
27 28
 export default class HouseList extends Component {
@@ -51,7 +52,7 @@ export default class HouseList extends Component {
51 52
     consultData: {}, // 分享的置业顾问信息
52 53
     consultShow: false,  // 置业顾问悬浮框显示隐藏
53 54
     noRecord: false,
54
-
55
+    loading: true,
55 56
   }
56 57
 
57 58
   componentDidShow() {
@@ -119,7 +120,8 @@ export default class HouseList extends Component {
119 120
     }
120 121
     queryHouseList(params).then(res => {
121 122
       this.setState({
122
-        houseList: this.groupHouseList(res) || []
123
+        houseList: this.groupHouseList(res) || [],
124
+        loading: false,
123 125
       }, () => {
124 126
         Taro.hideToast()
125 127
       })
@@ -576,8 +578,13 @@ export default class HouseList extends Component {
576 578
       posterData,
577 579
       posterConfig,
578 580
       noRecord,
581
+      loading,
579 582
     } = this.state
580 583
 
584
+    if (loading) {
585
+      return <View style="margin: 80px auto;"><Loading color="#BB9C79" size={100}/></View>
586
+    }
587
+
581 588
     const { userInfo: { person } } = this.props
582 589
 
583 590
     const showCircleBtn = posterData && posterData.qrcode