소스 검색

静态页面

1002884655 4 년 전
부모
커밋
45d2bc6076

+ 15
- 8
project.config.json 파일 보기

@@ -5,23 +5,30 @@
5 5
 	"appid": "wx1a0fa56e6d0b78b3",
6 6
 	"setting": {
7 7
 		"urlCheck": false,
8
-		"scopeDataCheck": false,
9
-		"coverView": true,
10 8
 		"es6": false,
9
+		"enhance": false,
11 10
 		"postcss": false,
12
-		"compileHotReLoad": false,
13 11
 		"preloadBackgroundData": false,
14 12
 		"minified": false,
15
-		"autoAudits": false,
16 13
 		"newFeature": false,
14
+		"coverView": true,
15
+		"nodeModules": false,
16
+		"autoAudits": false,
17
+		"showShadowRootInWxmlPanel": true,
18
+		"scopeDataCheck": false,
17 19
 		"uglifyFileName": false,
20
+		"checkInvalidKey": true,
21
+		"checkSiteMap": true,
18 22
 		"uploadWithSourceMap": true,
23
+		"compileHotReLoad": false,
24
+		"babelSetting": {
25
+			"ignore": [],
26
+			"disablePlugins": [],
27
+			"outputPath": ""
28
+		},
19 29
 		"useIsolateContext": true,
20
-		"nodeModules": false,
21
-		"enhance": false,
22 30
 		"useCompilerModule": false,
23
-		"userConfirmedUseCompilerModuleSwitch": false,
24
-		"showShadowRootInWxmlPanel": true
31
+		"userConfirmedUseCompilerModuleSwitch": false
25 32
 	},
26 33
 	"compileType": "miniprogram",
27 34
 	"simulatorType": "wechat",

+ 25
- 0
src/pages/index/components/IndexBanner/index.jsx 파일 보기

@@ -0,0 +1,25 @@
1
+import React, { useState, useEffect } from 'react'
2
+import './index.scss'
3
+import { Swiper, SwiperItem, Image } from '@tarojs/components'
4
+
5
+export default function IndexBanner (props) {
6
+  const { List = [] } = props
7
+  return (
8
+    <view className='components IndexBanner'>
9
+      <Swiper autoplay={true} interval={2000} indicator-dots={true}>
10
+        {
11
+          List.map((item, index) => (
12
+            <SwiperItem key={`Banner-${index}`}>
13
+              <view className="swiper-item">
14
+                {
15
+                  item.img &&
16
+                  <Image mode='aspectFill' className='centerLabel' src={item.img || null} />
17
+                }
18
+              </view>
19
+            </SwiperItem>
20
+          ))
21
+        }
22
+      </Swiper>
23
+    </view>
24
+  )
25
+}

+ 18
- 0
src/pages/index/components/IndexBanner/index.scss 파일 보기

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

+ 20
- 0
src/pages/index/components/IndexColumnTitle/index.jsx 파일 보기

@@ -0,0 +1,20 @@
1
+import React, { useState, useEffect } from 'react'
2
+import './index.scss'
3
+
4
+export default function IndexColumnTitle (props) {
5
+  const { Icon = '', Name = '', ToMore = () => { }, children } = props
6
+  return (
7
+    <view className='components IndexColumnTitle flex-h'>
8
+      <text className={`iconfont ${Icon}`}></text>
9
+      <text className='Name'>{Name}</text>
10
+      {
11
+        children
12
+      }
13
+      <view className='flex-item'></view>
14
+      <view className='More' onClick={ToMore}>
15
+        <text>更多</text>
16
+        <text className='iconfont'></text>
17
+      </view>
18
+    </view>
19
+  )
20
+}

+ 3
- 0
src/pages/index/components/IndexColumnTitle/index.scss 파일 보기

@@ -0,0 +1,3 @@
1
+.components.IndexColumnTitle {
2
+  align-items: center;
3
+}

+ 45
- 0
src/pages/index/components/IndexMenu/index.jsx 파일 보기

@@ -0,0 +1,45 @@
1
+import React, { useState, useEffect } from 'react'
2
+import './index.scss'
3
+import { Image } from '@tarojs/components'
4
+
5
+export default function IndexMenu (props) {
6
+  const { List = [] } = props
7
+  return (
8
+    <view className='components IndexMenu'>
9
+
10
+      {/* tab */}
11
+      <view className='Tab flex-h'>
12
+        <view>
13
+          <text className='active'>住宅</text>
14
+        </view>
15
+        <view>
16
+          <text>文旅</text>
17
+        </view>
18
+        <view>
19
+          <text>商办</text>
20
+        </view>
21
+        <view>
22
+          <text>康养</text>
23
+        </view>
24
+      </view>
25
+
26
+      {/* menu */}
27
+      <view className='MenuList'>
28
+        {
29
+          List.map((item, index) => (
30
+            <view className='MenuItem' key={`MenuItem-${index}`}>
31
+              <view className='Img'>
32
+                {
33
+                  item.img &&
34
+                  <Image mode='aspectFit' className='centerLabel' src={item.img || null} />
35
+                }
36
+              </view>
37
+              <view className='Name'>菜单名称</view>
38
+            </view>
39
+          ))
40
+        }
41
+      </view>
42
+
43
+    </view>
44
+  )
45
+}

+ 99
- 0
src/pages/index/components/IndexMenu/index.scss 파일 보기

@@ -0,0 +1,99 @@
1
+.components.IndexMenu {
2
+  padding: 0 20px;
3
+  position: relative;
4
+  overflow: hidden;
5
+  > .Tab {
6
+    border-bottom: 2px solid #eee;
7
+    align-items: center;
8
+    position: relative;
9
+    overflow: hidden;
10
+    > view {
11
+      flex: 5;
12
+      -webkit-flex: 5;
13
+      text-align: center;
14
+      font-size: 0;
15
+      position: relative;
16
+      overflow: hidden;
17
+      &::after {
18
+        content: "";
19
+        display: block;
20
+        height: 40px;
21
+        width: 2px;
22
+        top: 50%;
23
+        left: 0;
24
+        position: absolute;
25
+        transform: translateY(-50%);
26
+        -webkit-transform: translateY(-50%);
27
+        background: #eee;
28
+      }
29
+      &:first-child {
30
+        text-align: left;
31
+        flex: 3;
32
+        -webkit-flex: 3;
33
+        &::after {
34
+          display: none;
35
+        }
36
+      }
37
+      &:last-child {
38
+        text-align: right;
39
+        flex: 3;
40
+        -webkit-flex: 3;
41
+      }
42
+      > text {
43
+        display: inline-block;
44
+        font-size: 32px;
45
+        position: relative;
46
+        line-height: 80px;
47
+        &.active {
48
+          font-weight: bold;
49
+          &::after {
50
+            content: "";
51
+            display: block;
52
+            position: absolute;
53
+            left: 50%;
54
+            bottom: 0;
55
+            transform: translateX(-50%);
56
+            -webkit-transform: translateX(-50%);
57
+            height: 4px;
58
+            width: 100%;
59
+            background: blue;
60
+          }
61
+        }
62
+      }
63
+    }
64
+  }
65
+  > .MenuList {
66
+    position: relative;
67
+    overflow: hidden;
68
+    font-size: 0;
69
+    padding-bottom: 30px;
70
+    > view {
71
+      display: inline-block;
72
+      vertical-align: middle;
73
+      width: 20%;
74
+      position: relative;
75
+      overflow: hidden;
76
+      text-align: center;
77
+      margin-top: 30px;
78
+      > .Img {
79
+        width: 90px;
80
+        height: 90px;
81
+        position: relative;
82
+        overflow: hidden;
83
+        background: #ccc;
84
+        margin: 0 auto;
85
+        > image {
86
+          width: 100%;
87
+          height: 100%;
88
+        }
89
+      }
90
+      > .Name {
91
+        text-align: center;
92
+        font-size: 28px;
93
+        line-height: 40px;
94
+        text-align: center;
95
+        margin-top: 6px;
96
+      }
97
+    }
98
+  }
99
+}

+ 25
- 0
src/pages/index/components/SubBanner/index.jsx 파일 보기

@@ -0,0 +1,25 @@
1
+import React, { useState, useEffect } from 'react'
2
+import './index.scss'
3
+import { Swiper, SwiperItem, Image } from '@tarojs/components'
4
+
5
+export default function SubBanner (props) {
6
+  const { List = [] } = props
7
+  return (
8
+    <view className='components SubBanner'>
9
+      <Swiper autoplay={true} interval={2000} indicator-dots={true}>
10
+        {
11
+          List.map((item, index) => (
12
+            <SwiperItem key={`Banner-${index}`}>
13
+              <view className="swiper-item">
14
+                {
15
+                  item.img &&
16
+                  <Image mode='aspectFill' className='centerLabel' src={item.img || null} />
17
+                }
18
+              </view>
19
+            </SwiperItem>
20
+          ))
21
+        }
22
+      </Swiper>
23
+    </view>
24
+  )
25
+}

+ 18
- 0
src/pages/index/components/SubBanner/index.scss 파일 보기

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

+ 55
- 21
src/pages/index/index.jsx 파일 보기

@@ -1,51 +1,85 @@
1 1
 import React, { useState, useEffect } from 'react'
2 2
 import withLayout from '@/layout'
3 3
 import './index.scss'
4
-import { Swiper, SwiperItem, Image, ScrollView } from '@tarojs/components'
4
+import IndexBanner from './components/IndexBanner/index'
5
+import IndexMenu from './components/IndexMenu/index'
6
+import SubBanner from './components/SubBanner/index'
7
+import IndexColumnTitle from './components/IndexColumnTitle/index'
8
+import { ScrollView } from '@tarojs/components'
5 9
 
6 10
 export default withLayout((props) => {
7 11
 
8
-  const [PageProps] = useState(props)
12
+  // const [PageProps] = useState(props)
9 13
   const [BannerList, setBannerList] = useState(['', '', ''])
14
+  const [MenuList, setMenuList] = useState(['', '', '', '', '', '', '', '', '', ''])
15
+  const [SubBannerList, setSubBannerList] = useState(['', '', ''])
10 16
   const [IsPull, setPull] = useState(false)
11 17
   const [PullTimer, setPullTimer] = useState(null)
12 18
 
13 19
   const PageRefresh = () => { // 页面下拉刷新回调
14
-    clearTimeout(PullTimer)
15 20
     setPull(true)
16
-    setPullTimer(setTimeout(() => {
17
-      setPull(false)
18
-    }, 2000))
19 21
   }
20 22
 
23
+  useEffect(() => { // 下拉刷新触发
24
+    if (IsPull) {
25
+      clearTimeout(PullTimer)
26
+      setPullTimer(setTimeout(() => {
27
+        setPull(false)
28
+      }, 2000))
29
+    }
30
+  }, [IsPull])
31
+
21 32
   return (
22 33
     <view className='Page Index'>
23 34
 
24
-      <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#f8f8f8'>
35
+      <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
25 36
         <view className='PageContent'>
26 37
 
27 38
           {/* banner */}
28 39
           <view className='Banner'>
29 40
             <view>
30 41
               <view>
31
-                <Swiper autoplay={true} interval={2000} indicator-dots={true}>
32
-                  {
33
-                    BannerList.map((item, index) => (
34
-                      <SwiperItem key={`Banner-${index}`}>
35
-                        <view className="swiper-item">
36
-                          {
37
-                            item.img &&
38
-                            <Image mode='widthFix' className='centerLabel' src={item.img || null} />
39
-                          }
40
-                        </view>
41
-                      </SwiperItem>
42
-                    ))
43
-                  }
44
-                </Swiper>
42
+                <IndexBanner List={BannerList}></IndexBanner>
43
+              </view>
44
+            </view>
45
+          </view>
46
+
47
+          {/* menu */}
48
+          <view className='IndexMenu'>
49
+            <view>
50
+              <IndexMenu List={MenuList}></IndexMenu>
51
+            </view>
52
+          </view>
53
+
54
+          {/* sub banner */}
55
+          <view className='SubBanner'>
56
+            <view>
57
+              <view>
58
+                <SubBanner List={SubBannerList}></SubBanner>
45 59
               </view>
46 60
             </view>
47 61
           </view>
48 62
 
63
+          {/* hot activity */}
64
+          <view className='HotActivity'>
65
+            <IndexColumnTitle Name='热门活动'></IndexColumnTitle>
66
+          </view>
67
+
68
+          {/* all project */}
69
+          <view className='AllProject'>
70
+            <IndexColumnTitle Name='所有项目'>
71
+              <view className='ToMap'>
72
+                <text className='iconfont'></text>
73
+                <text>地图找房</text>
74
+              </view>
75
+            </IndexColumnTitle>
76
+          </view>
77
+
78
+          {/* bottom */}
79
+          <view className='PageBottom'>
80
+            <text>已经到底了~</text>
81
+          </view>
82
+
49 83
         </view>
50 84
       </ScrollView>
51 85
 

+ 50
- 24
src/pages/index/index.scss 파일 보기

@@ -1,37 +1,63 @@
1 1
 .Page.Index {
2
-  background: #f8f8f8;
3
-  .PageContent {
4
-    position: relative;
5
-    overflow: hidden;
6
-    min-height: 100vh;
7
-    > .Banner {
8
-      padding: 0 30px;
2
+  background: #fff;
3
+  > scroll-view {
4
+    width: 100%;
5
+    height: 100%;
6
+    .PageContent {
9 7
       position: relative;
10 8
       overflow: hidden;
11
-      margin-top: 30px;
12
-      > view {
9
+      min-height: 100vh;
10
+      > .Banner {
11
+        padding: 0 30px;
13 12
         position: relative;
14 13
         overflow: hidden;
15
-        width: 100%;
16
-        padding-bottom: 56.25%;
14
+        // margin-top: 30px;
17 15
         > view {
16
+          position: relative;
17
+          overflow: hidden;
18 18
           width: 100%;
19
-          position: absolute;
20
-          left: 0;
21
-          top: 0;
22
-          bottom: 0;
19
+          padding-bottom: 56.25%;
20
+          > view {
21
+            width: 100%;
22
+            position: absolute;
23
+            left: 0;
24
+            top: 0;
25
+            bottom: 0;
26
+            overflow: hidden;
27
+          }
28
+        }
29
+      }
30
+      > .IndexMenu {
31
+        padding: 0 30px;
32
+        position: relative;
33
+        overflow: visible;
34
+        > view {
35
+          position: relative;
23 36
           overflow: hidden;
37
+          background: #fff;
24 38
           border-radius: 10px;
25
-          background: #ccc;
26
-          > swiper {
39
+          min-height: 40px;
40
+          margin-top: 30px;
41
+          box-shadow: 0 0 10px 10px rgba(0, 0, 0, 0.05);
42
+        }
43
+      }
44
+      > .SubBanner {
45
+        padding: 0 30px;
46
+        position: relative;
47
+        overflow: hidden;
48
+        margin-top: 30px;
49
+        > view {
50
+          position: relative;
51
+          overflow: hidden;
52
+          width: 100%;
53
+          padding-bottom: 30%;
54
+          > view {
27 55
             width: 100%;
28
-            height: 100%;
29
-            .swiper-item {
30
-              > image {
31
-                width: 100%;
32
-                height: 100%;
33
-              }
34
-            }
56
+            position: absolute;
57
+            left: 0;
58
+            top: 0;
59
+            bottom: 0;
60
+            overflow: hidden;
35 61
           }
36 62
         }
37 63
       }