张延森 3 년 전
부모
커밋
72ea903bac

+ 1
- 1
project.config.json 파일 보기

@@ -2,7 +2,7 @@
2 2
   "miniprogramRoot": "./dist",
3 3
   "projectname": "miniapp",
4 4
   "description": "十公里",
5
-  "appid": "touristappid",
5
+  "appid": "wxe44244d1a5ea3364",
6 6
   "setting": {
7 7
     "urlCheck": true,
8 8
     "es6": false,

+ 1
- 2
src/app.config.js 파일 보기

@@ -1,7 +1,6 @@
1 1
 export default {
2 2
   pages: [
3
-    'pages/index/index',
4
-    'pages/test/index'
3
+    'pages/index/index'
5 4
   ],
6 5
   window: {
7 6
     backgroundTextStyle: 'light',

BIN
src/assets/icons/comm/home.png 파일 보기


BIN
src/assets/icons/comm/home_white.png 파일 보기


BIN
src/assets/icons/comm/logo_small.png 파일 보기


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

@@ -1,8 +1,11 @@
1 1
 
2 2
 import { useState, useEffect, useMemo } from 'react'
3 3
 import Taro from '@tarojs/taro'
4
+import homeBlack from '@/assets/icons/comm/home.png'
5
+import homeWhite from '@/assets/icons/comm/home_white.png'
4 6
 import gobackBlack from '@/assets/icons/comm/goback.png'
5 7
 import gobackWhite from '@/assets/icons/comm/goback_white.png'
8
+
6 9
 import './style.less'
7 10
 
8 11
 export default (props) => {
@@ -69,13 +72,14 @@ export default (props) => {
69 72
             !!logo && <image src={logo} className='custom-nav-bar-logo' mode='aspectFit' style={logoStyle} />
70 73
           }
71 74
           {
72
-            !home && (
75
+            !logo && !home && (
73 76
               <view className='custom-nav-bar-action-btns'>
74 77
                 <view className='custom-nav-bar-action-part' onClick={handleAction}>
75
-                  <image src={bgImg ? gobackWhite : gobackBlack} className='custom-nav-bar-action-goback' mode='aspectFit' />
78
+                  <image src={bgImg ? gobackWhite : gobackBlack} mode='aspectFit' />
76 79
                 </view>
77 80
                 <view className='custom-nav-bar-action-part'>
78
-                </view>                
81
+                  <image src={bgImg ? homeWhite : homeBlack} mode='aspectFit' />
82
+                </view>
79 83
               </view>
80 84
             )
81 85
           }

+ 8
- 4
src/components/CustomNav/style.less 파일 보기

@@ -2,14 +2,15 @@
2 2
 	display: block;
3 3
 	position: relative;
4 4
 
5
-  &-bar {    
6
-    position: absolute;
5
+  &-bar {
6
+    display: flex;
7
+    position: fixed;
7 8
     width: 100%;
8 9
     z-index: 1024;
9 10
     left: 0;
10 11
 
11 12
     &-action {
12
-      display: inline-block;
13
+      flex: none;
13 14
       box-sizing: border-box;
14 15
 
15 16
       image {
@@ -28,6 +29,7 @@
28 29
           text-align: center;
29 30
 
30 31
           image {
32
+            width: 100%;
31 33
             height: 30px;
32 34
           }
33 35
         }
@@ -35,11 +37,13 @@
35 37
     }
36 38
 
37 39
     &-logo {
40
+      display: block !important;
38 41
       border-radius: 50%;
42
+      margin: 0 auto;
39 43
     }
40 44
 
41 45
     &-content {
42
-      display: inline-block;
46
+      flex: none;
43 47
       text-align: center;
44 48
       font-size: 32px;
45 49
       cursor: none;

+ 4
- 0
src/pages/index/index.config.js 파일 보기

@@ -1,4 +1,8 @@
1 1
 export default {
2 2
   navigationBarTitleText: '首页',
3 3
   navigationStyle: 'custom',
4
+  styleIsolation: 'shared',
5
+  usingComponents: {
6
+    "mp-tabbar": "weui-miniprogram/tabbar/tabbar"
7
+  }
4 8
 }

+ 20
- 7
src/pages/index/index.jsx 파일 보기

@@ -1,15 +1,28 @@
1
-
1
+import React, { useState } from 'react'
2 2
 import { View, Text } from '@tarojs/components'
3 3
 import CustomNav from '@/components/CustomNav'
4
-
5
-
4
+import logo from '@/assets/icons/comm/logo_small.png'
5
+import tabList from './tabbar'
6 6
 import './index.less'
7 7
 
8 8
 export default (props) => {
9
+  const [currentTab, setCurrentTab] = useState(0)
10
+
11
+  const handleTabChange = (e) => {
12
+    const { index } = e.detail
13
+    setCurrentTab(index)
14
+  }
15
+
9 16
   return (
10
-    <View className='index'>
11
-      <CustomNav title='首页' />
12
-      <Text>Hello world!</Text>
13
-    </View>
17
+    <view className='page-index'>
18
+      <view className='index-navbar'>
19
+        <CustomNav logo={logo} title='首页' />
20
+      </view>
21
+      <view className='index-container'>
22
+      </view>
23
+      <view className='index-tabbar'>
24
+        <mp-tabbar extClass='custom-tabbar' current={currentTab} list={tabList} onChange={handleTabChange}></mp-tabbar>
25
+      </view>
26
+    </view>
14 27
   )
15 28
 }

+ 32
- 0
src/pages/index/index.less 파일 보기

@@ -0,0 +1,32 @@
1
+.page-index {
2
+  display: flex;
3
+  flex-direction: column;
4
+  width: 100vw;
5
+  height: 100vh;
6
+  overflow: hidden;
7
+  box-sizing: border-box;
8
+
9
+  .index-navbar {
10
+    flex: none;
11
+  }
12
+
13
+  .index-tabber {
14
+    flex: none;
15
+  }
16
+
17
+  .index-container {
18
+    flex: auto;
19
+  }
20
+}
21
+
22
+.custom-tabbar {
23
+  .weui-tabbar__label {
24
+    color: #C0C8D3;
25
+  }
26
+
27
+  .weui-bar__item_on {
28
+    .weui-tabbar__label {
29
+      color: #202020;
30
+    }
31
+  }
32
+}

+ 25
- 0
src/pages/index/tabbar.js 파일 보기

@@ -0,0 +1,25 @@
1
+
2
+const tabbar = [
3
+  {
4
+    text: '房东推荐',
5
+    iconPath: require('@/assets/icons/tabbar/recommend.png'),
6
+    selectedIconPath: require('@/assets/icons/tabbar/recommend_active.png'),
7
+  },
8
+  {
9
+    text: '入住指引',
10
+    iconPath: require('@/assets/icons/tabbar/guide.png'),
11
+    selectedIconPath: require('@/assets/icons/tabbar/guide_active.png'),
12
+  },
13
+  {
14
+    text: '定制攻略',
15
+    iconPath: require('@/assets/icons/tabbar/strategy.png'),
16
+    selectedIconPath: require('@/assets/icons/tabbar/strategy_active.png'),
17
+  },
18
+  {
19
+    text: '个人中心',
20
+    iconPath: require('@/assets/icons/tabbar/mine.png'),
21
+    selectedIconPath: require('@/assets/icons/tabbar/mine_active.png'),
22
+  },
23
+]
24
+
25
+export default tabbar

+ 0
- 6
src/pages/test/index.config.js 파일 보기

@@ -1,6 +0,0 @@
1
-export default {
2
-  navigationBarTitleText: '测试页面',
3
-  usingComponents: {
4
-    "mp-tabbar": "weui-miniprogram/tabbar/tabbar"
5
-  }
6
-}

+ 0
- 27
src/pages/test/index.jsx 파일 보기

@@ -1,27 +0,0 @@
1
-import Layout from '@/layouts'
2
-import Taro, { useRouter } from '@tarojs/taro'
3
-import { useEffect } from 'react'
4
-export default (props) => {
5
-  const router = useRouter()
6
-
7
-  console.log('----------->', router)
8
-
9
-  // useEffect(() => {
10
-  //   const t = setTimeout(() => {
11
-  //     try {
12
-  //       Taro.navigateTo({ url: '/pages/test/index?id=1' })
13
-  //     } catch (e) {
14
-  //       console.log('-----eeee------>', e)
15
-  //     }
16
-  //     clearTimeout(t)
17
-  //     console.log('-----setTimeout------>', t)
18
-  //     console.log(Taro.getCurrentPages())
19
-  //   }, 2000)
20
-
21
-  // }, [])
22
-
23
-  return (
24
-    <Layout>
25
-    </Layout>
26
-  )
27
-}

+ 0
- 0
src/pages/test/index.less 파일 보기


+ 0
- 10
src/router/core.js 파일 보기

@@ -1,10 +0,0 @@
1
-
2
-export default function createRouter (routes, options) {
3
-  let current;
4
-  let prev;
5
-  let next;
6
-
7
-  function transitionTo(location) {
8
-
9
-  }
10
-}