Commit dd81986b by Zhang Xin

修改接口url && 修改bug

parent 6d1fea1a
......@@ -32,7 +32,7 @@ export function scanBarCodeGetProductInfo(postData) {
}
export function submitProductInfo(postData) {
return (dispatch)=>{
let url = String(domain+'/machine_pad/submit_add_loss_task');
let url = String(domain+'machine_pad/submit_add_loss_task');
fetch(url,{
credentials : 'include',
method : 'POST',
......
......@@ -46,7 +46,6 @@ const getStoreInfo = (storeId)=>{
body: JSON.stringify(bodyData)
}).then((response)=>response.json())
.then(json=>{
console.log(json);
if(json.meta.success && json.data.warehouse){
dispatch(saveStoreInfo(Object.assign({},json.data.warehouse,{id:storeId})))
}else{
......
......@@ -122,8 +122,6 @@ var myHeaders = new Headers({
const getTroubleList = (info)=>{
console.log("getTroubleList ",info);
//{storeId: 17, employeeId: 5, token: "966D5C0B-3CF2-420D-B9A3-313BA37DE092"}
return(dispatch)=>{
let bodyData = Object.assign({},{
employeeId : info.employeeId,
......@@ -142,18 +140,12 @@ const getTroubleList = (info)=>{
dispatch(saveTroubleList(json.data))
}
}).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)=>{
let bodyData = Object.assign({},{details:info},headerInfo);
console.log("updateTroubleList :",bodyData)
return(dispatch)=>{
fetch(domain + 'machine_pad/save_all.action',{
credentials : 'include',
......@@ -163,7 +155,6 @@ const updateTroubleList = (info,headerInfo)=>{
body : JSON.stringify(bodyData)
}).then((response)=>response.json())
.then(json=>{
console.log("updateTroubleList : ",json);
}).catch(e=>{console.error(e)})
}
}
......
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)=>{
return{
type:actionTypes.INITHEADERS,
......
......@@ -4,7 +4,7 @@ const domain = ENV.domain;
//有服务器交互的actions
export function initGetOtherProblem(postData) {
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)
fetch(url,{
credentials : 'include',
......@@ -31,7 +31,7 @@ export function initGetOtherProblem(postData) {
}
export function addNewProbem(postData) {
return (dispatch) => {
let url = String(domain+'/machine_pad/insert_problem.action');
let url = String(domain+'machine_pad/insert_problem.action');
console.log(url)
fetch(url,{
credentials : 'include',
......@@ -59,7 +59,7 @@ export function addNewProbem(postData) {
}
export function deleteProblem(postData) {
return (dispatch) => {
let url = String(domain+'/machine_pad/skip_feed_problem.action');
let url = String(domain+'machine_pad/skip_feed_problem.action');
fetch(url,{
credentials : 'include',
method : 'POST',
......@@ -92,7 +92,7 @@ export function deleteProblem(postData) {
}
export function submitProblemList(postData) {
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)
fetch(url,{
credentials : 'include',
......
import fetch from 'isomorphic-fetch';
import actionTypes from '../actiontype/refreshImg'
import {addErrorInfo} from './uploadError'
import {getIp} from "./getIp";
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)=>{
return{
type:actionTypes.REFRESHIMG,
......@@ -60,8 +9,6 @@ const refreshImg = (data)=>{
};
const checkStatus = (response)=>{
console.log("===========")
console.log(response);
if (response.status >= 200 && response.status < 300) {
return response;
}
......@@ -89,7 +36,6 @@ const getRefreshImg = (errorId,type)=>{
}).then((response)=>response.json())
.then(json=>{
console.log(json);
if(json.meta.success && json.data){
let data = {
errorId,
......@@ -99,21 +45,12 @@ const getRefreshImg = (errorId,type)=>{
dispatch(refreshImg(data))
}
}).catch(e=>{console.error(e)})
// let data = {
// errorId,
// type,
// files : json.data.files ? json.data.files : []
// };
// dispatch(refreshImg(data))
}
};
const deleteImg = (errorId,type,fileId)=>{
return(dispatch)=>{
console.log("deleteImg action :",errorId,type,fileId);
let bodyData = Object.assign({},{errorId,type,fileId})
console.log(bodyData);
fetch(domain + 'delete_image_error.action',{
credentials : 'include',
method : 'POST',
......@@ -125,7 +62,6 @@ const deleteImg = (errorId,type,fileId)=>{
}).then(checkStatus)
.then(parseJson)
.then((data) => {
console.log("data :",data);
if(data.meta.success){
dispatch(getRefreshImg(errorId,type))
}
......@@ -133,14 +69,6 @@ const deleteImg = (errorId,type,fileId)=>{
.catch((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({
'Content-Type': 'application/json; charset=UTF-8',
});
const uploadError = (info)=>{
console.log("uploadError ",info)
let bodyData = {
warehouseId : info.storeId,
exceptionType : info.exceptionType,
......@@ -25,13 +24,11 @@ const uploadError = (info)=>{
}).then((response)=>response.json())
.then(json=>{
console.log(json);
}).catch(e=>{console.error(e)});
})
};
const addErrorInfo = (errMsg)=>{
console.log("errMsg ,",errMsg)
return{
type : actionType.ADDERRORINFO,
errMsg
......
......@@ -37,7 +37,6 @@ var myHeaders = new Headers({
const getUserinfo = (info,headerInfo)=>{
console.log("getUserinfo ",info)
let employeeId = info.employeeId;
let storeId = headerInfo.storeId;
let bodyData = Object.assign({},{employeeId,storeId})
......@@ -51,7 +50,6 @@ const getUserinfo = (info,headerInfo)=>{
body : JSON.stringify(bodyData)
}).then((response)=>response.json())
.then(json=>{
console.log(json);
if(json.meta.success && json.data){
dispatch(saveUserinfo(json.data));
if(!json.data.type){
......@@ -59,13 +57,6 @@ const getUserinfo = (info,headerInfo)=>{
}
}
}).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{
let showImgDom = <div onClick={()=>hidePopup()} className={"showBigImg"}>
<img src={imgSrc} alt=""/>
</div>;
console.log("showimg")
showPopup({
popupChild : showImgDom
popupChild : showImgDom,
showPopup : true
});
}
......@@ -145,7 +147,7 @@ export default class TroubleItemComponent extends React.Component{
<span className={"colff7860 font32 star"}>*</span>
<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>
}
......
......@@ -17,7 +17,6 @@ export default class TextAreaContainer extends React.Component{
componentWillMount() {
let {text} = this.props;
let hasChange = text ? true : false ;
this.setState({
text : text,
originText : text,
......@@ -36,12 +35,10 @@ export default class TextAreaContainer extends React.Component{
this.setState({text: value});
}
handleBlur(){
console.log("--handleBlur--");
this.props.setStyle({})
}
handleFocus(){
console.log("==handleFocus==");
this.props.setStyle({
'position':'absolute',
'top':'0px'
......@@ -87,7 +84,7 @@ export default class TextAreaContainer extends React.Component{
onChange={this.handleChange.bind(this)} value={this.state.text}
placeholder={"点击输入"} onBlur={this.handleBlur.bind(this)}
onFocus={this.handleFocus.bind(this)}
></textarea>
/>
</div>
</div>
</div>
......
......@@ -46,7 +46,7 @@ export default class TroubleContainer extends React.Component{
componentWillMount(){
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({
troubleList : troubleList
})
......@@ -71,10 +71,24 @@ export default class TroubleContainer extends React.Component{
})
}
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);
}
}
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