|
@@ -23,14 +23,11 @@ export const getAgeAction = () => {
|
|
|
return async (dispatch: AppDispatch) => {
|
|
|
const res = await http.post('/api/show/getTree', { type: 'age' })
|
|
|
|
|
|
- const temp = [] as any
|
|
|
- res.data.forEach((v: any) => {
|
|
|
- v.children.forEach((p: any) => {
|
|
|
- temp.push({ value: p.id, label: p.name })
|
|
|
- })
|
|
|
- })
|
|
|
-
|
|
|
- let data = temp
|
|
|
+ let data = res.data.map((v: HomeSortType) => ({
|
|
|
+ ...v,
|
|
|
+ value: v.id,
|
|
|
+ label: v.name
|
|
|
+ }))
|
|
|
data.unshift({ value: -1, label: '全部年代' })
|
|
|
dispatch({ type: 'home/setAge', payload: data })
|
|
|
}
|