张延森 3 년 전
부모
커밋
c096d60f11
3개의 변경된 파일42개의 추가작업 그리고 52개의 파일을 삭제
  1. 1
    1
      project.config.dev.json
  2. 31
    40
      src/pages/MineUserAll/AllOrder/index.jsx
  3. 10
    11
      src/pages/MineUserAll/AllOrder/style.less

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

@@ -4,7 +4,7 @@
4 4
   "description": "十公里",
5 5
   "appid": "wx835627a9b9b3932a",
6 6
   "setting": {
7
-    "urlCheck": true,
7
+    "urlCheck": false,
8 8
     "es6": false,
9 9
     "postcss": false,
10 10
     "minified": false

+ 31
- 40
src/pages/MineUserAll/AllOrder/index.jsx 파일 보기

@@ -1,11 +1,34 @@
1
-import { useState, useEffect, } from 'react'
2
-import { Taro, useRouter } from '@tarojs/taro'
1
+import { useState, useEffect, useMemo, } from 'react'
2
+import { Current, Taro, useRouter } from '@tarojs/taro'
3 3
 import { View } from '@tarojs/components'
4 4
 import withLayout from '@/layouts'
5 5
 import CustomNav from '@/components/CustomNav'
6 6
 import Complete from '@/components/CompoentsOrder/complete'
7 7
 import './style.less'
8 8
 
9
+const tabs = ['全部', '待支付', '待核销', '已使用','已过期'].map(x => ({ title: x }))
10
+
11
+const TabBar = (props) => {
12
+  const handleClick = (e) => {
13
+    console.log('-----------------handleTabChange----------------', e)
14
+    const { index } = e.detail
15
+    props.onClick(index)
16
+  }
17
+
18
+  return (
19
+    <mp-tabs
20
+      tabClass='tabs-extend'
21
+      activeClass='tabs-extend-active'
22
+      swiperClass='tabs-extend-swiper'
23
+      tabUnderlineColor='#000'
24
+      tabs={tabs}
25
+      activeTab={props.current}
26
+      onTabclick={handleClick}
27
+    >
28
+    </mp-tabs>
29
+  )
30
+}
31
+
9 32
 
10 33
 export default withLayout((props) => {
11 34
   const [activeTab, setActiveTab] = useState(0)
@@ -13,7 +36,6 @@ export default withLayout((props) => {
13 36
   const { params } = useRouter()
14 37
   const { tabJump } = params || {}
15 38
 
16
-
17 39
   useEffect(() => {
18 40
     if (tabJump) {
19 41
       setActiveTab(tabJump - 0)
@@ -21,33 +43,13 @@ export default withLayout((props) => {
21 43
   }, [tabJump])
22 44
 
23 45
 
24
-
25
-  const tabs = [
26
-    {
27
-      title: '全部',
28
-    },
29
-    {
30
-      title: '待支付',
31
-
32
-    },
33
-    {
34
-      title: '待核销',
35
-
36
-    },
37
-    {
38
-      title: '已使用',
39
-
40
-    },
41
-    {
42
-      title: '已过期',
43
-
44
-    },
45
-  ]
46
-
47
-  const handleTabChange = (e) => {
48
-    const { index } = e.detail
46
+  const handleTabClick = (index) => {
47
+    console.log('------tab-----event--------', index)
49 48
     setActiveTab(index)
50 49
   }
50
+  
51
+  console.log('------setActiveTab--------', activeTab)
52
+
51 53
   return (
52 54
     <view className='page-index box-content'>
53 55
       <view className='index-navbar'>
@@ -55,18 +57,7 @@ export default withLayout((props) => {
55 57
       </view>
56 58
       <View className='index-container' style={{display:'flex',flexDirection:'column',boxSizing:'border-box'}}>
57 59
         <view className='index-tabs'>
58
-          <mp-tabs
59
-            tabClass='tabs-Unselected'
60
-            swiperClass='tabs-swiper'
61
-            activeClass='tabs-Selected'
62
-            tabUnderlineColor='#000'
63
-            tabInactiveTextColor='#C0C8D3'
64
-            tabs={tabs}
65
-            current={activeTab}
66
-            onChange={handleTabChange}
67
-            activeTab={activeTab}
68
-          >
69
-          </mp-tabs>
60
+          <TabBar onClick={handleTabClick} current={activeTab} />
70 61
         </view>
71 62
         {activeTab === 0 && <Complete />}
72 63
         {activeTab === 1 && <Complete type={0} />}

+ 10
- 11
src/pages/MineUserAll/AllOrder/style.less 파일 보기

@@ -3,25 +3,24 @@
3 3
   .index-tabs {
4 4
     width: 100%;
5 5
 
6
-    .tabs-Unselected {
6
+    .tabs-extend {
7 7
       width: 20vw;
8 8
       text-align: center;
9
-      height: 26px;
9
+      line-height: 84px;
10
+      height: 84px;
10 11
       font-size: 28px;
11 12
       font-weight: bold;
12 13
       color: #c0c8d3;
14
+      box-sizing: border-box;
13 15
     }
14
-    .tabs-swiper {
15
-      max-height: 0px;
16
-    }
17
-    .tabs-Selected {
18
-      height: 30px;
19
-      font-size: 32px;
20
-      font-weight: bold;
16
+
17
+    .tabs-extend-active {
21 18
       color: #4c4c4c;
22
-      padding-top: 33px;
23
-      padding-bottom: 28px;
24 19
       border-bottom: 5px solid black;
25 20
     }
21
+
22
+    .tabs-extend-swiper {
23
+      max-height: 0;
24
+    }
26 25
   }
27 26
 }