Commit dd81986b by Zhang Xin

修改接口url && 修改bug

parent 6d1fea1a
...@@ -32,7 +32,7 @@ export function scanBarCodeGetProductInfo(postData) { ...@@ -32,7 +32,7 @@ export function scanBarCodeGetProductInfo(postData) {
} }
export function submitProductInfo(postData) { export function submitProductInfo(postData) {
return (dispatch)=>{ return (dispatch)=>{
let url = String(domain+'/machine_pad/submit_add_loss_task'); let url = String(domain+'machine_pad/submit_add_loss_task');
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
method : 'POST', method : 'POST',
......
...@@ -46,7 +46,6 @@ const getStoreInfo = (storeId)=>{ ...@@ -46,7 +46,6 @@ const getStoreInfo = (storeId)=>{
body: JSON.stringify(bodyData) body: JSON.stringify(bodyData)
}).then((response)=>response.json()) }).then((response)=>response.json())
.then(json=>{ .then(json=>{
console.log(json);
if(json.meta.success && json.data.warehouse){ if(json.meta.success && json.data.warehouse){
dispatch(saveStoreInfo(Object.assign({},json.data.warehouse,{id:storeId}))) dispatch(saveStoreInfo(Object.assign({},json.data.warehouse,{id:storeId})))
}else{ }else{
......
...@@ -122,8 +122,6 @@ var myHeaders = new Headers({ ...@@ -122,8 +122,6 @@ var myHeaders = new Headers({
const getTroubleList = (info)=>{ const getTroubleList = (info)=>{
console.log("getTroubleList ",info);
//{storeId: 17, employeeId: 5, token: "966D5C0B-3CF2-420D-B9A3-313BA37DE092"}
return(dispatch)=>{ return(dispatch)=>{
let bodyData = Object.assign({},{ let bodyData = Object.assign({},{
employeeId : info.employeeId, employeeId : info.employeeId,
...@@ -142,18 +140,12 @@ const getTroubleList = (info)=>{ ...@@ -142,18 +140,12 @@ const getTroubleList = (info)=>{
dispatch(saveTroubleList(json.data)) dispatch(saveTroubleList(json.data))
} }
}).catch(e=>{console.error(e)}) }).catch(e=>{console.error(e)})
// if(json.meta.success && json.data){
// dispatch(saveHeaderInfo({taskId:json.data.taskId,sellOrderId:json.data.sellOrderId}))
// dispatch(saveTroubleList(json.data))
// }
} }
}; };
const updateTroubleList = (info,headerInfo)=>{ const updateTroubleList = (info,headerInfo)=>{
let bodyData = Object.assign({},{details:info},headerInfo); let bodyData = Object.assign({},{details:info},headerInfo);
console.log("updateTroubleList :",bodyData)
return(dispatch)=>{ return(dispatch)=>{
fetch(domain + 'machine_pad/save_all.action',{ fetch(domain + 'machine_pad/save_all.action',{
credentials : 'include', credentials : 'include',
...@@ -163,7 +155,6 @@ const updateTroubleList = (info,headerInfo)=>{ ...@@ -163,7 +155,6 @@ const updateTroubleList = (info,headerInfo)=>{
body : JSON.stringify(bodyData) body : JSON.stringify(bodyData)
}).then((response)=>response.json()) }).then((response)=>response.json())
.then(json=>{ .then(json=>{
console.log("updateTroubleList : ",json);
}).catch(e=>{console.error(e)}) }).catch(e=>{console.error(e)})
} }
} }
......
import actionTypes from '../actiontype/initHeader' import actionTypes from '../actiontype/initHeader'
const domain = ENV.domain;
let json = {
"meta": {
"code": "200",
"message": "成功",
"success": true
},
"data": {
"warehouse": {
"id": 13,
"name": "华贸商业街",
"image": "http://static.mjitech.com/static/tmp/2018-05-25/1527243213701.jpg",
"address": "华贸商业街(新光天地与利兹卡尔顿酒店之间广场)"
}
}
};
const saveHeaderInfo = (data)=>{ const saveHeaderInfo = (data)=>{
return{ return{
type:actionTypes.INITHEADERS, type:actionTypes.INITHEADERS,
......
...@@ -4,7 +4,7 @@ const domain = ENV.domain; ...@@ -4,7 +4,7 @@ const domain = ENV.domain;
//有服务器交互的actions //有服务器交互的actions
export function initGetOtherProblem(postData) { export function initGetOtherProblem(postData) {
return (dispatch) => { return (dispatch) => {
let url = String(domain+'/machine_pad/list_other_fault.action'); let url = String(domain+'machine_pad/list_other_fault.action');
console.log(url) console.log(url)
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
...@@ -31,7 +31,7 @@ export function initGetOtherProblem(postData) { ...@@ -31,7 +31,7 @@ export function initGetOtherProblem(postData) {
} }
export function addNewProbem(postData) { export function addNewProbem(postData) {
return (dispatch) => { return (dispatch) => {
let url = String(domain+'/machine_pad/insert_problem.action'); let url = String(domain+'machine_pad/insert_problem.action');
console.log(url) console.log(url)
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
...@@ -59,7 +59,7 @@ export function addNewProbem(postData) { ...@@ -59,7 +59,7 @@ export function addNewProbem(postData) {
} }
export function deleteProblem(postData) { export function deleteProblem(postData) {
return (dispatch) => { return (dispatch) => {
let url = String(domain+'/machine_pad/skip_feed_problem.action'); let url = String(domain+'machine_pad/skip_feed_problem.action');
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
method : 'POST', method : 'POST',
...@@ -92,7 +92,7 @@ export function deleteProblem(postData) { ...@@ -92,7 +92,7 @@ export function deleteProblem(postData) {
} }
export function submitProblemList(postData) { export function submitProblemList(postData) {
return (dispatch) => { return (dispatch) => {
let url = String(domain+'/machine_pad/add_feed_problem.action'); let url = String(domain+'machine_pad/add_feed_problem.action');
console.log(url) console.log(url)
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
......
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 {getIp} from "./getIp";
const domain = ENV.domain; const domain = ENV.domain;
let json = {
"meta": {
"code": "200",
"message": "成功",
"success": true
},
"data": {
"files":[
{
"id": 17,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 18,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 19,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 21,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 22,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 23,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 24,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 25,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 26,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
}
]
}
}
const refreshImg = (data)=>{ const refreshImg = (data)=>{
return{ return{
type:actionTypes.REFRESHIMG, type:actionTypes.REFRESHIMG,
...@@ -60,8 +9,6 @@ const refreshImg = (data)=>{ ...@@ -60,8 +9,6 @@ const refreshImg = (data)=>{
}; };
const checkStatus = (response)=>{ const checkStatus = (response)=>{
console.log("===========")
console.log(response);
if (response.status >= 200 && response.status < 300) { if (response.status >= 200 && response.status < 300) {
return response; return response;
} }
...@@ -89,7 +36,6 @@ const getRefreshImg = (errorId,type)=>{ ...@@ -89,7 +36,6 @@ const getRefreshImg = (errorId,type)=>{
}).then((response)=>response.json()) }).then((response)=>response.json())
.then(json=>{ .then(json=>{
console.log(json);
if(json.meta.success && json.data){ if(json.meta.success && json.data){
let data = { let data = {
errorId, errorId,
...@@ -99,21 +45,12 @@ const getRefreshImg = (errorId,type)=>{ ...@@ -99,21 +45,12 @@ const getRefreshImg = (errorId,type)=>{
dispatch(refreshImg(data)) dispatch(refreshImg(data))
} }
}).catch(e=>{console.error(e)}) }).catch(e=>{console.error(e)})
// let data = {
// errorId,
// type,
// files : json.data.files ? json.data.files : []
// };
// dispatch(refreshImg(data))
} }
}; };
const deleteImg = (errorId,type,fileId)=>{ const deleteImg = (errorId,type,fileId)=>{
return(dispatch)=>{ return(dispatch)=>{
console.log("deleteImg action :",errorId,type,fileId);
let bodyData = Object.assign({},{errorId,type,fileId}) let bodyData = Object.assign({},{errorId,type,fileId})
console.log(bodyData);
fetch(domain + 'delete_image_error.action',{ fetch(domain + 'delete_image_error.action',{
credentials : 'include', credentials : 'include',
method : 'POST', method : 'POST',
...@@ -125,7 +62,6 @@ const deleteImg = (errorId,type,fileId)=>{ ...@@ -125,7 +62,6 @@ const deleteImg = (errorId,type,fileId)=>{
}).then(checkStatus) }).then(checkStatus)
.then(parseJson) .then(parseJson)
.then((data) => { .then((data) => {
console.log("data :",data);
if(data.meta.success){ if(data.meta.success){
dispatch(getRefreshImg(errorId,type)) dispatch(getRefreshImg(errorId,type))
} }
...@@ -133,14 +69,6 @@ const deleteImg = (errorId,type,fileId)=>{ ...@@ -133,14 +69,6 @@ const deleteImg = (errorId,type,fileId)=>{
.catch((err) =>{ .catch((err) =>{
console.error("Err:",err); console.error("Err:",err);
}); });
// let info = json.data.files.filter(i=>i.id !== fileId);
// let data = {
// errorId,
// type,
// files : info
// };
// dispatch(refreshImg(data))
} }
} }
......
...@@ -9,7 +9,6 @@ var myHeaders = new Headers({ ...@@ -9,7 +9,6 @@ var myHeaders = new Headers({
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
}); });
const uploadError = (info)=>{ const uploadError = (info)=>{
console.log("uploadError ",info)
let bodyData = { let bodyData = {
warehouseId : info.storeId, warehouseId : info.storeId,
exceptionType : info.exceptionType, exceptionType : info.exceptionType,
...@@ -25,13 +24,11 @@ const uploadError = (info)=>{ ...@@ -25,13 +24,11 @@ const uploadError = (info)=>{
}).then((response)=>response.json()) }).then((response)=>response.json())
.then(json=>{ .then(json=>{
console.log(json);
}).catch(e=>{console.error(e)}); }).catch(e=>{console.error(e)});
}) })
}; };
const addErrorInfo = (errMsg)=>{ const addErrorInfo = (errMsg)=>{
console.log("errMsg ,",errMsg)
return{ return{
type : actionType.ADDERRORINFO, type : actionType.ADDERRORINFO,
errMsg errMsg
......
...@@ -37,7 +37,6 @@ var myHeaders = new Headers({ ...@@ -37,7 +37,6 @@ var myHeaders = new Headers({
const getUserinfo = (info,headerInfo)=>{ const getUserinfo = (info,headerInfo)=>{
console.log("getUserinfo ",info)
let employeeId = info.employeeId; let employeeId = info.employeeId;
let storeId = headerInfo.storeId; let storeId = headerInfo.storeId;
let bodyData = Object.assign({},{employeeId,storeId}) let bodyData = Object.assign({},{employeeId,storeId})
...@@ -51,7 +50,6 @@ const getUserinfo = (info,headerInfo)=>{ ...@@ -51,7 +50,6 @@ const getUserinfo = (info,headerInfo)=>{
body : JSON.stringify(bodyData) body : JSON.stringify(bodyData)
}).then((response)=>response.json()) }).then((response)=>response.json())
.then(json=>{ .then(json=>{
console.log(json);
if(json.meta.success && json.data){ if(json.meta.success && json.data){
dispatch(saveUserinfo(json.data)); dispatch(saveUserinfo(json.data));
if(!json.data.type){ if(!json.data.type){
...@@ -59,13 +57,6 @@ const getUserinfo = (info,headerInfo)=>{ ...@@ -59,13 +57,6 @@ const getUserinfo = (info,headerInfo)=>{
} }
} }
}).catch(e=>{console.error(e)}) }).catch(e=>{console.error(e)})
// if(json.meta.success && json.data){
// dispatch(saveUserinfo(json.data));
// if(!json.data.types){
// dispatch(addErrorInfo('没有任务需要处理'))
// }
// }
} }
} }
......
...@@ -70,8 +70,10 @@ export default class TroubleItemComponent extends React.Component{ ...@@ -70,8 +70,10 @@ export default class TroubleItemComponent extends React.Component{
let showImgDom = <div onClick={()=>hidePopup()} className={"showBigImg"}> let showImgDom = <div onClick={()=>hidePopup()} className={"showBigImg"}>
<img src={imgSrc} alt=""/> <img src={imgSrc} alt=""/>
</div>; </div>;
console.log("showimg")
showPopup({ showPopup({
popupChild : showImgDom popupChild : showImgDom,
showPopup : true
}); });
} }
...@@ -145,7 +147,7 @@ export default class TroubleItemComponent extends React.Component{ ...@@ -145,7 +147,7 @@ export default class TroubleItemComponent extends React.Component{
<span className={"colff7860 font32 star"}>*</span> <span className={"colff7860 font32 star"}>*</span>
<div className={"itemTextAreaBox col999 border_e5"} onClick={()=>props.showText(item.errorCode)}> <div className={"itemTextAreaBox col999 border_e5"} onClick={()=>props.showText(item.errorCode)}>
{ {
item.explanation ? <textarea maxlength="200" readOnly className={"itemTextAreaBoxs col999"} value={text} /> : item.explanation ? <textarea maxLength="200" readOnly className={"itemTextAreaBoxs col999"} value={text} /> :
<span className={"itemPlayceHolder"}>编辑检查结果</span> <span className={"itemPlayceHolder"}>编辑检查结果</span>
} }
......
...@@ -17,7 +17,6 @@ export default class TextAreaContainer extends React.Component{ ...@@ -17,7 +17,6 @@ export default class TextAreaContainer extends React.Component{
componentWillMount() { componentWillMount() {
let {text} = this.props; let {text} = this.props;
let hasChange = text ? true : false ;
this.setState({ this.setState({
text : text, text : text,
originText : text, originText : text,
...@@ -36,12 +35,10 @@ export default class TextAreaContainer extends React.Component{ ...@@ -36,12 +35,10 @@ export default class TextAreaContainer extends React.Component{
this.setState({text: value}); this.setState({text: value});
} }
handleBlur(){ handleBlur(){
console.log("--handleBlur--");
this.props.setStyle({}) this.props.setStyle({})
} }
handleFocus(){ handleFocus(){
console.log("==handleFocus==");
this.props.setStyle({ this.props.setStyle({
'position':'absolute', 'position':'absolute',
'top':'0px' 'top':'0px'
...@@ -87,7 +84,7 @@ export default class TextAreaContainer extends React.Component{ ...@@ -87,7 +84,7 @@ export default class TextAreaContainer extends React.Component{
onChange={this.handleChange.bind(this)} value={this.state.text} onChange={this.handleChange.bind(this)} value={this.state.text}
placeholder={"点击输入"} onBlur={this.handleBlur.bind(this)} placeholder={"点击输入"} onBlur={this.handleBlur.bind(this)}
onFocus={this.handleFocus.bind(this)} onFocus={this.handleFocus.bind(this)}
></textarea> />
</div> </div>
</div> </div>
</div> </div>
......
...@@ -46,7 +46,7 @@ export default class TroubleContainer extends React.Component{ ...@@ -46,7 +46,7 @@ export default class TroubleContainer extends React.Component{
componentWillMount(){ componentWillMount(){
let {troubleList,initTroubleList} = this.props; let {troubleList,initTroubleList} = this.props;
// initTroubleList({storeId: 17, employeeId: 5, token: "966D5C0B-3CF2-420D-B9A3-313BA37DE092"}); // initTroubleList({storeId: 7, employeeId: 5, token: "966D5C0B-3CF2-420D-B9A3-313BA37DE092"});
this.setState({ this.setState({
troubleList : troubleList troubleList : troubleList
}) })
...@@ -71,10 +71,24 @@ export default class TroubleContainer extends React.Component{ ...@@ -71,10 +71,24 @@ export default class TroubleContainer extends React.Component{
}) })
} }
let refreshImg = nextProps.refreshImg; let refreshImg = nextProps.refreshImg;
if(refreshImg && refreshImg.errorId && refreshImg.type && refreshImg.files){ let lastRefreshImg = this.props.refreshImg;
if(
(
!lastRefreshImg && (refreshImg && refreshImg.errorId && refreshImg.type && refreshImg.files)
) ||
(
lastRefreshImg && refreshImg && lastRefreshImg.errorId !== refreshImg.errorId
) ||
(
lastRefreshImg && refreshImg && lastRefreshImg.type !== refreshImg.type
) ||
(
lastRefreshImg && refreshImg && lastRefreshImg.files && refreshImg.files && refreshImg.files.length !== lastRefreshImg.files.length
)
){
this.updateImg(refreshImg); this.updateImg(refreshImg);
} }
} }
updateImg(info){ updateImg(info){
......
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