Commit 260c7578 by yaxiLiuu

Merge branch 'dev' of git.mjitech.com:zhangxin/max_android_panel into dev

parents 75bddc2e fadaa735
...@@ -27,41 +27,33 @@ const saveStoreInfo = (data)=>{ ...@@ -27,41 +27,33 @@ const saveStoreInfo = (data)=>{
}; };
var myHeaders = new Headers({ var myHeaders = new Headers({
// 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
// 'Content-Type': 'text/plain;charset=UTF-8', // 'Content-Type': 'text/plain;charset=UTF-8',
// 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', // 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
// 'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
// 'token':'123456'
}); });
const getStoreInfo = (storeId)=>{ const getStoreInfo = (storeId)=>{
return(dispatch)=>{ return(dispatch)=>{
dispatch(saveHeaderInfo({storeId})) dispatch(saveHeaderInfo({storeId}))
let bodyData = {storeId}; let bodyData = {storeId};
// headers.append("token","123456");
fetch(domain + 'pad_warehouse/getMachineData.action',{ fetch(domain + 'pad_warehouse/getMachineData.action',{
credentials : 'include', credentials : 'include',
method : 'POST', method : 'POST',
mode : 'cors', mode : 'cors',
headers: { headers: myHeaders,
'content-type':'application/json;charset=UTF-8',
'token' : '',
'employeeId' : ''
},
body: JSON.stringify(bodyData) body: JSON.stringify(bodyData)
}).then((response)=>response.json()) }).then((response)=>response.json())
.then(json=>{ .then(json=>{
console.log(json); console.log(json);
if(json.meta.success && json.data.warehouse){
dispatch(saveStoreInfo(Object.assign({},json.data.warehouse,{id:storeId})))
}else{
//没有店铺信息
}
}).catch(e=>{console.error(e)}) }).catch(e=>{console.error(e)})
if(json.meta.success && json.data.warehouse){
dispatch(saveStoreInfo(Object.assign({},json.data.warehouse,{id:storeId})))
}else{
}
} }
} }
......
...@@ -47,7 +47,8 @@ let json = { ...@@ -47,7 +47,8 @@ let json = {
"employeeName": "机器库管员", "employeeName": "机器库管员",
"headImageUrl": "http://www.mjitech.com/static/coupon/gounian/banner_hongbaotupian-3-14.jpg" "headImageUrl": "http://www.mjitech.com/static/coupon/gounian/banner_hongbaotupian-3-14.jpg"
}, },
"taskIds": 155 "taskId": 155,
"sellOrderId" : 1
} }
} }
...@@ -67,42 +68,55 @@ const saveUserInfo = (data)=>{ ...@@ -67,42 +68,55 @@ const saveUserInfo = (data)=>{
} }
} }
var myHeaders = new Headers({
'Access-Control-Allow-Origin': '*',
// 'Content-Type': 'text/plain;charset=UTF-8',
// 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Content-Type': 'application/json; charset=UTF-8',
});
const getTroubleList = (info)=>{ const getTroubleList = (info)=>{
console.log(info); console.log(info);
//{storeId: 17, employeeId: 5, token: "966D5C0B-3CF2-420D-B9A3-313BA37DE092"}
return(dispatch)=>{ return(dispatch)=>{
// fetch(domain + '/web/pad_warehouse/getMachineData.action',{ let bodyData = Object.assign({},{
// credentials : 'include', employeeId : info.employeeId,
// method : 'POST', storeId : info.storeId
// mode : 'cors', });
// body : {} fetch(domain + 'machine_pad/list_fault.action',{
// credentials : 'include',
// }).then((response)=>response.json()) method : 'POST',
// .then(json=>{ mode : 'cors',
// console.log(json); headers: myHeaders,
// }).catch(e=>{console.error(e)}) body : JSON.stringify(bodyData)
if(json.meta.success && json.data){ }).then((response)=>response.json())
dispatch(saveHeaderInfo({taskId:json.data.taskIds})) .then(json=>{
dispatch(saveTroubleList(json.data)) if(json.meta.success && json.data){
} dispatch(saveHeaderInfo({taskId:json.data.taskId,sellOrderId:json.data.sellOrderId}))
dispatch(saveTroubleList(json.data))
}
}).catch(e=>{console.error(e)})
} }
}; };
const updateTroubleList = (info)=>{ const updateTroubleList = (info,headerInfo)=>{
let bodyData = Object.assign({},{details:info},headerInfo);
console.log("updateTroubleList :",bodyData)
return(dispatch)=>{ return(dispatch)=>{
// fetch(domain + '/web/machine_pad/save_all.action',{ fetch(domain + 'machine_pad/save_all.action',{
// credentials : 'include', credentials : 'include',
// method : 'POST', method : 'POST',
// mode : 'cors', mode : 'cors',
// body : {} headers: myHeaders,
// body : JSON.stringify(bodyData)
// }).then((response)=>response.json()) }).then((response)=>response.json())
// .then(json=>{ .then(json=>{
// console.log(json); console.log("updateTroubleList : ",json);
// }).catch(e=>{console.error(e)}) }).catch(e=>{console.error(e)})
} }
} }
......
import fetch from 'isomorphic-fetch'; import fetch from 'isomorphic-fetch';
import actionTypes from '../actiontype/refreshImg' import actionTypes from '../actiontype/refreshImg'
import {addErrorInfo} from './uploadError' import {addErrorInfo} from './uploadError'
import {getIp} from "./getIp";
const domain = ENV.domain; const domain = ENV.domain;
let json = { let json = {
...@@ -56,46 +57,77 @@ const refreshImg = (data)=>{ ...@@ -56,46 +57,77 @@ const refreshImg = (data)=>{
} }
}; };
const checkStatus = (response)=>{
console.log("===========")
console.log(response);
if (response.status >= 200 && response.status < 300) {
return response;
}
const error = new Error(response.statusText);
error.response = response;
throw error;
};
const parseJson = (response)=>{
return response.json();
};
const getRefreshImg = (errorId,type)=>{ const getRefreshImg = (errorId,type)=>{
return(dispatch)=>{ return(dispatch)=>{
// fetch(domain + '/web/flush_image.action',{ let bodyData = Object.assign({},{errorId,type})
// credentials : 'include', fetch(domain + 'flush_image.action',{
// method : 'POST', credentials : 'include',
// mode : 'cors', method : 'POST',
// body : {} mode : 'cors',
// headers: {
// }).then((response)=>response.json()) 'content-type':'application/json;charset=UTF-8',
// .then(json=>{ },
// console.log(json); body: JSON.stringify(bodyData)
// }).catch(e=>{console.error(e)})
if(json.meta.success && json.data){ }).then((response)=>response.json())
let data = { .then(json=>{
errorId, console.log(json);
type, if(json.meta.success && json.data){
files : json.data let data = {
}; errorId,
dispatch(refreshImg(data)) type,
} files : json.data.files ? json.data.files : []
};
dispatch(refreshImg(data))
}
}).catch(e=>{console.error(e)})
} }
}; };
const deleteImg = (errorId,type,fileId)=>{ const deleteImg = (errorId,type,fileId)=>{
fetch(domain + '/web/delete_image_error.action',{ return(dispatch)=>{
credentials : 'include', console.log("deleteImg action :",errorId,type,fileId);
method : 'POST', let bodyData = Object.assign({},{errorId,type,fileId})
mode : 'cors', console.log(bodyData);
body : Object.assign({},{errorId,type,fileId}) fetch(domain + 'delete_image_error.action',{
credentials : 'include',
method : 'POST',
mode : 'cors',
headers: {
'content-type':'application/json;charset=UTF-8',
},
body: JSON.stringify(bodyData)
}).then(checkStatus)
.then(parseJson)
.then((data) => {
console.log("data :",data);
if(data.meta.success){
dispatch(getRefreshImg(errorId,type))
}
})
.catch((err) =>{
console.error("Err:",err);
});
}
}).then((response)=>response.json())
.then(json=>{
if(json.meta.success){
dispatch(getRefreshImg(errorId,type))
}else {
dispatch(addErrorInfo(json.meta.message))
}
}).catch(e=>{console.error(e)})
} }
export {getRefreshImg,deleteImg} export {getRefreshImg,deleteImg}
......
...@@ -17,6 +17,7 @@ export default class FinishTroubleComponent extends React.Component{ ...@@ -17,6 +17,7 @@ export default class FinishTroubleComponent extends React.Component{
haveNoNext(){ haveNoNext(){
console.log("没有"); console.log("没有");
let props = this.props; let props = this.props;
console.log(CONFIG.showPage[4]);
props.changePages(CONFIG.showPage[4]) props.changePages(CONFIG.showPage[4])
} }
......
...@@ -8,7 +8,7 @@ export default class TroubleItemComponent extends React.Component{ ...@@ -8,7 +8,7 @@ export default class TroubleItemComponent extends React.Component{
text: '' text: ''
} }
this.reRreshImg = this.reRreshImg.bind(this) this.reRreshImg = this.reRreshImg.bind(this)
this.deleteImg = this.deleteImg.bind(this) this.deleteImgById = this.deleteImgById.bind(this)
this.addImg = this.addImg.bind(this) this.addImg = this.addImg.bind(this)
} }
...@@ -37,8 +37,15 @@ export default class TroubleItemComponent extends React.Component{ ...@@ -37,8 +37,15 @@ export default class TroubleItemComponent extends React.Component{
props.showQrcode(item.errorCode) props.showQrcode(item.errorCode)
} }
deleteImg(){ deleteImgById(fileId){
console.log("deleteImgById :",fileId)
let props = this.props; let props = this.props;
let {deleteImg} = props;
let item = props.item;
let errorId = item.id;
let type = item.type;
console.log(errorId,type,fileId)
deleteImg(errorId,type,fileId)
} }
...@@ -49,10 +56,10 @@ export default class TroubleItemComponent extends React.Component{ ...@@ -49,10 +56,10 @@ export default class TroubleItemComponent extends React.Component{
let imgFiles = Array.isArray(item.files) ? item.files.map((f,k)=>{ let imgFiles = Array.isArray(item.files) ? item.files.map((f,k)=>{
return <ImageComponent key={"troubleItemImg"+k} return <ImageComponent key={"troubleItemImg"+k}
noCloseBtn={false} noCloseBtn={false}
handleClikCloseFunc = {this.deleteImg} handleClikCloseFunc = {()=>this.deleteImgById(f.id)}
handleClikImgFunc = {()=>{}} handleClikImgFunc = {()=>{}}
type={"custom"} type={"custom"}
imgSrc = {item.filePath}/> imgSrc = {f.filePath}/>
}) : null; }) : null;
return ( return (
......
import swiperContainers from './swiperContainer' import swiperContainers from './swiperContainer'
import showPage from './showPage' import showPage from './showPage'
import socketType from './socketType' import socketType from './socketType'
import taskType from './taskType'
module.exports = {swiperContainers,...showPage,socketType,taskType} module.exports = {swiperContainers,...showPage,socketType}
\ No newline at end of file \ No newline at end of file
import {getTroubleList} from "../actions/getTroubles";
const taskType = {
Trouble : getTroubleList,
};
module.exports = {taskType};
\ No newline at end of file
const troubleType = {
1 : 'KN', //已知故障
3 : 'OP', //新建问题
};
module.exports = troubleType;
\ No newline at end of file
...@@ -3,7 +3,7 @@ import React from 'react' ...@@ -3,7 +3,7 @@ import React from 'react'
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import {getStoreInfo} from "../../actions/getStore"; import {getStoreInfo} from "../../actions/getStore";
import {getTroubleList} from "../../actions/getTroubles"; import {getTroubleList,updateTroubleList} from "../../actions/getTroubles";
import {initGetOtherProblem,addNewProbem,deleteProblem,editProblemItem,submitProblemList} from "../../actions/otherQuestion" import {initGetOtherProblem,addNewProbem,deleteProblem,editProblemItem,submitProblemList} from "../../actions/otherQuestion"
import {scanBarCodeGetProductInfo,submitProductInfo,saveEditProductInfo} from "../../actions/ScanBarCode" import {scanBarCodeGetProductInfo,submitProductInfo,saveEditProductInfo} from "../../actions/ScanBarCode"
import {getReportDamageList,deleteDamageItem} from '../../actions/reportDamageList' import {getReportDamageList,deleteDamageItem} from '../../actions/reportDamageList'
...@@ -48,16 +48,12 @@ class PageContainer extends React.Component { ...@@ -48,16 +48,12 @@ class PageContainer extends React.Component {
lastPage : '', lastPage : '',
page : null, page : null,
popupInfo : defaultPopupInfo, popupInfo : defaultPopupInfo,
pageStyle : {},
lastPageStyle:{},
showClock : false, //关门页面显示倒计时 showClock : false, //关门页面显示倒计时
headerInfo : {} headerInfo : {}
}; };
this.getPages = this.getPages.bind(this); //获取当前页面 this.getPages = this.getPages.bind(this); //获取当前页面
this.showPopup = this.showPopup.bind(this); //显示弹窗 this.showPopup = this.showPopup.bind(this); //显示弹窗
this.hidePopup = this.hidePopup.bind(this); // 隐藏弹窗 this.hidePopup = this.hidePopup.bind(this); // 隐藏弹窗
this.saveLastPage = this.saveLastPage.bind(this); //保存上一页
this.goBack = this.goBack.bind(this); // 回到上一页
this.handleTouch = this.handleTouch.bind(this); //监听页面触碰 this.handleTouch = this.handleTouch.bind(this); //监听页面触碰
this.beginCountBack = this.beginCountBack.bind(this); //开始300s倒计时 this.beginCountBack = this.beginCountBack.bind(this); //开始300s倒计时
this.endCountBack = this.endCountBack.bind(this); //结束300s倒计时 this.endCountBack = this.endCountBack.bind(this); //结束300s倒计时
...@@ -86,10 +82,6 @@ class PageContainer extends React.Component { ...@@ -86,10 +82,6 @@ class PageContainer extends React.Component {
}; };
} }
connectOk(){
console.log("connectOk")
}
componentWillMount() { componentWillMount() {
let that = this; let that = this;
let {dispatch} = this.props; let {dispatch} = this.props;
...@@ -97,7 +89,7 @@ class PageContainer extends React.Component { ...@@ -97,7 +89,7 @@ class PageContainer extends React.Component {
console.log("==GETSTOREINFO===") console.log("==GETSTOREINFO===")
console.log(data); console.log(data);
dispatch(getStoreInfo(data.storeId)); dispatch(getStoreInfo(data.storeId));
}) });
on(CONFIG.socketType.GETSOCKETMSG,this,function (data) { on(CONFIG.socketType.GETSOCKETMSG,this,function (data) {
console.log("==GETSTOREINFO===") console.log("==GETSTOREINFO===")
console.log(data) console.log(data)
...@@ -201,6 +193,7 @@ class PageContainer extends React.Component { ...@@ -201,6 +193,7 @@ class PageContainer extends React.Component {
changePages(page){ changePages(page){
console.log("changePages : ",page);
this.setState({ this.setState({
showPage : page, showPage : page,
popupInfo : defaultPopupInfo popupInfo : defaultPopupInfo
...@@ -345,24 +338,8 @@ class PageContainer extends React.Component { ...@@ -345,24 +338,8 @@ class PageContainer extends React.Component {
}) })
} }
saveLastPage(page,pageStyle){
this.setState({
lastPage : page,
lastPageStyle : pageStyle
})
}
goBack(){
console.log("goback")
let lastPage = this.state.lastPage;
let pageStyle = this.state.lastPageStyle;
this.setState({
showPage: lastPage,
pageStyle : pageStyle
})
}
getPages(){ getPages(){
let pages = null; let pages = null;
...@@ -378,9 +355,10 @@ class PageContainer extends React.Component { ...@@ -378,9 +355,10 @@ class PageContainer extends React.Component {
showTextArea={(text)=>this.showTextArea(text)} showTextArea={(text)=>this.showTextArea(text)}
showPopup={(info)=>this.showPopup(info)} showPopup={(info)=>this.showPopup(info)}
hidePopup={()=>this.hidePopup()} hidePopup={()=>this.hidePopup()}
changePages={()=>this.changePages()} changePages={(pageIndex)=>this.changePages(pageIndex)}
getRefreshImg={(errorId,type)=>dispatch(getRefreshImg(errorId,type))} getRefreshImg={(errorId,type)=>dispatch(getRefreshImg(errorId,type))}
deleteImg={(errorId,type,fileId)=>dispatch(deleteImg(errorId,type,fileId))} deleteImg={(errorId,type,fileId)=>dispatch(deleteImg(errorId,type,fileId))}
updateTroubleList={(info)=>dispatch(updateTroubleList(info,state.headerInfo))}
/>; />;
break; break;
case showPage[2]: case showPage[2]:
...@@ -436,7 +414,7 @@ class PageContainer extends React.Component { ...@@ -436,7 +414,7 @@ class PageContainer extends React.Component {
render() { render() {
let {state} = this.props; let {state} = this.props;
return ( return (
<div className={"pageContainer "} style={this.state.pageStyle} onTouchStart={()=>this.handleTouch()}> <div className={"pageContainer "} onTouchStart={()=>this.handleTouch()}>
<PopupComponent popupInfo={this.state.popupInfo} /> <PopupComponent popupInfo={this.state.popupInfo} />
{this.getPages()} {this.getPages()}
</div> </div>
......
...@@ -141,7 +141,7 @@ export default class TroubleContainer extends React.Component{ ...@@ -141,7 +141,7 @@ export default class TroubleContainer extends React.Component{
} }
dealTrouble(){ dealTrouble(){
let {showPopup,hidePopup} = this.props; let {showPopup,hidePopup,updateTroubleList} = this.props;
let troubleList = this.state.troubleList; let troubleList = this.state.troubleList;
let details = troubleList.details; let details = troubleList.details;
let arr = details.filter(d=>{ let arr = details.filter(d=>{
...@@ -158,7 +158,7 @@ export default class TroubleContainer extends React.Component{ ...@@ -158,7 +158,7 @@ export default class TroubleContainer extends React.Component{
details.forEach((d)=>{ details.forEach((d)=>{
d.imagesFileId = d.files.map(f=>f.id).join(','); d.imagesFileId = d.files.map(f=>f.id).join(',');
}); });
console.log(details); updateTroubleList(details);
this.setState({ this.setState({
showTrouble : false showTrouble : false
}) })
...@@ -166,7 +166,7 @@ export default class TroubleContainer extends React.Component{ ...@@ -166,7 +166,7 @@ export default class TroubleContainer extends React.Component{
} }
getDefaultDom(){ getDefaultDom(){
let {userInfo,storeInfo,getRefreshImg} = this.props; let {userInfo,storeInfo,getRefreshImg,deleteImg,changePages} = this.props;
let troubleList = this.state.troubleList; let troubleList = this.state.troubleList;
let showTrouble = Array.isArray(troubleList.details) && troubleList.details.length > 0; let showTrouble = Array.isArray(troubleList.details) && troubleList.details.length > 0;
let details = Array.isArray(troubleList.details) ? troubleList.details : []; let details = Array.isArray(troubleList.details) ? troubleList.details : [];
...@@ -174,6 +174,7 @@ export default class TroubleContainer extends React.Component{ ...@@ -174,6 +174,7 @@ export default class TroubleContainer extends React.Component{
return <TroubleItem key={k} item={i} num={k+1} setItem={this.setItem} return <TroubleItem key={k} item={i} num={k+1} setItem={this.setItem}
showText={this.showText} showQrcode={this.showQrcode} showText={this.showText} showQrcode={this.showQrcode}
getRefreshImg={getRefreshImg} getRefreshImg={getRefreshImg}
deleteImg={deleteImg}
/>; />;
}); });
let swiperOptions = { let swiperOptions = {
...@@ -208,7 +209,7 @@ export default class TroubleContainer extends React.Component{ ...@@ -208,7 +209,7 @@ export default class TroubleContainer extends React.Component{
</div> </div>
</div> </div>
</div> : <FinishTrouble changePages={props.changePages}/> </div> : <FinishTrouble changePages={changePages}/>
} }
</div> </div>
) )
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>怪兽家便利店</title> <title>怪兽家便利店</title>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=false,target-densitydpi=device-dpi'/> <meta name='viewport' content='width=device-width, initial-scale=0.67, maximum-scale=0.67, user-scalable=false,target-densitydpi=device-dpi'/>
<meta name="format-detection" content="telephone=no"/> <meta name="format-detection" content="telephone=no"/>
</head> </head>
......
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