From 7b8b5cd0936e8fce93c902b1d9c2575ab0c22b86 Mon Sep 17 00:00:00 2001
From: wujiabao <jiabaowu@mjitech.com>
Date: Wed, 19 Sep 2018 14:33:57 +0800
Subject: [PATCH] 改 barcodeCommon

---
 client/actions/BreakageContainer.js               | 56 --------------------------------------------------------
 client/actions/barcodeCommon.js                   | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 client/actions/common.js                          |  2 --
 client/actiontype/barcodeCommon.js                |  4 ++++
 client/containers/PageContainer/PageContainer.jsx |  4 ++--
 client/reducers/barcodeCommon.js                  | 16 ++++++++++++++++
 client/reducers/index.js                          |  4 ++--
 7 files changed, 80 insertions(+), 62 deletions(-)
 delete mode 100644 client/actions/BreakageContainer.js
 create mode 100644 client/actions/barcodeCommon.js
 create mode 100644 client/actiontype/barcodeCommon.js
 create mode 100644 client/reducers/barcodeCommon.js

diff --git a/client/actions/BreakageContainer.js b/client/actions/BreakageContainer.js
deleted file mode 100644
index de4e3b4..0000000
--- a/client/actions/BreakageContainer.js
+++ /dev/null
@@ -1,56 +0,0 @@
-import fetch from 'isomorphic-fetch'
-import getTaskList from './common'
-import breakActionType from '../actiontype/breakageContainer'
-
-// const changeStatus = (data)=>{
-      
-//       let {taskId,currentTaskType}=data.taskInfo;
-//       let url = `http://192.168.10.128:8080/web/flat/work/lr/status/${taskId}/${currentTaskType}`
-//       return (dispatch)=>{
-//             fetch(url,{
-//                 credentials : 'include',
-//                 method : 'PUT',
-//                 mode : 'cors',
-//                 body : {}
-//             }).then((response)=>response.json())
-//              .then((json)=>{
-//                   if(json.data){
-//                         getTaskList(data)
-//                   }
-//              })
-//       }
-// }
-
-
-const changeTaskStatus = (data)=>{
-      return {
-
-      }
-}
-
-//test 输入条形码获取商品信息
-
-const getProductInfo = (data)=>{
-      let {barcode}=data;
-      let url=`http://192.168.10.128:8080/web/flat/barcode/1/A/LR/${barcode}`
-      return (dispatch)=>{
-            fetch(url,{
-                method : 'GET',
-                mode : 'cors'
-            }).then((response)=>response.json())
-            .then((json)=>{
-                if(json.meta.success&&json.data){
-                    dispatch(saveProductInfo(json.data))
-                }
-            })
-
-      }
-}
-const saveProductInfo = (data)=>{
-      return{
-          type : breakActionType.GETPRODUCTINFO,
-          data
-      }
-  }
-
-  export {getProductInfo}
\ No newline at end of file
diff --git a/client/actions/barcodeCommon.js b/client/actions/barcodeCommon.js
new file mode 100644
index 0000000..570eb01
--- /dev/null
+++ b/client/actions/barcodeCommon.js
@@ -0,0 +1,56 @@
+import fetch from 'isomorphic-fetch'
+import getTaskList from './common'
+import barcodeActionType from '../actiontype/barcodeCommon'
+
+// const changeStatus = (data)=>{
+      
+//       let {taskId,currentTaskType}=data.taskInfo;
+//       let url = `http://192.168.10.128:8080/web/flat/work/lr/status/${taskId}/${currentTaskType}`
+//       return (dispatch)=>{
+//             fetch(url,{
+//                 credentials : 'include',
+//                 method : 'PUT',
+//                 mode : 'cors',
+//                 body : {}
+//             }).then((response)=>response.json())
+//              .then((json)=>{
+//                   if(json.data){
+//                         getTaskList(data)
+//                   }
+//              })
+//       }
+// }
+
+
+const changeTaskStatus = (data)=>{
+      return {
+
+      }
+}
+
+//test 输入条形码获取商品信息
+
+const getProductInfo = (data)=>{
+      let {barcode}=data;
+      let url=`http://192.168.10.128:8080/web/flat/barcode/1/A/LR/${barcode}`
+      return (dispatch)=>{
+            fetch(url,{
+                method : 'GET',
+                mode : 'cors'
+            }).then((response)=>response.json())
+            .then((json)=>{
+                if(json.meta.success&&json.data){
+                    dispatch(saveProductInfo(json.data))
+                }
+            })
+
+      }
+}
+const saveProductInfo = (data)=>{
+      return{
+          type : barcodeActionType.GETPRODUCTINFO,
+          data
+      }
+  }
+
+  export {getProductInfo}
\ No newline at end of file
diff --git a/client/actions/common.js b/client/actions/common.js
index 3169083..9ce8178 100644
--- a/client/actions/common.js
+++ b/client/actions/common.js
@@ -2,8 +2,6 @@ import fetch from 'isomorphic-fetch';
 import actionType from '../actiontype/common'
 import {addErrorInfo} from './uploadError'
 const domain = ENV.domain;
-//获取工单
-
 
 let myHeaders = new Headers({
     // 'Access-Control-Allow-Origin': '*',
diff --git a/client/actiontype/barcodeCommon.js b/client/actiontype/barcodeCommon.js
new file mode 100644
index 0000000..345fba3
--- /dev/null
+++ b/client/actiontype/barcodeCommon.js
@@ -0,0 +1,4 @@
+const breakActionType={
+    GETPRODUCTINFO:'GETPRODUCTINFO'
+}
+export default breakActionType
\ No newline at end of file
diff --git a/client/containers/PageContainer/PageContainer.jsx b/client/containers/PageContainer/PageContainer.jsx
index 29f77b4..2fbc009 100755
--- a/client/containers/PageContainer/PageContainer.jsx
+++ b/client/containers/PageContainer/PageContainer.jsx
@@ -27,7 +27,7 @@ import TakeStokeContainer from '../TakeStokeContainer/TakeStokeContainer'
 import BreakageContainer from '../BreakageContainer/BreakageConatiner'
 import RecoveryPage from '../RecoveryContainer/RecoveryContainer'
 import ReplenishContainer from '../ReplenishContainer/ReplenishContainer'
-import {getProductInfo} from '../../actions/BreakageContainer'
+import {getProductInfo} from '../../actions/barcodeCommon'
 import {getTaskInfo,getTaskList} from '../../actions/common'
 /*二期引用 end*/
 
@@ -57,7 +57,7 @@ class PageContainer extends React.Component {
     constructor(props) {
         super(props);
         this.state = {
-            showPage : showPage[11],
+            showPage : showPage[5],
             lastPage : '',
             page : null,
             popupInfo : defaultPopupInfo,
diff --git a/client/reducers/barcodeCommon.js b/client/reducers/barcodeCommon.js
new file mode 100644
index 0000000..bef694c
--- /dev/null
+++ b/client/reducers/barcodeCommon.js
@@ -0,0 +1,16 @@
+import barcodeActionType from '../actiontype/barcodeCommon'
+
+
+//扫码商品的信息
+const saveProductInfo = (data,content)=>{
+    console.log(content,'这是吴加宝打印的数据')
+    return Object.assign({},data,{product:content})
+}
+export default function(state={}, action) {
+    switch (action.type) {
+        case barcodeActionType.GETPRODUCTINFO:
+            return saveProductInfo(state,action.data);
+        default:
+            return state;
+    }
+}
\ No newline at end of file
diff --git a/client/reducers/index.js b/client/reducers/index.js
index 9e50a8d..95332a2 100755
--- a/client/reducers/index.js
+++ b/client/reducers/index.js
@@ -9,7 +9,7 @@ import headerInfo from './initHeader' //获取头部信息
 import reportDamageList from './reportDamge' //一期商铺报损
 import errMsg from './error' //上报异常
 import commonInfo from './common' //上报异常
-import breakageContainer from './breakageContainer'
+import barcodeCommon from './barcodeCommon'
 export default combineReducers({
     troubleList,
     storeInfo,
@@ -21,7 +21,7 @@ export default combineReducers({
     reportDamageList,
     errMsg,
     commonInfo,
-    breakageContainer
+    barcodeCommon
 })
 
 
--
libgit2 0.26.0