shaogen1995 11 月之前
父節點
當前提交
cefc7367fa
共有 1 個文件被更改,包括 14 次插入5 次删除
  1. 14 5
      src/store/action/A2exhibition.ts

+ 14 - 5
src/store/action/A2exhibition.ts

@@ -9,12 +9,21 @@ export const A2_APIgetList = (data: any): any => {
   return async (dispatch: AppDispatch) => {
     const res = await http.post('cms/exhibition/pageList', data)
     if (res.code === 0) {
+      const arr: any = []
+
+      res.data.records.forEach((v: any) => {
+        let activityTime = ''
+
+        if (v.type !== 'long') {
+          if (v.dateStart) activityTime += v.dateStart
+          if (v.dateEnd) activityTime += ` 至 ${v.dateEnd}`
+        }
+        v.activityTime = activityTime
+        arr.push(v)
+      })
+
       const obj = {
-        list: res.data.records.map((v: any) => ({
-          ...v,
-          activityTime:
-            v.type === 'long' ? '' : v.dateStart + ' 至 ' + (v.dateEnd ? v.dateEnd : '长期有效')
-        })),
+        list: arr,
         total: res.data.total
       }
       dispatch({ type: 'A2/getList', payload: obj })