caipin 5 سال پیش
والد
کامیت
96b0179d43

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 569 - 0
src/common/clientPopups/index.js


+ 52 - 0
src/common/clientPopups/store/actionCreators.js

@@ -0,0 +1,52 @@
+import * as constants from './constants';
+import { fromJS } from 'immutable';
+
+import axios from '../../../common/axios_auth.js';
+// import axios from 'axios';
+
+
+
+//actionType
+export const searchFocus = () => ({
+    type: constants.SEARCH_FOCUS
+});
+
+export const getList = () => {
+    return (dispatch) => {
+        axios.get('/api/submenuList.json').then((res) => {
+            const data = res.data;
+            dispatch(changeList(data.data));
+        }).catch(() => {
+            console.log('error');
+        })
+    }
+};
+
+export const changeInputValue = (value) => (  {
+    type: constants.CHANGE_INPUTVALUE,
+    data:fromJS(value),
+});
+
+const changeList = (data) => ({
+    type: constants.CHANGE_LIST,
+    data: fromJS(data),
+    // totalPage: Math.ceil(data.length / 10)
+});
+
+// export const searchBlur = () => ({
+// 	type: constants.SEARCH_BLUR
+// });
+
+// export const mouseEnter = () => ({
+// 	type: constants.MOUSE_ENTER
+// });
+
+// export const mouseLeave = () => ({
+// 	type: constants.MOUSE_LEAVE
+// });
+
+// export const changePage = (page) => ({
+// 	type: constants.CHANGE_PAGE,
+// 	page
+// });
+

+ 5 - 0
src/common/clientPopups/store/constants.js

@@ -0,0 +1,5 @@
+export const SEARCH_FOCUS = 'submenu/SEARCH_FOCUS';
+export const CHANGE_LIST ='submenu/CHANGE_LIST';
+export const CHANGE_INPUTVALUE ='submenu/CHANGE_INPUTVALUE';
+
+

+ 5 - 0
src/common/clientPopups/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 }

+ 58 - 0
src/common/clientPopups/store/reducer.js

@@ -0,0 +1,58 @@
+import * as constants from './constants';
+//锁定state不可修改,导致错误y
+import { fromJS } from 'immutable';
+
+
+const defaultState = fromJS({
+    menu: 'hello submenu-t!!!',
+    list:[],
+    inputValue:'',
+
+});
+
+
+export default (state = defaultState, action) => {
+
+    // switch(action.type) {
+	// 	case constants.SEARCH_FOCUS:
+	// 		return state.set('focused', true);
+	// 	case constants.SEARCH_BLUR:
+	// 		return state.set('focused', false);
+	// 	case constants.CHANGE_LIST:
+	// 		return state.merge({
+	// 			list: action.data,
+	// 			totalPage: action.totalPage
+	// 		});
+	// 	case constants.MOUSE_ENTER:
+	// 		return state.set('mouseIn', true);
+	// 	case constants.MOUSE_LEAVE:
+	// 		return state.set('mouseIn', false);
+	// 	case constants.CHANGE_PAGE:
+	// 		return state.set('page', action.page);
+	// 	default:
+	// 		return state;
+	// }
+    if(action.type===constants.CHANGE_INPUTVALUE){
+        return state.set('inputValue',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;
+}

+ 5 - 1
src/contact/client/index.js

@@ -4,7 +4,8 @@ import { connect } from 'react-redux';
 
 import { actionCreators } from './store';
 
-import StaffHeader from '../../common/staffHeader'
+import StaffHeader from '../../common/staffHeader';
+import ClientPopups from '../../common/clientPopups'
 
 class client extends PureComponent {
 
@@ -438,6 +439,9 @@ class client extends PureComponent {
               </div>
             </div>
           </main>
+
+          <ClientPopups />
+
           </Fragment>
         );
     }