Commit 4ac2783c by wujiabao

fix 问题

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