Commit 4ac2783c by wujiabao

fix 问题

parent 7b50d3c6
......@@ -2,27 +2,27 @@ import React from 'react';
import PropTypes from 'prop-types'
require('./index.css')
const headerStatus = CONFIG.headerStatus;
export default class HeaderComponent extends React.Component{
constructor(props){
export default class HeaderComponent extends React.Component {
constructor(props) {
super(props);
this.getHomeHeader = this.getHomeHeader.bind(this);
this.getOtherHeader = this.getOtherHeader.bind(this);
this.handleShowClassify = this.handleShowClassify.bind(this);
this.showVersion = this.showVersion.bind(this);
this.state = {
showHeader : headerStatus[1],
showClassify : false,
showVersion : false,
showHeader: headerStatus[1],
showClassify: false,
showVersion: false,
}
this.timer = null;
this.countbackTime = 1000;
}
componentWillReceiveProps(nextProps){
componentWillReceiveProps(nextProps) {
}
handleShowClassify(){
handleShowClassify() {
// this.setState({
// showClassify : !this.state.showClassify
// })
......@@ -30,11 +30,11 @@ export default class HeaderComponent extends React.Component{
this.context.toggleOrders()
}
getHeader(){
getHeader() {
let pages = null;
let {showHeader} = this.props;
let { showHeader } = this.props;
showHeader = showHeader ? showHeader : this.state.showHeader;
switch (showHeader){
switch (showHeader) {
case headerStatus[1]:
pages = this.getHomeHeader();
break;
......@@ -46,36 +46,36 @@ export default class HeaderComponent extends React.Component{
return pages;
}
showVersion(){
showVersion() {
this.setState({
showVersion : !this.state.showVersion
},()=>{
if(!this.timer && this.state.showVersion){
this.timer = window.setTimeout(()=>{
showVersion: !this.state.showVersion
}, () => {
if (!this.timer && this.state.showVersion) {
this.timer = window.setTimeout(() => {
window.clearTimeout(this.timer);
this.timer = null;
this.setState({
showVersion : false
showVersion: false
})
},this.countbackTime)
}, this.countbackTime)
}
})
if(this.isShowVersionAndPort()){
this.props.changePages(CONFIG.showPage[8888])
if (this.isShowVersionAndPort() && this.props.changePages) {
this.props.changePages(CONFIG.showPage[8888])
}
}
//判断是否显示版本号和端口号页面
isShowVersionAndPort () {
isShowVersionAndPort() {
return true
}
getHomeHeader(){
getHomeHeader() {
let headerInfo = this.props.headerInfo;
let {storeInfo,userInfo,taskInfo} = headerInfo;
let { storeInfo, userInfo, taskInfo } = headerInfo;
let style = {}
if(taskInfo && taskInfo.currentTaskNum && taskInfo.totalTaskNum){
if (taskInfo && taskInfo.currentTaskNum && taskInfo.totalTaskNum) {
style = {
'width' : (parseInt(taskInfo.currentTaskNum) / parseInt(taskInfo.totalTaskNum) * 100) + '%'
'width': (parseInt(taskInfo.currentTaskNum) / parseInt(taskInfo.totalTaskNum) * 100) + '%'
}
}
......@@ -88,10 +88,10 @@ export default class HeaderComponent extends React.Component{
return (
<div className={"homeHeader clearfix"}>
<div className={"headerContent leftContent fl"}>
<div className={"headerlogo"} onClick={()=>this.showVersion()}>
<div className={"headerlogo"} onClick={() => this.showVersion()}>
{
this.state.showVersion ? <div className={"colfff font26"} style={versionStyle}>当前版本号 --- {CURVERSION}</div> :
<img className={"logoImg"} src={UTILPATH.localImg.headlogo} alt=""/>
<img className={"logoImg"} src={UTILPATH.localImg.headlogo} alt="" />
}
</div>
{
......@@ -111,12 +111,12 @@ export default class HeaderComponent extends React.Component{
<p className={"font30"}>{storeInfo.name}</p>
<p className={"font24"}>ID : {storeInfo.id}</p>
</div>
</div> :null
</div> : null
}
{
userInfo && userInfo.id ? <div className={"userinfos"}>
<img className={"userheadImg"} src={ userInfo.headImageUrl || UTILPATH.localImg.defaultImg} alt=""/>
userInfo && userInfo.id ? <div className={"userinfos"}>
<img className={"userheadImg"} src={userInfo.headImageUrl || UTILPATH.localImg.defaultImg} alt="" />
<div className={"userinfo font30 colfff"}>
<p>{userInfo.employeeName || ''}</p>
<p>ID:{userInfo.id || 0}</p>
......@@ -124,30 +124,30 @@ export default class HeaderComponent extends React.Component{
</div> : null
}
<div className={"line"} />
<div className={"classify icon iconfont icon-menu colfff font70"} onClick={()=>this.handleShowClassify()}/>
<div className={"classify icon iconfont icon-menu colfff font70"} onClick={() => this.handleShowClassify()} />
</div>
</div>
)
}
getOtherHeader(){
let {headerIconList} = this.props;
getOtherHeader() {
let { headerIconList } = this.props;
return <div className={"otherHeader font32 clearfix"}>
{
headerIconList ? headerIconList.map((info,index)=>{
headerIconList ? headerIconList.map((info, index) => {
let dom = null;
if(index === 0){
if (index === 0) {
dom = (
<div className={"fl colfff"} onClick={()=>info.option()}>
<div className={"fl colfff"} onClick={() => info.option()}>
<i className={"iconfont middle icon font50 icon-circle-left circleIcon"}></i>
<span className={"middle"}>{info.text || ''}</span>
</div>
)
}else if(index ===1){
} else if (index === 1) {
dom = (
<div className={"fr "+(info.active ? 'colff7860':'col999')} onClick={()=>info.option()}>
<div className={"fr " + (info.active ? 'colff7860' : 'col999')} onClick={() => info.option()}>
<i className={"iconfont middle icon font50 icon-save saveIcon"}></i>
<span className={"middle"}>{info.text || ''}</span>
</div>
......@@ -165,7 +165,7 @@ export default class HeaderComponent extends React.Component{
render(){
render() {
let pages = this.getHeader.bind(this)();
return <div className={"headerComponent"}>
{pages}
......
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