Commit e1acf99d by FE

cart jump function in header-search component

parent 26714acd
...@@ -4,32 +4,36 @@ import './index.scss' ...@@ -4,32 +4,36 @@ import './index.scss'
class HeaderBar extends Component { class HeaderBar extends Component {
toSearch() { toSearch() {
window.location.href = '/search' window.location.href = '/search';
} }
return() { return() {
window.location.href = '/' window.location.href = '/';
} }
goShop = () => { goShop = () => {
location.replace('/shopcart') const { isLogin = false } = this.props;
let url = isLogin? '/shopcart' : '/passport';
window.location.replace(url);
} }
render() { render() {
{
console.log(this.props.toHref);
}
return ( return (
<div className='preferential'> <div className='preferential'>
<div className="search-nav"> <div className="search-nav">
{ {
!this.props.toHref && !this.props.toHref &&
<i className={'iconfont iconiconfront-68 return'} onClick={this.return.bind(this)}></i> <i
className={'iconfont iconiconfront-68 return'}
onClick={this.return.bind(this)}
/>
} }
{ {
this.props.toHref && this.props.toHref &&
<i className={'iconfont iconiconfront-68 return'} onClick={this.props.toHref}></i> <i
className={'iconfont iconiconfront-68 return'}
onClick={this.props.toHref}
/>
} }
<SearchBar <SearchBar
placeholder="搜索课程" placeholder="搜索课程"
...@@ -37,7 +41,10 @@ class HeaderBar extends Component { ...@@ -37,7 +41,10 @@ class HeaderBar extends Component {
onFocus={this.toSearch.bind(this)} onFocus={this.toSearch.bind(this)}
showCancelButton={false} showCancelButton={false}
/> />
<i className={'iconfont icongouwuche-xianxing shopping-cart'} onClick={this.goShop}></i> <i
className={'iconfont icongouwuche-xianxing shopping-cart'}
onClick={this.goShop}
/>
</div> </div>
</div> </div>
) )
...@@ -45,4 +52,4 @@ class HeaderBar extends Component { ...@@ -45,4 +52,4 @@ class HeaderBar extends Component {
} }
export default HeaderBar export default HeaderBar;
...@@ -10,7 +10,9 @@ import Loading from '@/common/Loading' ...@@ -10,7 +10,9 @@ import Loading from '@/common/Loading'
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {getCourses} from './../detail/actions'; import {getCourses} from './../detail/actions';
@connect() @connect(({user}) => ({
user
}))
class Classify extends Component { class Classify extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
...@@ -117,6 +119,8 @@ class Classify extends Component { ...@@ -117,6 +119,8 @@ class Classify extends Component {
} }
render() { render() {
const { user ={} } = this.props;
let isLogin = user.data && user.data.uid? true : false;
const bottom = ( const bottom = (
<i className={'iconfont iconiconfront-69 pull-down'}></i> <i className={'iconfont iconiconfront-69 pull-down'}></i>
) )
...@@ -128,7 +132,10 @@ class Classify extends Component { ...@@ -128,7 +132,10 @@ class Classify extends Component {
return ( return (
<div className='class-child'> <div className='class-child'>
<HeaderSearch toHref={this.toClassify}></HeaderSearch> <HeaderSearch
isLogin={isLogin}
toHref={this.toClassify}
/>
<Loading isLoading={this.state.isLoading}> <Loading isLoading={this.state.isLoading}>
<div className='class-content'> <div className='class-content'>
<WhiteSpace/> <WhiteSpace/>
......
...@@ -10,7 +10,9 @@ import {bindActionCreators} from 'redux'; ...@@ -10,7 +10,9 @@ import {bindActionCreators} from 'redux';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {getCourses} from './../detail/actions'; import {getCourses} from './../detail/actions';
@connect() @connect(({user}) => ({
user
}))
class Preferential extends Component { class Preferential extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
...@@ -91,9 +93,11 @@ class Preferential extends Component { ...@@ -91,9 +93,11 @@ class Preferential extends Component {
{title: '砍价专区'}, {title: '砍价专区'},
{title: '一键拼团'} {title: '一键拼团'}
] ]
const { user ={} } = this.props;
let isLogin = user.data && user.data.uid? true : false;
return ( return (
<div className='preferential'> <div className='preferential'>
<HeaderSearch></HeaderSearch> <HeaderSearch isLogin={isLogin} />
<Loading isLoading={this.state.isLoading}> <Loading isLoading={this.state.isLoading}>
<div className='class-content'> <div className='class-content'>
<WhiteSpace/> <WhiteSpace/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment