caipin 5 tahun lalu
induk
melakukan
e0f843ad2e

+ 14 - 0
src/contact/common/store/actionCreators.js

@@ -0,0 +1,14 @@
+import * as constants from './constants';
+import { fromJS } from 'immutable';
+
+import axios from '../../../common/axios_auth.js';
+// import axios from 'axios';
+
+//actionType
+export const menuActive = (value) => ({
+    type: constants.MENU_ACTIVE,
+    data:fromJS(value),
+});
+
+
+

+ 4 - 0
src/contact/common/store/constants.js

@@ -0,0 +1,4 @@
+export const MENU_ACTIVE = 'common/MENU_ACTIVE';
+
+
+

+ 5 - 0
src/contact/common/store/index.js

@@ -0,0 +1,5 @@
+import reducer from './reducer';
+import * as actionCreators from './actionCreators';
+import * as constants from './constants';
+
+export { reducer,actionCreators,constants }

+ 35 - 0
src/contact/common/store/reducer.js

@@ -0,0 +1,35 @@
+import * as constants from './constants';
+//锁定state不可修改,导致错误y
+import { fromJS } from 'immutable';
+
+
+const defaultState = fromJS({
+    menuActive: 'client',
+});
+
+
+export default (state = defaultState, action) => {
+
+    if(action.type===constants.MENU_ACTIVE){
+        return state.set('menuActive',action.data);
+    }
+
+
+
+    // if(action.type===constants.SEARCH_FOCUS){
+    //     return state.set('menu','clicke me');
+    //     // return {
+    //     //     menu:'clicke me'
+    //     // }
+    // }
+    // if(action.type===constants.CHANGE_LIST){
+    //     return state.set('list',action.data);
+    //     //return state.set('menu','clicke me');
+
+    //     // return state.merge({
+    //     //     list: action.data,
+    //     //     //totalPage: action.totalPage
+    //     // });
+    // }
+    return state;
+}