|
|
@@ -7,6 +7,8 @@ import Cards from './Cards'
|
|
|
import {graphqls} from '../../api/graphql_request'
|
|
|
import {getProductByProps} from '../../api/graphql/product'
|
|
|
|
|
|
+import './HomePage.css'
|
|
|
+
|
|
|
|
|
|
|
|
|
class HomePage extends Component{
|
|
|
@@ -41,7 +43,8 @@ class HomePage extends Component{
|
|
|
this.setState({
|
|
|
tabs:[{title: '所有果品'},...tabs],
|
|
|
products:products,
|
|
|
- select:'所有果品'
|
|
|
+ select:'所有果品',
|
|
|
+ detail:'false'
|
|
|
})
|
|
|
sessionStorage.setItem("products",JSON.stringify(products))
|
|
|
})
|
|
|
@@ -64,13 +67,38 @@ class HomePage extends Component{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ toDetail(e){
|
|
|
+ this.setState({
|
|
|
+ detail:"true"
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ changeComponent(e){
|
|
|
+ if(e=='1'){
|
|
|
+ return(
|
|
|
+ <div>detail</div>
|
|
|
+ )
|
|
|
+ }else if(e=='2'){
|
|
|
+ return(
|
|
|
+ <div>order</div>
|
|
|
+ )
|
|
|
+ }else{
|
|
|
+ return(
|
|
|
+ <div>
|
|
|
+ <Search getProductByName={this.getGoods.bind(this)}/>
|
|
|
+ <TabBarTop tabs={this.state.tabs} tabChange={this.tabChange.bind(this)}/>
|
|
|
+ <Cards products={this.state.products||[]}/>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
render(){
|
|
|
return (
|
|
|
<div className="homeWrap">
|
|
|
- <Search getProductByName={this.getGoods.bind(this)}/>
|
|
|
- <TabBarTop tabs={this.state.tabs} tabChange={this.tabChange.bind(this)}/>
|
|
|
- <Cards products={this.state.products||[]}/>
|
|
|
+ {this.changeComponent("3")}
|
|
|
</div>
|
|
|
)
|
|
|
}
|