Commit 94616e90 by liguokang

feat:

parent 8a344c7b
/*
* @Description:
* @Date: 2020-03-18 18:19:52
* @LastEditTime: 2021-04-19 13:50:38
* @LastEditors: JamosLi
*/
export const actionTypes = {
CHANGE_CITY: 'CHANGE_CITY',
};
import { actionTypes } from './action-types';
export function changeCity(city) {
return {
type: actionTypes.CHANGE_CITY,
city,
};
}
/*
* @Description:
* @Date: 2020-03-18 18:19:52
* @LastEditTime: 2021-04-20 11:25:50
* @LastEditors: JamosLi
*/
import { actionTypes } from '../action/action-types';
import cityMap from 'static/cityconfig.json';
let initState = {
city: '',
cityMap: cityMap,
};
//根据url 设置客户端城市初始值,
if (typeof window === 'object') {
// debugger;
const href = window.location.href;
// initState.city = createCityBySubDomain(href, JSON.parse(sessionStorage.getItem('citylist')))
initState.city = '杭州';
}
export default (state = initState, action) => {
switch (action.type) {
case actionTypes.CHANGE_CITY:
return {
...state,
city: action.city,
};
default:
return state;
}
};
/*
* @Description:
* @Date: 2020-03-18 18:19:52
* @LastEditTime: 2021-04-19 13:50:30
* @LastEditors: JamosLi
*/
import { createStore } from 'redux';
import Reducer from './reducer';
const store = createStore(Reducer);
export default store;
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