Commit 144150e6 by Zhang Xin

add storeinfo

parent 83bb3475
...@@ -2,6 +2,22 @@ import fetch from 'isomorphic-fetch'; ...@@ -2,6 +2,22 @@ import fetch from 'isomorphic-fetch';
import actionTypes from '../actiontype/store' import actionTypes from '../actiontype/store'
const domain = ENV.domain; const domain = ENV.domain;
let mock = {
"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 saveStoreInfo = (data)=>{ const saveStoreInfo = (data)=>{
return{ return{
type:actionTypes.SAVESTORE, type:actionTypes.SAVESTORE,
...@@ -11,16 +27,17 @@ const saveStoreInfo = (data)=>{ ...@@ -11,16 +27,17 @@ const saveStoreInfo = (data)=>{
const getStoreInfo = ()=>{ const getStoreInfo = ()=>{
return(dispatch)=>{ return(dispatch)=>{
fetch(domain + '/web/pad_warehouse/getMachineData.action',{ // fetch(domain + '/web/pad_warehouse/getMachineData.action',{
credentials : 'include', // credentials : 'include',
method : 'POST', // method : 'POST',
mode : 'cors', // mode : 'cors',
body : {} // body : {}
//
}).then((response)=>response.json()) // }).then((response)=>response.json())
.then(json=>{ // .then(json=>{
console.log(json); // console.log(json);
}).catch(e=>{console.error(e)}) // }).catch(e=>{console.error(e)})
dispatch(saveStoreInfo(mock.data))
} }
} }
......
import fetch from 'isomorphic-fetch';
import actionTypes from '../actiontype/trouble'
const domain = ENV.domain;
let mock = {
"meta": {
"code": "200",
"message": "成功",
"success": true
},
"data": {
"details": [
{
"id": 1634,
"errorCode": "ER00001",
"type": "KN",
"description": "2:左侧动作故障,4:机械手移动到放货位置出错()",
"files": [
{
"id": 16,
"filePath": "/tmp/2016-08-16/1471329685902.jpg"
},
{
"id": 17,
"filePath": "/sku/0/0/427/1471329704482.jpg"
},
{
"id": 18,
"filePath": "/sku/0/0/426/1471330380712.jpg"
}
],
},
{
"id": 1,
"errorCode": null,
"type": "OP",
"files": [
{
"id": 16,
"filePath": "/tmp/2016-08-16/1471329685902.jpg"
},
{
"id": 17,
"filePath": "/sku/0/0/427/1471329704482.jpg"
},
{
"id": 18,
"filePath": "/sku/0/0/426/1471330380712.jpg"
}
],
"parentProblemName": "机械故障",
"subProblemName": "其他问题111"
}
],
"employee": {
"id": 5,
"employeeName": "机器库管员",
"headImageUrl": "/static/coupon/gounian/banner_hongbaotupian-3-14.jpg"
},
"taskIds": [
155
]
}
}
const saveTroubleList = (data)=>{
return{
type:actionTypes.SAVETROUBLELIST,
data
}
};
const getTroubleList = ()=>{
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)})
dispatch(saveTroubleList(mock.data))
}
}
export {getTroubleList}
const actionTypes = {
SAVETROUBLELIST : 'SAVETROUBLELIST',
}
export default actionTypes
\ No newline at end of file
'use strict'; 'use strict';
import React from 'react' import React from 'react'
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import {getStoreInfo} from "../../actions/getStore";
import {getTroubleList} from "../../actions/getTroubles";
import HeaderComponent from '../../components/CommonComponent/HeaderComponent/HeaderComponent' import HeaderComponent from '../../components/CommonComponent/HeaderComponent/HeaderComponent'
import PopupComponent from '../../components/CommonComponent/PopupComponent/PopupComponent' import PopupComponent from '../../components/CommonComponent/PopupComponent/PopupComponent'
import TroubleContainer from '../TroubleContainer/TroubleContainer' import TroubleContainer from '../TroubleContainer/TroubleContainer'
...@@ -53,6 +57,9 @@ class PageContainer extends React.Component { ...@@ -53,6 +57,9 @@ class PageContainer extends React.Component {
this.hidePopup = this.hidePopup.bind(this); this.hidePopup = this.hidePopup.bind(this);
} }
componentWillMount() { componentWillMount() {
let {dispatch} = this.props;
dispatch(getStoreInfo());
dispatch(getTroubleList());
let pages = this.getPages(); let pages = this.getPages();
this.setState({ this.setState({
page : pages page : pages
......
import { combineReducers } from 'redux' import { combineReducers } from 'redux'
import trouble from './trouble' import trouble from './trouble'
import storeInfo from './store'
import scanBarCodeContainer from './scanBarCodeContainer' import scanBarCodeContainer from './scanBarCodeContainer'
export default combineReducers({ export default combineReducers({
trouble, trouble,
storeInfo,
scanBarCodeContainer scanBarCodeContainer
}) })
import actionTypes from '../actiontype/store';
const saveStore = (content,data)=>{
return Object.assign({},content,data);
}
export default function(state={}, action) {
switch (action.type) {
case actionTypes.SAVESTORE:
return saveStore(state,action.data)
default:
return state;
}
}
\ No newline at end of file
import actionTypes from '../actiontype/trouble';
const saveStore = (content,data)=>{
return Object.assign({},content,data);
}
export default function(state={}, action) { export default function(state={}, action) {
switch (action.type) { switch (action.type) {
case actionTypes.SAVETROUBLELIST:
return saveStore(state,action.data)
default: default:
return state; return state;
} }
......
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