傅行帆 5 anni fa
parent
commit
00b638a855

+ 4
- 14
src/pages/system/editPolicy.jsx Vedi File

@@ -8,6 +8,7 @@ import BuildSelect from '../../components/SelectButton/BuildSelect'
8 8
 import SelectCity from '../../components/SelectButton/CitySelect'
9 9
 import XForm, { FieldTypes } from '../../components/XForm';
10 10
 import Wangedit from '../../components/Wangedit/Wangedit'
11
+import apis from '../../services/apis';
11 12
 import request from '../../utils/request'
12 13
 
13 14
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
@@ -27,10 +28,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
27 28
 
28 29
   // 查询列表
29 30
   const getPolicyData = (policyId) => {
30
-    request({
31
-        url: '/api/admin/taPolicy/' + policyId,
32
-        method: 'GET',
33
-    }).then((data) => {
31
+    request({ ...apis.system.taPolicy, urlData: {id: policyId} }).then((data) => {
34 32
         console.log(data)
35 33
         setPolicyData(data)
36 34
     })
@@ -80,22 +78,14 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
80 78
       console.log('submit data --->', val)
81 79
       if(policyId){
82 80
         val.policyId = policyId
83
-        request({
84
-          url: '/api/admin/taPolicy/'+policyId,
85
-          method: 'PUT',
86
-          data: val,
87
-        }).then((data) => {
81
+        request({ ...apis.system.updateTaPolicy, urlData: {id: policyId},data: val, }).then((data) => {
88 82
           message.info("保存成功")
89 83
           cancelPage()
90 84
         }).catch((err) => {
91 85
           message.info(err.msg || err.message)
92 86
         })
93 87
       }else{
94
-        request({
95
-          url: '/api/admin/taPolicy',
96
-          method: 'POST',
97
-          data: val,
98
-        }).then((data) => {
88
+        request({ ...apis.system.addTaPolicy,data: val, }).then((data) => {
99 89
           message.info("保存成功")
100 90
           cancelPage()
101 91
         }).catch((err) => {

+ 5
- 20
src/pages/system/housingPolicy.jsx Vedi File

@@ -6,7 +6,7 @@ import router from 'umi/router';
6 6
 import moment from 'moment';
7 7
 import SelectCity from '../../components/SelectButton/CitySelect'
8 8
 import BuildSelect from '../../components/SelectButton/BuildSelect'
9
-
9
+import apis from '../../services/apis';
10 10
 import request from '../../utils/request'
11 11
 
12 12
 const { Option } = Select;
@@ -21,11 +21,7 @@ const header = (props) => {
21 21
 
22 22
   // 查询列表
23 23
   const getList = (params) => {
24
-    request({
25
-        url: '/api/admin/taPolicy',
26
-        method: 'GET',
27
-        params: { ...params },
28
-    }).then((data) => {
24
+    request({ ...apis.system.getTaPolicy, params: { ...params }, }).then((data) => {
29 25
         console.log(data)
30 26
         setData(data)
31 27
     })
@@ -104,10 +100,7 @@ const deletePolicy = (policyId) => () => {
104 100
     okText: '确定',
105 101
     cancelText: '取消',
106 102
     onOk() {
107
-        request({
108
-            url: '/api/admin/taPolicy/'+policyId,
109
-            method: 'DELETE',
110
-        }).then((data) => {
103
+        request({ ...apis.system.deleteTaPolicy, urlData: {id: policyId }, }).then((data) => {
111 104
             message.info('操作成功!')
112 105
             getList({ pageNum: 1, pageSize: 10,cityId: '' });
113 106
         }).catch((err) => {
@@ -123,11 +116,7 @@ const deletePolicy = (policyId) => () => {
123 116
   const topPolicy = (row) => () => {
124 117
       const weight = Math.abs(row.weight - 1)
125 118
       row.weight = weight
126
-      request({
127
-          url: '/api/admin/taPolicy/'+row.policyId,
128
-          method: 'PUT',
129
-          data: row,
130
-      }).then((data) => {
119
+      request({ ...apis.system.updateTaPolicy, urlData: {id: row.policyId},data: row, }).then((data) => {
131 120
           console.log(data)
132 121
           message.info('操作成功!')
133 122
           getList({ pageNum: 1, pageSize: 10,cityId: '' });
@@ -144,11 +133,7 @@ const deletePolicy = (policyId) => () => {
144 133
         row.publishStatus = 1
145 134
       }
146 135
 
147
-      request({
148
-        url: '/api/admin/taPolicy/'+row.policyId,
149
-        method: 'PUT',
150
-        data: row,
151
-      }).then((data) => {
136
+      request({ ...apis.system.updateTaPolicy, urlData: {id: row.policyId},data: row, }).then((data) => {
152 137
           console.log(data)
153 138
           message.info('操作成功!')
154 139
           getList({ pageNum: 1, pageSize: 10,cityId: '' });

+ 3
- 10
src/pages/system/intention.jsx Vedi File

@@ -7,6 +7,7 @@ import router from 'umi/router';
7 7
 import BuildSelect from '../../components/SelectButton/BuildSelect'
8 8
 import XForm, { FieldTypes } from '../../components/XForm';
9 9
 import Wangedit from '../../components/Wangedit/Wangedit'
10
+import apis from '../../services/apis';
10 11
 import request from '../../utils/request'
11 12
 import SelectCity from '../../components/SelectButton/CitySelect'
12 13
 
@@ -23,11 +24,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
23 24
 
24 25
   const changBuilding = (buildingId) => {
25 26
     setBuildingIdData(buildingId)
26
-    request({
27
-      url: '/api/admin/tdBizEventIntention',
28
-      method: 'GET',
29
-      params: {pageNum: 1, pageSize: 999,buildingId}
30
-    }).then((data) => {
27
+    request({ ...apis.system.tdBizEventIntention, params: {pageNum: 1, pageSize: 999,buildingId}}).then((data) => {
31 28
       console.log(data)
32 29
       setData(data.records)
33 30
     })
@@ -50,11 +47,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
50 47
     if(buildingIdValue === ''){
51 48
       return
52 49
     }
53
-    request({
54
-      url: '/api/admin/taBuildingIntentionAddOrUpdate/' + buildingIdValue,
55
-      method: 'POST',
56
-      data
57
-    }).then((data) => {
50
+    request({ ...apis.system.taBuildingIntentionAddOrUpdate, urlData: {id: buildingIdValue}, data,}).then((data) => {
58 51
       message.info("保存成功")
59 52
     })
60 53
   }

+ 2
- 6
src/pages/system/messageList.jsx Vedi File

@@ -6,7 +6,7 @@ import router from 'umi/router';
6 6
 import moment from 'moment';
7 7
 import SelectCity from '../../components/SelectButton/CitySelect'
8 8
 import BuildSelect from '../../components/SelectButton/BuildSelect'
9
-
9
+import apis from '../../services/apis';
10 10
 import request from '../../utils/request'
11 11
 
12 12
 const { Option } = Select;
@@ -22,11 +22,7 @@ const header = (props) => {
22 22
 
23 23
   // 查询列表
24 24
   const getList = (params) => {
25
-    request({
26
-        url: '/api/admin/taCustomerMessage',
27
-        method: 'GET',
28
-        params: { ...params },
29
-    }).then((data) => {
25
+    request({ ...apis.system.taCustomerMessage, params: { ...params },}).then((data) => {
30 26
         console.log(data)
31 27
         setData(data)
32 28
     })

+ 4
- 13
src/pages/system/report.jsx Vedi File

@@ -7,6 +7,7 @@ import router from 'umi/router';
7 7
 import BuildSelect from '../../components/SelectButton/BuildSelect'
8 8
 import XForm, { FieldTypes } from '../../components/XForm';
9 9
 import Wangedit from '../../components/Wangedit/Wangedit'
10
+import apis from '../../services/apis';
10 11
 import request from '../../utils/request'
11 12
 
12 13
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
@@ -27,19 +28,13 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
27 28
 
28 29
   // 查询数据
29 30
   const getReportList = () => {
30
-    request({
31
-        url: '/api/admin/tdReports',
32
-        method: 'GET',
33
-    }).then((data) => {
31
+    request({ ...apis.system.tdReports, }).then((data) => {
34 32
         setData((data.records || []).map(x => ({label: x.reportName, value: x.reportCode}) ))
35 33
     })
36 34
   }
37 35
 
38 36
   const getCheckedList = () => {
39
-    request({
40
-      url: '/api/admin/taBuildingReports',
41
-      method: 'GET',
42
-    }).then((data) => {
37
+    request({ ...apis.system.taBuildingReports, }).then((data) => {
43 38
       setCheckData((data.records || []).map((x) => x.reportCode))
44 39
     })
45 40
   }
@@ -51,11 +46,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
51 46
 
52 47
   const saveCheckedReport = () => {
53 48
     console.log(checkData)
54
-    request({
55
-      url: '/api/admin/taBuildingReport/add',
56
-      method: 'POST',
57
-      data: {list: checkData}
58
-    }).then((data) => {
49
+    request({ ...apis.system.addTaBuildingReports, data: {list: checkData}}).then((data) => {
59 50
       message.info("保存成功")
60 51
     })
61 52
   }

+ 75
- 29
src/services/apis.js Vedi File

@@ -165,125 +165,171 @@ export default {
165 165
   activity: {
166 166
       list: {
167 167
         method: 'GET',
168
-        url: '/api/admin/iBuildingDynamicList',
168
+        url: `${prefix}/iBuildingDynamicList`,
169 169
       },
170 170
       weight: {
171 171
         method: 'PUT',
172
-        url: '/api/admin/buildingDynamic/weight',
172
+        url: `${prefix}/buildingDynamic/weight`,
173 173
       },
174 174
       cancel: {
175 175
         method: 'PUT',
176
-        url: '/api/admin/buildingDynamic/cancel/:id',
176
+        url: `${prefix}/buildingDynamic/cancel/:id`,
177 177
       },
178 178
       send: {
179
-        url: '/api/admin/buildingDynamic/send/:id',
179
+        url: `${prefix}/buildingDynamic/send/:id`,
180 180
         method: 'PUT',
181 181
       },
182 182
       finish: {
183
-        url: '/api/admin/buildingDynamic/finish',
183
+        url: `${prefix}/buildingDynamic/finish`,
184 184
         method: 'PUT',
185 185
       },
186 186
       details: {
187
-        url: '/api/admin/buildingDynamic/Details',
187
+        url: `${prefix}/buildingDynamic/Details`,
188 188
         method: 'GET',
189 189
       },
190 190
       update: {
191
-        url: '/api/admin/buildingDynamic/update',
191
+        url: `${prefix}/buildingDynamic/update`,
192 192
         method: 'PUT',
193 193
       },
194 194
       add: {
195
-        url: '/api/admin/buildingDynamic/add',
195
+        url: `${prefix}/buildingDynamic/add`,
196 196
         method: 'POST',
197 197
       },
198 198
       poster: {
199
-        url: '/api/admin/poster',
199
+        url: `${prefix}/poster`,
200 200
         method: 'GET',
201 201
       },
202 202
       updatePoster: {
203
-        url: '/api/admin/poster/:id',
203
+        url: `${prefix}/poster/:id`,
204 204
         method: 'PUT',
205 205
       },
206 206
       addPoster: {
207
-        url: '/api/admin/poster',
207
+        url: `${prefix}/poster`,
208 208
         method: 'POST',
209 209
       },
210 210
       shareContent: {
211
-        url: '/api/admin/shareContent',
211
+        url: `${prefix}/shareContent`,
212 212
         method: 'GET',
213 213
       },
214 214
       updateShareContent: {
215
-        url: '/api/admin/shareContent/:id',
215
+        url: `${prefix}/shareContent/:id`,
216 216
         method: 'PUT',
217 217
       },
218 218
       addShareContent: {
219
-        url: '/api/admin/shareContent',
219
+        url: `${prefix}/shareContent`,
220 220
         method: 'POST',
221 221
       },
222 222
       signList: {
223
-        url: '/api/admin/SignList',
223
+        url: `${prefix}/SignList`,
224 224
         method: 'GET',
225 225
       }
226 226
   },
227 227
   integralMall: {
228 228
     tdPointsRules: {
229
-      url: '/api/admin/tdPointsRules',
229
+      url: `${prefix}/tdPointsRules`,
230 230
       method: 'GET',
231 231
     },
232 232
     change: {
233
-      url: '/api/admin/tdPointsRules/change',
233
+      url: `${prefix}/tdPointsRules/change`,
234 234
       method: 'PUT',
235 235
     },
236 236
     taGoods: {
237
-      url: '/api/admin/taGoods/:id',
237
+      url: `${prefix}/taGoods/:id`,
238 238
       method: 'GET',
239 239
     },
240 240
     updateTaGoods: {
241
-      url: '/api/admin/taGoods',
241
+      url: `${prefix}/taGoods`,
242 242
       method: 'PUT',
243 243
     },
244 244
     addTaGoods: {
245
-      url: '/api/admin/taGoods/add',
245
+      url: `${prefix}/taGoods/add`,
246 246
       method: 'POST',
247 247
     },
248 248
     taPointsExchange: {
249
-      url: '/api/admin/taPointsExchange',
249
+      url: `${prefix}/taPointsExchange`,
250 250
         method: 'GET',
251 251
     },
252 252
     getTaGoods: {
253
-      url: '/api/admin/taGoods',
253
+      url: `${prefix}/taGoods`,
254 254
       method: 'GET',
255 255
     },
256 256
     changeTaGoods: {
257
-      url: '/api/admin/taGoods/change',
257
+      url: `${prefix}/taGoods/change`,
258 258
       method: 'PUT',
259 259
     },
260 260
     changeTaPointsExchange: {
261
-      url: '/api/admin/taPointsExchange/change',
261
+      url: `${prefix}/taPointsExchange/change`,
262 262
       method: 'PUT',
263 263
     }
264 264
   },
265 265
   carsuseFigure: {
266 266
     extendContent: {
267
-      url: '/api/admin/extendContent',
267
+      url: `${prefix}/extendContent`,
268 268
       method: 'GET',
269 269
     },
270 270
     finish: {
271
-      url: '/api/admin/buildingDynamic/finish',
271
+      url: `${prefix}/buildingDynamic/finish`,
272 272
       method: 'PUT',
273 273
     },
274 274
     updataExtendContent: {
275
-      url: '/api/admin/extendContent/:id',
275
+      url: `${prefix}/extendContent/:id`,
276 276
       method: 'PUT',
277 277
     },
278 278
     getExtendContent: {
279
-      url: '/api/admin/extendContent/:id',
279
+      url: `${prefix}/extendContent/:id`,
280 280
       method: 'GET',
281 281
     },
282 282
     addExtendContent: {
283
-      url: '/api/admin/extendContent',
283
+      url: `${prefix}/extendContent`,
284 284
       method: 'POST',
285 285
     }
286 286
   },
287
+  system: {
288
+    taPolicy: {
289
+      url: `${prefix}/taPolicy/:id`,
290
+      method: 'GET',
291
+    },
292
+    updateTaPolicy: {
293
+      url: `${prefix}/taPolicy/:id`,
294
+      method: 'PUT',
295
+    },
296
+    addTaPolicy: {
297
+      url: `${prefix}/taPolicy`,
298
+      method: 'POST',
299
+    },
300
+    getTaPolicy: {
301
+      url: `${prefix}/taPolicy`,
302
+      method: 'GET',
303
+    },
304
+    deleteTaPolicy: {
305
+      url: `${prefix}/taPolicy/:id`,
306
+      method: 'DELETE',
307
+    },
308
+    tdBizEventIntention: {
309
+      url: `${prefix}/tdBizEventIntention`,
310
+      method: 'GET',
311
+    },
312
+    taBuildingIntentionAddOrUpdate: {
313
+      url: `${prefix}/taBuildingIntentionAddOrUpdate/:id`,
314
+      method: 'POST',
315
+    },
316
+    taCustomerMessage: {
317
+      url: `${prefix}/taCustomerMessage`,
318
+      method: 'GET',
319
+    },
320
+    tdReports: {
321
+      url: `${prefix}/tdReports`,
322
+      method: 'GET',
323
+    },
324
+    taBuildingReports: {
325
+      url: `${prefix}/taBuildingReports`,
326
+      method: 'GET',
327
+    },
328
+    addTaBuildingReports: {
329
+      url: `${prefix}/taBuildingReport/add`,
330
+      method: 'POST',
331
+    }
332
+  }
287 333
   // indexEcharts:{
288 334
   //   list:{
289 335
   //     method:'get',