Commit 63ed0d3a by Zhang Xin

fix opendoor commonInfo

parent 43f4fd99
import fetch from 'isomorphic-fetch' import fetch from 'isomorphic-fetch'
import {logout,getTaskList} from "./common"; import {logout, getTaskList, saveCommonInfo} from "./common";
let domain = ENV.domain; let domain = ENV.domain;
// let domain1='http://192.168.10.184:8080/maxbox/web/' // let domain1='http://192.168.10.184:8080/maxbox/web/'
const willCloseDoor=(data,flag=false)=>{ const willCloseDoor=(data,flag=false)=>{
...@@ -22,7 +22,11 @@ const willCloseDoor=(data,flag=false)=>{ ...@@ -22,7 +22,11 @@ const willCloseDoor=(data,flag=false)=>{
}).then((response)=>response.json()) }).then((response)=>response.json())
.then((json)=>{ .then((json)=>{
if(flag){ if(flag){
//回收箱完成
dispatch(getTaskList(data)) dispatch(getTaskList(data))
}else{
//没有问题,完成任务
// dispatch(saveCommonInfo(Object.assign({},{taskInfo:{currentTaskType:'FINISH'}})))
} }
// dispatch(closeDoorSuccess(data)); // dispatch(closeDoorSuccess(data));
}) })
......
...@@ -9,9 +9,10 @@ export default class HomePageContainer extends React.Component{ ...@@ -9,9 +9,10 @@ export default class HomePageContainer extends React.Component{
constructor(props){ constructor(props){
super(props); super(props);
this.state = { this.state = {
text : '' text : '',
closeDoorStatus : 0
} }
this.logout = this.logout.bind(this) this.logout = this.logout.bind(this);
this.showLogoutPopup = this.showLogoutPopup.bind(this) this.showLogoutPopup = this.showLogoutPopup.bind(this)
} }
...@@ -38,10 +39,23 @@ export default class HomePageContainer extends React.Component{ ...@@ -38,10 +39,23 @@ export default class HomePageContainer extends React.Component{
} }
logout(){ logout(){
if(this.state.closeDoorStatus === 0){
this.setState({
closeDoorStatus : 1
},()=>{
this.props.willCloseDoor();
// let msg={type:'WILL_CLOSEDOOR'}; // let msg={type:'WILL_CLOSEDOOR'};
// sendMsg(JSON.stringify(msg)); // sendMsg(JSON.stringify(msg));
// this.props.changeIsSend(true); // this.props.changeIsSend(true);
this.props.tempLogout() this.props.tempLogout()
})
}
}
componentWillUnmount(){
this.setState({
closeDoorStatus : 0
})
} }
showLogoutPopup(){ showLogoutPopup(){
...@@ -89,7 +103,7 @@ export default class HomePageContainer extends React.Component{ ...@@ -89,7 +103,7 @@ export default class HomePageContainer extends React.Component{
: null : null
} }
<div className={"homeText font42"} style={{marginTop:marginTop20}}>请关门,然后继续完成其他工作</div> <div className={"homeText font42"} style={{marginTop:marginTop20}}>请关门,然后继续完成其他工作</div>
<Button text={'关门'} btnContainer={'colfff font30'} style={buttonStyle} option={this.logout.bind(this)}/> <Button text={this.state.closeDoorStatus ? '关门中...' : '请点击按钮后关门'} btnContainer={'colfff font30'} style={buttonStyle} option={this.logout.bind(this)}/>
</div> : </div> :
<div className={"homeContainer"} > <div className={"homeContainer"} >
<img className={"homeIcon"} style={imgStyle} src={UTILPATH.localImg.homePage} alt=""/> <img className={"homeIcon"} style={imgStyle} src={UTILPATH.localImg.homePage} alt=""/>
......
...@@ -194,7 +194,7 @@ class PageContainer extends React.Component { ...@@ -194,7 +194,7 @@ class PageContainer extends React.Component {
} }
if(info.area){ if(info.area){
//区域信息 //区域信息
dispatch(saveCommonInfo(Object.assign({},{taskInfo:{area:info.area,taskId:0,currentTaskType:''}}))) dispatch(saveCommonInfo(Object.assign({},{taskInfo:{area:info.area,taskId:0,currentTaskType:'OPEN'}})))
} }
this.setState({ this.setState({
...@@ -270,11 +270,11 @@ class PageContainer extends React.Component { ...@@ -270,11 +270,11 @@ class PageContainer extends React.Component {
//补货人员,根据type判断显示页面 //补货人员,根据type判断显示页面
let nextTaskInfo = nextCommonInfo.taskInfo || {}; let nextTaskInfo = nextCommonInfo.taskInfo || {};
let lastCurrentType = taskInfo.currentTaskType; let lastCurrentType = taskInfo.currentTaskType || '';
if(nextUserInfo.taskType === "SECOND" && nextTaskInfo && nextTaskInfo.currentTaskType && if(nextUserInfo.taskType === "SECOND" && nextTaskInfo && nextTaskInfo.currentTaskType &&
nextTaskInfo.currentTaskType !== lastCurrentType nextTaskInfo.currentTaskType !== lastCurrentType && lastCurrentType !== 'FINISH'
){ ){
switch (nextTaskInfo.currentTaskType) { switch (nextTaskInfo.currentTaskType) {
case 'LR' : case 'LR' :
...@@ -299,6 +299,9 @@ class PageContainer extends React.Component { ...@@ -299,6 +299,9 @@ class PageContainer extends React.Component {
case 'REA' : case 'REA' :
this.changePages(CONFIG.showPage[15]); this.changePages(CONFIG.showPage[15]);
break; break;
case 'FINISH' :
this.changePages(CONFIG.showPage[131]);
break;
default: default:
this.changePages(CONFIG.showPage[13]); this.changePages(CONFIG.showPage[13]);
break; break;
...@@ -614,6 +617,9 @@ class PageContainer extends React.Component { ...@@ -614,6 +617,9 @@ class PageContainer extends React.Component {
case 'REA' : case 'REA' :
this.changePages(CONFIG.showPage[15]); this.changePages(CONFIG.showPage[15]);
break; break;
case 'FINISH':
this.changePages(CONFIG.showPage[131]);
break;
default: default:
this.changePages(CONFIG.showPage[13]); this.changePages(CONFIG.showPage[13]);
break; break;
......
...@@ -23,11 +23,11 @@ export default class QuestionContainer extends React.Component{ ...@@ -23,11 +23,11 @@ export default class QuestionContainer extends React.Component{
handleNoQuestion(){ handleNoQuestion(){
let {menuType = '',changePages} = this.props; let {menuType = '',changePages,willCloseDoor} = this.props;
if(menuType){ if(menuType){
this.context.goBackTask() this.context.goBackTask()
}else{ }else{
this.props.willCloseDoor(); // willCloseDoor();
changePages(CONFIG.showPage[131]) changePages(CONFIG.showPage[131])
} }
} }
......
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