소스 검색

静态页面

1002884655 3 년 전
부모
커밋
d36f55530a

+ 3
- 3
src/components/ProjectListItem/index.jsx 파일 보기

@@ -11,7 +11,7 @@ export default function ProjectListItem (props) {
11 11
     <view className='components ProjectListItem flex-h' onClick={() => {Taro.navigateTo({ url: `/pages/index/buildingDetail/index?id=${Data.buildingId}` })}}>
12 12
       <view className='Img'>
13 13
         <view>
14
-          <Image mode='aspectFill' className='centerLabel' src={Data.buildingListImg.length ? Data.buildingListImg[0].url : null} />
14
+          <Image mode='aspectFill' className='centerLabel' src={Data.buildingListImg?.length ? Data.buildingListImg[0].url : null} />
15 15
         </view>
16 16
       </view>
17 17
       <view className='flex-item'>
@@ -25,7 +25,7 @@ export default function ProjectListItem (props) {
25 25
         <text className='Address'>{Data.address}</text>
26 26
         <view className='Tags'>
27 27
           {
28
-            Data.buildingTag.map((item, index) => (
28
+            (Data.buildingTag || []).map((item, index) => (
29 29
               <text key={`Tags-${index}`}>{item.tagName}</text>
30 30
             ))
31 31
           }
@@ -35,7 +35,7 @@ export default function ProjectListItem (props) {
35 35
           <text>{Data.shareNum}次分享</text>
36 36
           <view className='Users'>
37 37
             {
38
-              uvList.records.slice(0, 3).map((item, index) => (
38
+              (uvList.records || []).slice(0, 3).map((item, index) => (
39 39
                 <view key={`uv-${index}`}>
40 40
                   <Image mode='aspectFill' className='centerLabel' src={item.photoOravatar} />
41 41
                 </view>

+ 21
- 13
src/components/ProjectListItem/index.scss 파일 보기

@@ -2,7 +2,7 @@
2 2
   padding-bottom: 30px;
3 3
   border-bottom: 2px solid rgba(0, 0, 0, 0.1);
4 4
   > .Img {
5
-    width: 260px;
5
+    width: 280px;
6 6
     position: relative;
7 7
     overflow: hidden;
8 8
     margin-right: 20px;
@@ -26,8 +26,8 @@
26 26
         margin-right: 10px;
27 27
         > text {
28 28
           display: block;
29
-          font-size: 28px;
30
-          font-weight: bold;
29
+          font-size: 32px;
30
+          font-weight: 600;
31 31
           color: #333;
32 32
           line-height: 40px;
33 33
           white-space: nowrap;
@@ -36,7 +36,7 @@
36 36
         }
37 37
       }
38 38
       > text {
39
-        font-size: 24px;
39
+        font-size: 22px;
40 40
         line-height: 40px;
41 41
         color: #333;
42 42
         &:last-child {
@@ -46,16 +46,18 @@
46 46
     }
47 47
     > .Address {
48 48
       display: block;
49
-      font-size: 24px;
49
+      font-size: 22px;
50 50
       color: #666;
51
-      line-height: 40px;
51
+      line-height: 1;
52 52
       white-space: nowrap;
53 53
       overflow: hidden;
54 54
       text-overflow: ellipsis;
55
+      margin-top: 20px;
55 56
     }
56 57
     > .Tags {
57 58
       font-size: 0;
58 59
       white-space: nowrap;
60
+      margin-top: 18px;
59 61
       > text {
60 62
         display: inline-block;
61 63
         vertical-align: middle;
@@ -64,23 +66,29 @@
64 66
         line-height: 28px;
65 67
         background: rgba(251, 171, 87, 0.3);
66 68
         color: #333;
67
-        margin-right: 10px;
69
+        margin-left: 20px;
70
+        &:first-child {
71
+          margin-left: 0;
72
+        }
68 73
       }
69 74
     }
70 75
     > .ShareInfo {
71 76
       font-size: 0;
72 77
       white-space: nowrap;
73
-      margin-top: 10px;
78
+      margin-top: 20px;
74 79
       > text {
75 80
         display: inline-block;
76 81
         vertical-align: middle;
77
-        font-size: 24px;
82
+        font-size: 16px;
78 83
         color: #333;
79
-        line-height: 40px;
84
+        line-height: 1;
80 85
         margin-left: 10px;
81 86
         &:first-child {
82 87
           margin-left: 0;
83 88
         }
89
+        &.iconfont {
90
+          font-size: 20px;
91
+        }
84 92
       }
85 93
       > .Users {
86 94
         display: inline-block;
@@ -91,11 +99,11 @@
91 99
         > view {
92 100
           display: inline-block;
93 101
           vertical-align: middle;
94
-          width: 40px;
95
-          height: 40px;
102
+          width: 24px;
103
+          height: 24px;
96 104
           background: #eee;
97 105
           border-radius: 100%;
98
-          margin-left: -10px;
106
+          margin-left: -6px;
99 107
           position: relative;
100 108
           overflow: hidden;
101 109
           &:nth-child(1) {

+ 31
- 2
src/pages/index/buildingList/index.jsx 파일 보기

@@ -4,14 +4,43 @@ import './index.scss'
4 4
 import { ScrollView } from '@tarojs/components'
5 5
 import '../../../assets/css/iconfont.css'
6 6
 import ProjectListItem from '../../../components/ProjectListItem/index'
7
+import { useSelector } from 'react-redux'
8
+import { fetch } from '@/utils/request'
9
+import { API_INDEX_PROJECTS } from '@/constants/api'
7 10
 
8 11
 export default withLayout((props) => {
9 12
 
10
-  // const [PageProps] = useState(props)
11
-  const [PageList, setPageList] = useState(['', '', '', '', '', '', '', '', '', '', '', '', ''])
13
+  const [PageProps] = useState(props)
14
+  const city = useSelector(state => state.city)
15
+  const [PageList, setPageList] = useState([])
16
+  const [pageNum, setPageNum] = useState(null)
17
+  const [pageSize] = useState(10)
12 18
   const [IsPull, setPull] = useState(false)
19
+  const [DataLock, setDataLock] = useState(false)
13 20
   const [PullTimer, setPullTimer] = useState(null)
14 21
 
22
+  useEffect(() => {
23
+    if(city.curCity.name) {
24
+      setPageNum(1)
25
+    }
26
+  }, [city])
27
+
28
+  useEffect(() => {
29
+    if(pageNum !== null && !DataLock) {
30
+      setDataLock(true)
31
+      GetProjectList()
32
+    }
33
+  }, [pageNum])
34
+
35
+  const GetProjectList = () => { // 获取项目列表
36
+    fetch({url: API_INDEX_PROJECTS, method: 'get', payload: {cityId: city.curCity.id, pageNum, pageSize}}).then((res) => {
37
+      setPageList(res.records || [])
38
+      setDataLock(false)
39
+    }).catch(() => {
40
+      setDataLock(false)
41
+    })
42
+  }
43
+
15 44
   const PageRefresh = () => { // 页面下拉刷新回调
16 45
     setPull(true)
17 46
   }

+ 6
- 2
src/pages/index/buildingList/index.scss 파일 보기

@@ -9,17 +9,21 @@
9 9
       background: #f8f8f8;
10 10
       font-size: 0;
11 11
       white-space: nowrap;
12
-      border-radius: 44px;
12
+      border-radius: 78px;
13 13
       >text {
14 14
         display: inline-block;
15 15
         vertical-align: middle;
16 16
         font-size: 20px;
17 17
         color: #999;
18 18
         margin-left: 10px;
19
-        line-height: 44px;
19
+        line-height: 78px;
20 20
         &:first-child {
21 21
           margin-left: 0;
22 22
         }
23
+        &.iconfont {
24
+          font-size: 24px;
25
+          color: #666;
26
+        }
23 27
       }
24 28
     }
25 29
   }

+ 5
- 1
src/pages/index/components/Banner/index.scss 파일 보기

@@ -1,7 +1,7 @@
1 1
 .components.Banner {
2 2
   width: 100%;
3 3
   height: 100%;
4
-  border-radius: 10px;
4
+  border-radius: 8px;
5 5
   background: #eee;
6 6
   position: relative;
7 7
   overflow: hidden;
@@ -9,9 +9,13 @@
9 9
     width: 100%;
10 10
     height: 100%;
11 11
     .swiper-item {
12
+      border-radius: 8px;
13
+      position: relative;
14
+      overflow: hidden;
12 15
       > image {
13 16
         width: 100%;
14 17
         height: 100%;
18
+        border-radius: 8px;
15 19
       }
16 20
     }
17 21
   }

+ 7
- 4
src/pages/index/components/HotRecommend/index.scss 파일 보기

@@ -13,7 +13,7 @@
13 13
       align-items: center;
14 14
       background: rgba(0, 0, 0, 0.08);
15 15
       > view {
16
-        font-size: 30px;
16
+        font-size: 28px;
17 17
         line-height: 70px;
18 18
         text-align: center;
19 19
         font-weight: bold;
@@ -29,6 +29,7 @@
29 29
       padding: 20px;
30 30
       > .flex-h {
31 31
         align-items: center;
32
+        margin-top: 10px;
32 33
         > .flex-item {
33 34
           font-size: 32px;
34 35
           color: #193c83;
@@ -40,7 +41,7 @@
40 41
           & + text {
41 42
             font-size: 30px;
42 43
             color: #193c83;
43
-            line-height: 60px;
44
+            line-height: 56px;
44 45
             box-sizing: border-box;
45 46
             border: 2px solid #193c83;
46 47
             border-radius: 30px;
@@ -51,9 +52,11 @@
51 52
       }
52 53
       >text {
53 54
         font-size: 28px;
54
-        line-height: 40px;
55
+        line-height: 1;
55 56
         display: block;
56
-        padding-bottom: 10px;
57
+        padding-bottom: 20px;
58
+        margin-top: 6px;
59
+        text-indent: 26px;
57 60
       }
58 61
     }
59 62
   }

+ 2
- 1
src/pages/index/components/Location/index.scss 파일 보기

@@ -4,10 +4,11 @@
4 4
   overflow: hidden;
5 5
   min-height: 10px;
6 6
   box-shadow: 0px 8px 10px 0px rgba(0, 0, 0, 0.08);
7
+  border-radius: 78px;
7 8
   align-items: center;
8 9
   >text {
9 10
     font-size: 20px;
10
-    line-height: 80px;
11
+    line-height: 78px;
11 12
     margin-left: 10px;
12 13
     &:first-child {
13 14
       margin-left: 20px;

+ 4
- 3
src/pages/index/components/Menu/index.scss 파일 보기

@@ -1,6 +1,7 @@
1 1
 .components.Menu {
2 2
   position: relative;
3 3
   overflow: hidden;
4
+  margin-top: 50px;
4 5
   > view {
5 6
     width: 100%;
6 7
     padding-bottom: 50%;
@@ -26,10 +27,10 @@
26 27
             position: relative;
27 28
             overflow: hidden;
28 29
             width: 20%;
29
-            margin-top: 20px;
30
+            margin-bottom: 30px;
30 31
             > image {
31
-              width: 88px;
32
-              height: 88px;
32
+              width: 90px;
33
+              height: 90px;
33 34
               display: block;
34 35
               margin: 0 auto;
35 36
             }

+ 4
- 1
src/pages/index/index.scss 파일 보기

@@ -11,7 +11,7 @@
11 11
         padding: 0 30px;
12 12
         position: relative;
13 13
         overflow: visible;
14
-        margin-top: 24px;
14
+        margin-top: 20px;
15 15
       }
16 16
       > .Banner {
17 17
         padding: 0 30px;
@@ -38,6 +38,9 @@
38 38
         position: relative;
39 39
         overflow: hidden;
40 40
       }
41
+      >.HotRecommend {
42
+        margin-top: -20px;
43
+      }
41 44
       > .AllProject {
42 45
         .ToMap {
43 46
           margin-left: 20px;