Commit e1acf99d by FE

cart jump function in header-search component

parent 26714acd
......@@ -4,32 +4,36 @@ import './index.scss'
class HeaderBar extends Component {
toSearch() {
window.location.href = '/search'
window.location.href = '/search';
}
return() {
window.location.href = '/'
window.location.href = '/';
}
goShop = () => {
location.replace('/shopcart')
const { isLogin = false } = this.props;
let url = isLogin? '/shopcart' : '/passport';
window.location.replace(url);
}
render() {
{
console.log(this.props.toHref);
}
return (
<div className='preferential'>
<div className="search-nav">
{
!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 &&
<i className={'iconfont iconiconfront-68 return'} onClick={this.props.toHref}></i>
<i
className={'iconfont iconiconfront-68 return'}
onClick={this.props.toHref}
/>
}
<SearchBar
placeholder="搜索课程"
......@@ -37,7 +41,10 @@ class HeaderBar extends Component {
onFocus={this.toSearch.bind(this)}
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>
)
......@@ -45,4 +52,4 @@ class HeaderBar extends Component {
}
export default HeaderBar
export default HeaderBar;
......@@ -10,7 +10,9 @@ import Loading from '@/common/Loading'
import {connect} from 'react-redux';
import {getCourses} from './../detail/actions';
@connect()
@connect(({user}) => ({
user
}))
class Classify extends Component {
constructor(props) {
super(props)
......@@ -117,6 +119,8 @@ class Classify extends Component {
}
render() {
const { user ={} } = this.props;
let isLogin = user.data && user.data.uid? true : false;
const bottom = (
<i className={'iconfont iconiconfront-69 pull-down'}></i>
)
......@@ -128,7 +132,10 @@ class Classify extends Component {
return (
<div className='class-child'>
<HeaderSearch toHref={this.toClassify}></HeaderSearch>
<HeaderSearch
isLogin={isLogin}
toHref={this.toClassify}
/>
<Loading isLoading={this.state.isLoading}>
<div className='class-content'>
<WhiteSpace/>
......
......@@ -10,7 +10,9 @@ import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {getCourses} from './../detail/actions';
@connect()
@connect(({user}) => ({
user
}))
class Preferential extends Component {
constructor(props) {
super(props)
......@@ -91,9 +93,11 @@ class Preferential extends Component {
{title: '砍价专区'},
{title: '一键拼团'}
]
const { user ={} } = this.props;
let isLogin = user.data && user.data.uid? true : false;
return (
<div className='preferential'>
<HeaderSearch></HeaderSearch>
<HeaderSearch isLogin={isLogin} />
<Loading isLoading={this.state.isLoading}>
<div className='class-content'>
<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