shaogen1995 2 gadi atpakaļ
vecāks
revīzija
dab07cbad6
2 mainītis faili ar 7 papildinājumiem un 9 dzēšanām
  1. 5 8
      webNew/src/store/action/home.ts
  2. 2 1
      webNew/src/utils/http.ts

+ 5 - 8
webNew/src/store/action/home.ts

@@ -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 })
   }

+ 2 - 1
webNew/src/utils/http.ts

@@ -2,7 +2,8 @@ import axios from 'axios'
 // import history from './history'
 // import { getTokenInfo } from './storage'
 // 请求基地址
-export const baseURL = process.env.NODE_ENV === "development" ? 'https://hnbwg.4dage.com' : ''
+export const baseURL = process.env.NODE_ENV === "development" ? 'http://192.168.20.55:8032' : ''
+// export const baseURL = process.env.NODE_ENV === "development" ? 'https://hnbwg.4dage.com' : ''
 
 // 创建 axios 实例
 const http = axios.create({