Browse Source

apis action

魏熙美 5 years ago
parent
commit
fe4c773582

+ 4
- 6
src/pages/building/list/add/components/poster.jsx View File

31
     // eslint-disable-next-line react-hooks/rules-of-hooks
31
     // eslint-disable-next-line react-hooks/rules-of-hooks
32
     useEffect(() => {
32
     useEffect(() => {
33
       request({
33
       request({
34
-        url: '/api/admin/poster',
35
-        method: 'GET',
34
+        ...apis.activity.poster,
36
         params: { targetId: buildingId, targetType: 'building' },
35
         params: { targetId: buildingId, targetType: 'building' },
37
       }).then(data => {
36
       }).then(data => {
38
         console.log(data, '2222')
37
         console.log(data, '2222')
64
     if (buildingId) {
63
     if (buildingId) {
65
       if (posterId) {
64
       if (posterId) {
66
         request({
65
         request({
67
-          url: `/api/admin/poster/${posterId}`,
68
-          method: 'PUT',
66
+          ...apis.activity.updatePoster,
67
+          urlData: { id: posterId },
69
           data: { targetId: buildingId, targetType: 'building', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
68
           data: { targetId: buildingId, targetType: 'building', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
70
         }).then(() => {
69
         }).then(() => {
71
           message.info('保存成功')
70
           message.info('保存成功')
74
         })
73
         })
75
       } else {
74
       } else {
76
         request({
75
         request({
77
-          url: '/api/admin/poster',
78
-          method: 'POST',
76
+          ...apis.activity.addPoster,
79
           data: { targetId: buildingId, targetType: 'building', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
77
           data: { targetId: buildingId, targetType: 'building', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
80
         }).then(data => {
78
         }).then(data => {
81
           setPosterId(data.posterId)
79
           setPosterId(data.posterId)

+ 7
- 8
src/pages/building/list/add/components/share.jsx View File

14
 import touxiang from '../../../../../assets/touxiang.jpg';
14
 import touxiang from '../../../../../assets/touxiang.jpg';
15
 import poster1 from '../../../../../assets/poster1.png';
15
 import poster1 from '../../../../../assets/poster1.png';
16
 import poster2 from '../../../../../assets/poster2.png';
16
 import poster2 from '../../../../../assets/poster2.png';
17
+import apis from '../../../../../services/apis';
17
 
18
 
18
 const Share = props => {
19
 const Share = props => {
19
   const [inputValue, changeInput] = useState('')
20
   const [inputValue, changeInput] = useState('')
25
     // eslint-disable-next-line react-hooks/rules-of-hooks
26
     // eslint-disable-next-line react-hooks/rules-of-hooks
26
     useEffect(() => {
27
     useEffect(() => {
27
       request({
28
       request({
28
-        url: '/api/admin/shareContent',
29
-        method: 'GET',
29
+        ...apis.activity.shareContent,
30
         params: { targetId: buildingId, targetType: 'building' },
30
         params: { targetId: buildingId, targetType: 'building' },
31
       }).then(data => {
31
       }).then(data => {
32
         if (data.length > 0) {
32
         if (data.length > 0) {
44
     if (buildingId) {
44
     if (buildingId) {
45
       if (shareContentId) {
45
       if (shareContentId) {
46
         request({
46
         request({
47
-          url: `/api/admin/shareContent/${shareContentId}`,
48
-          method: 'PUT',
49
-          data: { targetId: buildingId, shareContentType: 'building',shareContentImg: imgValue,shareContentTitle: inputValue },
47
+          ...apis.activity.updateShareContent,
48
+          urlData: { id: shareContentId },
49
+          data: { targetId: buildingId, shareContentType: 'building', shareContentImg: imgValue,shareContentTitle: inputValue },
50
         }).then(data => {
50
         }).then(data => {
51
           message.info('保存成功')
51
           message.info('保存成功')
52
         }).catch(err => {
52
         }).catch(err => {
54
         })
54
         })
55
        } else {
55
        } else {
56
         request({
56
         request({
57
-          url: '/api/admin/shareContent',
58
-          method: 'POST',
59
-          data: { targetId: buildingId, shareContentType: 'building',shareContentImg: imgValue,shareContentTitle: inputValue },
57
+          ...apis.activity.addShareContent,
58
+          data: { targetId: buildingId, shareContentType: 'building', shareContentImg: imgValue,shareContentTitle: inputValue },
60
         }).then(data => {
59
         }).then(data => {
61
           setShareContentId(data.shareContentId)
60
           setShareContentId(data.shareContentId)
62
           message.info('保存成功')
61
           message.info('保存成功')

+ 29
- 0
src/services/apis.js View File

31
     getList: {
31
     getList: {
32
       method: 'GET',
32
       method: 'GET',
33
       url: `${prefix}/buildinglist`,
33
       url: `${prefix}/buildinglist`,
34
+      action: 'admin.buildinglist.get',
34
     },
35
     },
35
     updateStatus: {
36
     updateStatus: {
36
       method: 'PUT',
37
       method: 'PUT',
37
       url: `${prefix}/building/update/status`,
38
       url: `${prefix}/building/update/status`,
39
+      action: 'admin.building.update.status.put',
38
     },
40
     },
39
     addBuilding: {
41
     addBuilding: {
40
       method: 'POST',
42
       method: 'POST',
41
       url: `${prefix}/building/add`,
43
       url: `${prefix}/building/add`,
44
+      action: 'admin.building.add.post',
42
     },
45
     },
43
     updateBuilding: {
46
     updateBuilding: {
44
       method: 'PUT',
47
       method: 'PUT',
45
       url: `${prefix}/building/update`,
48
       url: `${prefix}/building/update`,
49
+      action: 'admin.building.update.put',
46
     },
50
     },
47
     buildingGetById: {
51
     buildingGetById: {
48
       method: 'GET',
52
       method: 'GET',
49
       url: `${prefix}/buildingSelectId/id`,
53
       url: `${prefix}/buildingSelectId/id`,
54
+      action: 'admin.buildingSelectId.id.get',
50
     },
55
     },
51
     deleteBuilding: {
56
     deleteBuilding: {
52
       method: 'DELETE',
57
       method: 'DELETE',
53
       url: `${prefix}/building/delete/id`,
58
       url: `${prefix}/building/delete/id`,
59
+      action: 'admin.building.delete.id.delete',
54
     },
60
     },
55
     buildingApartment: {
61
     buildingApartment: {
56
       method: 'GET',
62
       method: 'GET',
57
       url: `${prefix}/buildingApartment/buildingId/id`,
63
       url: `${prefix}/buildingApartment/buildingId/id`,
64
+      action: 'admin.buildingApartment.buildingId.id.get',
58
     },
65
     },
59
     buildingApartmentGetById: {
66
     buildingApartmentGetById: {
60
       method: 'GET',
67
       method: 'GET',
61
       url: `${prefix}/buildingApartment/id`,
68
       url: `${prefix}/buildingApartment/id`,
69
+      action: 'admin.buildingApartment.id.get',
62
     },
70
     },
63
     buildingApartmentUpdate: {
71
     buildingApartmentUpdate: {
64
       method: 'PUT',
72
       method: 'PUT',
65
       url: `${prefix}/buildingApartment/update`,
73
       url: `${prefix}/buildingApartment/update`,
74
+      action: 'admin.buildingApartment.update.put',
66
     },
75
     },
67
     buildingApartmentAdd: {
76
     buildingApartmentAdd: {
68
       method: 'POST',
77
       method: 'POST',
69
       url: `${prefix}/buildingApartment/add`,
78
       url: `${prefix}/buildingApartment/add`,
79
+      action: 'admin.buildingApartment.add.post',
70
     },
80
     },
71
     buildingApartmentDelete: {
81
     buildingApartmentDelete: {
72
       method: 'DELETE',
82
       method: 'DELETE',
73
       url: `${prefix}/apartment/deleted/id`,
83
       url: `${prefix}/apartment/deleted/id`,
84
+      action: 'admin.apartment.deleted.id.delete',
74
     },
85
     },
75
   },
86
   },
76
   buildingType: {
87
   buildingType: {
77
     getList: {
88
     getList: {
78
       method: 'GET',
89
       method: 'GET',
79
       url: `${prefix}/tdBuildingType`,
90
       url: `${prefix}/tdBuildingType`,
91
+      action: 'admin.tdBuildingType.get',
80
     },
92
     },
81
     delete: {
93
     delete: {
82
       method: 'DELETE',
94
       method: 'DELETE',
83
       url: `${prefix}/tdBuildingType/id`,
95
       url: `${prefix}/tdBuildingType/id`,
96
+      action: 'admin.tdBuildingType.id.delete',
84
     },
97
     },
85
     update: {
98
     update: {
86
       method: 'PUT',
99
       method: 'PUT',
87
       url: `${prefix}/tdBuildingType/id`,
100
       url: `${prefix}/tdBuildingType/id`,
101
+      action: 'admin.tdBuildingType.id.put',
88
     },
102
     },
89
     add: {
103
     add: {
90
       method: 'POST',
104
       method: 'POST',
91
       url: `${prefix}/tdBuildingType`,
105
       url: `${prefix}/tdBuildingType`,
106
+      action: 'admin.tdBuildingType.post',
92
     },
107
     },
93
     getById: {
108
     getById: {
94
       method: 'GET',
109
       method: 'GET',
95
       url: `${prefix}/tdBuildingType/id`,
110
       url: `${prefix}/tdBuildingType/id`,
111
+      action: 'admin.tdBuildingType.id.get',
96
     },
112
     },
97
   },
113
   },
98
   news: {
114
   news: {
105
     drift: {
121
     drift: {
106
       method: 'GET',
122
       method: 'GET',
107
       url: `${prefix}/customer/recommend/drift`,
123
       url: `${prefix}/customer/recommend/drift`,
124
+      action: 'admin.customer.recommend.drift.get',
108
     },
125
     },
109
     report: {
126
     report: {
110
       method: 'GET',
127
       method: 'GET',
111
       url: `${prefix}/customer/recommend/report`,
128
       url: `${prefix}/customer/recommend/report`,
129
+      action: 'admin.customer.recommend.report.get',
112
     },
130
     },
113
     recommender: {
131
     recommender: {
114
       method: 'GET',
132
       method: 'GET',
115
       url: `${prefix}/customer/recommend/recommender`,
133
       url: `${prefix}/customer/recommend/recommender`,
134
+      action: 'admin.customer.recommend.recommender.get',
116
     },
135
     },
117
     auto: {
136
     auto: {
118
       method: 'PUT',
137
       method: 'PUT',
119
       url: `${prefix}/customer/recommend/verify/id`,
138
       url: `${prefix}/customer/recommend/verify/id`,
139
+      action: 'admin.customer.recommend.verify.id.put',
120
     },
140
     },
121
     recommendGetById: {
141
     recommendGetById: {
122
       method: 'GET',
142
       method: 'GET',
123
       url: `${prefix}/customer/recommend/getById/id`,
143
       url: `${prefix}/customer/recommend/getById/id`,
144
+      action: 'admin.customer.recommend.getById.id.get',
124
     },
145
     },
125
     agents: {
146
     agents: {
126
       method: 'GET',
147
       method: 'GET',
127
       url: `${prefix}/customer/agents`,
148
       url: `${prefix}/customer/agents`,
149
+      action: 'admin.customer.agents.get',
128
     },
150
     },
129
     customerRecommend: {
151
     customerRecommend: {
130
       method: 'GET',
152
       method: 'GET',
131
       url: `${prefix}/customer/recommend`,
153
       url: `${prefix}/customer/recommend`,
154
+      action: 'admin.customer.recommend.get',
132
     },
155
     },
133
     consultant: {
156
     consultant: {
134
       method: 'GET',
157
       method: 'GET',
135
       url: `${prefix}/consultant`,
158
       url: `${prefix}/consultant`,
159
+      action: 'admin.consultant.get',
136
     },
160
     },
137
     recommendEdit: {
161
     recommendEdit: {
138
       method: 'PUT',
162
       method: 'PUT',
139
       url: `${prefix}/customer/recommend/edit/id`,
163
       url: `${prefix}/customer/recommend/edit/id`,
164
+      action: 'admin.customer.recommend.edit.id.put',
140
     },
165
     },
141
     taPointsRecords: {
166
     taPointsRecords: {
142
       method: 'GET',
167
       method: 'GET',
143
       url: `${prefix}/mine/taPointsRecords/id`,
168
       url: `${prefix}/mine/taPointsRecords/id`,
169
+      action: 'admin.mine.taPointsRecords.id.get',
144
     },
170
     },
145
     recommend: {
171
     recommend: {
146
       method: 'GET',
172
       method: 'GET',
147
       url: `${prefix}/customer/recommend/id`,
173
       url: `${prefix}/customer/recommend/id`,
174
+      action: 'admin.customer.recommend.id.get',
148
     },
175
     },
149
     InviteClientsList: {
176
     InviteClientsList: {
150
       method: 'GET',
177
       method: 'GET',
151
       url: `${prefix}/channel/InviteClientsList`,
178
       url: `${prefix}/channel/InviteClientsList`,
179
+      action: 'admin.channel.InviteClientsList.get',
152
     },
180
     },
153
     CustomerRecommendGet: {
181
     CustomerRecommendGet: {
154
       method: 'GET',
182
       method: 'GET',
155
       url: `${prefix}/customer/recommend/get/id`,
183
       url: `${prefix}/customer/recommend/get/id`,
184
+      action: 'admin.customer.recommend.get.id.get',
156
     },
185
     },
157
   },
186
   },
158
   indexEcharts: {
187
   indexEcharts: {