Commit 357b52a7 by wujiabao

add 任务转中文 根据后台跳组件

parent 7ff102c5
......@@ -35,8 +35,8 @@ const getTaskInfo = (data)=>{
taskInfo = Object.assign({},json.data)
}
console.log(taskInfo)
dispatch(startalljob(Object.assign({},taskInfo)))
dispatch(saveCommonInfo(Object.assign({},taskInfo)))
dispatch(startalljob(Object.assign({},{taskInfo})))
}).catch(e=>{console.error(e)})
}
......
......@@ -12,7 +12,7 @@ export default class ButtonComponent extends React.Component{
let colorClass = props.classInfo && props.classInfo.colorInfo ? props.classInfo.colorInfo : "col333";
let fontClass = props.classInfo && props.classInfo.fontInfo ? props.classInfo.fontInfo : "font32";
return(
<div className={`buttonComponent ${fontClass} ${colorClass} ${classInfo}`} style={props.style} onClick={()=>props.option()}>
<div className={`buttonComponent ${fontClass} ${colorClass} ${classInfo}`} style={props.style} onClick={()=>{props.option()}}>
{props.text}
</div>
)
......
......@@ -16,12 +16,6 @@ export default class HomePageContainer extends React.Component{
}
componentWillReceiveProps(nextProps){
}
render(){
let props = this.props;
let {userInfo,storeInfo,headerInfo} = props;
......@@ -42,12 +36,37 @@ export default class HomePageContainer extends React.Component{
<img className={"homeIcon"} src={UTILPATH.localImg.homePage} alt=""/>
<div className={'homeWelcom font30 clo333'} style={{marginTop:'50px'}}>欢迎来到<span className="homeArea font50 colff775c" style={{padding:'0 8px'}}>A</span></div>
<div className={"homeText font42"} style={{fontWeight:'800',marginTop:'20px'}}>下午好, 你辛苦了!</div>
<Button text={'开始工作'} classInfo={classInfo} style={buttonStyle} option={props.startTask} />
<Button text={'开始工作'} classInfo={classInfo} style={buttonStyle} option={this.start.bind(this)}/>
</div>
</div>
)
}
start(){
let props=this.props;
props.startTask();
}
componentWillReceiveProps(nextProps){
let props=this.props;
if(nextProps.headerInfo.taskInfo){
let num=nextProps.headerInfo.taskInfo.currentTaskNum;
switch(num){
case 1 :
props.changePages(CONFIG.showPage[6]);
break;
case 1 :
props.changePages(CONFIG.showPage[6]);
break;
case 1 :
props.changePages(CONFIG.showPage[6]);
break;
case 1 :
props.changePages(CONFIG.showPage[6]);
break;
}
}
}
}
HomePageContainer.propTypes = {
......
......@@ -88,6 +88,7 @@ class PageContainer extends React.Component {
/*以下是二期方法 start*/
this.showHomePage = this.showHomePage.bind(this); //二期显示首页
this.triggerAllClassify = this.triggerAllClassify.bind(this); //二期显示菜单栏
this.showSecondTroubelPage = this.showSecondTroubelPage.bind(this); //根据用户的type判断显示的页面
/*以下是二期方法 end*/
......@@ -99,6 +100,7 @@ class PageContainer extends React.Component {
this.taskTypeOption = {
'ER': this.showTroublePage,
'BH': this.showSecondTroubelPage
};
}
......@@ -249,7 +251,12 @@ class PageContainer extends React.Component {
this.beginCountBack();
});
}
showSecondTroubelPage(info){
// let {dispatch} =this.props;
this.setState({
showPage : showPage[13]
})
}
changePages(page){
console.log("changePages : ",page);
this.setState({
......@@ -466,7 +473,7 @@ class PageContainer extends React.Component {
pages = <TroubleContainer
troubleList={state.troubleList}
refreshImg = {state.refreshImg}
storeInfo={state.storeInfo}
storeInfo={state.commonInfo.storeInfo}
userInfo={state.userInfo}
initTroubleList={(info)=>dispatch(getTroubleList(info))}
showTextArea={(text)=>this.showTextArea(text)}
......@@ -553,7 +560,11 @@ class PageContainer extends React.Component {
break;
/*以下是二期页面 start*/
case showPage[13]:
pages = <HomePage headerInfo={state.commonInfo} startTask={()=>{dispatch(getTaskInfo(state.commonInfo))}} />;
console.log(state.commonInfo,'12121212121212')
pages = <HomePage headerInfo={state.commonInfo}
startTask={()=>{dispatch(getTaskInfo(state.commonInfo))}}
changePages={(data)=>this.changePages(data)}
/>;
break;
case showPage[6]:
pages = <TakeStokeContainer headerInfo = {state.commonInfo}/>;
......
......@@ -22,8 +22,61 @@ const saveCommonInfo = (state,data)=>{
const emptyCommInfo = (state,data)=>{
return Object.assign({},state,data)
}
// 传入一个对象 对象中包含currentTaskNum表示大任务
// childTaskNum 表示大任务下的小任务
const NumChangeWord=(obj)=>{
let arr=[
{
title:'散落商品检查',
children:['1','2']
},
{
title:'核对数量',
children:['1','2']
},
{
title:'回收区货品回收',
children:['1','2']
},
{
title:'补货',
children:['1','2']
}
]
let name=obj.currentTaskNum;
let child=obj.childTaskNum?obj.childTaskNum:false;
switch(name){
case 1 :
obj.currentTaskName=arr[name-1].title;
if(child){
obj.childTaskNum=arr[name-1].children[child-1]
}
break;
case 2 :
obj.currentTaskName=arr[name-1].title;
if(child){
obj.childTaskNum=arr[name-1].children[child-1]
}
break;
case 3 :
obj.currentTaskName=arr[name-1].title;
if(child){
obj.childTaskNum=arr[name-1].children[child-1]
}
break;
case 4 :
obj.currentTaskName=arr[name-1].title;
if(child){
obj.childTaskNum=arr[name-1].children[child-1]
}
break;
}
}
const startalljob= (state,data)=>{
return Object.assign({},state,data)
let info =saveCommonInfo(state,data);
return info;
}
export default function(state={}, action) {
switch (action.type) {
......@@ -32,7 +85,7 @@ export default function(state={}, action) {
case actionTypes.EMPTYCOMMONINFO:
return emptyCommInfo(state);
case actionTypes.STARTALLJOB :
return startalljob(state);
return startalljob(state,action.data);
default:
return state;
}
......
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