Parcourir la source

跳转时添加state tabHidden:false则隐藏tabbar,购物车数据更新修改

Csy817 il y a 6 ans
Parent
commit
8e1fbcce34

+ 1 - 1
src/App.js

@@ -50,7 +50,7 @@ class App extends Component {
         // 有 state 的话,根据tabHidden显示或隐藏 tabbar, (进入子界面)
         // 无 state 的话,就显示 tabbar (返回到主界面)
         if (location && state) {
-            let tabHidden = state.tabHidden
+            let tabHidden = state.tabHidden !== undefined ? state.tabHidden : true
             this.setState({
                 tabHidden
             })

+ 8 - 3
src/pages/cart/all/detail/index.js

@@ -38,8 +38,15 @@ class CartDetail extends Component {
         // console.log("CartDetail componentWillReceiveProps",nextProps)
         if(nextProps.updateData){
             this.props.refetch().then(()=>{
+                let cartListLength = nextProps.cartList ? nextProps.cartList.length : 0
                 this.setState({
                     cartList:nextProps.cartList
+                },()=>{
+                    if(cartListLength){
+                        this.sumPrice()
+                    }else {
+                        this.checkedAll('',true)
+                    }
                 })
             })
         }
@@ -189,9 +196,7 @@ class CartDetail extends Component {
         sessionStorage.setItem("totalCount",JSON.stringify(this.state.selectedCount))
         this.props.history.push({
             pathname: '/cart/orders',
-            state:{
-                tabHidden:true
-            }
+            state:{}
         })
     } 
 

+ 2 - 5
src/pages/cart/orders/index.js

@@ -103,9 +103,7 @@ class CartOrders extends Component {
 
             this.props.history.push({
                 pathname:'/cart/pay',
-                state:{
-                    tabHidden:true
-                }
+                state:{}
             })
         })
     }
@@ -142,8 +140,7 @@ class CartOrders extends Component {
                                     this.props.history.push({
                                         pathname:'/my/tools',
                                         state: {
-                                            page: 'address',
-                                            tabHidden:true
+                                            page: 'address'
                                         }})
                                 }}>
                                 <div>

+ 2 - 4
src/pages/home/all/index.js

@@ -91,8 +91,7 @@ class All extends Component {
                         this.props.history.push({
                             pathname: '/home/kind',
                             state: {
-                                id: kind.id,
-                                tabHidden:true
+                                id: kind.id
                             }
                         })
                     }}/>
@@ -141,8 +140,7 @@ class Like extends Component {
                           this.props.history.push({
                               pathname: '/home/detail',
                               state: {
-                                  id: guess.id,
-                                  tabHidden:true
+                                  id: guess.id
                               }
                           })
                       }}

+ 1 - 2
src/pages/home/kind/index.js

@@ -96,8 +96,7 @@ class KindRender extends Component {
                                   this.props.history.push({
                                       pathname: '/home/detail',
                                       state: {
-                                          id: product.id,
-                                          tabHidden:true
+                                          id: product.id
                                       }
                                   })
 

+ 4 - 8
src/pages/my/all/index.js

@@ -105,8 +105,7 @@ class All extends Component {
                                   this.props.history.push({
                                       pathname: '/my/order',
                                       state: {
-                                          kind: order.id,
-                                          tabHidden:true
+                                          kind: order.id
                                       }
                                   })
                               }}
@@ -131,8 +130,7 @@ class All extends Component {
                                       this.props.history.push({
                                           pathname: '/my/tools',
                                           state: {
-                                              page: tools.id,
-                                              tabHidden:true
+                                              page: tools.id
                                           }
                                       })
                                   }
@@ -153,8 +151,7 @@ class All extends Component {
                                   this.props.history.push({
                                       pathname: '/my/member',
                                       state: {
-                                          page: member.id,
-                                          tabHidden:true
+                                          page: member.id
                                       }
                                   })
                               }}
@@ -174,8 +171,7 @@ class All extends Component {
                                   this.props.history.push({
                                       pathname: '/my/manage',
                                       state: {
-                                          page: shop.id,
-                                          tabHidden:true
+                                          page: shop.id
                                       }
                                   })
                               }}

+ 1 - 3
src/pages/my/manage/index.js

@@ -17,9 +17,7 @@ class Manage extends Component {
         if (location && location.state) {
             this.props.history.push({
                 pathname: '/my/manage/' + location.state.page,
-                state: {
-                    tabHidden:true
-                }
+                state: {}
             })
         }
     }

+ 1 - 3
src/pages/my/member/index.js

@@ -17,9 +17,7 @@ class Member extends Component {
         if (location && location.state) {
             this.props.history.push({
                 pathname: '/my/member/' + location.state.page,
-                state: {
-                    tabHidden:true
-                }
+                state: {}
             })
         }
     }

+ 1 - 2
src/pages/my/order/detail/index.js

@@ -71,8 +71,7 @@ class Detail extends Component {
                     this.props.history.push({
                         pathname: '/home/detail',
                         state: {
-                            id: data.id,
-                            tabHidden:true
+                            id: data.id
                         }
                     })
                 }}>

+ 1 - 2
src/pages/my/order/display/index.js

@@ -241,8 +241,7 @@ class DisplayRender extends Component {
                                                         this.props.history.push({
                                                             pathname: '/my/order/detail',
                                                             state: {
-                                                                data: order,
-                                                                tabHidden:true
+                                                                data: order
                                                             }
                                                         })
                                                     }}>

+ 2 - 5
src/pages/my/order/index.js

@@ -16,16 +16,13 @@ class Order extends Component {
                 this.props.history.push({
                     pathname: '/my/order/display',
                     state: {
-                        kind: location.state.kind,
-                        tabHidden:true
+                        kind: location.state.kind
                     }
                 })
             } else {
                 this.props.history.push({
                     pathname: '/my/order/detail',
-                    state: {
-                        tabHidden:true
-                    }
+                    state: {}
                 })
             }
         }

+ 1 - 3
src/pages/my/tools/index.js

@@ -16,9 +16,7 @@ class Tools extends Component {
         if (location && location.state) {
             this.props.history.push({
                 pathname: '/my/tools/' + location.state.page,
-                state: {
-                    tabHidden:true
-                }
+                state: {}
             })
         }
     }