ttk-app-core
Version:
@ttk/recat enterprise develop framework
41 lines (39 loc) • 1.01 kB
JavaScript
import { Map, fromJS, List } from "immutable";
export function showState(
state = Map(
fromJS({
loading: true,
})
),
action
) {
// 框架在初始化state的值时,action默认带一个type小于1的随机值(即:action={type: 0.12354556435634}),这里判断小于1时返回默认值
if (action.type && action.type < 1) return state;
state = state.sf(["loading"], action);
return state;
}
//视频课程列表
export function accountList(state = List(), action) {
if (action.type && action.type < 1) return state;
state = List(fromJS(action));
return state;
}
//视频课程图片
export function accountImg(state = List(), action) {
if (action.type && action.type < 1) return state;
state = List(fromJS(action));
return state;
}
export function accountNum(
state = Map(
fromJS({
tempData: {},
})
),
action
) {
if (action.type && action.type < 1) return state;
state = state.sf(["tempData"], action);
state = fromJS(state);
return state;
}