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)=>{
};
var myHeaders = new Headers({
// 'Access-Control-Allow-Origin': '*',
'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',
// 'token':'123456'
'Content-Type': 'application/json; charset=UTF-8',
});
const getStoreInfo = (storeId)=>{
return(dispatch)=>{
dispatch(saveHeaderInfo({storeId}))
let bodyData = {storeId};
// headers.append("token","123456");
fetch(domain + 'pad_warehouse/getMachineData.action',{
credentials : 'include',
method : 'POST',
mode : 'cors',
headers: {
'content-type':'application/json;charset=UTF-8',
'token' : '',
'employeeId' : ''
},
headers: myHeaders,
body: JSON.stringify(bodyData)
}).then((response)=>response.json())
.then(json=>{
console.log(json);
}).catch(e=>{console.error(e)})
if(json.meta.success && json.data.warehouse){
dispatch(saveStoreInfo(Object.assign({},json.data.warehouse,{id:storeId})))
}else{
//没有店铺信息
}
}).catch(e=>{console.error(e)})
}
}
......
......@@ -47,7 +47,8 @@ let json = {
"employeeName": "机器库管员",
"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)=>{
}
}
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)=>{
console.log(info);
//{storeId: 17, employeeId: 5, token: "966D5C0B-3CF2-420D-B9A3-313BA37DE092"}
return(dispatch)=>{
// fetch(domain + '/web/pad_warehouse/getMachineData.action',{
// credentials : 'include',
// method : 'POST',
// mode : 'cors',
// body : {}
//
// }).then((response)=>response.json())
// .then(json=>{
// console.log(json);
// }).catch(e=>{console.error(e)})
let bodyData = Object.assign({},{
employeeId : info.employeeId,
storeId : info.storeId
});
fetch(domain + 'machine_pad/list_fault.action',{
credentials : 'include',
method : 'POST',
mode : 'cors',
headers: myHeaders,
body : JSON.stringify(bodyData)
}).then((response)=>response.json())
.then(json=>{
if(json.meta.success && json.data){
dispatch(saveHeaderInfo({taskId:json.data.taskIds}))
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)=>{
// fetch(domain + '/web/machine_pad/save_all.action',{
// credentials : 'include',
// method : 'POST',
// mode : 'cors',
// body : {}
//
// }).then((response)=>response.json())
// .then(json=>{
// console.log(json);
// }).catch(e=>{console.error(e)})
fetch(domain + 'machine_pad/save_all.action',{
credentials : 'include',
method : 'POST',
mode : 'cors',
headers: myHeaders,
body : JSON.stringify(bodyData)
}).then((response)=>response.json())
.then(json=>{
console.log("updateTroubleList : ",json);
}).catch(e=>{console.error(e)})
}
}
......
import fetch from 'isomorphic-fetch';
import actionTypes from '../actiontype/refreshImg'
import {addErrorInfo} from './uploadError'
import {getIp} from "./getIp";
const domain = ENV.domain;
let json = {
......@@ -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)=>{
return(dispatch)=>{
// fetch(domain + '/web/flush_image.action',{
// credentials : 'include',
// method : 'POST',
// mode : 'cors',
// body : {}
//
// }).then((response)=>response.json())
// .then(json=>{
// console.log(json);
// }).catch(e=>{console.error(e)})
let bodyData = Object.assign({},{errorId,type})
fetch(domain + 'flush_image.action',{
credentials : 'include',
method : 'POST',
mode : 'cors',
headers: {
'content-type':'application/json;charset=UTF-8',
},
body: JSON.stringify(bodyData)
}).then((response)=>response.json())
.then(json=>{
console.log(json);
if(json.meta.success && json.data){
let data = {
errorId,
type,
files : json.data
files : json.data.files ? json.data.files : []
};
dispatch(refreshImg(data))
}
}).catch(e=>{console.error(e)})
}
};
const deleteImg = (errorId,type,fileId)=>{
fetch(domain + '/web/delete_image_error.action',{
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',
mode : 'cors',
body : Object.assign({},{errorId,type,fileId})
}).then((response)=>response.json())
.then(json=>{
if(json.meta.success){
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))
}else {
dispatch(addErrorInfo(json.meta.message))
}
}).catch(e=>{console.error(e)})
})
.catch((err) =>{
console.error("Err:",err);
});
}
}
export {getRefreshImg,deleteImg}
......
......@@ -17,6 +17,7 @@ export default class FinishTroubleComponent extends React.Component{
haveNoNext(){
console.log("没有");
let props = this.props;
console.log(CONFIG.showPage[4]);
props.changePages(CONFIG.showPage[4])
}
......
......@@ -8,7 +8,7 @@ export default class TroubleItemComponent extends React.Component{
text: ''
}
this.reRreshImg = this.reRreshImg.bind(this)
this.deleteImg = this.deleteImg.bind(this)
this.deleteImgById = this.deleteImgById.bind(this)
this.addImg = this.addImg.bind(this)
}
......@@ -37,8 +37,15 @@ export default class TroubleItemComponent extends React.Component{
props.showQrcode(item.errorCode)
}
deleteImg(){
deleteImgById(fileId){
console.log("deleteImgById :",fileId)
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{
let imgFiles = Array.isArray(item.files) ? item.files.map((f,k)=>{
return <ImageComponent key={"troubleItemImg"+k}
noCloseBtn={false}
handleClikCloseFunc = {this.deleteImg}
handleClikCloseFunc = {()=>this.deleteImgById(f.id)}
handleClikImgFunc = {()=>{}}
type={"custom"}
imgSrc = {item.filePath}/>
imgSrc = {f.filePath}/>
}) : null;
return (
......
import swiperContainers from './swiperContainer'
import showPage from './showPage'
import socketType from './socketType'
import taskType from './taskType'
module.exports = {swiperContainers,...showPage,socketType,taskType}
\ No newline at end of file
module.exports = {swiperContainers,...showPage,socketType}
\ 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'
import { connect } from 'react-redux';
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 {scanBarCodeGetProductInfo,submitProductInfo,saveEditProductInfo} from "../../actions/ScanBarCode"
import {getReportDamageList,deleteDamageItem} from '../../actions/reportDamageList'
......@@ -48,16 +48,12 @@ class PageContainer extends React.Component {
lastPage : '',
page : null,
popupInfo : defaultPopupInfo,
pageStyle : {},
lastPageStyle:{},
showClock : false, //关门页面显示倒计时
headerInfo : {}
};
this.getPages = this.getPages.bind(this); //获取当前页面
this.showPopup = this.showPopup.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.beginCountBack = this.beginCountBack.bind(this); //开始300s倒计时
this.endCountBack = this.endCountBack.bind(this); //结束300s倒计时
......@@ -86,10 +82,6 @@ class PageContainer extends React.Component {
};
}
connectOk(){
console.log("connectOk")
}
componentWillMount() {
let that = this;
let {dispatch} = this.props;
......@@ -97,7 +89,7 @@ class PageContainer extends React.Component {
console.log("==GETSTOREINFO===")
console.log(data);
dispatch(getStoreInfo(data.storeId));
})
});
on(CONFIG.socketType.GETSOCKETMSG,this,function (data) {
console.log("==GETSTOREINFO===")
console.log(data)
......@@ -201,6 +193,7 @@ class PageContainer extends React.Component {
changePages(page){
console.log("changePages : ",page);
this.setState({
showPage : page,
popupInfo : defaultPopupInfo
......@@ -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(){
let pages = null;
......@@ -378,9 +355,10 @@ class PageContainer extends React.Component {
showTextArea={(text)=>this.showTextArea(text)}
showPopup={(info)=>this.showPopup(info)}
hidePopup={()=>this.hidePopup()}
changePages={()=>this.changePages()}
changePages={(pageIndex)=>this.changePages(pageIndex)}
getRefreshImg={(errorId,type)=>dispatch(getRefreshImg(errorId,type))}
deleteImg={(errorId,type,fileId)=>dispatch(deleteImg(errorId,type,fileId))}
updateTroubleList={(info)=>dispatch(updateTroubleList(info,state.headerInfo))}
/>;
break;
case showPage[2]:
......@@ -436,7 +414,7 @@ class PageContainer extends React.Component {
render() {
let {state} = this.props;
return (
<div className={"pageContainer "} style={this.state.pageStyle} onTouchStart={()=>this.handleTouch()}>
<div className={"pageContainer "} onTouchStart={()=>this.handleTouch()}>
<PopupComponent popupInfo={this.state.popupInfo} />
{this.getPages()}
</div>
......
......@@ -141,7 +141,7 @@ export default class TroubleContainer extends React.Component{
}
dealTrouble(){
let {showPopup,hidePopup} = this.props;
let {showPopup,hidePopup,updateTroubleList} = this.props;
let troubleList = this.state.troubleList;
let details = troubleList.details;
let arr = details.filter(d=>{
......@@ -158,7 +158,7 @@ export default class TroubleContainer extends React.Component{
details.forEach((d)=>{
d.imagesFileId = d.files.map(f=>f.id).join(',');
});
console.log(details);
updateTroubleList(details);
this.setState({
showTrouble : false
})
......@@ -166,7 +166,7 @@ export default class TroubleContainer extends React.Component{
}
getDefaultDom(){
let {userInfo,storeInfo,getRefreshImg} = this.props;
let {userInfo,storeInfo,getRefreshImg,deleteImg,changePages} = this.props;
let troubleList = this.state.troubleList;
let showTrouble = Array.isArray(troubleList.details) && troubleList.details.length > 0;
let details = Array.isArray(troubleList.details) ? troubleList.details : [];
......@@ -174,6 +174,7 @@ export default class TroubleContainer extends React.Component{
return <TroubleItem key={k} item={i} num={k+1} setItem={this.setItem}
showText={this.showText} showQrcode={this.showQrcode}
getRefreshImg={getRefreshImg}
deleteImg={deleteImg}
/>;
});
let swiperOptions = {
......@@ -208,7 +209,7 @@ export default class TroubleContainer extends React.Component{
</div>
</div>
</div> : <FinishTrouble changePages={props.changePages}/>
</div> : <FinishTrouble changePages={changePages}/>
}
</div>
)
......
......@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<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"/>
</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