Kaynağa Gözat

静态页面

1002884655 4 yıl önce
ebeveyn
işleme
aa676dcacf

+ 17457
- 0
package-lock.json
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 29
- 12
project.config.json Dosyayı Görüntüle

@@ -1,13 +1,30 @@
1 1
 {
2
-  "miniprogramRoot": "./dist",
3
-  "projectname": "miniapp",
4
-  "description": "",
5
-  "appid": "wx1a0fa56e6d0b78b3",
6
-  "setting": {
7
-    "urlCheck": false,
8
-    "es6": false,
9
-    "postcss": false,
10
-    "minified": false
11
-  },
12
-  "compileType": "miniprogram"
13
-}
2
+	"miniprogramRoot": "dist/",
3
+	"projectname": "miniapp",
4
+	"description": "",
5
+	"appid": "wx1a0fa56e6d0b78b3",
6
+	"setting": {
7
+		"urlCheck": false,
8
+		"scopeDataCheck": false,
9
+		"coverView": true,
10
+		"es6": false,
11
+		"postcss": false,
12
+		"compileHotReLoad": false,
13
+		"preloadBackgroundData": false,
14
+		"minified": false,
15
+		"autoAudits": false,
16
+		"newFeature": false,
17
+		"uglifyFileName": false,
18
+		"uploadWithSourceMap": true,
19
+		"useIsolateContext": true,
20
+		"nodeModules": false,
21
+		"enhance": false,
22
+		"useCompilerModule": false,
23
+		"userConfirmedUseCompilerModuleSwitch": false,
24
+		"showShadowRootInWxmlPanel": true
25
+	},
26
+	"compileType": "miniprogram",
27
+	"simulatorType": "wechat",
28
+	"simulatorPluginLibVersion": {},
29
+	"condition": {}
30
+}

+ 35
- 0
src/app.scss Dosyayı Görüntüle

@@ -0,0 +1,35 @@
1
+page,
2
+.Page {
3
+  width: 100%;
4
+  height: 100%;
5
+  position: relative;
6
+  overflow: hidden;
7
+}
8
+
9
+.centerLabel {
10
+  display: block;
11
+  position: absolute;
12
+  left: 50%;
13
+  top: 50%;
14
+  transform: translate(-50%, -50%);
15
+  -webkit-transform: translate(-50%, -50%);
16
+}
17
+
18
+.flex-h {
19
+  display: flex;
20
+  display: -webkit-flex;
21
+}
22
+
23
+.flex-v {
24
+  display: flex;
25
+  display: -webkit-flex;
26
+  flex-direction: column;
27
+  -webkit-flex-direction: column;
28
+}
29
+
30
+.flex-item {
31
+  flex: 1;
32
+  -webkit-flex: 1;
33
+  position: relative;
34
+  overflow: hidden;
35
+}

+ 1
- 1
src/pages/index/index.config.js Dosyayı Görüntüle

@@ -1,3 +1,3 @@
1 1
 export default {
2
-  navigationBarTitleText: '首页'
2
+  navigationBarTitleText: '新联康'
3 3
 }

+ 49
- 4
src/pages/index/index.jsx Dosyayı Görüntüle

@@ -1,9 +1,54 @@
1
-import React from 'react'
1
+import React, { useState, useEffect } from 'react'
2 2
 import withLayout from '@/layout'
3
+import './index.scss'
4
+import { Swiper, SwiperItem, Image, ScrollView } from '@tarojs/components'
3 5
 
4 6
 export default withLayout((props) => {
5
-  // props 里面包含了一些基本的信息
6
-  console.log('-----props---->', props)
7 7
 
8
-  return '这里是小程序首页';
8
+  const [PageProps] = useState(props)
9
+  const [BannerList, setBannerList] = useState(['', '', ''])
10
+  const [IsPull, setPull] = useState(false)
11
+  const [PullTimer, setPullTimer] = useState(null)
12
+
13
+  const PageRefresh = () => { // 页面下拉刷新回调
14
+    clearTimeout(PullTimer)
15
+    setPull(true)
16
+    setPullTimer(setTimeout(() => {
17
+      setPull(false)
18
+    }, 2000))
19
+  }
20
+
21
+  return (
22
+    <view className='Page Index'>
23
+
24
+      <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#f8f8f8'>
25
+        <view className='PageContent'>
26
+
27
+          {/* banner */}
28
+          <view className='Banner'>
29
+            <view>
30
+              <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>
45
+              </view>
46
+            </view>
47
+          </view>
48
+
49
+        </view>
50
+      </ScrollView>
51
+
52
+    </view>
53
+  )
9 54
 })

+ 40
- 0
src/pages/index/index.scss Dosyayı Görüntüle

@@ -0,0 +1,40 @@
1
+.Page.Index {
2
+  background: #f8f8f8;
3
+  .PageContent {
4
+    position: relative;
5
+    overflow: hidden;
6
+    min-height: 100vh;
7
+    > .Banner {
8
+      padding: 0 30px;
9
+      position: relative;
10
+      overflow: hidden;
11
+      margin-top: 30px;
12
+      > view {
13
+        position: relative;
14
+        overflow: hidden;
15
+        width: 100%;
16
+        padding-bottom: 56.25%;
17
+        > view {
18
+          width: 100%;
19
+          position: absolute;
20
+          left: 0;
21
+          top: 0;
22
+          bottom: 0;
23
+          overflow: hidden;
24
+          border-radius: 10px;
25
+          background: #ccc;
26
+          > swiper {
27
+            width: 100%;
28
+            height: 100%;
29
+            .swiper-item {
30
+              > image {
31
+                width: 100%;
32
+                height: 100%;
33
+              }
34
+            }
35
+          }
36
+        }
37
+      }
38
+    }
39
+  }
40
+}