浏览代码

apis action

魏熙美 5 年前
父节点
当前提交
fe4c773582

+ 4
- 6
src/pages/building/list/add/components/poster.jsx 查看文件

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

+ 7
- 8
src/pages/building/list/add/components/share.jsx 查看文件

@@ -14,6 +14,7 @@ import logo from '../../../../../assets/logo.png';
14 14
 import touxiang from '../../../../../assets/touxiang.jpg';
15 15
 import poster1 from '../../../../../assets/poster1.png';
16 16
 import poster2 from '../../../../../assets/poster2.png';
17
+import apis from '../../../../../services/apis';
17 18
 
18 19
 const Share = props => {
19 20
   const [inputValue, changeInput] = useState('')
@@ -25,8 +26,7 @@ const Share = props => {
25 26
     // eslint-disable-next-line react-hooks/rules-of-hooks
26 27
     useEffect(() => {
27 28
       request({
28
-        url: '/api/admin/shareContent',
29
-        method: 'GET',
29
+        ...apis.activity.shareContent,
30 30
         params: { targetId: buildingId, targetType: 'building' },
31 31
       }).then(data => {
32 32
         if (data.length > 0) {
@@ -44,9 +44,9 @@ const Share = props => {
44 44
     if (buildingId) {
45 45
       if (shareContentId) {
46 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 50
         }).then(data => {
51 51
           message.info('保存成功')
52 52
         }).catch(err => {
@@ -54,9 +54,8 @@ const Share = props => {
54 54
         })
55 55
        } else {
56 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 59
         }).then(data => {
61 60
           setShareContentId(data.shareContentId)
62 61
           message.info('保存成功')

+ 29
- 0
src/services/apis.js 查看文件

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