周立森 vor 5 Jahren
Ursprung
Commit
572d331c6a
91 geänderte Dateien mit 2992 neuen und 1360 gelöschten Zeilen
  1. 1
    0
      .eslintrc.js
  2. 2
    0
      .gitignore
  3. 348
    0
      config/routes.js
  4. 2
    0
      package.json
  5. 21
    0
      src/app.js
  6. 9
    1
      src/components/EchartsTest/EChart.jsx
  7. 1
    0
      src/components/EchartsTest/china.js
  8. 15
    2
      src/components/SelectButton/BuildSelect.jsx
  9. 42
    28
      src/components/XForm/ImageListUpload.jsx
  10. 25
    14
      src/components/XForm/ImageUpload.jsx
  11. 14
    4
      src/global.less
  12. 1
    1
      src/models/login.js
  13. 8
    5
      src/pages/Welcome.jsx
  14. 7
    25
      src/pages/activity/ActivityList.jsx
  15. 2
    6
      src/pages/activity/SignList.jsx
  16. 11
    46
      src/pages/activity/editActivity.jsx
  17. 43
    0
      src/pages/building/list/add/amap.css
  18. 53
    0
      src/pages/building/list/add/amap.less
  19. 43
    0
      src/pages/building/list/add/amap.wxss
  20. 107
    0
      src/pages/building/list/add/components/amap.jsx
  21. 21
    14
      src/pages/building/list/add/components/base.jsx
  22. 245
    0
      src/pages/building/list/add/components/buildingProjectType.jsx
  23. 10
    1
      src/pages/building/list/add/components/imageSet.jsx
  24. 6
    5
      src/pages/building/list/add/components/modalImage.jsx
  25. 145
    0
      src/pages/building/list/add/components/poster.jsx
  26. 96
    0
      src/pages/building/list/add/components/share.jsx
  27. 19
    23
      src/pages/building/list/add/components/tags.jsx
  28. 42
    15
      src/pages/building/list/add/index.jsx
  29. 20
    0
      src/pages/building/list/add/style.less
  30. 67
    61
      src/pages/building/list/index.jsx
  31. 10
    7
      src/pages/building/list/style.css
  32. 17
    14
      src/pages/building/list/style.less
  33. 6
    6
      src/pages/building/list/style.wxss
  34. 8
    5
      src/pages/building/type/index.jsx
  35. 7
    6
      src/pages/building/type/style.css
  36. 8
    7
      src/pages/building/type/style.less
  37. 4
    4
      src/pages/building/type/style.wxss
  38. 6
    22
      src/pages/carouselFigure/advertisingList.jsx
  39. 6
    22
      src/pages/carouselFigure/carouselFigureList.jsx
  40. 4
    14
      src/pages/carouselFigure/editAdvertising.jsx
  41. 4
    14
      src/pages/carouselFigure/editCarousel.jsx
  42. 21
    10
      src/pages/channel/InviteClients.jsx
  43. 7
    10
      src/pages/channel/addChannel.jsx
  44. 14
    23
      src/pages/channel/brokerList.jsx
  45. 41
    43
      src/pages/channel/channelList.jsx
  46. 15
    15
      src/pages/channel/editChannel.jsx
  47. 20
    10
      src/pages/channel/recommendClients.jsx
  48. 137
    0
      src/pages/charts/CityNums.jsx
  49. 27
    17
      src/pages/customer/customerlist/index.jsx
  50. 4
    4
      src/pages/customer/customerlist/style.css
  51. 9
    8
      src/pages/customer/customerlist/style.less
  52. 4
    4
      src/pages/customer/customerlist/style.wxss
  53. 9
    8
      src/pages/customer/drift/style.less
  54. 12
    5
      src/pages/customer/independentList/index.jsx
  55. 4
    4
      src/pages/customer/independentList/style.css
  56. 8
    7
      src/pages/customer/independentList/style.less
  57. 4
    4
      src/pages/customer/independentList/style.wxss
  58. 9
    4
      src/pages/customer/recommendCustomer/index.jsx
  59. 4
    4
      src/pages/customer/recommendCustomer/style.css
  60. 6
    5
      src/pages/customer/recommendCustomer/style.less
  61. 4
    4
      src/pages/customer/recommendCustomer/style.wxss
  62. 9
    7
      src/pages/customer/report/index.jsx
  63. 4
    4
      src/pages/customer/report/style.css
  64. 9
    7
      src/pages/customer/report/style.less
  65. 4
    4
      src/pages/customer/report/style.wxss
  66. 25
    17
      src/pages/integralMall/GoodsList.jsx
  67. 19
    13
      src/pages/integralMall/achieve.jsx
  68. 4
    14
      src/pages/integralMall/editGoods.jsx
  69. 3
    7
      src/pages/integralMall/exchangeRecords.jsx
  70. 3
    11
      src/pages/integralMall/verifyList.jsx
  71. 10
    10
      src/pages/news/list/NewsList.jsx
  72. 8
    7
      src/pages/news/list/style.less
  73. 70
    36
      src/pages/staff/list/RoleList.jsx
  74. 86
    172
      src/pages/staff/list/StaffList.jsx
  75. 235
    129
      src/pages/staff/list/addRole.jsx
  76. 86
    140
      src/pages/staff/list/editRole.jsx
  77. 88
    51
      src/pages/staff/list/editStaff.jsx
  78. 28
    36
      src/pages/staff/list/style.less
  79. 4
    14
      src/pages/system/editPolicy.jsx
  80. 5
    20
      src/pages/system/housingPolicy.jsx
  81. 6
    13
      src/pages/system/intention.jsx
  82. 2
    6
      src/pages/system/messageList.jsx
  83. 4
    13
      src/pages/system/report.jsx
  84. 1
    1
      src/pages/user/login/components/Login/index.jsx
  85. 11
    4
      src/pages/user/login/components/Login/index.less
  86. 2
    6
      src/pages/user/login/index.jsx
  87. 1
    1
      src/pages/user/login/style.less
  88. 360
    47
      src/services/apis.js
  89. 1
    1
      src/utils/mixStr.js
  90. 6
    3
      src/utils/request.js
  91. 33
    5
      src/utils/upload.js

+ 1
- 0
.eslintrc.js Datei anzeigen

@@ -5,5 +5,6 @@ module.exports = {
5 5
   globals: {
6 6
     ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true,
7 7
     page: true,
8
+    AMap: true,
8 9
   },
9 10
 };

+ 2
- 0
.gitignore Datei anzeigen

@@ -38,3 +38,5 @@ screenshot
38 38
 .eslintcache
39 39
 
40 40
 build
41
+
42
+config/proxy.js

+ 348
- 0
config/routes.js Datei anzeigen

@@ -0,0 +1,348 @@
1
+export default [
2
+  {
3
+    path: '/user',
4
+    component: '../layouts/UserLayout',
5
+    routes: [
6
+      {
7
+        name: 'login',
8
+        path: '/user/login',
9
+        component: './user/login',
10
+      },
11
+    ],
12
+  },
13
+  {
14
+    path: '/',
15
+    component: '../layouts/SecurityLayout',
16
+    routes: [
17
+      {
18
+        path: '/',
19
+        component: '../layouts/BasicLayout',
20
+        authority: ['admin', 'user'],
21
+        routes: [
22
+          {
23
+            path: '/',
24
+            redirect: '/welcome',
25
+          },
26
+          {
27
+            path: '/welcome',
28
+            name: '首页',
29
+            component: './Welcome',
30
+          },
31
+          {
32
+            path: '/building',
33
+            name: '项目管理',
34
+            component: '../layouts/BlankLayout',
35
+            routes: [
36
+              {
37
+                path: '/building/list',
38
+                name: '项目列表',
39
+                component: './building/list/index',
40
+              },
41
+              {
42
+                path: '/building/list/add',
43
+                name: '项目添加', // 项目添加
44
+                hideInMenu: true,
45
+                component: './building/list/add/index',
46
+              },
47
+              {
48
+                path: '/building/type',
49
+                name: '项目类型',
50
+                component: './building/type/index',
51
+              },
52
+              {
53
+                path: '/building/type/edi',
54
+                name: '项目类型编辑',
55
+                hideInMenu: true,
56
+                component: './building/type/edi',
57
+              },
58
+            ],
59
+          },
60
+          {
61
+            path: '/customer',
62
+            name: '客户管理',
63
+            component: '../layouts/BlankLayout',
64
+            routes: [
65
+              {
66
+                path: '/customer/customerlist/list',
67
+                name: '客户列表',
68
+                component: './customer/customerlist/index',
69
+              },
70
+              {
71
+                path: '/customer/customerlist/customerDetail',
72
+                name: '客户编辑',
73
+                hideInMenu: true,
74
+                component: './customer/customerlist/customerDetail',
75
+              },
76
+              {
77
+                path: '/customer/drift/list',
78
+                name: '游客列表',
79
+                component: './customer/drift/index',
80
+              },
81
+              {
82
+                path: '/customer/report/list',
83
+                name: '报备客户',
84
+                component: './customer/report/index',
85
+              },
86
+              {
87
+                path: '/customer/recommendCustomer/list',
88
+                name: '推荐客户',
89
+                component: './customer/recommendCustomer/index',
90
+              },
91
+              {
92
+                path: '/customer/recommendCustomer/audit',
93
+                name: '客户审核', 
94
+                hideInMenu: true,
95
+                component: './customer/recommendCustomer/audit',
96
+              },
97
+              {
98
+                path: '/customer/independentList',
99
+                name: '经纪人',
100
+                component: './customer/independentList/index',
101
+              },
102
+            ],
103
+          },
104
+          {
105
+            path: '/integralMall',
106
+            name: '积分商城',
107
+            component: '../layouts/BlankLayout',
108
+            routes: [
109
+              {
110
+                path: '/integralMall/GoodsList',
111
+                name: '商品列表',
112
+                component: './integralMall/GoodsList',
113
+              },
114
+              {
115
+                path: '/integralMall/achieve',
116
+                name: '积分获取',
117
+                component: './integralMall/achieve',
118
+              },
119
+              {
120
+                path: '/integralMall/editGoods',
121
+                name: '商品编辑',
122
+                hideInMenu: true,
123
+                component: './integralMall/editGoods',
124
+              },
125
+              {
126
+                path: '/integralMall/exchangeRecords',
127
+                name: '兑换记录',
128
+                component: './integralMall/exchangeRecords',
129
+              },
130
+              {
131
+                path: '/integralMall/writeOff',
132
+                name: '商品核销',
133
+                component: './integralMall/writeOff',
134
+              },
135
+              {
136
+                path: '/integralMall/verifyList',
137
+                name: '商品核销列表',
138
+                hideInMenu: true,
139
+                component: './integralMall/verifyList',
140
+              },
141
+            ],
142
+          },
143
+          {
144
+            path: '/channel',
145
+            name: '渠道管理',
146
+            component: '../layouts/BlankLayout',
147
+            routes: [
148
+              {
149
+                path: '/channel/channelList',
150
+                name: '渠道管理',
151
+                component: './channel/channelList',
152
+              },
153
+              {
154
+                path: '/channel/addChannel',
155
+                name: '添加渠道',
156
+                hideInMenu: true,
157
+                component: './channel/addChannel',
158
+              },
159
+              {
160
+                path: '/channel/editChannel',
161
+                name: '编辑渠道',
162
+                hideInMenu: true,
163
+                component: './channel/editChannel',
164
+              },
165
+              {
166
+                path: '/channel/brokerList',
167
+                name: '经纪人',
168
+                component: './channel/brokerList',
169
+              },
170
+              {
171
+                path: '/channel/recommendClients',
172
+                name: '渠道推荐',
173
+                hideInMenu: true,
174
+                component: './channel/recommendClients',
175
+              },
176
+              {
177
+                path: '/channel/InviteClients',
178
+                name: '邀请客户',
179
+                hideInMenu: true,
180
+                component: './channel/InviteClients',
181
+              },
182
+            ],
183
+          },
184
+          {
185
+            path: '/news',
186
+            name: '资讯管理',
187
+            component: '../layouts/BlankLayout',
188
+            routes: [
189
+              {
190
+                path: '/news/type/NewsType',
191
+                name: '资讯类型',
192
+                component: './news/type/NewsType',
193
+              },
194
+              {
195
+                path: '/news/type/editNews',
196
+                name: '编辑资讯类型',
197
+                hideInMenu: true,
198
+                component: './news/type/editNews',
199
+              },
200
+              {
201
+                path: '/news/list/NewsList',
202
+                name: '资讯列表',
203
+                component: './news/list/NewsList',
204
+              },
205
+              {
206
+                path: '/news/list/editNewsList',
207
+                name: '编辑资讯',
208
+                hideInMenu: true,
209
+                component: './news/list/editNewsList',
210
+              },
211
+            ],
212
+          },
213
+          {
214
+            path: '/activity',
215
+            name: '活动管理',
216
+            component: '../layouts/BlankLayout',
217
+            routes: [
218
+              {
219
+                path: '/activity/ActivityList',
220
+                name: '活动列表',
221
+                component: './activity/ActivityList',
222
+              },
223
+              {
224
+                path: '/activity/editActivity',
225
+                name: '编辑活动',
226
+                hideInMenu: true,
227
+                component: './activity/editActivity',
228
+              },
229
+              {
230
+                path: '/activity/SignList',
231
+                name: '报名列表',
232
+                hideInMenu: true,
233
+                component: './activity/SignList',
234
+              },
235
+            ],
236
+          },
237
+          {
238
+            path: '/staff',
239
+            name: '员工管理',
240
+            component: '../layouts/BlankLayout',
241
+            routes: [
242
+              {
243
+                path: '/staff/StaffList',
244
+                name: '员工列表',
245
+                component: './staff/list/StaffList',
246
+              },
247
+              {
248
+                path: '/staff/editStaff',
249
+                name: '编辑员工',
250
+                hideInMenu: true,
251
+                component: './staff/list/editStaff',
252
+              },
253
+
254
+              {
255
+                path: '/staff/RoleList',
256
+                name: '角色管理',
257
+                component: './staff/list/RoleList',
258
+              },
259
+              {
260
+                path: '/staff/editRole',
261
+                name: '编辑角色',
262
+                hideInMenu: true,
263
+                component: './staff/list/editRole',
264
+              },
265
+              {
266
+                path: '/staff/list/addRole',
267
+                name: '添加角色',
268
+                hideInMenu: true,
269
+                component: './staff/list/addRole',
270
+              },  
271
+            ],
272
+          },
273
+          {
274
+            path: '/carouselFigure',
275
+            name: '轮播图管理',
276
+            component: '../layouts/BlankLayout',
277
+            routes: [
278
+              {
279
+                path: '/carouselFigure/carouselFigureList',
280
+                name: '轮播图列表',
281
+                component: './carouselFigure/carouselFigureList',
282
+              },
283
+              {
284
+                path: '/carouselFigure/editCarousel',
285
+                name: '轮播图编辑',
286
+                hideInMenu: true,
287
+                component: './carouselFigure/editCarousel',
288
+              },
289
+              {
290
+                path: '/carouselFigure/advertisingList',
291
+                name: '开屏广告',
292
+                component: './carouselFigure/advertisingList',
293
+              },
294
+              {
295
+                path: '/carouselFigure/editAdvertising',
296
+                name: '开屏广告编辑',
297
+                hideInMenu: true,
298
+                component: './carouselFigure/editAdvertising',
299
+              },
300
+            ],
301
+          },
302
+          {
303
+            path: '/system',
304
+            name: '系统管理',
305
+            component: '../layouts/BlankLayout',
306
+            routes: [
307
+              {
308
+                path: '/system/messageList',
309
+                name: '客户留言',
310
+                component: './system/messageList',
311
+              },
312
+              {
313
+                path: '/system/report',
314
+                name: '报表数据',
315
+                component: './system/report',
316
+              },
317
+              {
318
+                path: '/system/intention',
319
+                name: '意向值',
320
+                component: './system/intention',
321
+              },
322
+              {
323
+                path: '/system/housingPolicy',
324
+                name: '购房政策维护',
325
+                component: './system/housingPolicy',
326
+              },
327
+              {
328
+                path: '/system/editPolicy',
329
+                name: '购房政策编辑',
330
+                hideInMenu: true,
331
+                component: './system/editPolicy',
332
+              },
333
+            ],
334
+          },
335
+          {
336
+            component: './404',
337
+          },
338
+        ],
339
+      },
340
+      {
341
+        component: './404',
342
+      },
343
+    ],
344
+  },
345
+  {
346
+    component: './404',
347
+  },
348
+];

+ 2
- 0
package.json Datei anzeigen

@@ -55,6 +55,8 @@
55 55
     "path-to-regexp": "^3.0.0",
56 56
     "qs": "^6.7.0",
57 57
     "react": "^16.8.6",
58
+    "react-amap": "^1.2.8",
59
+    "react-amap-plugin-autocomplete": "0.0.4",
58 60
     "react-copy-to-clipboard": "^5.0.1",
59 61
     "react-document-title": "^2.0.3",
60 62
     "react-dom": "^16.8.6",

+ 21
- 0
src/app.js Datei anzeigen

@@ -1,3 +1,24 @@
1
+(function (doc, win) {
2
+  var docEl = doc.documentElement,
3
+    resizeEvt = 'onorientationchange' in window ? 'onorientationchange' : 'resize',
4
+    recalc = function () {
5
+      var clientWidth = docEl.clientWidth;
6
+      if (!clientWidth) return;
7
+      if (clientWidth < 1700) {
8
+        docEl.style.fontSize = '150px';
9
+      } else if ( 1700>=clientWidth>2000 ){
10
+        docEl.style.fontSize = '170px';
11
+      }else{
12
+        docEl.style.fontSize = '170px';
13
+        // docEl.style.fontSize = 100 * (clientWidth / 1400) + 'px';
14
+      }
15
+    };
16
+
17
+  if (!doc.addEventListener) return;
18
+  win.addEventListener(resizeEvt, recalc, false);
19
+  doc.addEventListener('DOMContentLoaded', recalc, false);
20
+})(document, window);
21
+
1 22
 export const dva = {
2 23
   config: {
3 24
     onError(e) {

+ 9
- 1
src/components/EchartsTest/EChart.jsx Datei anzeigen

@@ -5,12 +5,21 @@ import echarts from 'echarts/lib/echarts';
5 5
 // 引入柱状图
6 6
 import 'echarts/lib/chart/bar';
7 7
 import 'echarts/lib/chart/pie';
8
+import 'echarts/lib/chart/scatter';
9
+import 'echarts/lib/chart/effectScatter';
10
+import 'echarts/lib/chart/map';
8 11
 // 引入提示框和标题组件
9 12
 import 'echarts/lib/component/tooltip';
10 13
 import 'echarts/lib/component/legend';
11 14
 import 'echarts/lib/component/title';
12 15
 import 'echarts/lib/chart/line';
13 16
 import 'echarts/lib/component/dataZoom';
17
+import 'echarts/lib/component/geo';
18
+import 'echarts/lib/component/visualMap';
19
+
20
+import { ChinaData } from './china';
21
+
22
+echarts.registerMap('china', ChinaData);
14 23
 
15 24
 class EchartsTest extends Component {
16 25
     chartRef = React.createRef();
@@ -34,7 +43,6 @@ class EchartsTest extends Component {
34 43
                 ...this.props.options || {},
35 44
             }
36 45
 
37
-            // console.log(options)
38 46
 
39 47
             this.chart.setOption(options);
40 48
         }

+ 1
- 0
src/components/EchartsTest/china.js
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 15
- 2
src/components/SelectButton/BuildSelect.jsx Datei anzeigen

@@ -1,10 +1,18 @@
1
-import React, { useState, useEffect } from 'react';
1
+import React, { useState, useEffect, useRef } from 'react';
2 2
 import { Select } from 'antd';
3 3
 
4 4
 import request from '../../utils/request'
5 5
 
6 6
 const { Option } = Select;
7 7
 
8
+function usePrevious(props) {
9
+  const ref = useRef();
10
+  useEffect(() => {
11
+    ref.current = props;
12
+  });
13
+  return ref.current;
14
+}
15
+
8 16
 /**
9 17
  *
10 18
  *
@@ -13,7 +21,12 @@ const { Option } = Select;
13 21
  */
14 22
 const BuildingSelect = (props) => {
15 23
   const [ data, setData ] = useState([])
16
-  const [ value, setValue ] = useState(props.value)
24
+  const [ value, setValue ] = useState('')
25
+  const preProps = usePrevious(props)
26
+  
27
+  if ((!preProps || !preProps.value) && props.value && !value) {
28
+    setValue(props.value)
29
+  }
17 30
 
18 31
   useEffect(() => {
19 32
     getCityList();

+ 42
- 28
src/components/XForm/ImageListUpload.jsx Datei anzeigen

@@ -3,65 +3,79 @@ import { Upload, Icon, Modal } from 'antd';
3 3
 import './style.less';
4 4
 import { uploaderProps } from '../../utils/upload';
5 5
 
6
-function getBase64(file) {
7
-  return new Promise((resolve, reject) => {
8
-    const reader = new FileReader();
9
-    reader.readAsDataURL(file);
10
-    reader.onload = () => resolve(reader.result);
11
-    reader.onerror = error => reject(error);
12
-  });
13
-}
14
-
15 6
 class ImageListUpload extends React.Component {
16 7
   state = {
17 8
     previewVisible: false,
18 9
     previewImage: '',
19
-    fileList: [],
10
+    loadding: false,
20 11
   };
21 12
 
13
+  getFileList = () => {
14
+    return (this.props.value || []).map((img, inx) => ({ uid: inx, url: img, status: 'done' }))
15
+  }
16
+
22 17
   handleCancel = () => this.setState({ previewVisible: false });
23 18
 
24 19
   handlePreview = async file => {
25
-    if (!file.url && !file.preview) {
26
-      file.preview = await getBase64(file.originFileObj);
27
-    }
28
-
29 20
     this.setState({
30
-      previewImage: file.url || file.preview,
21
+      previewImage: file.url ,
31 22
       previewVisible: true,
32 23
     });
33 24
   };
34 25
 
35
-  handleChange = ({ fileList }) => {
36
-    this.setState({ fileList })
37
-    if (typeof this.props.onChange === 'function') {
38
-      // return item.response.url
39
-      const images = fileList.filter(item => item.status === 'done')
40
-      this.props.onChange(images.map(item => item.response.url))
26
+  handleChange = (e) => {
27
+    if (e.file.status === "uploading") {
28
+      this.setState({ loading: true });
29
+      return;
30
+    }
31
+
32
+    if (e.file.state === 'removed') {
33
+      const fileList = (this.props.value || []).filter(x => x != e.file.url);
34
+      this.props.onChange(fileList);
41 35
     }
36
+
37
+    // if (e.file.status === "done") {
38
+    //   this.setState({
39
+    //     loading: false,
40
+    //   })
41
+
42
+    //   if (e.file.response && e.file.response.url) {
43
+    //     if (typeof this.props.onChange === 'function') {
44
+    //       const fileList = this.getFileList()
45
+    //       this.props.onChange([...fileList || [], e.file.response.url]);
46
+    //     }
47
+    //   }
48
+    // }
42 49
   };
43 50
 
44
-  render() {
45
-    const { previewVisible, previewImage, fileList } = this.state;
51
+  handleUploadSucess = (url) => {
52
+    this.setState({ loading: false });
53
+    if (typeof this.props.onChange === 'function') {
54
+      const fileList = this.props.value || [];
55
+      this.props.onChange([...fileList, url]);
56
+    }
57
+  }
46 58
 
47
-    const { value } = this.props
59
+  render() {
60
+    const { previewVisible, previewImage } = this.state;
61
+    const fileList = this.getFileList();
48 62
 
49 63
     const uploadButton = (
50 64
       <div>
51
-        <Icon type="plus" />
52
-        <div className="ant-upload-text">Upload</div>
65
+        <Icon style={{ fontSize: '2em', color: '#aaa' }} type={this.state.loading ? "loading" : "plus"}  />
53 66
       </div>
54 67
     );
55 68
     return (
56 69
       <div className="clearfix">
57 70
         <Upload
58 71
           listType="picture-card"
59
-          fileList={fileList || value}
72
+          fileList={fileList}
60 73
           onPreview={this.handlePreview}
61 74
           onChange={this.handleChange}
62 75
           { ...uploaderProps }
76
+          onSuccess={this.handleUploadSucess}
63 77
         >
64
-          {fileList.length >= 8 ? null : uploadButton}
78
+          {(fileList || images).length >= 8 ? null : uploadButton}
65 79
         </Upload>
66 80
         <Modal visible={previewVisible} footer={null} onCancel={this.handleCancel}>
67 81
           <img alt="example" style={{ width: '100%' }} src={previewImage} />

+ 25
- 14
src/components/XForm/ImageUpload.jsx Datei anzeigen

@@ -16,24 +16,35 @@ class ImageUpload extends React.Component {
16 16
       this.setState({ loading: true });
17 17
       return;
18 18
     }
19
+    
20
+    if (e.file.state === 'removed') {
21
+      this.props.onChange();
22
+    }
19 23
 
20
-    if (info.file.status === "done") {
21
-      this.setState({
22
-        loading: false,
23
-      })
24
+    // if (info.file.status === "done") {
25
+    //   this.setState({
26
+    //     loading: false,
27
+    //   })
24 28
 
25
-      if (info.file.response && info.file.response.url) {
26
-        this.setState({
27
-          imageUrl: info.file.response.thumbUrl,
28
-        });
29
+    //   if (info.file.response && info.file.response.url) {
30
+    //     this.setState({
31
+    //       imageUrl: info.file.response.thumbUrl,
32
+    //     });
29 33
 
30
-        if (typeof this.props.onChange === 'function') {
31
-          this.props.onChange(info.file.response.url);
32
-        }
33
-      }
34
-    }
34
+    //     if (typeof this.props.onChange === 'function') {
35
+    //       this.props.onChange(info.file.response.url);
36
+    //     }
37
+    //   }
38
+    // }
35 39
   };
36 40
 
41
+  handleUploadSucess = (url) => {
42
+    this.setState({ loading: false });
43
+    if (typeof this.props.onChange === 'function') {
44
+      this.props.onChange(url);
45
+    }
46
+  }
47
+
37 48
   render() {
38 49
     const uploadButton = (
39 50
       <div>
@@ -50,8 +61,8 @@ class ImageUpload extends React.Component {
50 61
         showUploadList={false}
51 62
         beforeUpload={this.props.beforeUpload}
52 63
         onChange={this.handleChange}
53
-
54 64
         {...uploaderProps}
65
+        onSuccess={this.handleUploadSucess}
55 66
       >
56 67
         {(this.state.imageUrl || value) ? (
57 68
           <img src={this.state.imageUrl || value} alt="avatar" style={{ width: "100%" }} />

+ 14
- 4
src/global.less Datei anzeigen

@@ -79,13 +79,23 @@ ol {
79 79
 .ant-menu-vertical-left .ant-menu-submenu-title,
80 80
 .ant-menu-vertical-right .ant-menu-submenu-title,
81 81
 .ant-menu-inline .ant-menu-submenu-title,
82
-.ant-input ,.ant-btn{
83
-  font-size: 16px;
82
+.ant-input ,.ant-btn,.ant-select,.ant-table,.ant-form-item,.ant-form label,.ant-tabs-nav-container {
83
+  font-size: 0.1rem;
84
+  
85
+}
86
+.ant-input{
87
+  height: 32px;
88
+  border-radius: 4px;
89
+  padding: 0 0 0 10px;
90
+  align-items: center;
91
+}
92
+.ant-row.ant-form-item .ant-form-item-label.ant-col-sm-3{
93
+  min-width: 100px;
84 94
 }
85 95
 .ant-breadcrumb{
86
-  font-size: 16px;
96
+  font-size: 0.1rem;
87 97
   .anticon {
88
-    font-size: 16px;
98
+    font-size: 0.1rem;
89 99
   }
90 100
 } 
91 101
   .ant-pro-global-header-trigger{

+ 1
- 1
src/models/login.js Datei anzeigen

@@ -50,7 +50,7 @@ const Model = {
50 50
     *logout(_, { put, call }) {
51 51
       const { redirect } = getPageQuery(); // redirect
52 52
 
53
-      yield call(signout, { logout: true });
53
+      yield call(signout);
54 54
 
55 55
       if (window.location.pathname !== '/user/login' && !redirect) {
56 56
         yield put(

+ 8
- 5
src/pages/Welcome.jsx Datei anzeigen

@@ -1,7 +1,9 @@
1 1
 import React from 'react';
2 2
 import { Card, Typography, Alert, Row, Col } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import EchartsTest from '../components/EchartsTest'
4
+import EchartsTest from '../components/EchartsTest';
5
+import CityNums from './charts/CityNums';
6
+
5 7
 const option = {
6 8
   xAxis: {
7 9
     type: 'category',
@@ -15,12 +17,13 @@ const option = {
15 17
     type: 'line'
16 18
   }]
17 19
 };
20
+
18 21
 export default () => (
19 22
   <>
20 23
     <div style={{ display: 'flex' }}>
21 24
       <div style={{
22 25
         textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(144deg,rgba(241,43,62,1) 0%,rgba(254,144,155,1) 100%)', height: '100px',
23
-        boxShadow: '0px 18px 14px -15px rgba(241,43,62,1)',
26
+        boxShadow: '0px  0.11rem 14px -15px rgba(241,43,62,1)',
24 27
         borderRadius: '12px', width: '32%', marginRight: '2%'
25 28
       }}>
26 29
         <span style={{ fontSize: '24px', color: '#fff' }}>总用户 </span>
@@ -28,7 +31,7 @@ export default () => (
28 31
       </div>
29 32
       <div style={{
30 33
         textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(144deg,rgba(255,126,74,1) 0%,rgba(255,196,168,1) 100%)', height: '100px',
31
-        boxShadow: '0px 18px 14px -15px rgba(255,126,74,1)',
34
+        boxShadow: '0px  0.11rem 14px -15px rgba(255,126,74,1)',
32 35
         borderRadius: '12px', width: '32%', marginRight: '2%'
33 36
       }}>
34 37
         <span style={{ fontSize: '24px', color: '#fff' }}>总注册用户 </span>
@@ -36,7 +39,7 @@ export default () => (
36 39
       </div>
37 40
       <div style={{
38 41
         textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(137deg,rgba(107,130,230,1) 0%,rgba(152,175,251,1) 100%)', height: '100px',
39
-        boxShadow: '0px 18px 14px -15px rgba(107,130,230,1)',
42
+        boxShadow: '0px  0.11rem 14px -15px rgba(107,130,230,1)',
40 43
         borderRadius: '12px', width: '32%',
41 44
       }}>
42 45
         <span style={{ fontSize: '24px', color: '#fff' }}>最近7天新增 </span>
@@ -44,7 +47,7 @@ export default () => (
44 47
       </div>
45 48
     </div>
46 49
     <EchartsTest style={{width: 500, height:500}}></EchartsTest>
47
-
50
+    <CityNums></CityNums>
48 51
   </>
49 52
 );
50 53
 

+ 7
- 25
src/pages/activity/ActivityList.jsx Datei anzeigen

@@ -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/iBuildingDynamicList',
27
-        method: 'GET',
28
-        params: { ...params },
29
-    }).then((data) => {
25
+    request({ ...apis.activity.list, params: { ...params } }).then((data) => {
30 26
         console.log(data)
31 27
         setData(data)
32 28
     })
@@ -124,11 +120,7 @@ const toEditGoods = (dynamicId) => () => {
124 120
           okText: '确定',
125 121
           cancelText: '取消',
126 122
           onOk() {
127
-              request({
128
-                  url: '/api/admin/buildingDynamic/finish',
129
-                  method: 'PUT',
130
-                  data: {dynamicId: row.dynamicId, top: ""},
131
-              }).then((data) => {
123
+              request({ ...apis.activity.finish, data: {dynamicId: row.dynamicId, top: ""} }).then((data) => {
132 124
                   console.log(data)
133 125
                   message.info('操作成功!')
134 126
                   getList({ pageNum: 1, pageSize: 10 })
@@ -143,11 +135,7 @@ const toEditGoods = (dynamicId) => () => {
143 135
 //   置顶
144 136
   const topDynamic = (row) => () => {
145 137
       const weight = Math.abs(row.weight - 1)
146
-      request({
147
-          url: '/api/admin/buildingDynamic/weight',
148
-          method: 'PUT',
149
-          params: {dynamicId: row.dynamicId, weight},
150
-      }).then((data) => {
138
+      request({ ...apis.activity.weight, params: {dynamicId: row.dynamicId, weight} }).then((data) => {
151 139
           console.log(data)
152 140
           message.info('操作成功!')
153 141
           getList({ pageNum: 1, pageSize: 10 })
@@ -167,10 +155,7 @@ const toEditGoods = (dynamicId) => () => {
167 155
   
168 156
   // 取消活动
169 157
   const cancelDynamic = (row) => {
170
-      request({
171
-          url: '/api/admin/buildingDynamic/cancel/'+row.dynamicId,
172
-          method: 'PUT',
173
-      }).then((data) => {
158
+      request({ ...apis.activity.cancel, urlData: {id: row.dynamicId}}).then((data) => {
174 159
           message.info('操作成功!')
175 160
           getList({ pageNum: 1, pageSize: 10 })
176 161
       }).catch((err) => {
@@ -181,10 +166,7 @@ const toEditGoods = (dynamicId) => () => {
181 166
   
182 167
   //发布活动
183 168
   const sendDynamic = (row) => {
184
-      request({
185
-          url: '/api/admin/buildingDynamic/send/'+row.dynamicId,
186
-          method: 'PUT',
187
-      }).then((data) => {
169
+      request({ ...apis.activity.send, urlData: {id: row.dynamicId}}).then((data) => {
188 170
           message.info('操作成功!')
189 171
           getList({ pageNum: 1, pageSize: 10 });
190 172
       }).catch((err) => {
@@ -250,7 +232,7 @@ const handleSubmit = (e, props) => {
250 232
           </Button>
251 233
         </Form.Item>
252 234
       </Form>
253
-      <Button type="primary" className={styles.addBtn} onClick={toEditGoods()}>新增</Button>
235
+      <Button type="danger" className={styles.addBtn} onClick={toEditGoods()}>新增</Button>
254 236
       <Table dataSource={data.list} columns={columns} pagination={false}/>
255 237
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
256 238
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />

+ 2
- 6
src/pages/activity/SignList.jsx Datei anzeigen

@@ -4,7 +4,7 @@ import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5 5
 import router from 'umi/router';
6 6
 import moment from 'moment';
7
-
7
+import apis from '../../services/apis';
8 8
 import request from '../../utils/request'
9 9
 
10 10
 const { Option } = Select;
@@ -50,11 +50,7 @@ const header = (props) => {
50 50
 
51 51
   // 查询列表
52 52
   const getSignList = (params) => {
53
-    request({
54
-        url: '/api/admin/SignList',
55
-        method: 'GET',
56
-        params: { ...params },
57
-    }).then((data) => {
53
+    request({ ...apis.activity.signList, params: { ...params },}).then((data) => {
58 54
         console.log(data)
59 55
         setData(data)
60 56
     })

+ 11
- 46
src/pages/activity/editActivity.jsx Datei anzeigen

@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
2 2
 import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5
+import apis from '../../services/apis';
5 6
 import moment from 'moment';
6 7
 import router from 'umi/router';
7 8
 import BuildSelect from '../../components/SelectButton/BuildSelect'
@@ -36,11 +37,7 @@ const Edit = (props) => {
36 37
 
37 38
     // 查询列表
38 39
     const getDynamicData = (dynamicId) => {
39
-      request({
40
-        url: '/api/admin/buildingDynamic/Details',
41
-        method: 'GET',
42
-        params: { dynamicId },
43
-      }).then((data) => {
40
+      request({ ...apis.activity.details, params: { dynamicId } }).then((data) => {
44 41
         console.log(data)
45 42
         setDynamicData(data)
46 43
       })
@@ -143,22 +140,14 @@ const Edit = (props) => {
143 140
       console.log('submit data --->', submitValue)
144 141
       if (dynamicId) {
145 142
         submitValue.dynamicId = dynamicId
146
-        request({
147
-          url: '/api/admin/buildingDynamic/update',
148
-          method: 'PUT',
149
-          data: submitValue,
150
-        }).then((data) => {
143
+        request({ ...apis.activity.update, data: submitValue }).then((data) => {
151 144
           message.info("保存成功")
152 145
           cancelPage()
153 146
         }).catch((err) => {
154 147
           message.info(err.msg || err.message)
155 148
         })
156 149
       } else {
157
-        request({
158
-          url: '/api/admin/buildingDynamic/add',
159
-          method: 'POST',
160
-          data: submitValue,
161
-        }).then((data) => {
150
+        request({ ...apis.activity.add, data: submitValue }).then((data) => {
162 151
           message.info("保存成功")
163 152
           cancelPage()
164 153
         }).catch((err) => {
@@ -178,11 +167,7 @@ const Edit = (props) => {
178 167
 
179 168
     if(dynamicId){
180 169
       useEffect(() => {
181
-        request({
182
-          url: '/api/admin/poster',
183
-          method: 'GET',
184
-          params: {targetId: dynamicId,targetType: 'activity'},
185
-        }).then((data) => {
170
+        request({ ...apis.activity.poster, params: {targetId: dynamicId,targetType: 'activity'} }).then((data) => {
186 171
           console.log(data,"2222")
187 172
           if(data.length > 0){
188 173
             setPosterId(data[0].posterId)
@@ -199,21 +184,13 @@ const Edit = (props) => {
199 184
     const submitPoster  = () => {
200 185
        if(dynamicId){
201 186
         if(posterId){
202
-          request({
203
-            url: '/api/admin/poster/'+posterId,
204
-            method: 'PUT',
205
-            data: {targetId: dynamicId,targetType: 'activity',posterImg: imgValue,posterTitle: inputValue,posterDescription: textAreaValue},
206
-          }).then((data) => {
187
+          request({ ...apis.activity.updatePoster, urlData: {id: posterId}, data: {targetId: dynamicId,targetType: 'activity',posterImg: imgValue,posterTitle: inputValue,posterDescription: textAreaValue},}).then((data) => {
207 188
             message.info("保存成功")
208 189
           }).catch((err) => {
209 190
             message.info(err.msg || err.message)
210 191
           })
211 192
          }else{
212
-          request({
213
-            url: '/api/admin/poster',
214
-            method: 'POST',
215
-            data: {targetId: dynamicId,targetType: 'activity',posterImg: imgValue,posterTitle: inputValue,posterDescription: textAreaValue},
216
-          }).then((data) => {
193
+          request({ ...apis.activity.addPoster, data: {targetId: dynamicId,targetType: 'activity',posterImg: imgValue,posterTitle: inputValue,posterDescription: textAreaValue},}).then((data) => {
217 194
             setPosterId(data.posterId)
218 195
             message.info("保存成功")
219 196
           }).catch((err) => {
@@ -245,7 +222,7 @@ const Edit = (props) => {
245 222
               textOverflow: 'ellipsis'
246 223
             }}>{inputValue ? inputValue : '海报标题'}</p>
247 224
 
248
-            <img src={yinhao} style={{ width: '30px', marginLeft: '10px' }} alt="" />
225
+            <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
249 226
             <p style={{
250 227
               margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
251 228
               display: '-webkit-box', lineClamp: '3', height: '76px',
@@ -290,11 +267,7 @@ const Edit = (props) => {
290 267
     
291 268
     if(dynamicId){
292 269
       useEffect(() => {
293
-        request({
294
-          url: '/api/admin/shareContent',
295
-          method: 'GET',
296
-          params: {targetId: dynamicId,targetType: 'activity'},
297
-        }).then((data) => {
270
+        request({ ...apis.activity.shareContent, params: {targetId: dynamicId,targetType: 'activity'},}).then((data) => {
298 271
           console.log(data,"2222")
299 272
           if(data.length > 0){
300 273
             setShareContentId(data[0].shareContentId)
@@ -310,21 +283,13 @@ const Edit = (props) => {
310 283
     const submitShare = () => {
311 284
       if(dynamicId){
312 285
         if(shareContentId){
313
-          request({
314
-            url: '/api/admin/shareContent/'+shareContentId,
315
-            method: 'PUT',
316
-            data: {targetId: dynamicId,shareContentType: 'activity',shareContentImg: imgValue,shareContentTitle: inputValue},
317
-          }).then((data) => {
286
+          request({ ...apis.activity.updateShareContent, urlData: {id: shareContentId},data: {targetId: dynamicId,shareContentType: 'activity',shareContentImg: imgValue,shareContentTitle: inputValue},}).then((data) => {
318 287
             message.info("保存成功")
319 288
           }).catch((err) => {
320 289
             message.info(err.msg || err.message)
321 290
           })
322 291
          }else{
323
-          request({
324
-            url: '/api/admin/shareContent',
325
-            method: 'POST',
326
-            data: {targetId: dynamicId,shareContentType: 'activity',shareContentImg: imgValue,shareContentTitle: inputValue},
327
-          }).then((data) => {
292
+          request({ ...apis.activity.addShareContent, data: {targetId: dynamicId,shareContentType: 'activity',shareContentImg: imgValue,shareContentTitle: inputValue},}).then((data) => {
328 293
             setShareContentId(data.shareContentId)
329 294
             message.info("保存成功")
330 295
           }).catch((err) => {

+ 43
- 0
src/pages/building/list/add/amap.css Datei anzeigen

@@ -0,0 +1,43 @@
1
+.infoBox {
2
+  padding: 10px;
3
+  position: absolute;
4
+  top: 20px;
5
+  left: 20px;
6
+  background-color: white;
7
+  width: 280px;
8
+  box-shadow: 0 2px 6px 0 rgba(114, 124, 245, 0.5);
9
+  z-index: 100;
10
+}
11
+.infoBox .inputText {
12
+  margin-right: 10px;
13
+}
14
+.infoBox .input {
15
+  width: 150px;
16
+  height: 32px;
17
+  font-size: 16px;
18
+}
19
+/* types */
20
+.native-toast-error {
21
+  background-color: #d92727;
22
+  color: white;
23
+}
24
+.native-toast-success {
25
+  background-color: #62a465;
26
+  color: white;
27
+}
28
+.native-toast-warning {
29
+  background-color: #fdaf17;
30
+  color: white;
31
+}
32
+.native-toast-info {
33
+  background-color: #5060ba;
34
+  color: white;
35
+}
36
+[class^="native-toast-icon-"] {
37
+  vertical-align: middle;
38
+  margin-right: 8px;
39
+}
40
+[class^="native-toast-icon-"] svg {
41
+  width: 16px;
42
+  height: 16px;
43
+}

+ 53
- 0
src/pages/building/list/add/amap.less Datei anzeigen

@@ -0,0 +1,53 @@
1
+
2
+.infoBox {
3
+  padding: 10px;
4
+  position: absolute;
5
+  top: 20px;
6
+  left: 20px;
7
+  background-color: white;
8
+  width: 290px;
9
+  box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
10
+  z-index: 100;
11
+  .inputText{
12
+    margin-right: 10px;
13
+  }
14
+  .input{
15
+    width: 150px;
16
+    height: 32px;
17
+    font-size: 16px;
18
+  }
19
+ 
20
+}
21
+
22
+
23
+/* types */
24
+
25
+.native-toast-error {
26
+  background-color: #d92727;
27
+  color: white;
28
+}
29
+
30
+.native-toast-success {
31
+  background-color: #62a465;
32
+  color: white;
33
+}
34
+
35
+.native-toast-warning {
36
+  background-color: #fdaf17;
37
+  color: white;
38
+}
39
+
40
+.native-toast-info {
41
+  background-color: #5060ba;
42
+  color: white;
43
+}
44
+
45
+[class^="native-toast-icon-"] {
46
+  vertical-align: middle;
47
+  margin-right: 8px
48
+}
49
+
50
+[class^="native-toast-icon-"] svg {
51
+  width: 16px;
52
+  height: 16px;
53
+}

+ 43
- 0
src/pages/building/list/add/amap.wxss Datei anzeigen

@@ -0,0 +1,43 @@
1
+.infoBox {
2
+  padding: 10px;
3
+  position: absolute;
4
+  top: 20px;
5
+  left: 20px;
6
+  background-color: white;
7
+  width: 280px;
8
+  box-shadow: 0 2px 6px 0 rgba(114, 124, 245, 0.5);
9
+  z-index: 100;
10
+}
11
+.infoBox .inputText {
12
+  margin-right: 10px;
13
+}
14
+.infoBox .input {
15
+  width: 150px;
16
+  height: 32px;
17
+  font-size: 16px;
18
+}
19
+/* types */
20
+.native-toast-error {
21
+  background-color: #d92727;
22
+  color: white;
23
+}
24
+.native-toast-success {
25
+  background-color: #62a465;
26
+  color: white;
27
+}
28
+.native-toast-warning {
29
+  background-color: #fdaf17;
30
+  color: white;
31
+}
32
+.native-toast-info {
33
+  background-color: #5060ba;
34
+  color: white;
35
+}
36
+[class^="native-toast-icon-"] {
37
+  vertical-align: middle;
38
+  margin-right: 8px;
39
+}
40
+[class^="native-toast-icon-"] svg {
41
+  width: 16px;
42
+  height: 16px;
43
+}

+ 107
- 0
src/pages/building/list/add/components/amap.jsx Datei anzeigen

@@ -0,0 +1,107 @@
1
+import React from 'react';
2
+import ReactDOM from 'react-dom';
3
+import { Map, Marker } from 'react-amap';
4
+import styles from '../amap.less'
5
+
6
+class Amap extends React.Component {
7
+  constructor(props) {
8
+    super(props);
9
+    // 高德地图 Marker 实例
10
+    this.markerInstance = undefined
11
+    // 高德地图 Map 实例
12
+    this.mapInstance = undefined
13
+    this.amapEvents = {
14
+      created: mapInstance => {
15
+        console.log('高德地图 Map 实例创建成功;如果你要亲自对实例进行操作,可以从这里开始。比如:');
16
+        console.log(mapInstance.getZoom());
17
+        this.mapInstance = mapInstance
18
+
19
+        AMap.plugin(['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.CitySearch'], () => {
20
+          // 实例化Autocomplete
21
+          const autoOptions = {
22
+            // city 限定城市,默认全国
23
+            city: '全国',
24
+            // input 为绑定输入提示功能的input的DOM ID
25
+            input: 'amapInput',
26
+          }
27
+          const autoComplete = new AMap.Autocomplete(autoOptions);
28
+          // 无需再手动执行search方法,autoComplete会根据传入input对应的DOM动态触发search
29
+
30
+          const placeSearch = new AMap.PlaceSearch({
31
+            city: '南京',
32
+            map: mapInstance,
33
+          })
34
+
35
+          // 监听下拉框选中事件
36
+          AMap.event.addListener(autoComplete, 'select', e => {
37
+            // TODO 针对选中的poi实现自己的功能
38
+            placeSearch.setCity(e.poi.adcode)
39
+            placeSearch.search(e.poi.name)
40
+          })
41
+
42
+
43
+          const citySearch = new AMap.CitySearch()
44
+          citySearch.getLocalCity((status, result) => {
45
+            if (status === 'complete' && result.info === 'OK') {
46
+              // 查询成功,result即为当前所在城市信息
47
+              console.log('当前所在城市:', result)
48
+              if (result && result.city && result.bounds) {
49
+                // 当前城市名称
50
+                // const cityinfo = result.city;
51
+
52
+                // 当前城市位置信息
53
+                const citybounds = result.bounds;
54
+                // document.getElementById('info').innerHTML = '您当前所在城市:'+cityinfo;
55
+                // 地图显示当前城市
56
+                mapInstance.setBounds(citybounds);
57
+              }
58
+            }
59
+          })
60
+        })
61
+
62
+        // 实例点击事件
63
+        mapInstance.on('click', e => {
64
+          const lngLat = `${e.lnglat.getLng()},${e.lnglat.getLat()}`
65
+          console.log('坐标位置:', lngLat)
66
+          this.props.onChange(lngLat)
67
+        });
68
+      },
69
+    };
70
+    this.markerEvents = {
71
+      created: markerInstance => {
72
+        console.log('高德地图 Marker 实例创建成功;如果你要亲自对实例进行操作,可以从这里开始。比如:');
73
+        console.log(markerInstance.getPosition());
74
+
75
+        this.markerInstance = markerInstance
76
+      },
77
+    }
78
+    this.markerPosition = { longitude: 120, latitude: 30 };
79
+  }
80
+
81
+  render() {
82
+    const { value } = this.props
83
+    if (value) {
84
+      this.markerInstance.setPosition(value.split(','))
85
+    }
86
+
87
+    return (
88
+      <>
89
+        <div style={{ width: '100%', height: '400px', position: 'relative' }}>
90
+          <Map events={this.amapEvents} amapkey="f0d1d4f82432504003ebf46e5e36ff03">
91
+            <Marker position={this.markerPosition} events={this.markerEvents} />
92
+          </Map>
93
+          {
94
+          <div className={styles.infoBox}>
95
+            <span className={styles.inputText}>请输入关键字</span>
96
+            <input id="amapInput" className={styles.input} type="text" />
97
+          </div>
98
+          }
99
+        </div>
100
+      </>
101
+    )
102
+  }
103
+}
104
+
105
+// f0d1d4f82432504003ebf46e5e36ff03
106
+
107
+export default Amap

+ 21
- 14
src/pages/building/list/add/components/base.jsx Datei anzeigen

@@ -9,6 +9,9 @@ import ImageUpload from '../../../../../components/XForm/ImageUpload'
9 9
 import ImageListUpload from '../../../../../components/XForm/ImageListUpload'
10 10
 import Wangedit from '../../../../../components/Wangedit/Wangedit'
11 11
 import TagGroup from './tags'
12
+import Amap from './amap'
13
+import BudildingProjectType from './buildingProjectType'
14
+import SelectCity from '../../../../../components/SelectButton/CitySelect'
12 15
 
13 16
 const { Option } = Select
14 17
 const { TabPane } = Tabs;
@@ -55,6 +58,7 @@ function AddBuilding(props) {
55 58
     request({ url: tempUrl, method }).then(res => {
56 59
       res.openingDate = moment(res.openingDate)
57 60
       res.receivedDate = moment(res.receivedDate)
61
+      res.avatarImage = res.buildingImg.map(item => item.url)
58 62
       props.form.setFieldsValue(res)
59 63
     })
60 64
   }
@@ -71,12 +75,13 @@ function AddBuilding(props) {
71 75
   function addBuilding(data) {
72 76
     data.openingDate = moment(data.openingDate, 'yyyy-MM-dd HH:mm:ss')
73 77
     data.receivedDate = moment(data.receivedDate, 'yyyy-MM-dd HH:mm:ss')
74
-    data.buildingProjectType = []
75 78
     // 项目主图
76 79
     data.img = data.avatarImage && data.avatarImage.map((item, index) => ({ imgType: 'banner', url: item, orderNo: index + 1 }))
77 80
 
78
-    request({ ...apis.building.addBuilding, data: { ...data } }).then(() => {
81
+    const api = data.buildingId === undefined ? apis.building.addBuilding : apis.building.updateBuilding
82
+    request({ ...api, data: { ...data } }).then(() => {
79 83
       openNotificationWithIcon('success', '操作成功')
84
+      router.go(-1)
80 85
     }).catch(err => {
81 86
       openNotificationWithIcon('error', err.message)
82 87
     })
@@ -84,6 +89,9 @@ function AddBuilding(props) {
84 89
 
85 90
   return (
86 91
         <Form {...formItemLayout} onSubmit={handleSubmit}>
92
+          <Form.Item label="项目Id" hasFeedback style={{ display: 'none' }}>
93
+            {getFieldDecorator('buildingId')(<Input disabled />)}
94
+          </Form.Item>
87 95
           <Form.Item label="楼盘编号" hasFeedback>
88 96
             {getFieldDecorator('code')(<Input />)}
89 97
           </Form.Item>
@@ -93,13 +101,13 @@ function AddBuilding(props) {
93 101
           <Form.Item label="别名" hasFeedback>
94 102
             {getFieldDecorator('name')(<Input />)}
95 103
           </Form.Item>
96
-          <Form.Item label="项目类型" hasFeedback>
97
-            {getFieldDecorator('buildingProjectType')(<Input />)}
104
+          <Form.Item label="项目类型">
105
+            {getFieldDecorator('buildingProjectType')(<BudildingProjectType />)}
98 106
           </Form.Item>
99 107
           <Form.Item label="均价" hasFeedback>
100 108
             {getFieldDecorator('price')(<Input />)}
101 109
           </Form.Item>
102
-          <Form.Item label="开盘时间" hasFeedback>
110
+          <Form.Item label="开盘时间"  hasFeedback>
103 111
             {getFieldDecorator('openingDate')(<DatePicker format="YYYY/MM/DD" />)}
104 112
           </Form.Item>
105 113
           <Form.Item label="电话" hasFeedback>
@@ -109,16 +117,17 @@ function AddBuilding(props) {
109 117
             {getFieldDecorator('dynamic')(<Input />)}
110 118
           </Form.Item>
111 119
           <Form.Item label="物业类型" hasFeedback>
112
-            {getFieldDecorator('buildingProperty')(
113
-              <Select mode="multiple" placeholder="物业类型" style={{ width: '1016px' }}>
114
-                <Option value="未知">未知</Option>
115
-              </Select>,
120
+            {getFieldDecorator('propertyType')(
121
+              // <Select mode="multiple" placeholder="物业类型" style={{ width: '1016px' }}>
122
+              //   <Option value="未知">未知</Option>
123
+              // </Select>,
124
+              <Input />,
116 125
             )}
117 126
           </Form.Item>
118 127
           <Form.Item label="销售状态" hasFeedback>
119 128
             {getFieldDecorator('marketStatus')(<Input />)}
120 129
           </Form.Item>
121
-          <Form.Item label="标签" hasFeedback>
130
+          <Form.Item label="标签" hasFeedback style={{ display: 'none' }}>
122 131
             {getFieldDecorator('tags')(
123 132
               <Select mode="multiple" placeholder="标签" style={{ width: '1016px' }}>
124 133
                 <Option value="未知">未知</Option>
@@ -156,9 +165,7 @@ function AddBuilding(props) {
156 165
           </Form.Item>
157 166
           <Form.Item label="所在城市" hasFeedback>
158 167
             {getFieldDecorator('cityId')(
159
-              <Select placeholder="选择城市" style={{ width: '200px' }}>
160
-                <Option value="red">Red</Option>
161
-              </Select>,
168
+              <SelectCity />,
162 169
             )}
163 170
           </Form.Item>
164 171
           <Form.Item label="楼盘区域" hasFeedback>
@@ -171,7 +178,7 @@ function AddBuilding(props) {
171 178
             {getFieldDecorator('coordinate')(<Input disabled />)}
172 179
           </Form.Item>
173 180
           <Form.Item label="地图位置" hasFeedback>
174
-            {(<Input />)}
181
+            {getFieldDecorator('coordinate')(<Amap />)}
175 182
           </Form.Item>
176 183
           <Form.Item label="周边交通" hasFeedback>
177 184
             {getFieldDecorator('buildingTransport')(

+ 245
- 0
src/pages/building/list/add/components/buildingProjectType.jsx Datei anzeigen

@@ -0,0 +1,245 @@
1
+import React, { useEffect, useState } from 'react'
2
+import { Button, Radio, Icon, Form, Input, Row, Col, Modal, notification, Checkbox } from 'antd';
3
+import { render } from 'react-dom';
4
+import request from '../../../../../utils/request';
5
+import apis from '../../../../../services/apis';
6
+
7
+
8
+const formItemLayout = {
9
+  labelCol: {
10
+    xs: { span: 24 },
11
+    sm: { span: 3 },
12
+  },
13
+  wrapperCol: {
14
+    xs: { span: 24 },
15
+    sm: { span: 16 },
16
+  },
17
+};
18
+
19
+/**
20
+ * 项目类型 form 表单子组件
21
+ *
22
+ * @param {*} props
23
+ */
24
+class TypeForm extends React.Component {
25
+
26
+  componentDidMount() {
27
+    this.props.form.setFieldsValue(this.props.type)
28
+  }
29
+
30
+  onChange(e, name) {
31
+    // console.log(e.target.value)
32
+    this.props.form.validateFieldsAndScroll((err, values) => {
33
+      if (!err) {
34
+        // console.log('Received values of form: ', values);
35
+        values[name] = e.target.value
36
+        values.buildingTypeName = this.props.type.buildingTypeName
37
+        console.log('values: ', values)
38
+        this.props.onSuccess(values)
39
+      }
40
+    });
41
+  }
42
+
43
+  close() {
44
+    this.props.onClose(this.props.form.getFieldsValue(['buildingTypeId']))
45
+  }
46
+
47
+  render() {
48
+    const { getFieldDecorator } = this.props.form;
49
+
50
+    // this.props.form.setFieldsValue(this.props.type)
51
+
52
+    return (
53
+      <>
54
+        <Col span={11} style={{
55
+          position: 'relative',
56
+          border: '1px solid #eee',
57
+          borderRadius: '4px',
58
+          marginTop:'16px'
59
+        }}>
60
+
61
+          <p style={{ padding: '20px', borderBottom: '1px solid #eee' }}>{this.props.type.buildingTypeName || ''}  <Button type="link" style={{ position: 'absolute', right: '16px' }} icon="close" onClick={() => this.close()} /></p>
62
+
63
+          <Form {...formItemLayout} style={{ padding: '10px 0px 10px 10px' }}>
64
+            <Form.Item label="类型编号" style={{ display: 'none' }}>
65
+              {getFieldDecorator('buildingTypeId')(<Input disabled />)}
66
+            </Form.Item>
67
+            <Form.Item label="状态" style={{ display: 'none' }}>
68
+              {getFieldDecorator('status')(<Input disabled />)}
69
+            </Form.Item>
70
+            <Form.Item label="价格">
71
+              {getFieldDecorator('price')(<Input type="number" placeholder="元/㎡" onChange={e => this.onChange(e, 'price')} />)}
72
+            </Form.Item>
73
+            <Form.Item label="装修标准">
74
+              {getFieldDecorator('decoration')(<Input onChange={e => this.onChange(e, 'decoration')} />)}
75
+            </Form.Item>
76
+            <Form.Item label="产权年限">
77
+              {getFieldDecorator('rightsYear')(<Input onChange={e => this.onChange(e, 'rightsYear')} />)}
78
+            </Form.Item>
79
+          </Form>
80
+        </Col>
81
+      </>
82
+    )
83
+  }
84
+}
85
+
86
+const WrappedTypeForm = Form.create({ name: 'TypeForm' })(TypeForm);
87
+
88
+/**
89
+ *项目类型组件
90
+ *
91
+ * @param {*} props
92
+ */
93
+class ProjectTypeBody extends React.Component {
94
+
95
+  constructor(props) {
96
+    super(props)
97
+    this.state = {
98
+      one: false,
99
+      projectType: [],
100
+      defaultCheckboxValue: [], // 多选框默认选中的值
101
+      visible: false,
102
+      data: [],
103
+      // data: [{ buildingTypeId: '1', buildingTypeName: '公寓', price: '10', decoration: '全包', rightsYear: '10', status: '1' }, { buildingTypeId: '2', buildingTypeName: '住宅', price: '10', decoration: '全包', rightsYear: '10', status: '1' }, { buildingTypeId: '3', buildingTypeName: '太平房', price: '10', decoration: '全包', rightsYear: '10', status: '1' }],
104
+    }
105
+  }
106
+
107
+  componentDidMount() {
108
+    this.getList({ pageNum: 1, pageSize: 999 })
109
+  }
110
+
111
+  componentDidUpdate(prevProps) {
112
+    // 典型用法(不要忘记比较 props):
113
+    if (this.props.value !== prevProps.data && !this.state.one) {
114
+      this.setValue()
115
+      this.setState({ one: true })
116
+    }
117
+  }
118
+
119
+  onSuccess = (values, item) => {
120
+    const newData = this.getNewProjectType(values)
121
+    this.setState({ data: newData })
122
+    if (typeof this.props.onChange === 'function') {
123
+      this.props.onChange(newData)
124
+    }
125
+  }
126
+
127
+  onCheckboxChange = checkedValues => {
128
+    // console.log('checkedValues: ', checkedValues)
129
+    const checked = (`${checkedValues}` || '').split(',')
130
+    const { projectType } = this.state
131
+    const buildingType = projectType.filter(item => checked.includes(`${item.buildingTypeId}`))
132
+
133
+    const tempDate = buildingType.map(item => ({ buildingTypeId: item.buildingTypeId, buildingTypeName: item.buildingTypeName, price: '', decoration: '', rightsYear: '', status: '1' }))
134
+    const updateProjectDate = this.updateProjectType(tempDate)
135
+    console.log('updateProjectDate: ', updateProjectDate)
136
+    this.setState({ data: updateProjectDate })
137
+  }
138
+
139
+  onClose = e => {
140
+    const { data } = this.state
141
+    const buildingType = data.filter(item => e.buildingTypeId !== item.buildingTypeId)
142
+    this.setState({ data: buildingType })
143
+    this.setState({ defaultCheckboxValue: buildingType.map(item => item.buildingTypeId) })
144
+  }
145
+
146
+  getNewProjectType = values => {
147
+    const data = []
148
+    this.state.data.map(item => {
149
+      if (item.buildingTypeId === values.buildingTypeId) {
150
+        data.push(values)
151
+      } else {
152
+        data.push(item)
153
+      }
154
+    })
155
+
156
+    return data
157
+  }
158
+
159
+  updateProjectType = values => {
160
+    // 获取所有复选框选中的id
161
+    const valueIdArray = values.map(item => item.buildingTypeId)
162
+    // console.log('valueIdArray: ', valueIdArray)
163
+
164
+    // 获取 data 中已经赋值的数据  交集
165
+    const valueData = this.state.data.filter(item => valueIdArray.includes(item.buildingTypeId))
166
+    // console.log('valueData: ', valueData)
167
+
168
+    // 获取 非 data中数据(也就是没有赋值),交集
169
+    const trueValueArr = valueData.map(item => item.buildingTypeId)
170
+    const trueValueData = values.filter(item => !trueValueArr.includes(item.buildingTypeId))
171
+
172
+    // console.log('trueValueData: ', trueValueData)
173
+
174
+    // 把两个 数组的值,合并返回
175
+    return valueData.concat(trueValueData)
176
+  }
177
+
178
+  getList = params => {
179
+    request({ ...apis.buildingType.getList, params: { ...params } }).then(res => {
180
+      this.setState({ projectType: res.records })
181
+    }).catch(err => {
182
+      this.openNotificationWithIcon('error', err.message)
183
+    })
184
+  }
185
+
186
+  setValue = () => {
187
+    let tempData = []
188
+    let tempCheckboxValue = []
189
+    const { value } = this.props
190
+    // console.log('value: ', value)
191
+    if (value !== undefined && value !== null) {
192
+      tempData = value
193
+      tempCheckboxValue = tempData.map(item => item.buildingTypeId)
194
+      this.setState({ defaultCheckboxValue: tempCheckboxValue })
195
+      this.setState({ data: tempData })
196
+    }
197
+  }
198
+
199
+  openNotificationWithIcon = (type, message) => {
200
+    notification[type]({
201
+      message,
202
+      description: '',
203
+    })
204
+  }
205
+
206
+  handleOk = e => {
207
+    this.setState({
208
+      visible: false,
209
+    });
210
+  };
211
+
212
+  handleCancel = e => {
213
+    this.setState({
214
+      visible: false,
215
+    });
216
+  };
217
+
218
+  showMadel = () => {
219
+    this.setState({ visible: true })
220
+    this.getList({ pageNum: 1, pageSize: 999 })
221
+  }
222
+
223
+  render() {
224
+    return (
225
+      <>
226
+        <Button type="primary" icon="plus" size="large" onClick={() => this.showMadel()} />
227
+        <Modal
228
+          title="项目类型"
229
+          visible={this.state.visible}
230
+          onOk={this.handleOk}
231
+          onCancel={this.handleCancel}
232
+        >
233
+          <Checkbox.Group options={this.state.projectType.map(item => ({ label: item.buildingTypeName, value: item.buildingTypeId }))} defaultValue={this.state.defaultCheckboxValue} onChange={e => this.onCheckboxChange(e)} />
234
+        </Modal>
235
+        <Row type="flex" justify="space-between">
236
+          {
237
+            this.state.data.map(item => <WrappedTypeForm type={item} key={item.id} onSuccess={(e) => this.onSuccess(e, item)} onClose={(e) => this.onClose(e)} />)
238
+          }
239
+        </Row>
240
+      </>
241
+    )
242
+  }
243
+}
244
+
245
+export default ProjectTypeBody

+ 10
- 1
src/pages/building/list/add/components/imageSet.jsx Datei anzeigen

@@ -61,6 +61,15 @@ function imageSet(props) {
61 61
     })
62 62
   }
63 63
 
64
+  /**
65
+   *回调事件
66
+   *
67
+   */
68
+  function onModalChange() {
69
+    getList()
70
+    setVisibleData({ visible: false, apartmentId: '', buildingId: '' })
71
+  }
72
+
64 73
   /**
65 74
    *打开编辑页
66 75
    *
@@ -138,7 +147,7 @@ function imageSet(props) {
138 147
 
139 148
       {/* 编辑页 */}
140 149
       {/*  onSuccess是子组件传递事件信息  */}
141
-      <ModalImage visibleData={visibleData} key={1} onSuccess={getList}/>
150
+      <ModalImage visibleData={visibleData} key={1} onSuccess={() => onModalChange()}/>
142 151
     </>
143 152
   )
144 153
 }

+ 6
- 5
src/pages/building/list/add/components/modalImage.jsx Datei anzeigen

@@ -5,6 +5,7 @@ import request from '../../../../../utils/request';
5 5
 import apis from '../../../../../services/apis';
6 6
 import Styles from '../style.less';
7 7
 import ImageUpload from '../../../../../components/XForm/ImageUpload'
8
+import ImageListUpload from '../../../../../components/XForm/ImageListUpload'
8 9
 import Wangedit from '../../../../../components/Wangedit/Wangedit'
9 10
 
10 11
 
@@ -61,8 +62,8 @@ class ModalImage extends React.Component {
61 62
   // }
62 63
 
63 64
   componentDidUpdate(preProps, preState) {
64
-    console.log(this.props.visibleData)
65 65
     if (this.props.visibleData.visible !== preState.visibleData.visible) {
66
+      console.log(this.props.visibleData)
66 67
       this.getById()
67 68
       this.setState({ visibleData: this.props.visibleData });
68 69
     }
@@ -91,7 +92,7 @@ class ModalImage extends React.Component {
91 92
 
92 93
     request({ url: tempUrl, method, params: { ...params } }).then(res => {
93 94
       // res.img = res.buildingImgList.map((item, _) => item.url)
94
-      res.img = res.buildingImgList[0].url
95
+      res.img = res.buildingImgList.map(item => item.url)
95 96
       this.props.form.setFieldsValue(res)
96 97
     }).catch(err => {
97 98
      this.openNotificationWithIcon('error', err)
@@ -118,7 +119,7 @@ class ModalImage extends React.Component {
118 119
 
119 120
   submitData(data) {
120 121
     // TODO 这里应该是要支持多图,但是封装的控件没有
121
-    data.img = [{ imgType: 'aparment', url: data.img, orderNo: 1 }]
122
+    data.img = data.img.map((item, index) => ({ imgType: 'aparment', url: item, orderNo: index }))
122 123
     data.buildingId = this.props.visibleData.buildingId;
123 124
     const api = data.apartmentId !== undefined ? apis.building.buildingApartmentUpdate : apis.building.buildingApartmentAdd;
124 125
 
@@ -131,7 +132,7 @@ class ModalImage extends React.Component {
131 132
       // onSuccess() 是自定义
132 133
       this.props.onSuccess()
133 134
 
134
-      this.handleCancel()
135
+      // this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } }, () => console.log('回调:', this.state.visibleData))
135 136
     }).catch(err => {
136 137
       // eslint-disable-next-line no-unused-expressions
137 138
       this.openNotificationWithIcon('error', err)
@@ -186,7 +187,7 @@ class ModalImage extends React.Component {
186 187
               </Form.Item>
187 188
               <Form.Item label="图片">
188 189
               {getFieldDecorator('img')(
189
-                <ImageUpload />,
190
+                <ImageListUpload />,
190 191
               )}
191 192
               </Form.Item>
192 193
               <Form.Item label="面积">

+ 145
- 0
src/pages/building/list/add/components/poster.jsx Datei anzeigen

@@ -0,0 +1,145 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import moment from 'moment';
5
+import router from 'umi/router';
6
+import BuildSelect from '../../../../../components/SelectButton/BuildSelect'
7
+import XForm, { FieldTypes } from '../../../../../components/XForm';
8
+import Wangedit from '../../../../../components/Wangedit/Wangedit'
9
+import request from '../../../../../utils/request'
10
+import PosterBottom from '../../../../../assets/bottom.png'
11
+import yinhao from '../../../../../assets/yinhao.png'
12
+import ImageUploader from '../../../../../components/XForm/ImageUpload';
13
+import poster1 from '../../../../../assets/poster1.png';
14
+import poster2 from '../../../../../assets/poster2.png';
15
+import Styles from '../style.less';
16
+import apis from '../../../../../services/apis';
17
+
18
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
19
+const { TextArea } = Input;
20
+
21
+const Poster = props => {
22
+  const [inputValue, changeInput] = useState('')
23
+  const [textAreaValue, changeTextArea] = useState('')
24
+  const [imgValue, changeImg] = useState('')
25
+  const [posterId, setPosterId] = useState('')
26
+
27
+  const [building, setBuilding] = useState({})
28
+  const { buildingId } = props.building
29
+
30
+  if (buildingId) {
31
+    // eslint-disable-next-line react-hooks/rules-of-hooks
32
+    useEffect(() => {
33
+      request({
34
+        ...apis.activity.poster,
35
+        params: { targetId: buildingId, targetType: 'building' },
36
+      }).then(data => {
37
+        console.log(data, '2222')
38
+        if (data.length > 0) {
39
+          setPosterId(data[0].posterId)
40
+          changeImg(data[0].posterImg)
41
+          changeTextArea(data[0].posterDescription)
42
+          changeInput(data[0].posterTitle)
43
+        }
44
+      }).catch(err => {
45
+        message.info(err.msg || err.message)
46
+      })
47
+
48
+      getById(buildingId)
49
+    }, [])
50
+  }
51
+
52
+  // 获取详情信息
53
+  function getById(currentId) {
54
+    const { url, method } = apis.building.buildingGetById
55
+    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(currentId)
56
+
57
+    request({ url: tempUrl, method }).then(res => {
58
+      setBuilding(res)
59
+    })
60
+  }
61
+
62
+  const submitPoster = () => {
63
+    if (buildingId) {
64
+      if (posterId) {
65
+        request({
66
+          ...apis.activity.updatePoster,
67
+          urlData: { id: posterId },
68
+          data: { targetId: buildingId, targetType: 'building', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
69
+        }).then(() => {
70
+          message.info('保存成功')
71
+        }).catch(err => {
72
+          message.info(err.msg || err.message)
73
+        })
74
+      } else {
75
+        request({
76
+          ...apis.activity.addPoster,
77
+          data: { targetId: buildingId, targetType: 'building', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
78
+        }).then(data => {
79
+          setPosterId(data.posterId)
80
+          message.info('保存成功')
81
+        }).catch(err => {
82
+          message.info(err.msg || err.message)
83
+        })
84
+      }
85
+    } else {
86
+      message.warn('请先保存基本信息数据')
87
+    }
88
+  }
89
+
90
+  return <div>
91
+    <div style={{ display: 'flex' }}>
92
+      <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
93
+        <div style={{ width: '375px', height: '785px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
94
+          <img style={{ width: '100%', height: '300px' }} src={imgValue || poster1} alt="" />
95
+
96
+          <p className={Styles.tagLabel}>
97
+            {
98
+              building.buildingTag && building.buildingTag.map(item => <span>{item.tagName}</span>)
99
+            }
100
+          </p>
101
+          <p style={{
102
+            margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
103
+            display: '-webkit-box', lineClamp: '3', height: '36px',lineHeight:'36px',
104
+            WebkitLineClamp: '1',
105
+            WebkitBoxOrient: 'vertical',
106
+            overflow: 'hidden',
107
+            textOverflow: 'ellipsis',
108
+          }}>{building.buildingName || '楼盘标题'}</p>
109
+          <p style={{ color: '#999',padding:' 0 20px' }}>约<span style={{ color: '#fd0d0c', fontSize: '24px',marginLeft:'6px' }}>{ building.price }</span><span style={{ color: '#fd0d0c', fontSize: '20px' }}>元/m²</span></p>
110
+
111
+          <img src={yinhao} style={{ width: '30px', marginLeft: '22px' }} alt="" />
112
+          <p style={{
113
+            margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
114
+            display: '-webkit-box', lineClamp: '3', height: '76px',
115
+            WebkitLineClamp: '3',
116
+            WebkitBoxOrient: 'vertical',
117
+            overflow: 'hidden',
118
+            textOverflow: 'ellipsis',
119
+          }}>{textAreaValue || '海报描述'}</p>
120
+          <img src={PosterBottom} style={{ width: '100%' }} alt="" />
121
+        </div>
122
+        <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
123
+      </div>
124
+      <div >
125
+        <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
126
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片</p>
127
+          <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
128
+        </div>
129
+        <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
130
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
131
+          <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
132
+        </div>
133
+        <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
134
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
135
+          <TextArea rows={5} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
136
+        </div>
137
+
138
+      </div>
139
+    </div>
140
+    <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
141
+    <Button onClick={() => router.go(-1)}>取消</Button>
142
+  </div>
143
+}
144
+
145
+export default Poster

+ 96
- 0
src/pages/building/list/add/components/share.jsx Datei anzeigen

@@ -0,0 +1,96 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import moment from 'moment';
5
+import router from 'umi/router';
6
+import BuildSelect from '../../../../../components/SelectButton/BuildSelect'
7
+import XForm, { FieldTypes } from '../../../../../components/XForm';
8
+import Wangedit from '../../../../../components/Wangedit/Wangedit'
9
+import request from '../../../../../utils/request'
10
+import PosterBottom from '../../../../../assets/bottom.png'
11
+import yinhao from '../../../../../assets/yinhao.png'
12
+import ImageUploader from '../../../../../components/XForm/ImageUpload';
13
+import logo from '../../../../../assets/logo.png';
14
+import touxiang from '../../../../../assets/touxiang.jpg';
15
+import poster1 from '../../../../../assets/poster1.png';
16
+import poster2 from '../../../../../assets/poster2.png';
17
+import apis from '../../../../../services/apis';
18
+
19
+const Share = props => {
20
+  const [inputValue, changeInput] = useState('')
21
+  const [imgValue, changeImg] = useState('')
22
+  const [shareContentId, setShareContentId] = useState('')
23
+
24
+  const { buildingId } = props.building
25
+  if (buildingId) {
26
+    // eslint-disable-next-line react-hooks/rules-of-hooks
27
+    useEffect(() => {
28
+      request({
29
+        ...apis.activity.shareContent,
30
+        params: { targetId: buildingId, targetType: 'building' },
31
+      }).then(data => {
32
+        if (data.length > 0) {
33
+          setShareContentId(data[0].shareContentId)
34
+          changeImg(data[0].shareContentImg)
35
+          changeInput(data[0].shareContentTitle)
36
+        }
37
+      }).catch(err => {
38
+        message.info(err.msg || err.message)
39
+      })
40
+    }, [])
41
+  }
42
+
43
+  const submitShare = () => {
44
+    if (buildingId) {
45
+      if (shareContentId) {
46
+        request({
47
+          ...apis.activity.updateShareContent,
48
+          urlData: { id: shareContentId },
49
+          data: { targetId: buildingId, shareContentType: 'building', shareContentImg: imgValue,shareContentTitle: inputValue },
50
+        }).then(data => {
51
+          message.info('保存成功')
52
+        }).catch(err => {
53
+          message.info(err.msg || err.message)
54
+        })
55
+       } else {
56
+        request({
57
+          ...apis.activity.addShareContent,
58
+          data: { targetId: buildingId, shareContentType: 'building', shareContentImg: imgValue,shareContentTitle: inputValue },
59
+        }).then(data => {
60
+          setShareContentId(data.shareContentId)
61
+          message.info('保存成功')
62
+        }).catch(err => {
63
+          message.info(err.msg || err.message)
64
+        })
65
+       }
66
+     } else {
67
+      message.warn('请先保存基本信息数据')
68
+     }
69
+  }
70
+
71
+  return <div style={{ padding: '20px' }}>
72
+    <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
73
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
74
+      <div>
75
+        <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}>
76
+          <img src={logo} style={{ width: '22px', marginRight: '10px' }} />
77
+          知与行互动
78
+        </p>
79
+        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue ? inputValue : '置业V客厅 精准获客平台'}</p>
80
+        <img style={{ width: '200px', height: '140px' }} src={imgValue ? imgValue : poster2} alt="" />
81
+      </div>
82
+    </div>
83
+    <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
84
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
85
+      <Input placeholder="请输入海报标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
86
+    </div>
87
+    <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
88
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片</p>
89
+      <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
90
+    </div>
91
+    <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
92
+    <Button onClick={() => router.go(-1)}>取消</Button>
93
+  </div>
94
+}
95
+
96
+export default Share

+ 19
- 23
src/pages/building/list/add/components/tags.jsx Datei anzeigen

@@ -3,15 +3,23 @@ import { Tag, Input, Tooltip, Icon } from 'antd';
3 3
 
4 4
 class EditableTagGroup extends React.Component {
5 5
   state = {
6
-    tags: [],
7 6
     inputVisible: false,
8 7
     inputValue: '',
9 8
   };
10 9
 
10
+  // 每次取值,都从 this.props.value 获取最新值
11
+  getTags = () => (this.props.value || '').split(',')
12
+
13
+  toggleOnChange = tags => {
14
+    if (typeof this.props.onChange === 'function') {
15
+      this.props.onChange(tags.join(','))
16
+    }
17
+  }
18
+
11 19
   handleClose = removedTag => {
12
-    const tags = this.state.tags.filter(tag => tag !== removedTag);
13
-    console.log(tags);
14
-    this.setState({ tags });
20
+    const tags = this.getTags().filter(tag => tag !== removedTag);
21
+    // this.setState({ tags });
22
+    this.toggleOnChange(tags)
15 23
   };
16 24
 
17 25
   showInput = () => {
@@ -24,39 +32,27 @@ class EditableTagGroup extends React.Component {
24 32
 
25 33
   handleInputConfirm = () => {
26 34
     const { inputValue } = this.state;
27
-    let { tags } = this.state;
35
+
36
+    const tags = this.getTags()
28 37
     if (inputValue && tags.indexOf(inputValue) === -1) {
29
-      tags = [...tags, inputValue];
38
+      // 如果有新的值,就把这个值追加到 tags 原本值的后面,在通过onChange事件传递出去
39
+      this.toggleOnChange(tags.concat(inputValue))
30 40
     }
31
-    console.log(tags);
41
+
32 42
     this.setState({
33
-      tags,
34 43
       inputVisible: false,
35 44
       inputValue: '',
36 45
     });
37
-
38
-    if (typeof this.props.onChange === 'function') {
39
-      const tempTags = tags.join(',')
40
-      this.props.onChange(tempTags);
41
-    }
42 46
   };
43 47
 
44 48
   saveInputRef = input => (this.input = input);
45 49
 
46 50
   render() {
47
-    const { tags, inputVisible, inputValue } = this.state;
48
-
49
-    const { value } = this.props
50
-    let data = []
51
-    if (value !== undefined && value !== null) {
52
-      data = value.split(',')
53
-    } else {
54
-      data = tags
55
-    }
51
+    const { inputVisible, inputValue } = this.state;
56 52
 
57 53
     return (
58 54
       <div>
59
-        {data.map((tag, index) => {
55
+        {this.getTags().map((tag, index) => {
60 56
           const isLongTag = tag.length > 20;
61 57
           const tagElem = (
62 58
             <Tag key={tag} closable onClose={() => this.handleClose(tag)}>

+ 42
- 15
src/pages/building/list/add/index.jsx Datei anzeigen

@@ -12,6 +12,8 @@ import Wangedit from '../../../../components/Wangedit/Wangedit'
12 12
 import TagGroup from './components/tags'
13 13
 import Base from './components/base'
14 14
 import ImageSet from './components/imageSet'
15
+import Poster from './components/poster'
16
+import Share from './components/share'
15 17
 
16 18
 
17 19
 const { Option } = Select
@@ -29,25 +31,50 @@ const formItemLayout = {
29 31
 };
30 32
 
31 33
 function AddBuilding(props) {
32
-  function tabsCallback(key) {
33
-    console.log(key);
34
+
35
+  const [tab, setTab] = useState('base')
36
+
37
+  function tabsCallback(e) {
38
+    console.log(e);
39
+    setTab(e.target.value)
34 40
   }
35 41
 
36
-  console.log(props.location)
42
+  // console.log(props.location)
37 43
 
38 44
   return (
39
-    <Tabs defaultActiveKey="1" onChange={tabsCallback}>
40
-      <TabPane tab="基本信息" key="1">
41
-        <Base building={{ buildingId: props.location.query && props.location.query.id }} />
42
-      </TabPane>
43
-      {
44
-        props.location.query.id &&
45
-        <TabPane tab="图片" key="2">
46
-          {/* '159fd19bb973b6972c10fbebf07ddeb1' */}
47
-          <ImageSet building={{ buildingId: props.location.query && props.location.query.id }} />
48
-        </TabPane>
49
-      }
50
-    </Tabs>
45
+    <>
46
+      <Radio.Group value={ tab } buttonStyle="solid" onChange={e => tabsCallback(e)}>
47
+        <Radio.Button value="base">基本信息</Radio.Button>
48
+        {
49
+          props.location.query.id &&
50
+          (
51
+            <>
52
+              <Radio.Button value="image">图片</Radio.Button>
53
+              <Radio.Button value="poster">海报图片</Radio.Button>
54
+              <Radio.Button value="share">分享设置</Radio.Button>
55
+            </>
56
+          )
57
+        }
58
+      </Radio.Group>
59
+      <div style={{ marginTop: '20px' }}>
60
+        { tab === 'base' && <Base building={{ buildingId: props.location.query && props.location.query.id }} /> }
61
+        { props.location.query.id && (tab === 'image' && <ImageSet building={{ buildingId: props.location.query && props.location.query.id }} />)}
62
+        { props.location.query.id && (tab === 'poster' && <Poster building={{ buildingId: props.location.query && props.location.query.id }} />)}
63
+        { props.location.query.id && (tab === 'share' && <Share building={{ buildingId: props.location.query && props.location.query.id }} />)}
64
+      </div>
65
+    </>
66
+    // <Tabs defaultActiveKey="1" onChange={tabsCallback}>
67
+    //   <TabPane tab="基本信息" key="1">
68
+    //     <Base building={{ buildingId: props.location.query && props.location.query.id }} />
69
+    //   </TabPane>
70
+    //   {
71
+    //     props.location.query.id &&
72
+    //     <TabPane tab="图片" key="2">
73
+    //       {/* '159fd19bb973b6972c10fbebf07ddeb1' */}
74
+    //       <ImageSet building={{ buildingId: props.location.query && props.location.query.id }} />
75
+    //     </TabPane>
76
+    //   }
77
+    // </Tabs>
51 78
   )
52 79
 }
53 80
 

+ 20
- 0
src/pages/building/list/add/style.less Datei anzeigen

@@ -0,0 +1,20 @@
1
+.tagLabel{
2
+  padding: 14px 20px 0 20px;
3
+  margin: 0 0 5px 0;
4
+  span{
5
+    padding: 2px 8px;
6
+    font-size: 10px;
7
+    background-color: #e1f7eb;
8
+    color: #3de180;
9
+    border-radius: 2px;
10
+    margin-right: 10px;
11
+  }
12
+  span:nth-child(3n+2){
13
+    color: #72a0d1;
14
+    background-color: #eaeff5;
15
+  }
16
+  span:nth-child(3n+3){
17
+    color: #ff5858;
18
+    background-color: #fff0f1;
19
+  }
20
+}

+ 67
- 61
src/pages/building/list/index.jsx Datei anzeigen

@@ -6,6 +6,7 @@ import apis from '../../../services/apis';
6 6
 import Styles from './style.less';
7 7
 import { router } from 'umi';
8 8
 import AuthButton from '@/components/AuthButton';
9
+import SelectCity from '../../../components/SelectButton/CitySelect'
9 10
 
10 11
 
11 12
 const { Option } = Select;
@@ -101,56 +102,62 @@ function CartBody(props) {
101 102
   }
102 103
 
103 104
   return (
104
-          <Card
105
-            hoverable
106
-            style={{ minWidth: '400px', borderRadius: '12px', margin: '10px', boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)' }}
107
-            cover={<img alt="example" src={ data.poster } style={{ borderRadius: '12px 12px 0 0', width: '100%', height: '14vw' }}></img>}
108
-            bodyStyle={{ padding: '10px 20px' }}
109
-          >
110
-            <p className={Styles.cardText}>
111
-              <span className={Styles.title}>楼盘编号</span>
112
-              <span >:{ data.code }</span>
113
-              <span className={Styles.ediText} onClick={() => toEdi(data)}>
114
-                编辑
115
-                <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
116
-              </span>
117
-            </p>
118
-            <p className={Styles.cardText}>
119
-              <span className={Styles.title}>楼盘名称</span>
120
-              <span >:{ data.name }</span>
121
-            </p>
122
-            <p className={Styles.cardItem}>
123
-              <span className={Styles.title}>均价</span>
124
-              <span >
125
-                :约<span style={{ color: '#FF0707', fontSize: '20px' }}> { data.price } </span>元/m
105
+    <Card
106
+      hoverable
107
+      style={{ minWidth: '330px', borderRadius: '12px', margin: '10px', boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)' }}
108
+      cover={<img alt="example" src={data.poster} style={{ borderRadius: '12px 12px 0 0', width: '100%', height: '14vw' }}></img>}
109
+      bodyStyle={{ padding: '10px 20px' }}
110
+    >
111
+      <p className={Styles.cardText}>
112
+        <span className={Styles.title}>楼盘编号</span>
113
+        <span >:{data.code}</span>
114
+        <AuthButton name="admin.building.update.put" noRight={null}>
115
+          <span className={Styles.ediText} onClick={() => toEdi(data)}>
116
+            编辑
117
+                  <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
118
+          </span>
119
+        </AuthButton>
120
+      </p>
121
+      <p className={Styles.cardText}>
122
+        <span className={Styles.title}>楼盘名称</span>
123
+        <span >:{data.name}</span>
124
+      </p>
125
+      <p className={Styles.cardItem}>
126
+        <span className={Styles.title}>均价</span>
127
+        <span >
128
+          :约<span style={{ color: '#FF0707', fontSize: '20px' }}> {data.price} </span>元/m
126 129
         </span>
127
-            </p>
128
-            <p className={Styles.cardItem}>
129
-              <span className={Styles.title}>项目地址</span>
130
-              <span className={ Styles.address }>:{ data.address }</span>
131
-            </p>
132
-            <p className={Styles.cardItem}>
133
-              <span className={Styles.title}>发布状态</span>
134
-              <span >:{ data.status === 1 ? '已发布' : '未发布' }</span>
135
-            </p>
136
-            <p className={Styles.cardItem}>
137
-              <span className={Styles.title}>录入时间</span>
138
-              <span >:{ data.createDate }</span>
139
-            </p>
140
-            <p style={{ margin: '15px 0', position: 'relative', fontSize: '18px' }}>
141
-              <span style={{ color: '#FF4A4A' }} onClick={() => pulicAndUnPulic(data)}>
142
-                {/* 已发布的时候,需要显示取消发布的字样 */}
143
-                { data.status === 1 ? '取消发布' : '发布' }
144
-                <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
145
-              </span>
146
-              <span style={{
147
-                color: '#FF4A4A', position: 'absolute', right: '0',
148
-              }} onClick={() => deleteBuilding(data)}>
149
-                删除
130
+      </p>
131
+      <p className={Styles.cardItem}>
132
+        <span className={Styles.title}>项目地址</span>
133
+        <span className={Styles.address}>:{data.address}</span>
134
+      </p>
135
+      <p className={Styles.cardItem}>
136
+        <span className={Styles.title}>发布状态</span>
137
+        <span >:{data.status === 1 ? '已发布' : '未发布'}</span>
138
+      </p>
139
+      <p className={Styles.cardItem}>
140
+        <span className={Styles.title}>录入时间</span>
141
+        <span >:{data.createDate}</span>
142
+      </p>
143
+      <p style={{ margin: '15px 0', position: 'relative', fontSize: '0.11rem' }}>
144
+      <AuthButton name="admin.building.update.status.put" noRight={null}>
145
+        <span style={{ color: '#FF4A4A' }} onClick={() => pulicAndUnPulic(data)}>
146
+          {/* 已发布的时候,需要显示取消发布的字样 */}
147
+          {data.status === 1 ? '取消发布' : '发布'}
148
+          <Icon type={data.status === 1 ? 'close-circle' : 'form'} style={{ color: '#C0C4CC', marginLeft: '8px' }} />
149
+        </span>
150
+      </AuthButton>
151
+      <AuthButton name="admin.building.delete.id.delete" noRight={null}>
152
+        <span style={{
153
+          color: '#FF4A4A', position: 'absolute', right: '0',
154
+        }} onClick={() => deleteBuilding(data)}>
155
+          删除
150 156
                 <Icon type="rest" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
151
-              </span>
152
-            </p>
153
-          </Card>
157
+        </span>
158
+      </AuthButton>
159
+      </p>
160
+    </Card>
154 161
   )
155 162
 }
156 163
 
@@ -210,7 +217,7 @@ function body(props) {
210 217
   // 分页
211 218
   function onChange(pageNumber) {
212 219
     // eslint-disable-next-line react-hooks/rules-of-hooks
213
-      getList({ pageNum: pageNumber, pageSize: 9 })
220
+    getList({ pageNum: pageNumber, pageSize: 9 })
214 221
   }
215 222
 
216 223
   function getDate(value, dateString) {
@@ -266,10 +273,7 @@ function body(props) {
266 273
         </Form.Item>
267 274
         <Form.Item>
268 275
           {getFieldDecorator('cityId')(
269
-            <Select style={{ width: '180px' }} placeholder="城市" onChange={handleSelectChange}>
270
-              <Option value="male">male</Option>
271
-              <Option value="female">female</Option>
272
-            </Select>,
276
+             <SelectCity />,
273 277
           )}
274 278
         </Form.Item>
275 279
         <Form.Item>
@@ -281,13 +285,15 @@ function body(props) {
281 285
           )}
282 286
         </Form.Item>
283 287
         <Form.Item>
284
-          <Button type="primary" htmlType="submit">
285
-            搜索
286
-          </Button>
288
+          <AuthButton name="admin.buildinglist.get" noRight={null}>
289
+            <Button type="primary" htmlType="submit">
290
+              搜索
291
+            </Button>
292
+          </AuthButton>
287 293
         </Form.Item>
288 294
       </Form>
289 295
 
290
-      <AuthButton name="building.add" noRight={null}>
296
+      <AuthButton name="admin.building.add.post" noRight={null}>
291 297
         <Button type="danger" className={Styles.addButton} onClick={() => toAdd()}>
292 298
           新增楼盘
293 299
         </Button>
@@ -297,10 +303,10 @@ function body(props) {
297 303
       <Row style={{ padding: ' 0 10px' }}>
298 304
         {
299 305
           dataSource.records.map((item, _) => (
300
-              <Col span={8}>
301
-                <CartBody data={item} key={item.buildingId} onSuccess={getList}/>
302
-              </Col>
303
-            ))
306
+            <Col span={8}>
307
+              <CartBody data={item} key={item.buildingId} onSuccess={getList} />
308
+            </Col>
309
+          ))
304 310
         }
305 311
       </Row>
306 312
       {/* 分页 */}

+ 10
- 7
src/pages/building/list/style.css Datei anzeigen

@@ -15,31 +15,34 @@
15 15
   margin: 10px 0px;
16 16
 }
17 17
 .cardText {
18
-  font-size: 18px;
18
+  font-size: 0.11rem;
19 19
   color: #333;
20
-  line-height: 24px;
20
+  line-height: 1.5;
21 21
   display: flex;
22 22
   align-items: center;
23 23
   position: relative;
24
+  margin-bottom: 0.08rem;
24 25
 }
25 26
 .cardItem {
26
-  font-size: 18px;
27
+  font-size: 0.11rem;
27 28
   font-weight: 400;
28 29
   color: #666;
29
-  line-height: 24px;
30 30
   display: flex;
31 31
   align-items: center;
32
+  line-height: 1.5;
33
+  font-size: 0.11rem;
34
+  margin-bottom: 0.08rem;
35
+
32 36
 }
33 37
 .ediText {
34
-  font-size: 18px;
38
+  font-size: 0.11rem;
35 39
   color: #ff925c;
36
-  line-height: 24px;
37 40
   position: absolute;
38 41
   right: 0;
39 42
 }
40 43
 .title {
41 44
   display: inline-block;
42
-  width: 84px;
45
+  width: 0.54rem;
43 46
   justify-content: space-between;
44 47
   text-align: justify;
45 48
   text-align-last: justify;

+ 17
- 14
src/pages/building/list/style.less Datei anzeigen

@@ -15,36 +15,39 @@
15 15
   margin: 10px 0px;
16 16
 }
17 17
 .cardText {
18
-  font-size: 18px;
18
+  font-size: 0.11rem;
19 19
   color: #333;
20
-  line-height: 24px;
21 20
   display: flex;
22 21
   align-items: center;
23 22
   position: relative;
24
-
23
+  margin-bottom: 0.08rem;
24
+  
25 25
 }
26 26
 .cardItem{
27
-  font-size: 18px;
27
+  font-size: 0.11rem;
28 28
   font-weight: 400;
29 29
   color: #666;
30
-  line-height: 24px;
31 30
   display: flex;
32 31
   align-items: center;  
32
+  margin-bottom: 0.08rem;
33
+  .title{
34
+    display: inline-block;
35
+    width: 0.54rem;
36
+    min-width: 0.54rem;
37
+    justify-content: space-between;
38
+    text-align: justify;
39
+    text-align-last:justify
40
+  }
41
+  
33 42
 }
34 43
 .ediText {
35
-  font-size: 18px;
44
+  font-size: 0.11rem;
36 45
   color: #ff925c;
37
-  line-height: 24px;
38 46
   position: absolute;
39 47
   right: 0;
48
+
40 49
 }
41
-.title{
42
-  display: inline-block;
43
-  width: 84px;
44
-  justify-content: space-between;
45
-  text-align: justify;
46
-  text-align-last:justify
47
-}
50
+
48 51
 
49 52
 .address { 
50 53
   width: 400px;

+ 6
- 6
src/pages/building/list/style.wxss Datei anzeigen

@@ -15,7 +15,7 @@
15 15
   margin: 10px 0px;
16 16
 }
17 17
 .cardText {
18
-  font-size: 18px;
18
+  font-size: 0.11rem;
19 19
   color: #333;
20 20
   line-height: 24px;
21 21
   display: flex;
@@ -23,23 +23,23 @@
23 23
   position: relative;
24 24
 }
25 25
 .cardItem {
26
-  font-size: 18px;
26
+  font-size: 0.11rem;
27 27
   font-weight: 400;
28 28
   color: #666;
29
-  line-height: 24px;
30 29
   display: flex;
31 30
   align-items: center;
31
+  margin-bottom: 0.08rem;
32 32
 }
33 33
 .ediText {
34
-  font-size: 18px;
34
+  font-size: 0.11rem;
35 35
   color: #ff925c;
36
-  line-height: 24px;
37 36
   position: absolute;
38 37
   right: 0;
38
+  margin-bottom: 0.08rem;
39 39
 }
40 40
 .title {
41 41
   display: inline-block;
42
-  width: 84px;
42
+   width: 0.54rem;
43 43
   justify-content: space-between;
44 44
   text-align: justify;
45 45
   text-align-last: justify;

+ 8
- 5
src/pages/building/type/index.jsx Datei anzeigen

@@ -5,6 +5,7 @@ import moment from 'moment';
5 5
 import Styles from './style.less'
6 6
 import request from '../../../utils/request';
7 7
 import apis from '../../../services/apis';
8
+import AuthButton from '@/components/AuthButton';
8 9
 
9 10
 function body() {
10 11
   // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -20,7 +21,7 @@ function body() {
20 21
       title: '类型名称',
21 22
       dataIndex: 'buildingTypeName',
22 23
       key: 'buildingTypeName',
23
-      render: (_, record) => <Tag color="blue" onClick={() => toEdi(record.buildingTypeId)}>{ record.buildingTypeName }</Tag>,
24
+      render: (_, record) => <Tag color="blue" onClick={() => toEdi(record.buildingTypeId)}>{record.buildingTypeName}</Tag>,
24 25
     },
25 26
     {
26 27
       title: '创建时间',
@@ -35,9 +36,9 @@ function body() {
35 36
       render: (_, record) => (
36 37
         <span onClick={() => deleteType(record)}>
37 38
           <span style={{
38
-              color: '#FF4A4A', right: '0',
39
+            color: '#FF4A4A', right: '0',
39 40
           }} >
40
-              删除
41
+            删除
41 42
           <Icon type="rest" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
42 43
           </span>
43 44
         </span>
@@ -96,8 +97,10 @@ function body() {
96 97
 
97 98
   return (
98 99
     <>
99
-      <Button type="primary" className={Styles.addButton} onClick={() => toEdi()}>新增类型</Button>
100
-      <Table dataSource={data.records} columns={columns} pagination={false}/>
100
+      <AuthButton name="admin.tdBuildingType.post" noRight={null}>
101
+        <Button type="danger" onClick={() => toEdi()}>新增类型</Button>
102
+      </AuthButton>
103
+      <Table style={{ marginTop: '30px' }} dataSource={data.records} columns={columns} pagination={false} />
101 104
       {/* 分页 */}
102 105
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
103 106
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={onChange} />

+ 7
- 6
src/pages/building/type/style.css Datei anzeigen

@@ -16,7 +16,7 @@
16 16
   margin: 10px 0px;
17 17
 }
18 18
 .cardText {
19
-  font-size: 18px;
19
+  font-size:  0.11rem;
20 20
   color: #333;
21 21
   line-height: 24px;
22 22
   display: flex;
@@ -24,15 +24,16 @@
24 24
   position: relative;
25 25
 }
26 26
 .cardItem {
27
-  font-size: 18px;
28
-  font-weight: 400;
27
+
29 28
   color: #666;
30
-  line-height: 24px;
31 29
   display: flex;
32 30
   align-items: center;
31
+  line-height: 1.5;
32
+  font-size: 0.11rem;
33
+  margin-bottom: 0.08rem;
33 34
 }
34 35
 .ediText {
35
-  font-size: 18px;
36
+  font-size: 0.11rem;
36 37
   color: #ff925c;
37 38
   line-height: 24px;
38 39
   position: absolute;
@@ -40,7 +41,7 @@
40 41
 }
41 42
 .title {
42 43
   display: inline-block;
43
-  width: 84px;
44
+  width: 0.54rem;
44 45
   justify-content: space-between;
45 46
   text-align: justify;
46 47
   text-align-last: justify;

+ 8
- 7
src/pages/building/type/style.less Datei anzeigen

@@ -16,24 +16,25 @@
16 16
   margin: 10px 0px;
17 17
 }
18 18
 .cardText {
19
-  font-size: 18px;
20 19
   color: #333;
21
-  line-height: 24px;
22 20
   display: flex;
23 21
   align-items: center;
24 22
   position: relative;
23
+  line-height: 1.5;
24
+  font-size: 0.11rem;
25
+  margin-bottom: 0.08rem;
25 26
 
26 27
 }
27 28
 .cardItem{
28
-  font-size: 18px;
29
-  font-weight: 400;
30 29
   color: #666;
31
-  line-height: 24px;
32 30
   display: flex;
33 31
   align-items: center;  
32
+  line-height: 1.5;
33
+  font-size: 0.11rem;
34
+  margin-bottom: 0.08rem;
34 35
 }
35 36
 .ediText {
36
-  font-size: 18px;
37
+  font-size: 0.11rem;
37 38
   color: #ff925c;
38 39
   line-height: 24px;
39 40
   position: absolute;
@@ -41,7 +42,7 @@
41 42
 }
42 43
 .title{
43 44
   display: inline-block;
44
-  width: 84px;
45
+  width: 0.54rem;
45 46
   justify-content: space-between;
46 47
   text-align: justify;
47 48
   text-align-last:justify

+ 4
- 4
src/pages/building/type/style.wxss Datei anzeigen

@@ -16,7 +16,7 @@
16 16
   margin: 10px 0px;
17 17
 }
18 18
 .cardText {
19
-  font-size: 18px;
19
+  font-size:  0.11rem;
20 20
   color: #333;
21 21
   line-height: 24px;
22 22
   display: flex;
@@ -24,7 +24,7 @@
24 24
   position: relative;
25 25
 }
26 26
 .cardItem {
27
-  font-size: 18px;
27
+  font-size:  0.11rem;
28 28
   font-weight: 400;
29 29
   color: #666;
30 30
   line-height: 24px;
@@ -32,7 +32,7 @@
32 32
   align-items: center;
33 33
 }
34 34
 .ediText {
35
-  font-size: 18px;
35
+  font-size:  0.11rem;
36 36
   color: #ff925c;
37 37
   line-height: 24px;
38 38
   position: absolute;
@@ -40,7 +40,7 @@
40 40
 }
41 41
 .title {
42 42
   display: inline-block;
43
-  width: 84px;
43
+  width:  0.54rem;
44 44
   justify-content: space-between;
45 45
   text-align: justify;
46 46
   text-align-last: justify;

+ 6
- 22
src/pages/carouselFigure/advertisingList.jsx Datei anzeigen

@@ -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/extendContent',
27
-        method: 'GET',
28
-        params: { ...params },
29
-    }).then((data) => {
25
+    request({ ...apis.carsuseFigure.extendContent, params: { ...params },}).then((data) => {
30 26
         console.log(data)
31 27
         setData(data)
32 28
     })
@@ -97,11 +93,7 @@ const toEdit = (contentId) => () => {
97 93
           okText: '确定',
98 94
           cancelText: '取消',
99 95
           onOk() {
100
-              request({
101
-                  url: '/api/admin/buildingDynamic/finish',
102
-                  method: 'PUT',
103
-                  data: {dynamicId: row.dynamicId, top: ""},
104
-              }).then((data) => {
96
+              request({ ...apis.carsuseFigure.finish, data: {dynamicId: row.dynamicId, top: ""},}).then((data) => {
105 97
                   console.log(data)
106 98
                   message.info('操作成功!')
107 99
                   getList({ pageNum: 1, pageSize: 10, showType: 'screen' })
@@ -123,11 +115,7 @@ const toEdit = (contentId) => () => {
123 115
           okText: '确定',
124 116
           cancelText: '取消',
125 117
           onOk() {
126
-              request({
127
-                  url: '/api/admin/extendContent/'+row.contentId,
128
-                  method: 'PUT',
129
-                  data: row,
130
-              }).then((data) => {
118
+              request({ ...apis.carsuseFigure.updataExtendContent,urlData:{id: row.contentId}, data: row,}).then((data) => {
131 119
                   message.info('操作成功!')
132 120
                   getList({ pageNum: 1, pageSize: 10, showType: 'screen' })
133 121
               }).catch((err) => {
@@ -143,11 +131,7 @@ const toEdit = (contentId) => () => {
143 131
           okText: '确定',
144 132
           cancelText: '取消',
145 133
           onOk() {
146
-              request({
147
-                  url: '/api/admin/extendContent/'+row.contentId,
148
-                  method: 'PUT',
149
-                  data: row,
150
-              }).then((data) => {
134
+              request({ ...apis.carsuseFigure.updataExtendContent,urlData:{id: row.contentId}, data: row,}).then((data) => {
151 135
                   message.info('操作成功!')
152 136
                   getList({ pageNum: 1, pageSize: 10, showType: 'screen' })
153 137
               }).catch((err) => {
@@ -217,7 +201,7 @@ const handleSubmit = (e, props) => {
217 201
           </Button>
218 202
         </Form.Item>
219 203
       </Form>
220
-      <Button type="primary" className={styles.addBtn} onClick={toEdit()}>新增</Button>
204
+      <Button type="danger" className={styles.addBtn} onClick={toEdit()}>新增</Button>
221 205
       <Table dataSource={data.records} columns={columns} pagination={false}/>
222 206
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
223 207
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />

+ 6
- 22
src/pages/carouselFigure/carouselFigureList.jsx Datei anzeigen

@@ -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/extendContent',
27
-        method: 'GET',
28
-        params: { ...params },
29
-    }).then((data) => {
25
+    request({ ...apis.carsuseFigure.extendContent, params: { ...params },}).then((data) => {
30 26
         console.log(data)
31 27
         setData(data)
32 28
     })
@@ -97,11 +93,7 @@ const toEditCarouse = (contentId) => () => {
97 93
           okText: '确定',
98 94
           cancelText: '取消',
99 95
           onOk() {
100
-              request({
101
-                  url: '/api/admin/buildingDynamic/finish',
102
-                  method: 'PUT',
103
-                  data: {dynamicId: row.dynamicId, top: ""},
104
-              }).then((data) => {
96
+            request({ ...apis.carsuseFigure.finish, data: {dynamicId: row.dynamicId, top: ""},}).then((data) => {
105 97
                   console.log(data)
106 98
                   message.info('操作成功!')
107 99
                   getList({ pageNum: 1, pageSize: 10, showType: 'banner' })
@@ -123,11 +115,7 @@ const toEditCarouse = (contentId) => () => {
123 115
           okText: '确定',
124 116
           cancelText: '取消',
125 117
           onOk() {
126
-              request({
127
-                  url: '/api/admin/extendContent/'+row.contentId,
128
-                  method: 'PUT',
129
-                  data: row,
130
-              }).then((data) => {
118
+            request({ ...apis.carsuseFigure.updataExtendContent,urlData:{id: row.contentId}, data: row,}).then((data) => {
131 119
                   message.info('操作成功!')
132 120
                   getList({ pageNum: 1, pageSize: 10, showType: 'banner' })
133 121
               }).catch((err) => {
@@ -143,11 +131,7 @@ const toEditCarouse = (contentId) => () => {
143 131
           okText: '确定',
144 132
           cancelText: '取消',
145 133
           onOk() {
146
-              request({
147
-                  url: '/api/admin/extendContent/'+row.contentId,
148
-                  method: 'PUT',
149
-                  data: row,
150
-              }).then((data) => {
134
+            request({ ...apis.carsuseFigure.updataExtendContent,urlData:{id: row.contentId}, data: row,}).then((data) => {
151 135
                   message.info('操作成功!')
152 136
                   getList({ pageNum: 1, pageSize: 10, showType: 'banner' })
153 137
               }).catch((err) => {
@@ -217,7 +201,7 @@ const handleSubmit = (e, props) => {
217 201
           </Button>
218 202
         </Form.Item>
219 203
       </Form>
220
-      <Button type="primary" className={styles.addBtn} onClick={toEditCarouse()}>新增</Button>
204
+      <Button type="danger" className={styles.addBtn} onClick={toEditCarouse()}>新增</Button>
221 205
       <Table dataSource={data.records} columns={columns} pagination={false}/>
222 206
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
223 207
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />

+ 4
- 14
src/pages/carouselFigure/editAdvertising.jsx Datei anzeigen

@@ -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,10 +28,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
27 28
 
28 29
   // 查询列表
29 30
   const getDetail = (contentId) => {
30
-    request({
31
-        url: '/api/admin/extendContent/' + contentId,
32
-        method: 'GET',
33
-    }).then((data) => {
31
+    request({ ...apis.carsuseFigure.getExtendContent,urlData:{id: contentId}}).then((data) => {
34 32
         console.log(data)
35 33
         setData(data)
36 34
     })
@@ -123,21 +121,13 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
123 121
     const handleSubmit = val => { 
124 122
       val.showType = 'screen'
125 123
       if(contentId){
126
-        request({
127
-          url: '/api/admin/extendContent/'+contentId,
128
-          method: 'PUT',
129
-          data: val,
130
-        }).then((data) => {
124
+        request({ ...apis.carsuseFigure.updataExtendContent,urlData:{id: contentId}, data: val,}).then((data) => {
131 125
           cancelPage()
132 126
         }).catch((err) => {
133 127
           message.info(err.msg || err.message)
134 128
         })
135 129
       }else{
136
-        request({
137
-          url: '/api/admin/extendContent',
138
-          method: 'POST',
139
-          data: val,
140
-        }).then((data) => {
130
+        request({ ...apis.carsuseFigure.addExtendContent, data: val,}).then((data) => {
141 131
           cancelPage()
142 132
         }).catch((err) => {
143 133
           message.info(err.msg || err.message)

+ 4
- 14
src/pages/carouselFigure/editCarousel.jsx Datei anzeigen

@@ -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,10 +28,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
27 28
 
28 29
   // 查询列表
29 30
   const getDetail = (contentId) => {
30
-    request({
31
-        url: '/api/admin/extendContent/' + contentId,
32
-        method: 'GET',
33
-    }).then((data) => {
31
+    request({ ...apis.carsuseFigure.getExtendContent,urlData:{id: contentId}}).then((data) => {
34 32
         console.log(data)
35 33
         setData(data)
36 34
     })
@@ -123,21 +121,13 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
123 121
     const handleSubmit = val => { 
124 122
       val.showType = 'banner'
125 123
       if(contentId){
126
-        request({
127
-          url: '/api/admin/extendContent/'+contentId,
128
-          method: 'PUT',
129
-          data: val,
130
-        }).then((data) => {
124
+        request({ ...apis.carsuseFigure.updataExtendContent,urlData:{id: contentId}, data: val,}).then((data) => {
131 125
           cancelPage()
132 126
         }).catch((err) => {
133 127
           message.info(err.msg || err.message)
134 128
         })
135 129
       }else{
136
-        request({
137
-          url: '/api/admin/extendContent',
138
-          method: 'POST',
139
-          data: val,
140
-        }).then((data) => {
130
+        request({ ...apis.carsuseFigure.addExtendContent, data: val,}).then((data) => {
141 131
           cancelPage()
142 132
         }).catch((err) => {
143 133
           message.info(err.msg || err.message)

+ 21
- 10
src/pages/channel/InviteClients.jsx Datei anzeigen

@@ -4,6 +4,7 @@ import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Sele
4 4
 import { FormattedMessage } from 'umi-plugin-react/locale';
5 5
 import channels from './channelList.less';
6 6
 import router from 'umi/router';
7
+import apis from '../../services/apis';
7 8
 import request from '../../utils/request'
8 9
 
9 10
 const { Option } = Select;
@@ -45,24 +46,34 @@ const header = props => {
45 46
   const [data, setData] = useState({ channelNmae: [], result: [] })
46 47
   // eslint-disable-next-line react-hooks/rules-of-hooks
47 48
   useEffect(() => {
48
-    getList({ id: props.location.query.id, pageNum: 1, pageSize: 10 })
49
+    getListInvite({ id: props.location.query.id, pageNum: 1, pageSize: 10 })
49 50
   }, [])
50 51
 
51
-  function getList(params) {
52
-    request({
53
-      url: '/api/admin/channel/InviteClientsList',
54
-      method: 'GET',
55
-      params: { ...params },
56
-  // eslint-disable-next-line no-shadow
57
-  }).then(data => {
58
-      console.log(data)
52
+  // function getListInvite(params) {
53
+  //   request({
54
+  //     url: '/api/admin/channel/InviteClientsList',
55
+  //     method: 'GET',
56
+  //     params: { ...params },
57
+  // // eslint-disable-next-line no-shadow
58
+  // }).then(data => {
59
+  //     console.log(data)
60
+  //     setData(data)
61
+  // })
62
+  // }
63
+
64
+  function getListInvite(params) {
65
+    request({ ...apis.channelList.getListInvite, params: { ...params } }).then((data) => {
59 66
       setData(data)
67
+  }).catch((err) => {
68
+      console.log(err)
69
+      message.info(err.msg || err.message)
60 70
   })
61 71
   }
72
+
62 73
   // 分页
63 74
   function onChange(pageNumber) {
64 75
     // eslint-disable-next-line react-hooks/rules-of-hooks
65
-      getList({ pageNum: pageNumber, pageSize: 9 })
76
+    getListInvite({ pageNum: pageNumber, pageSize: 9 })
66 77
   }
67 78
   return (
68 79
     <>

+ 7
- 10
src/pages/channel/addChannel.jsx Datei anzeigen

@@ -3,6 +3,7 @@ import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Sele
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import channels from './channelList.less';
5 5
 import router from 'umi/router';
6
+import apis from '../../services/apis';
6 7
 import request from '../../utils/request'
7 8
 
8 9
 const { TextArea } = Input;
@@ -17,18 +18,14 @@ const header = props => {
17 18
   //   addChannel({ pageNum: 1, pageSize: 10 })
18 19
   // }, [])
19 20
 
20
-  function addChannel (params) {
21
-    request({
22
-      url: '/api/admin/channel',
23
-      method: 'POST',
24
-      data: { ...params },
25
-      // eslint-disable-next-line no-shadow
26
-    }).then(data => {
27
-      console.log(data)
21
+  function addChannel(params) {
22
+    request({ ...apis.channelList.addChannel, data: { ...params } }).then((data) => {
28 23
       setData(data)
29
-      // eslint-disable-next-line no-unused-expressions
30 24
       router.go(-1)
31
-    })
25
+  }).catch((err) => {
26
+      console.log(err)
27
+      message.info(err.msg || err.message)
28
+  })
32 29
   }
33 30
 
34 31
   function handleSubmit (e) {

+ 14
- 23
src/pages/channel/brokerList.jsx Datei anzeigen

@@ -3,6 +3,7 @@ import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Sele
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import channels from './channelList.less';
5 5
 import router from 'umi/router';
6
+import apis from '../../services/apis';
6 7
 import request from '../../utils/request'
7 8
 
8 9
 const { Option } = Select;
@@ -102,37 +103,27 @@ const header = props => {
102 103
 //   const [page, changePage] = useState({})
103 104
   // eslint-disable-next-line react-hooks/rules-of-hooks
104 105
   useEffect(() => {
105
-    getList()
106
+    getListBroker()
106 107
   }, [])
107
-      function getList(params) {
108
-      request({
109
-        url: '/api/admin/channel/broker',
110
-        method: 'GET',
111
-        params: { ...params },
112
-    // eslint-disable-next-line no-shadow
113
-    }).then(data => {
114
-        console.log(data)
108
+
109
+    function getListBroker(params) {
110
+      request({ ...apis.channelList.getListBroker, params: { ...params } }).then((data) => {
115 111
         setData(data)
112
+    }).catch((err) => {
113
+        console.log(err)
114
+        message.info(err.msg || err.message)
116 115
     })
117 116
     }
118
-  // const getList = e => {
119
-  //   request({
120
-  //       url: '/api/xxx',
121
-  //       method: 'GET',
122
-  //       params: {},
123
-  //   // eslint-disable-next-line no-shadow
124
-  //   }).then(data => {
125
-  //       setData(data)
126
-  //   })
127
-  // }
117
+
118
+
128 119
  // 查询
129 120
  function queryList() {
130
-  getList({ ...queryData, pageNum: 1, pageSize: 10, channelId: localStorage.getItem('value') })
121
+  getListBroker({ ...queryData, pageNum: 1, pageSize: 10, channelId: localStorage.getItem('value') })
131 122
 }
132 123
     // 分页
133 124
     function onChange(pageNumber) {
134 125
       // eslint-disable-next-line react-hooks/rules-of-hooks
135
-        getList({ pageNum: pageNumber, pageSize: 10 })
126
+      getListBroker({ pageNum: pageNumber, pageSize: 10 })
136 127
     }
137 128
     // 获取input的值
138 129
     function onInputChangePhone (e) {
@@ -145,7 +136,7 @@ const header = props => {
145 136
     setQueryData({ ...queryData, phone: e.target.value })
146 137
   }
147 138
   function refurbishList () {
148
-    getList({ pageNum: 1, pageSize: 10 })
139
+    getListBroker({ pageNum: 1, pageSize: 10 })
149 140
   }
150 141
   // eslint-disable-next-line no-undef
151 142
   function handleClick() {
@@ -166,7 +157,7 @@ return (
166 157
       {/* <Button onClick={() => refurbishList() }>重置</Button> */}
167 158
     </div>
168 159
     </div>
169
-    <Table dataSource={data.list} columns={columns} pagination={{ pageSize: 10, total: data.total, onChange }} />
160
+    <Table style={{marginTop:'40px'}} dataSource={data.list} columns={columns} pagination={{ pageSize: 10, total: data.total, onChange }} />
170 161
   </>
171 162
 )
172 163
 }

+ 41
- 43
src/pages/channel/channelList.jsx Datei anzeigen

@@ -3,6 +3,7 @@ import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Sele
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import channels from './channelList.less';
5 5
 import router from 'umi/router';
6
+import apis from '../../services/apis';
6 7
 import request from '../../utils/request'
7 8
 
8 9
 const { Option } = Select;
@@ -80,7 +81,7 @@ const columns = [
80 81
     dataIndex: '',
81 82
     key: '',
82 83
     align: 'center',
83
-    render: (text, record) => <a style={ { color: '#66B3FF' } } onClick= {() => toedit(record.channelId)} >编辑</a>,
84
+    render: (text, record) => <a style={{ color: '#66B3FF' }} onClick={() => toedit(record.channelId)} >编辑</a>,
84 85
   },
85 86
 ];
86 87
 
@@ -93,16 +94,16 @@ function toAdd() {
93 94
     },
94 95
   });
95 96
 }
96
-  // 跳编辑页面
97
-  function toedit(channelId) {
98
-    // alert(channelId)
99
-    router.push({
100
-      pathname: '/channel/editChannel',
101
-      query: {
102
-        id: channelId,
103
-      },
104
-    });
105
-  }
97
+// 跳编辑页面
98
+function toedit(channelId) {
99
+  // alert(channelId)
100
+  router.push({
101
+    pathname: '/channel/editChannel',
102
+    query: {
103
+      id: channelId,
104
+    },
105
+  });
106
+}
106 107
 
107 108
 const header = props => {
108 109
   // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -112,16 +113,13 @@ const header = props => {
112 113
     localStorage.removeItem('value');
113 114
     getList({ pageNum: 1, pageSize: 10 })
114 115
   }, [])
115
-
116
+ 
116 117
   function getList(params) {
117
-    request({
118
-      url: '/api/admin/channel',
119
-      method: 'GET',
120
-      params: { ...params },
121
-  // eslint-disable-next-line no-shadow
122
-  }).then(data => {
123
-      console.log(data)
118
+    request({ ...apis.channelList.getList, params: { ...params } }).then((data) => {
124 119
       setData(data)
120
+  }).catch((err) => {
121
+      console.log(err)
122
+      message.info(err.msg || err.message)
125 123
   })
126 124
   }
127 125
   // value 的值
@@ -133,48 +131,48 @@ const header = props => {
133 131
   function queryList() {
134 132
     getList({ pageNum: 1, pageSize: 10, channelId: localStorage.getItem('value') })
135 133
   }
136
- // 重置
137
- function reset() {
138
-  getList({ pageNum: 1, pageSize: 10 })
139
- }
134
+  // 重置
135
+  function reset() {
136
+    getList({ pageNum: 1, pageSize: 10 })
137
+  }
140 138
 
141
- // 跳编辑页
142
- function toEdit() {
143
-  router.push({
144
-    pathname: '/integralMall/editGoods',
145
-    query: {
146
-      a: 'b',
147
-    },
148
-  });
149
-}
139
+  // 跳编辑页
140
+  function toEdit() {
141
+    router.push({
142
+      pathname: '/integralMall/editGoods',
143
+      query: {
144
+        a: 'b',
145
+      },
146
+    });
147
+  }
150 148
 
151 149
   // 分页
152 150
   function onChange(pageNumber) {
153 151
     // eslint-disable-next-line react-hooks/rules-of-hooks
154
-      getList({ pageNum: pageNumber, pageSize: 9 })
152
+    getList({ pageNum: pageNumber, pageSize: 9 })
155 153
   }
156 154
 
157 155
   return (
158 156
     <>
159 157
       <div className={channels.searchBox}>
160
-        <dvi>
158
+        <div>
161 159
           <span className={channels.selectName}>渠道名称</span>
162 160
           <Select defaultValue="请选择" style={{ width: 180 }} onChange={handleChange}>
163
-          <option value="">全部</option>
164
-              {data.channelNmae.map(Item =>
165
-                <Option value={ Item.channelId }> { Item.channelName } </Option>,
166
-              )}
167
-              {/* {listItems} */}
161
+            <option value="">全部</option>
162
+            {data.channelNmae.map(Item =>
163
+              <Option value={Item.channelId}> {Item.channelName} </Option>,
164
+            )}
165
+            {/* {listItems} */}
168 166
           </Select>
169
-        </dvi>
167
+        </div>
170 168
         <div >
171
-        <Button type="primary" onClick={() => queryList() }>查询</Button>
172
-        {/* <Button onClick={() => reset() }>重置</Button> */}
169
+          <Button type="primary" onClick={() => queryList()}>查询</Button>
170
+          {/* <Button onClick={() => reset() }>重置</Button> */}
173 171
         </div>
174 172
       </div>
175 173
       <Button type="danger" onClick={toAdd} className={channels.about} >新增</Button>
176 174
       <Table dataSource={data.result.records} columns={columns} pagination={{ pageSize: 10, total: data.result.total, onChange }} />
177
-  </>
175
+    </>
178 176
   )
179 177
 }
180 178
 

+ 15
- 15
src/pages/channel/editChannel.jsx Datei anzeigen

@@ -3,6 +3,7 @@ import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Sele
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import channels from './channelList.less';
5 5
 import router from 'umi/router';
6
+import apis from '../../services/apis';
6 7
 import request from '../../utils/request'
7 8
 
8 9
 const { TextArea } = Input;
@@ -14,30 +15,29 @@ const header = props => {
14 15
   useEffect(() => {
15 16
     getById()
16 17
   }, [])
18
+  
19
+  
17 20
   // 查询当前信息
18
-  function getById() {
19
-    request({
20
-      url: `/api/admin/channel/${props.location.query.id}`,
21
-      method: 'GET',
22
-  // eslint-disable-next-line no-shadow
23
-  }).then(data => {
21
+  function getById(params) {
22
+    request({ ...apis.channelList.getById, urlData: { id: props.location.query.id } }).then((data) => {
24 23
       props.form.setFieldsValue(data)
24
+  }).catch((err) => {
25
+      console.log(err)
26
+      message.info(err.msg || err.message)
25 27
   })
26 28
   }
27 29
 
28 30
   // 编辑
29 31
   function editChannel(data) {
30
-      request({
31
-        url: `/api/admin/channel/${props.location.query.id}`,
32
-        method: 'PUT',
33
-        data: { ...data },
34
-    // eslint-disable-next-line no-shadow
35
-    }).then(data => {
36
-         // eslint-disable-next-line no-unused-expressions
37
-         router.go(-1)
38
-    })
32
+    request({ ...apis.channelList.editChannel, urlData: { id: props.location.query.id }, data: { ...data } }).then((data) => {
33
+      router.go(-1)
34
+  }).catch((err) => {
35
+      console.log(err)
36
+      message.info(err.msg || err.message)
37
+  })
39 38
   }
40 39
 
40
+
41 41
   function handleSubmit(e) {
42 42
     e.preventDefault();
43 43
     props.form.validateFields((err, values) => {

+ 20
- 10
src/pages/channel/recommendClients.jsx Datei anzeigen

@@ -3,6 +3,7 @@ import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Sele
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import channels from './channelList.less';
5 5
 import router from 'umi/router';
6
+import apis from '../../services/apis';
6 7
 import request from '../../utils/request'
7 8
 
8 9
 const { Option } = Select;
@@ -98,18 +99,27 @@ const header = props => {
98 99
 //   const [page, changePage] = useState({})
99 100
   // eslint-disable-next-line react-hooks/rules-of-hooks
100 101
   useEffect(() => {
101
-    getList({ pageNumber: 1, pageSize: 10 })
102
+    getListRecommend({ pageNumber: 1, pageSize: 10 })
102 103
   }, [])
103 104
 
104
-  function getList(params) {
105
-    request({
106
-      url: `/api/admin/customer/recommend/${props.location.query.id}`,
107
-      method: 'GET',
108
-      params: { ...params },
109
-  // eslint-disable-next-line no-shadow
110
-  }).then(data => {
111
-      console.log(data)
105
+  // function getListRecommend(params) {
106
+  //   request({
107
+  //     url: `/api/admin/customer/recommend/${props.location.query.id}`,
108
+  //     method: 'GET',
109
+  //     params: { ...params },
110
+  // // eslint-disable-next-line no-shadow
111
+  // }).then(data => {
112
+  //     console.log(data)
113
+  //     setData(data)
114
+  // })
115
+  // }
116
+
117
+  function getListRecommend(params) {
118
+    request({ ...apis.channelList.getListRecommend, urlData: { id: props.location.query.id }, params: { ...params } }).then((data) => {
112 119
       setData(data)
120
+  }).catch((err) => {
121
+      console.log(err)
122
+      message.info(err.msg || err.message)
113 123
   })
114 124
   }
115 125
 
@@ -117,7 +127,7 @@ const header = props => {
117 127
    // 分页
118 128
  function onChange(pageNum) {
119 129
       // eslint-disable-next-line react-hooks/rules-of-hooks
120
-        getList({ pageNumber: pageNum, pageSize: 9 })
130
+      getListRecommend({ pageNumber: pageNum, pageSize: 9 })
121 131
     }
122 132
 return (
123 133
   <>

+ 137
- 0
src/pages/charts/CityNums.jsx Datei anzeigen

@@ -0,0 +1,137 @@
1
+import React, { useState, useEffect } from 'react';
2
+import Echart from '../../components/EchartsTest/EChart';
3
+import { fetch, apis } from '@/utils/request';
4
+
5
+const geoOptions = {
6
+  backgroundColor: '#fff',
7
+  title: {
8
+    text: '城市分布',
9
+    left: 20,
10
+    top: 20
11
+  },
12
+  tooltip : {
13
+      trigger: 'item',
14
+      formatter: (params) => {
15
+        return `${params.data.name}: ${params.data.value[2]}`
16
+      }
17
+  },
18
+  geo: {
19
+      map: 'china',
20
+      roam: true,
21
+      zoom: 1.2,
22
+      label: {
23
+        normal: {
24
+          show: true,
25
+          color: '#aaa',
26
+        },
27
+        emphasis: {
28
+          show: true
29
+        }
30
+      },
31
+      itemStyle: {
32
+          normal: {
33
+              areaColor: '#f3f3f3',
34
+              borderColor: '#ddd'
35
+          },
36
+          emphasis: {
37
+              areaColor: '#eee'
38
+          }
39
+      }
40
+  },
41
+}
42
+
43
+const getCityData = fetch(apis.indexEcharts.userCity)
44
+
45
+const mapDataRange = x => {
46
+  // 映射区间 [1, 100000] => [rangeStart, rangeEnd]
47
+  const min = 1
48
+  const max = 100000
49
+  const rangeStart = 16
50
+  const rangeEnd = 24
51
+
52
+  return rangeStart + (x - min) * (rangeEnd - rangeStart) / (max - min)
53
+}
54
+
55
+const CityNums = (props) => {
56
+  const [data, setData]= useState([])
57
+
58
+  useEffect(() => {
59
+    getCityData().then(response => {
60
+      const { selectCityUser = [] } = response || {}
61
+      const data = selectCityUser.map((item) => {
62
+        return {
63
+          name: item.name,
64
+          value: [item.lng - 0, item.lat - 0, item.cityCount]
65
+        }
66
+      })
67
+      setData(data)
68
+    })
69
+  }, [])
70
+
71
+  const options = {
72
+    ...geoOptions,
73
+    series: [
74
+      {
75
+        name: '人数',
76
+        type: 'scatter',
77
+        coordinateSystem: 'geo',
78
+        data,
79
+        symbolSize: 10,
80
+        label: {
81
+            normal: {
82
+                formatter: '{b}',
83
+                position: 'right',
84
+                show: false
85
+            },
86
+            emphasis: {
87
+                show: true
88
+            }
89
+        },
90
+        itemStyle: {
91
+            normal: {
92
+                color: '#DB3C4B'
93
+            }
94
+        }
95
+      },
96
+      {
97
+          name: '前三',
98
+          type: 'effectScatter',
99
+          coordinateSystem: 'geo',
100
+          data: data.sort(function (a, b) {
101
+              return b.value[2] - a.value[2];
102
+          }).slice(0, 3),
103
+          symbolSize: function (val) {
104
+              return mapDataRange(val[2]);
105
+          },
106
+          showEffectOn: 'render',
107
+          rippleEffect: {
108
+              brushType: 'stroke'
109
+          },
110
+          hoverAnimation: true,
111
+          label: {
112
+              normal: {
113
+                  formatter: '{b}',
114
+                  position: 'right',
115
+                  show: false
116
+              }
117
+          },
118
+          itemStyle: {
119
+              normal: {
120
+                  color: '#DB3C4B',
121
+                  shadowBlur: 10,
122
+                  shadowColor: '#333'
123
+              }
124
+          },
125
+          zlevel: 1
126
+      }
127
+    ],
128
+  }
129
+
130
+  return (
131
+    <div style={{ margin: '24px 0', width: '100%', borderRadius: '8px', boxShadow: '0px 0px 9px 1px rgba(0,0,0,0.12)', overflow: 'hidden' }}>
132
+      <Echart options={options} style={{ width: '100%', height: '600px' }} ></Echart>
133
+    </div>
134
+  )
135
+}
136
+
137
+export default CityNums;

+ 27
- 17
src/pages/customer/customerlist/index.jsx Datei anzeigen

@@ -9,6 +9,8 @@ import router from 'umi/router';
9 9
 import Attribution from './components/attribution'
10 10
 import IntegralRecord from './components/integralRecord'
11 11
 import ChangeStatus from './components/changeStatus'
12
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
13
+import AuthButton from '@/components/AuthButton';
12 14
 
13 15
 
14 16
 const { Option } = Select;
@@ -190,13 +192,19 @@ function body(props) {
190 192
       // eslint-disable-next-line no-nested-ternary
191 193
       render: (_, record) => (
192 194
         <>
193
-          <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showStatus(record)}>变更状态</Button>
194
-          &nbsp;&nbsp;
195
-          <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showGM(record)}>调整归属</Button>
196
-          <br />
197
-          <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => toCustomerDateil(record)}>查看详情</Button>
198
-          &nbsp;&nbsp;
199
-          <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showRecord(record)}>积分记录</Button>
195
+          <AuthButton name="admin.customer.recommend.edit.id.put" noRight={null}>
196
+            <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showStatus(record)}>变更状态</Button>
197
+            &nbsp;&nbsp;
198
+            <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showGM(record)}>调整归属</Button>
199
+          </AuthButton>
200
+            <br />
201
+          <AuthButton name="admin.customer.recommend.get" noRight={null}>
202
+            <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => toCustomerDateil(record)}>查看详情</Button>
203
+          </AuthButton>
204
+            &nbsp;&nbsp;
205
+          <AuthButton name="admin.mine.taPointsRecords.id.get" noRight={null}>
206
+            <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showRecord(record)}>积分记录</Button>
207
+          </AuthButton>
200 208
         </>
201 209
       ),
202 210
     },
@@ -207,9 +215,7 @@ function body(props) {
207 215
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
208 216
         <Form.Item>
209 217
           {getFieldDecorator('buildingId')(
210
-            <Select style={{ width: '180px' }} placeholder="意向项目" onChange={handleSelectChange}>
211
-              <Option value="male">male</Option>
212
-            </Select>,
218
+            <BuildSelect />,
213 219
           )}
214 220
         </Form.Item>
215 221
         <Form.Item>
@@ -248,17 +254,21 @@ function body(props) {
248 254
           )}
249 255
         </Form.Item>
250 256
         <Form.Item>
251
-          <Button type="danger" htmlType="submit" >
252
-            搜索
253
-          </Button>
257
+          <AuthButton name="admin.customer.recommend.get" noRight={null}>
258
+            <Button type="primary" htmlType="submit" >
259
+              查询
260
+            </Button>
261
+          </AuthButton>
254 262
         </Form.Item>
255 263
       </Form>
256 264
 
257 265
       <div style={{ marginTop: '20px', marginBottom: '20px' }}>
258
-        <Radio.Group value={customerType} onChange={radioButtonHandleSizeChange} buttonStyle="solid">
259
-          <Radio.Button value="private">私客</Radio.Button>
260
-          <Radio.Button value="public">公客</Radio.Button>
261
-        </Radio.Group>
266
+        <AuthButton name="admin.customer.recommend.get" noRight={null}>
267
+          <Radio.Group value={customerType} onChange={radioButtonHandleSizeChange} buttonStyle="solid">
268
+            <Radio.Button value="private">私客</Radio.Button>
269
+            <Radio.Button value="public">公客</Radio.Button>
270
+          </Radio.Group>
271
+        </AuthButton>
262 272
       </div>
263 273
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
264 274
 

+ 4
- 4
src/pages/customer/customerlist/style.css Datei anzeigen

@@ -19,7 +19,7 @@
19 19
   margin: 10px 0px;
20 20
 }
21 21
 .cardText {
22
-  font-size: 18px;
22
+  font-size:  0.11rem;
23 23
   color: #333;
24 24
   line-height: 24px;
25 25
   display: flex;
@@ -27,7 +27,7 @@
27 27
   position: relative;
28 28
 }
29 29
 .cardItem {
30
-  font-size: 18px;
30
+  font-size:  0.11rem;
31 31
   font-weight: 400;
32 32
   color: #666;
33 33
   line-height: 24px;
@@ -35,7 +35,7 @@
35 35
   align-items: center;
36 36
 }
37 37
 .ediText {
38
-  font-size: 18px;
38
+  font-size:  0.11rem;
39 39
   color: #ff925c;
40 40
   line-height: 24px;
41 41
   position: absolute;
@@ -43,7 +43,7 @@
43 43
 }
44 44
 .title {
45 45
   display: inline-block;
46
-  width: 84px;
46
+  width:  0.54rem;
47 47
   justify-content: space-between;
48 48
   text-align: justify;
49 49
   text-align-last: justify;

+ 9
- 8
src/pages/customer/customerlist/style.less Datei anzeigen

@@ -19,24 +19,25 @@
19 19
   margin: 10px 0px;
20 20
 }
21 21
 .cardText {
22
-  font-size: 18px;
23 22
   color: #333;
24
-  line-height: 24px;
25 23
   display: flex;
26 24
   align-items: center;
27 25
   position: relative;
26
+  line-height: 1.5;
27
+  font-size: 0.11rem;
28
+  margin-bottom: 0.08rem;
28 29
 
29 30
 }
30 31
 .cardItem{
31
-  font-size: 18px;
32
-  font-weight: 400;
33 32
   color: #666;
34
-  line-height: 24px;
35 33
   display: flex;
36
-  align-items: center;  
34
+  align-items: center; 
35
+  line-height: 1.5;
36
+  font-size: 0.11rem;
37
+  margin-bottom: 0.08rem; 
37 38
 }
38 39
 .ediText {
39
-  font-size: 18px;
40
+  font-size: 0.11rem;
40 41
   color: #ff925c;
41 42
   line-height: 24px;
42 43
   position: absolute;
@@ -44,7 +45,7 @@
44 45
 }
45 46
 .title{
46 47
   display: inline-block;
47
-  width: 84px;
48
+  width:  0.54rem;
48 49
   justify-content: space-between;
49 50
   text-align: justify;
50 51
   text-align-last:justify

+ 4
- 4
src/pages/customer/customerlist/style.wxss Datei anzeigen

@@ -19,7 +19,7 @@
19 19
   margin: 10px 0px;
20 20
 }
21 21
 .cardText {
22
-  font-size: 18px;
22
+  font-size:  0.11rem;
23 23
   color: #333;
24 24
   line-height: 24px;
25 25
   display: flex;
@@ -27,7 +27,7 @@
27 27
   position: relative;
28 28
 }
29 29
 .cardItem {
30
-  font-size: 18px;
30
+  font-size:  0.11rem;
31 31
   font-weight: 400;
32 32
   color: #666;
33 33
   line-height: 24px;
@@ -35,7 +35,7 @@
35 35
   align-items: center;
36 36
 }
37 37
 .ediText {
38
-  font-size: 18px;
38
+  font-size:  0.11rem;
39 39
   color: #ff925c;
40 40
   line-height: 24px;
41 41
   position: absolute;
@@ -43,7 +43,7 @@
43 43
 }
44 44
 .title {
45 45
   display: inline-block;
46
-  width: 84px;
46
+  width:  0.54rem;
47 47
   justify-content: space-between;
48 48
   text-align: justify;
49 49
   text-align-last: justify;

+ 9
- 8
src/pages/customer/drift/style.less Datei anzeigen

@@ -16,24 +16,25 @@
16 16
   margin: 10px 0px;
17 17
 }
18 18
 .cardText {
19
-  font-size: 18px;
20 19
   color: #333;
21
-  line-height: 24px;
22 20
   display: flex;
23 21
   align-items: center;
24 22
   position: relative;
23
+  line-height: 1.5;
24
+  font-size: 0.11rem;
25
+  margin-bottom: 0.08rem;
25 26
 
26 27
 }
27 28
 .cardItem{
28
-  font-size: 18px;
29
-  font-weight: 400;
30 29
   color: #666;
31
-  line-height: 24px;
32 30
   display: flex;
33
-  align-items: center;  
31
+  align-items: center; 
32
+  line-height: 1.5;
33
+  font-size: 0.11rem;
34
+  margin-bottom: 0.08rem; 
34 35
 }
35 36
 .ediText {
36
-  font-size: 18px;
37
+  font-size: 0.11rem;
37 38
   color: #ff925c;
38 39
   line-height: 24px;
39 40
   position: absolute;
@@ -41,7 +42,7 @@
41 42
 }
42 43
 .title{
43 44
   display: inline-block;
44
-  width: 84px;
45
+  width:  0.54rem;
45 46
   justify-content: space-between;
46 47
   text-align: justify;
47 48
   text-align-last:justify

+ 12
- 5
src/pages/customer/independentList/index.jsx Datei anzeigen

@@ -5,6 +5,7 @@ import request from '../../../utils/request';
5 5
 import apis from '../../../services/apis';
6 6
 import Styles from './style.less';
7 7
 import { router } from 'umi';
8
+import AuthButton from '@/components/AuthButton';
8 9
 
9 10
 
10 11
 const { Option } = Select;
@@ -375,9 +376,13 @@ function body(props) {
375 376
           {
376 377
             <>
377 378
               {/* <sapn style={{ color: 'rgba(239,39,58,1)' }}>查看详细</sapn> */}
378
-              <a style={{ color: 'rgba(239,39,58,1)' }} onClick={() => Invite(record)}>邀请经纪人</a>
379
+              <AuthButton name="admin.channel.InviteClientsList.get" noRight={null}>
380
+                <a style={{ color: 'rgba(239,39,58,1)' }} onClick={() => Invite(record)}>邀请经纪人</a>
381
+              </AuthButton>
379 382
               &nbsp;&nbsp;&nbsp;&nbsp;
380
-              <a style={{ color: 'rgba(239,39,58,1)' }} onClick={() => gM(record)}>推荐客户</a>
383
+              <AuthButton name="admin.customer.recommend.id.get" noRight={null}>
384
+                <a style={{ color: 'rgba(239,39,58,1)' }} onClick={() => gM(record)}>推荐客户</a>
385
+              </AuthButton>
381 386
             </>
382 387
           }
383 388
         </>
@@ -405,9 +410,11 @@ function body(props) {
405 410
           )}
406 411
         </Form.Item>
407 412
         <Form.Item>
408
-          <Button type="primary" htmlType="submit" className={Styles.SubmitButton}>
409
-            搜索
410
-          </Button>
413
+          <AuthButton name="admin.customer.agents.get" noRight={null}>
414
+            <Button type="primary" htmlType="submit" className={Styles.SubmitButton}>
415
+              搜索
416
+            </Button>
417
+          </AuthButton>
411 418
         </Form.Item>
412 419
       </Form>
413 420
 

+ 4
- 4
src/pages/customer/independentList/style.css Datei anzeigen

@@ -16,7 +16,7 @@
16 16
   margin: 10px 0px;
17 17
 }
18 18
 .cardText {
19
-  font-size: 18px;
19
+  font-size:  0.11rem;
20 20
   color: #333;
21 21
   line-height: 24px;
22 22
   display: flex;
@@ -24,7 +24,7 @@
24 24
   position: relative;
25 25
 }
26 26
 .cardItem {
27
-  font-size: 18px;
27
+  font-size:  0.11rem;
28 28
   font-weight: 400;
29 29
   color: #666;
30 30
   line-height: 24px;
@@ -32,7 +32,7 @@
32 32
   align-items: center;
33 33
 }
34 34
 .ediText {
35
-  font-size: 18px;
35
+  font-size:  0.11rem;
36 36
   color: #ff925c;
37 37
   line-height: 24px;
38 38
   position: absolute;
@@ -40,7 +40,7 @@
40 40
 }
41 41
 .title {
42 42
   display: inline-block;
43
-  width: 84px;
43
+  width:  0.54rem;
44 44
   justify-content: space-between;
45 45
   text-align: justify;
46 46
   text-align-last: justify;

+ 8
- 7
src/pages/customer/independentList/style.less Datei anzeigen

@@ -16,24 +16,25 @@
16 16
   margin: 10px 0px;
17 17
 }
18 18
 .cardText {
19
-  font-size: 18px;
20 19
   color: #333;
21
-  line-height: 24px;
22 20
   display: flex;
23 21
   align-items: center;
24 22
   position: relative;
23
+  line-height: 1.5;
24
+  font-size: 0.11rem;
25
+  margin-bottom: 0.08rem;
25 26
 
26 27
 }
27 28
 .cardItem{
28
-  font-size: 18px;
29
-  font-weight: 400;
30 29
   color: #666;
31
-  line-height: 24px;
32 30
   display: flex;
33 31
   align-items: center;  
32
+  line-height: 1.5;
33
+  font-size: 0.11rem;
34
+  margin-bottom: 0.08rem;
34 35
 }
35 36
 .ediText {
36
-  font-size: 18px;
37
+  font-size: 0.11rem;
37 38
   color: #ff925c;
38 39
   line-height: 24px;
39 40
   position: absolute;
@@ -41,7 +42,7 @@
41 42
 }
42 43
 .title{
43 44
   display: inline-block;
44
-  width: 84px;
45
+  width:  0.54rem;
45 46
   justify-content: space-between;
46 47
   text-align: justify;
47 48
   text-align-last:justify

+ 4
- 4
src/pages/customer/independentList/style.wxss Datei anzeigen

@@ -16,7 +16,7 @@
16 16
   margin: 10px 0px;
17 17
 }
18 18
 .cardText {
19
-  font-size: 18px;
19
+  font-size:  0.11rem;
20 20
   color: #333;
21 21
   line-height: 24px;
22 22
   display: flex;
@@ -24,7 +24,7 @@
24 24
   position: relative;
25 25
 }
26 26
 .cardItem {
27
-  font-size: 18px;
27
+  font-size:  0.11rem;
28 28
   font-weight: 400;
29 29
   color: #666;
30 30
   line-height: 24px;
@@ -32,7 +32,7 @@
32 32
   align-items: center;
33 33
 }
34 34
 .ediText {
35
-  font-size: 18px;
35
+  font-size:  0.11rem;
36 36
   color: #ff925c;
37 37
   line-height: 24px;
38 38
   position: absolute;
@@ -40,7 +40,7 @@
40 40
 }
41 41
 .title {
42 42
   display: inline-block;
43
-  width: 84px;
43
+  width:  0.54rem;
44 44
   justify-content: space-between;
45 45
   text-align: justify;
46 46
   text-align-last: justify;

+ 9
- 4
src/pages/customer/recommendCustomer/index.jsx Datei anzeigen

@@ -5,6 +5,7 @@ import request from '../../../utils/request';
5 5
 import apis from '../../../services/apis';
6 6
 import Styles from './style.less';
7 7
 import { router } from 'umi';
8
+import AuthButton from '@/components/AuthButton';
8 9
 
9 10
 
10 11
 const { Option } = Select;
@@ -130,7 +131,9 @@ function body(props) {
130 131
       render: (_, record) => (
131 132
         <>
132 133
           {
133
-            record.verifyStatus === 0 ? <sapn style={{ color: 'rgba(239,39,58,1)' }} onClick={() => toAudit(record.customerId)}>审核</sapn> : ''
134
+            <AuthButton name="admin.customer.recommend.verify.id.put" noRight={null}>
135
+              {record.verifyStatus === 0 ? <sapn style={{ color: 'rgba(239,39,58,1)' }} onClick={() => toAudit(record.customerId)}>审核</sapn> : ''}
136
+            </AuthButton>
134 137
           }
135 138
         </>
136 139
       ),
@@ -176,9 +179,11 @@ function body(props) {
176 179
           )}
177 180
         </Form.Item>
178 181
         <Form.Item>
179
-          <Button type="primary" htmlType="submit" className={Styles.SubmitButton}>
180
-            搜索
181
-          </Button>
182
+          <AuthButton name="admin.customer.recommend.recommender.get" noRight={null}>
183
+            <Button type="primary" htmlType="submit" className={Styles.SubmitButton}>
184
+              搜索
185
+            </Button>
186
+          </AuthButton>
182 187
         </Form.Item>
183 188
       </Form>
184 189
 

+ 4
- 4
src/pages/customer/recommendCustomer/style.css Datei anzeigen

@@ -16,7 +16,7 @@
16 16
   margin: 10px 0px;
17 17
 }
18 18
 .cardText {
19
-  font-size: 18px;
19
+  font-size:  0.11rem;
20 20
   color: #333;
21 21
   line-height: 24px;
22 22
   display: flex;
@@ -24,7 +24,7 @@
24 24
   position: relative;
25 25
 }
26 26
 .cardItem {
27
-  font-size: 18px;
27
+  font-size:  0.11rem;
28 28
   font-weight: 400;
29 29
   color: #666;
30 30
   line-height: 24px;
@@ -32,7 +32,7 @@
32 32
   align-items: center;
33 33
 }
34 34
 .ediText {
35
-  font-size: 18px;
35
+  font-size:  0.11rem;
36 36
   color: #ff925c;
37 37
   line-height: 24px;
38 38
   position: absolute;
@@ -40,7 +40,7 @@
40 40
 }
41 41
 .title {
42 42
   display: inline-block;
43
-  width: 84px;
43
+  width:  0.54rem;
44 44
   justify-content: space-between;
45 45
   text-align: justify;
46 46
   text-align-last: justify;

+ 6
- 5
src/pages/customer/recommendCustomer/style.less Datei anzeigen

@@ -16,16 +16,17 @@
16 16
   margin: 10px 0px;
17 17
 }
18 18
 .cardText {
19
-  font-size: 18px;
20 19
   color: #333;
21
-  line-height: 24px;
22 20
   display: flex;
23 21
   align-items: center;
24 22
   position: relative;
23
+  line-height: 1.5;
24
+  font-size: 0.11rem;
25
+  margin-bottom: 0.08rem;
25 26
 
26 27
 }
27 28
 .cardItem{
28
-  font-size: 18px;
29
+  font-size: 0.11rem;
29 30
   font-weight: 400;
30 31
   color: #666;
31 32
   line-height: 24px;
@@ -33,7 +34,7 @@
33 34
   align-items: center;  
34 35
 }
35 36
 .ediText {
36
-  font-size: 18px;
37
+  font-size:  0.11rem;
37 38
   color: #ff925c;
38 39
   line-height: 24px;
39 40
   position: absolute;
@@ -41,7 +42,7 @@
41 42
 }
42 43
 .title{
43 44
   display: inline-block;
44
-  width: 84px;
45
+  width:  0.54rem;
45 46
   justify-content: space-between;
46 47
   text-align: justify;
47 48
   text-align-last:justify

+ 4
- 4
src/pages/customer/recommendCustomer/style.wxss Datei anzeigen

@@ -16,7 +16,7 @@
16 16
   margin: 10px 0px;
17 17
 }
18 18
 .cardText {
19
-  font-size: 18px;
19
+  font-size:  0.11rem;
20 20
   color: #333;
21 21
   line-height: 24px;
22 22
   display: flex;
@@ -24,7 +24,7 @@
24 24
   position: relative;
25 25
 }
26 26
 .cardItem {
27
-  font-size: 18px;
27
+  font-size:  0.11rem;
28 28
   font-weight: 400;
29 29
   color: #666;
30 30
   line-height: 24px;
@@ -32,7 +32,7 @@
32 32
   align-items: center;
33 33
 }
34 34
 .ediText {
35
-  font-size: 18px;
35
+  font-size:  0.11rem;
36 36
   color: #ff925c;
37 37
   line-height: 24px;
38 38
   position: absolute;
@@ -40,7 +40,7 @@
40 40
 }
41 41
 .title {
42 42
   display: inline-block;
43
-  width: 84px;
43
+  width:  0.54rem;
44 44
   justify-content: space-between;
45 45
   text-align: justify;
46 46
   text-align-last: justify;

+ 9
- 7
src/pages/customer/report/index.jsx Datei anzeigen

@@ -4,6 +4,8 @@ import moment from 'moment';
4 4
 import request from '../../../utils/request';
5 5
 import apis from '../../../services/apis';
6 6
 import Styles from './style.less';
7
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
8
+import AuthButton from '@/components/AuthButton';
7 9
 
8 10
 
9 11
 const { Option } = Select;
@@ -148,18 +150,18 @@ function body(props) {
148 150
         </Form.Item>
149 151
         <Form.Item>
150 152
           {getFieldDecorator('buildingId')(
151
-            <Select style={{ width: '180px' }} placeholder="意向项目" onChange={handleSelectChange}>
152
-              <Option value="male">male</Option>
153
-            </Select>,
153
+            <BuildSelect />,
154 154
           )}
155 155
         </Form.Item>
156 156
         <Form.Item>
157
-          <Button type="primary" htmlType="submit">
158
-            搜索
159
-          </Button>
157
+          <AuthButton name="admin.customer.recommend.report.get" noRight={null}>
158
+            <Button type="primary" htmlType="submit">
159
+              搜索
160
+            </Button>
161
+          </AuthButton>
160 162
         </Form.Item>
161 163
       </Form>
162
-      <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
164
+      <Table style={{marginTop:'40px'}} dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
163 165
     </>
164 166
   );
165 167
 }

+ 4
- 4
src/pages/customer/report/style.css Datei anzeigen

@@ -16,7 +16,7 @@
16 16
   margin: 10px 0px;
17 17
 }
18 18
 .cardText {
19
-  font-size: 18px;
19
+  font-size:  0.11rem;
20 20
   color: #333;
21 21
   line-height: 24px;
22 22
   display: flex;
@@ -24,7 +24,7 @@
24 24
   position: relative;
25 25
 }
26 26
 .cardItem {
27
-  font-size: 18px;
27
+  font-size:  0.11rem;
28 28
   font-weight: 400;
29 29
   color: #666;
30 30
   line-height: 24px;
@@ -32,7 +32,7 @@
32 32
   align-items: center;
33 33
 }
34 34
 .ediText {
35
-  font-size: 18px;
35
+  font-size:  0.11rem;
36 36
   color: #ff925c;
37 37
   line-height: 24px;
38 38
   position: absolute;
@@ -40,7 +40,7 @@
40 40
 }
41 41
 .title {
42 42
   display: inline-block;
43
-  width: 84px;
43
+  width:  0.54rem;
44 44
   justify-content: space-between;
45 45
   text-align: justify;
46 46
   text-align-last: justify;

+ 9
- 7
src/pages/customer/report/style.less Datei anzeigen

@@ -16,24 +16,26 @@
16 16
   margin: 10px 0px;
17 17
 }
18 18
 .cardText {
19
-  font-size: 18px;
20 19
   color: #333;
21
-  line-height: 24px;
22 20
   display: flex;
23 21
   align-items: center;
24 22
   position: relative;
23
+  line-height: 1.5;
24
+  font-size: 0.11rem;
25
+  margin-bottom: 0.08rem;
25 26
 
26 27
 }
27 28
 .cardItem{
28
-  font-size: 18px;
29
-  font-weight: 400;
29
+
30 30
   color: #666;
31
-  line-height: 24px;
32 31
   display: flex;
33 32
   align-items: center;  
33
+  line-height: 1.5;
34
+  font-size: 0.11rem;
35
+  margin-bottom: 0.08rem;
34 36
 }
35 37
 .ediText {
36
-  font-size: 18px;
38
+  font-size: 0.11rem;
37 39
   color: #ff925c;
38 40
   line-height: 24px;
39 41
   position: absolute;
@@ -41,7 +43,7 @@
41 43
 }
42 44
 .title{
43 45
   display: inline-block;
44
-  width: 84px;
46
+  width:  0.54rem;
45 47
   justify-content: space-between;
46 48
   text-align: justify;
47 49
   text-align-last:justify

+ 4
- 4
src/pages/customer/report/style.wxss Datei anzeigen

@@ -16,7 +16,7 @@
16 16
   margin: 10px 0px;
17 17
 }
18 18
 .cardText {
19
-  font-size: 18px;
19
+  font-size:  0.11rem;
20 20
   color: #333;
21 21
   line-height: 24px;
22 22
   display: flex;
@@ -24,7 +24,7 @@
24 24
   position: relative;
25 25
 }
26 26
 .cardItem {
27
-  font-size: 18px;
27
+  font-size:  0.11rem;
28 28
   font-weight: 400;
29 29
   color: #666;
30 30
   line-height: 24px;
@@ -32,7 +32,7 @@
32 32
   align-items: center;
33 33
 }
34 34
 .ediText {
35
-  font-size: 18px;
35
+  font-size:  0.11rem;
36 36
   color: #ff925c;
37 37
   line-height: 24px;
38 38
   position: absolute;
@@ -40,7 +40,7 @@
40 40
 }
41 41
 .title {
42 42
   display: inline-block;
43
-  width: 84px;
43
+  width:  0.54rem;
44 44
   justify-content: space-between;
45 45
   text-align: justify;
46 46
   text-align-last: justify;

+ 25
- 17
src/pages/integralMall/GoodsList.jsx Datei anzeigen

@@ -4,8 +4,9 @@ import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5 5
 import router from 'umi/router';
6 6
 import BuildSelect from '../../components/SelectButton/BuildSelect'
7
-
7
+import apis from '../../services/apis';
8 8
 import request from '../../utils/request'
9
+import AuthButton from '@/components/AuthButton';
9 10
 
10 11
 const { Option } = Select;
11 12
 
@@ -20,11 +21,7 @@ function header(props) {
20 21
 
21 22
   // 查询列表
22 23
   const getList = (params) => {
23
-    request({
24
-        url: '/api/admin/taGoods',
25
-        method: 'GET',
26
-        params: { ...params },
27
-    }).then((data) => {
24
+    request({ ...apis.integralMall.getTaGoods, params: { ...params },}).then((data) => {
28 25
         console.log(data)
29 26
         setData(data)
30 27
     })
@@ -62,11 +59,7 @@ function header(props) {
62 59
       okText: '确认',
63 60
       cancelText: '取消',
64 61
       onOk() {
65
-        request({
66
-          url: '/api/admin/taGoods/change',
67
-          method: 'PUT',
68
-          data: { ...row },
69
-        }).then((data) => {
62
+        request({ ...apis.integralMall.changeTaGoods, data: { ...row },}).then((data) => {
70 63
           message.info('操作成功!')
71 64
           getList({ pageNum: 1, pageSize: 10 });
72 65
         })
@@ -131,8 +124,21 @@ function header(props) {
131 124
       dataIndex: 'handle',
132 125
       key: 'handle',
133 126
       align: 'center',
134
-      render: (x, row) => <><span style={{ color: '#EF273A', marginRight: '20px' }} onClick={changeGoodsStatus(row)}>{row.status == 1 ? '下架' : '上架'}<Icon type="shopping-cart" className={styles.shoppingCart} />
135
-                            </span><span style={{ color: '#FF925C' }} onClick={toEditGoods(row.goodsId)}>编辑<Icon type="form" className={styles.edit} /></span></>,
127
+      render: (x, row) => (
128
+        <>
129
+          <AuthButton name="admin.taGoods.change.put" noRight={null}>
130
+            <span style={{ color: '#EF273A', marginRight: '20px' }} onClick={changeGoodsStatus(row)}>
131
+              {row.status == 1 ? '下架' : '上架'}
132
+              {<Icon type="shopping-cart" className={styles.shoppingCart} />}
133
+            </span>
134
+          </AuthButton>
135
+          <AuthButton name="admin.taGoods.put" noRight={null}>
136
+            <span style={{ color: '#FF925C' }} onClick={toEditGoods(row.goodsId)}>
137
+              编辑<Icon type="form" className={styles.edit} />
138
+            </span>
139
+          </AuthButton>
140
+        </>
141
+      ),
136 142
     },
137 143
   ];
138 144
 
@@ -179,12 +185,14 @@ function header(props) {
179 185
           )}
180 186
         </Form.Item>
181 187
         <Form.Item>
182
-          <Button type="primary" htmlType="submit" className={styles.searchBtn}>
183
-            搜索
184
-          </Button>
188
+          <AuthButton name="admin.taGoods.get" noRight={null}>
189
+            <Button type="primary" htmlType="submit" className={styles.searchBtn}>
190
+              搜索
191
+            </Button>
192
+          </AuthButton>
185 193
         </Form.Item>
186 194
       </Form>
187
-      <Button type="primary" className={styles.addBtn} onClick={toEditGoods()}>新增</Button>
195
+      <Button type="danger" className={styles.addBtn} onClick={toEditGoods()}>新增</Button>
188 196
       <Table dataSource={data.records} columns={columns} pagination={false} />
189 197
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
190 198
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />

+ 19
- 13
src/pages/integralMall/achieve.jsx Datei anzeigen

@@ -5,7 +5,9 @@ import styles from '../style/GoodsList.less';
5 5
 import router from 'umi/router';
6 6
 import moment from 'moment';
7 7
 import BuildSelect from '../../components/SelectButton/BuildSelect'
8
-import request from '../../utils/request'
8
+import apis from '../../services/apis';
9
+import request from '../../utils/request';
10
+import AuthButton from '@/components/AuthButton';
9 11
 
10 12
 const { TabPane } = Tabs;
11 13
 
@@ -28,11 +30,7 @@ useEffect(() => {
28 30
 
29 31
 // 查询列表
30 32
 const getList = (params) => {
31
-  request({
32
-      url: '/api/admin/tdPointsRules',
33
-      method: 'GET',
34
-      params: { ...params },
35
-  }).then((data) => {
33
+  request({ ...apis.integralMall.tdPointsRules, params: { ...params },}).then((data) => {
36 34
       console.log(data)
37 35
       setData(data)
38 36
   })
@@ -54,11 +52,7 @@ const changePageNum = (pageNumber) => {
54 52
   }
55 53
 
56 54
   const changeStatus = (row) => () => {
57
-    request({
58
-      url: '/api/admin/tdPointsRules/change',
59
-      method: 'PUT',
60
-      data: { ...row },
61
-    }).then((data) => {
55
+    request({ ...apis.integralMall.change, data: { ...row },}).then((data) => {
62 56
       message.info('操作成功!')
63 57
       getList({ pageNum: 1, pageSize: 10, type: carType})
64 58
     })
@@ -96,8 +90,20 @@ const columns = [
96 90
       dataIndex: 'handle',
97 91
       key: 'handle',
98 92
       align: 'center',
99
-      render: (x,row) => <><span style={{ color: '#EF273A', marginRight: '20px' }} onClick={changeStatus(row)}>{row.status == 1?'停用':'启用'}<Icon type="stop" className={styles.shoppingCart} /></span>
100
-                      <span style={{ color: '#FF925C' }}>{row.buildingId != null ? '编辑'`${<Icon type="form" className={styles.edit} />}` : ''}</span></>,
93
+      render: (x,row) => (
94
+        <>
95
+          <AuthButton name="admin.tdPointsRules.change.put" noRight={null}>
96
+            <span style={{ color: '#EF273A', marginRight: '20px' }} onClick={changeStatus(row)}>
97
+              {row.status == 1?'停用':'启用'}<Icon type="stop" className={styles.shoppingCart} />
98
+            </span>
99
+          </AuthButton>
100
+          <AuthButton name="admin.tdPointsRules.put" noRight={null}>
101
+            <span style={{ color: '#FF925C' }}>
102
+              {row.buildingId != null ? '编辑'`${<Icon type="form" className={styles.edit} />}` : ''}
103
+            </span>
104
+          </AuthButton>
105
+        </>
106
+      ),
101 107
     },
102 108
   ];
103 109
 

+ 4
- 14
src/pages/integralMall/editGoods.jsx Datei anzeigen

@@ -6,6 +6,7 @@ import BuildSelect from '../../components/SelectButton/BuildSelect'
6 6
 import XForm, { FieldTypes } from '../../components/XForm';
7 7
 import Wangedit from '../../components/Wangedit/Wangedit'
8 8
 import router from 'umi/router';
9
+import apis from '../../services/apis';
9 10
 import request from '../../utils/request'
10 11
 
11 12
 const { TextArea } = Input;
@@ -21,10 +22,7 @@ const header = props => {
21 22
 
22 23
   // 查询列表
23 24
   const getGoodsData = (goodsId) => {
24
-    request({
25
-        url: '/api/admin/taGoods/' + goodsId,
26
-        method: 'GET',
27
-    }).then((data) => {
25
+    request({ ...apis.integralMall.taGoods, urlData: { id: goodsId },}).then((data) => {
28 26
         console.log(data)
29 27
         setGoodsData(data)
30 28
     })
@@ -111,21 +109,13 @@ const header = props => {
111 109
   const handleSubmit = (values) => {
112 110
     if(goodsId){
113 111
       values.goodsId = goodsId
114
-      request({
115
-        url: '/api/admin/taGoods',
116
-        method: 'PUT',
117
-        data: values,
118
-      }).then((data) => {
112
+      request({ ...apis.integralMall.updateTaGoods, data: values,}).then((data) => {
119 113
         cancelPage()
120 114
       }).catch((err) => {
121 115
         message.info(err.msg || err.message)
122 116
       })
123 117
       }else{
124
-      request({
125
-        url: '/api/admin/taGoods/add',
126
-        method: 'POST',
127
-        data: values,
128
-      }).then((data) => {
118
+      request({ ...apis.integralMall.addTaGoods, data: values,}).then((data) => {
129 119
         cancelPage()
130 120
       }).catch((err) => {
131 121
         message.info(err.msg || err.message)

+ 3
- 7
src/pages/integralMall/exchangeRecords.jsx Datei anzeigen

@@ -5,7 +5,7 @@ import styles from '../style/GoodsList.less';
5 5
 import router from 'umi/router';
6 6
 import moment from 'moment';
7 7
 import BuildSelect from '../../components/SelectButton/BuildSelect'
8
-
8
+import apis from '../../services/apis';
9 9
 import request from '../../utils/request'
10 10
 
11 11
 /**
@@ -27,11 +27,7 @@ function record(props) {
27 27
 
28 28
   // 查询列表
29 29
   const getList = (params) => {
30
-    request({
31
-        url: '/api/admin/taPointsExchange',
32
-        method: 'GET',
33
-        params: { ...params },
34
-    }).then((data) => {
30
+    request({ ...apis.integralMall.taPointsExchange, params: { ...params },}).then((data) => {
35 31
         setData(data)
36 32
     })
37 33
   }
@@ -190,7 +186,7 @@ function record(props) {
190 186
           </Form.Item>
191 187
         </div>
192 188
       </Form>
193
-      <Table dataSource={data.records} columns={columns} pagination={false} />
189
+      <Table style={{marginTop:'40px'}} dataSource={data.records} columns={columns} pagination={false} />
194 190
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
195 191
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
196 192
       </div>

+ 3
- 11
src/pages/integralMall/verifyList.jsx Datei anzeigen

@@ -4,7 +4,7 @@ import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5 5
 import router from 'umi/router';
6 6
 import moment from 'moment';
7
-
7
+import apis from '../../services/apis';
8 8
 import request from '../../utils/request'
9 9
 
10 10
 const { Option } = Select;
@@ -19,11 +19,7 @@ const header = (props) => {
19 19
 
20 20
   // 查询列表
21 21
   const getVerifyList = (params) => {
22
-    request({
23
-      url: '/api/admin/taPointsExchange',
24
-      method: 'GET',
25
-      params: { ...params },
26
-    }).then((data) => {
22
+    request({ ...apis.integralMall.taPointsExchange, params: { ...params },}).then((data) => {
27 23
         setData(data)
28 24
     })
29 25
   }
@@ -39,11 +35,7 @@ const header = (props) => {
39 35
   }
40 36
 
41 37
   const changeStatus = (row) => () => {
42
-    request({
43
-      url: '/api/admin/taPointsExchange/change',
44
-      method: 'PUT',
45
-      data: row
46
-    }).then((data) => {
38
+    request({ ...apis.integralMall.changeTaPointsExchange, data: row}).then((data) => {
47 39
         message.info("操作成功")
48 40
         getVerifyList({ pageNum: pageNumber, pageSize: 10, phone: props.location.query.telValue })
49 41
     })

+ 10
- 10
src/pages/news/list/NewsList.jsx Datei anzeigen

@@ -167,48 +167,48 @@ function body(props) {
167 167
         cover={<img alt="example" src={data.newsImg} style={{ borderRadius: '12px 0 0 12px', width: '260px', height: '253px' }}></img>}
168 168
         bodyStyle={{ padding: '10px 20px' }}
169 169
       >
170
-        <span style={{ position: 'absolute', right: '20px', top: '20px', fontSize: '18px', color: '#FF7E48' }} onClick={toEditList(data.newsId)}>
170
+        <span style={{ position: 'absolute', right: '20px', top: '20px', fontSize: ' 0.11rem', color: '#FF7E48' }} onClick={toEditList(data.newsId)}>
171 171
           编辑
172 172
                 <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
173 173
         </span>
174 174
         {data.newsStatus === 0 ?
175
-          <span style={{ position: 'absolute', left: '280px', bottom: '18px', fontSize: '18px', color: '#FF7E48' }} onClick={cancelRelease.bind(this, data.newsId, 1, data.buildingId, data.newsType.newsTypeId)}>
175
+          <span style={{ position: 'absolute', left: '280px', bottom: ' 0.11rem', fontSize: ' 0.11rem', color: '#FF7E48' }} onClick={cancelRelease.bind(this, data.newsId, 1, data.buildingId, data.newsType.newsTypeId)}>
176 176
             取消发布
177 177
               <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
178 178
           </span> :
179
-          <span style={{ position: 'absolute', left: '280px', bottom: '18px', fontSize: '18px', color: '#FF7E48' }} onClick={cancelRelease.bind(this, data.newsId, 0, data.buildingId, data.newsType.newsTypeId)}>
179
+          <span style={{ position: 'absolute', left: '280px', bottom: ' 0.11rem', fontSize: ' 0.11rem', color: '#FF7E48' }} onClick={cancelRelease.bind(this, data.newsId, 0, data.buildingId, data.newsType.newsTypeId)}>
180 180
             发布
181
-              <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
181
+              <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
182 182
           </span>
183 183
         }
184 184
 
185
-        <span style={{ position: 'absolute', right: '20px', bottom: '18px', fontSize: '18px', color: '#FF7E48' }} onClick={changeNewsListStatus(data.newsId)}>
185
+        <span style={{ position: 'absolute', right: '20px', bottom: ' 0.11rem', fontSize: ' 0.11rem', color: '#FF7E48' }} onClick={changeNewsListStatus(data.newsId)}>
186 186
           删除
187 187
                 <Icon type="rest" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
188 188
         </span>
189 189
         <div style={{ position: 'absolute', left: '260px', top: '0px', padding: '20px' }}>
190 190
           <p style={{
191
-            fontSize: '18px', color: '#333', fontWeight: '600', marginBottom: '10px', overflow: 'hidden',
191
+            fontSize: ' 0.11rem', color: '#333', fontWeight: '600', marginBottom: '10px', overflow: 'hidden',
192 192
             textOverflow: 'ellipsis',
193 193
             whiteSpace: 'nowrap',
194 194
             width: '300px',
195 195
           }}>{data.newsName}</p>
196
-          <p style={{ fontSize: '18px', color: '#555', marginBottom: '10px' }}>
196
+          <p style={{ fontSize: ' 0.11rem', color: '#555', marginBottom: '10px' }}>
197 197
             <span style={{ display: 'inline-block', width: '190px' }}>咨询类型:{data.newsType.newsTypeName}</span>
198 198
             <span>状态:{data.newsStatus == 0 ? "已发布" : "未发布"}</span>
199 199
           </p>
200 200
 
201
-          <p style={{ fontSize: '18px', color: '#555', marginBottom: '10px' }}>
201
+          <p style={{ fontSize: ' 0.11rem', color: '#555', marginBottom: '10px' }}>
202 202
             <span style={{ display: 'inline-block', width: '190px' }}>阅读数量:{data.pvNum}</span>
203 203
             <span>转发数量:{data.shareNum}</span>
204 204
           </p>
205 205
 
206
-          <p style={{ fontSize: '18px', color: '#555', marginBottom: '10px' }}>
206
+          <p style={{ fontSize: ' 0.11rem', color: '#555', marginBottom: '10px' }}>
207 207
             <span style={{ display: 'inline-block', width: '190px' }}>点赞数量:{data.favorNum}</span>
208 208
             <span>收藏数量:{data.saveNum}</span>
209 209
           </p>
210 210
 
211
-          <p style={{ fontSize: '18px', color: '#999', marginBottom: '10px' }}>发布时间:{data.createDate}</p>
211
+          <p style={{ fontSize: ' 0.11rem', color: '#999', marginBottom: '10px' }}>发布时间:{data.createDate}</p>
212 212
         </div>
213 213
       </Card>
214 214
     )

+ 8
- 7
src/pages/news/list/style.less Datei anzeigen

@@ -16,24 +16,25 @@
16 16
     margin: 10px 0px;
17 17
   }
18 18
   .cardText {
19
-    font-size: 18px;
20 19
     color: #333;
21
-    line-height: 24px;
22 20
     display: flex;
23 21
     align-items: center;
24 22
     position: relative;
23
+    line-height: 1.5;
24
+    font-size: 0.11rem;
25
+    margin-bottom: 0.08rem;
25 26
   
26 27
   }
27 28
   .cardItem{
28
-    font-size: 18px;
29
-    font-weight: 400;
30 29
     color: #666;
31
-    line-height: 24px;
32 30
     display: flex;
33 31
     align-items: center;  
32
+    line-height: 1.5;
33
+    font-size: 0.11rem;
34
+    margin-bottom: 0.08rem;
34 35
   }
35 36
   .ediText {
36
-    font-size: 18px;
37
+    font-size: 0.11rem;
37 38
     color: #ff925c;
38 39
     line-height: 24px;
39 40
     position: absolute;
@@ -41,7 +42,7 @@
41 42
   }
42 43
   .title{
43 44
     display: inline-block;
44
-    width: 84px;
45
+    width:  0.54rem;
45 46
     justify-content: space-between;
46 47
     text-align: justify;
47 48
     text-align-last:justify

+ 70
- 36
src/pages/staff/list/RoleList.jsx Datei anzeigen

@@ -7,40 +7,82 @@ import router from 'umi/router';
7 7
 import { Card, Avatar } from 'antd';
8 8
 import request from '../../../utils/request'
9 9
 import Styles from './style.less';
10
-
11
-
12
-function confirm() {
13
-  Modal.confirm({
14
-    title: '确认停用该角色?',
15
-    okText: '确认',
16
-    cancelText: '取消',
17
-    onOk() {
18
-      console.log('OK');
19
-    },
20
-    onCancel() {
21
-      console.log('Cancel');
22
-    },
10
+import apis from '../../../services/apis';
11
+
12
+const header = props => {
13
+// function confirm(id) {
14
+//   Modal.confirm({
15
+//     title: '确认停用该角色?',
16
+//     okText: '确认',
17
+//     cancelText: '取消',
18
+//     onOk() {
19
+//     },
20
+//     onCancel() {
21
+//       console.log('Cancel');
22
+//     },
23
+//   });
24
+// }
25
+
26
+function addRole(roleId) {
27
+  router.push({
28
+    pathname: '/staff/list/addRole',
23 29
   });
24
-
25 30
 }
26
-function toEditRole() {
31
+
32
+function toEditRole(roleId) {
27 33
   router.push({
28 34
     pathname: '/staff/list/addRole',
29 35
     query: {
30
-      a: 'b',
36
+      id: roleId,
31 37
     },
32 38
   });
33 39
 }
40
+const [data, setData] = useState({ data: [] })
41
+// 初始化角色
42
+ useEffect(() => {
43
+   localStorage.removeItem('value');
44
+    getRoleList({ pageNum: 1, pageSize: 100 })
45
+ }, [])
46
+
47
+//  function getRoleList(params) {
48
+//    request({
49
+//      url: '/api/admin/taRole',
50
+//      method: 'GET',
51
+//      params: { ...params },
52
+//  // eslint-disable-next-line no-shadow
53
+//  }).then(data => {
54
+//      console.log(data)
55
+//      setData(data)
56
+//  })
57
+//  }
58
+
59
+ function getRoleList(params) {
60
+  request({ ...apis.role.getRoleList, params: { ...params } }).then((data) => {
61
+    setData(data)
62
+}).catch((err) => {
63
+    console.log(err)
64
+    message.info(err.msg || err.message)
65
+})
66
+}
67
+
34 68
 
69
+function stop(ids) {
70
+  request({ ...apis.role.stop, urlData: { id: ids } }).then((data) => {
71
+    getRoleList({ pageNum: 1, pageSize: 100 })
72
+}).catch((err) => {
73
+    console.log(err)
74
+    message.info(err.msg || err.message)
75
+})
76
+}
35 77
 
36 78
 const dataSource = [
37 79
   {
38 80
     name: '置业顾问',
39
-    status: '1',//显示停用
81
+    status: '1',
40 82
   },
41 83
   {
42 84
     name: '置业经理',
43
-    status: '1',//停用
85
+    status: '1',
44 86
   },
45 87
 ];
46 88
 
@@ -55,10 +97,9 @@ const columns = [
55 97
   // },
56 98
   {
57 99
     title: '角色名称',
58
-    dataIndex: 'name',
59
-    key: 'name',
100
+    dataIndex: 'roleName',
101
+    key: 'roleName',
60 102
     align: 'center',
61
-    render: text => <a>{text}</a>,
62 103
   },
63 104
 
64 105
   {
@@ -67,11 +108,11 @@ const columns = [
67 108
     key: 'status',
68 109
     align: 'center',
69 110
 
70
-    render: () => <>
71
-      <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={confirm}>停用
72
-      <Icon type="stop" className={styles.shoppingCart} style={{fontSize:14}}/>
111
+    render: (text, record) => <>
112
+      <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={() => stop(record.roleId)}>{ record.status === 1 ? '停用' : '启用' }
113
+      <Icon type="stop" className={styles.shoppingCart} style={{ fontSize: 14 }}/>
73 114
       </span>
74
-      <span style={{ color: '#FF925C' }} onClick={toEditRole}>编辑
115
+      <span style={{ color: '#FF925C' }} onClick={() => toEditRole(record.roleId)} >编辑
75 116
       <Icon type="form" className={styles.edit} />
76 117
       </span>
77 118
     </>,
@@ -80,22 +121,15 @@ const columns = [
80 121
 ];
81 122
 
82 123
 
83
-const header = (props) => {
84
-
85
-
86
-
87
-
88
-  return (
124
+return (
89 125
     <>
90
-      <Button type="danger" className={styles.addBtn} onClick={toEditRole}>新增</Button>
126
+      <Button type="danger" className={styles.addBtn} onClick={addRole}>新增</Button>
91 127
       <div className={Styles.roletext}>
92 128
 
93
-        <Table dataSource={dataSource} columns={columns} />
129
+        <Table dataSource={data.records} columns={columns} />
94 130
       </div>
95 131
     </>
96 132
 
97 133
   )
98 134
 }
99
-const WrappedHeader = Form.create({ name: 'header' })(header);
100
-
101
-export default WrappedHeader
135
+export default header

+ 86
- 172
src/pages/staff/list/StaffList.jsx Datei anzeigen

@@ -5,114 +5,23 @@ import { FormattedMessage } from 'umi-plugin-react/locale';
5 5
 import styles from '../../style/GoodsList.less';
6 6
 import router from 'umi/router';
7 7
 import { Card, Avatar } from 'antd';
8
+import apis from '../../../services/apis';
8 9
 import request from '../../../utils/request'
9 10
 import Styles from './style.less';
10 11
 
11 12
 const { Meta } = Card;
12 13
 const { Option } = Select;
13 14
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14
-//标签颜色
15
-const colors = {
16
-  金牌顾问: '#E34B59',
17
-  销售冠军: '#E8747E',
18
-  优选顾问: '#EEC37E',
19
-  人气顾问: '#FDDA9F',
20
-}
21
-// 提交事件
22
-function handleSubmit (e, props) {
23
-  e.preventDefault();
24
-  props.form.validateFields((err, values) => {
25
-    if (!err) {
26
-      console.log('提交数据: ', values)
27
-    }
28
-  });
29
-}
30
-// Change 事件
31
-function handleSelectChange (props) {
32
-  console.log(props)
33
-}
34 15
 
35
-// 分页
36
-function onChange (pageNumber) {
37
-  console.log('Page: ', pageNumber);
38
-}
39 16
 // 跳转到编辑商品
40
-function toEditStaff () {
17
+const toEditStaff = (userId) => () => {
41 18
   router.push({
42 19
     pathname: '/staff/editStaff',
43
-    // query: {
44
-    //   a: 'b',
45
-    // },
46
-  });
47
-}
48
-function confirm () {
49
-  Modal.confirm({
50
-    title: '确认停用该角色?',
51
-    okText: '确认',
52
-    cancelText: '取消',
53
-    onOk () {
54
-      console.log('OK');
55
-    },
56
-    onCancel () {
57
-      console.log('Cancel');
20
+    query: {
21
+      userId
58 22
     },
59 23
   });
60
-
61 24
 }
62
-/**
63
- *
64
- *
65
- * 
66
- */
67
-
68
-// 假数据
69
-const tempData = [
70
-  {
71
-    name: '吴媛',
72
-    status: '1',// 启用
73
-    tel: '133 333 222',
74
-    avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
75
-    labels: ['金牌顾问', '销售冠军'],
76
-  },
77
-  {
78
-    name: '吴媛',
79
-    status: '1',// 启用
80
-    tel: '133 333 333',
81
-    avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
82
-    labels: ['金牌顾问', '销售冠军'],
83
-  },
84
-  {
85
-    name: '吴媛',
86
-    status: '1',// 启用
87
-    tel: '133 333 444',
88
-    avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
89
-    labels: ['金牌顾问', '销售冠军'],
90
-  },
91
-  {
92
-    name: '吴媛',
93
-    status: '1',// 启用
94
-    tel: '133 333 555',
95
-    avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
96
-    labels: ['金牌顾问', '销售冠军'],
97
-  },
98
-  {
99
-    name: '吴媛',
100
-    status: '0',
101
-    tel: '133 333 555',
102
-    avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
103
-    labels: ['金牌顾问', '销售冠军'],
104
-  },
105
-  {
106
-    name: '吴媛',
107
-    status: '1',// 启用
108
-    tel: '133 333 555',
109
-    avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
110
-    labels: ['金牌顾问'],
111
-  },
112
-
113
-
114
-
115
-]
116 25
 
117 26
 
118 27
 /**
@@ -120,52 +29,73 @@ const tempData = [
120 29
  *
121 30
  * @returns
122 31
  */
123
-function CartBody (props) {
32
+const CartBody = (props) => {
124 33
   const { data } = props
125 34
 
35
+  const confirm = (data) => () => {
36
+    console.log(data,"11111")
37
+    if(data.status === 1){
38
+      Modal.confirm({
39
+        title: '确认停用该角色?',
40
+        okText: '确认',
41
+        cancelText: '取消',
42
+        onOk() {
43
+          request({ ...apis.staff.change, urlData: {id:data.userId,type:'off'}}).then((data) => {
44
+            message.info("操作成功")
45
+            props.onFresh()
46
+          })
47
+        }
48
+      });
49
+    }else{
50
+      Modal.confirm({
51
+        title: '确认启用该角色?',
52
+        okText: '确认',
53
+        cancelText: '取消',
54
+        onOk() {
55
+          request({ ...apis.staff.change, urlData: {id:data.userId,type:'on'}}).then((data) => {
56
+            message.info("操作成功")
57
+            props.onFresh()
58
+          })
59
+        }
60
+      });
61
+    }
62
+    
63
+  }
126 64
   return (
127 65
 
128 66
     <Card className={Styles.card}>
129 67
       <div>
130 68
 
131
-        <Avatar src={data.avatar} style={{ width: 94, height: 94 }} />
132
-        <span className={Styles.ediText} style={{ marginLeft: '20px' }} onClick={toEditStaff}>
69
+        <Avatar src={data.avatar} style={{ width: '0.48rem', height: '0.48rem' }} />
70
+        <Button type="link" style={{ marginLeft: '0.04rem', color: '#FF925C', fontSize: '0.11rem' }} onClick={toEditStaff(data.userId)}>
133 71
           编辑
134
-                <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
135
-        </span>
136
-        <span className={Styles.ediText} style={{ marginLeft: '50px' }} onClick={confirm}>
137
-          停用
138
-                <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
139
-        </span>
72
+                <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '0.04rem' }} />
73
+        </Button>
74
+        <Button type="link" style={{ fontSize: ' 0.11rem', color: '#cacaca', position: 'absolute', top: '40px', right: '0' }} onClick={confirm(data)}>
75
+          {data.status === 1 ? '停用' : '启用'}
76
+                <Icon type={data.status===1?'close-circle':'form'} style={{ color: '#C0C4CC', marginLeft: '0.04rem' }} />
77
+        </Button>
78
+        {/* <Button type="link" style={{ fontSize: ' 0.11rem', color: '#FF925C', position: 'absolute', top: '50px', right: '0' }} onClick={confirm}>
79
+          启用
80
+                <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
81
+        </Button> */}
140 82
 
141 83
       </div>
142 84
       <div>
143 85
 
144 86
         <span>
145 87
           {
146
-            data.labels.map((item, index) => {
147
-              const color = colors[item];
148
-              console.log(color, '------');
149
-              return <Tag className={Styles.cardTag} color={color}>{item}</Tag>
88
+            data.taTagsList.map((item, index) => {
89
+              return <Tag className={Styles.cardTag} color={item.tagColor}>{item.tagName}</Tag>
150 90
             })
151 91
           }
152 92
         </span>
153
-        {/* {
154
-           data.label.map((item, index) => (
155
-              
156
-                <Tag className={Styles.cardTag}>{item}</Tag>
157
-          
158
-            ))
159
-            } */}
160
-
161
-        <p className={Styles.cardText} style={{ width: '300px' }}>
162
-          <span>姓名:{data.name}</span>
163
-
164
-          <span style={{ float: "right" }}>状态:{data.status === '1' ? '启用' : '停用'}</span>
165 93
 
94
+        <p className={Styles.cardText} >姓名 : {data.userName}
166 95
         </p>
167
-        <p className={Styles.cardText} style={{ width: '300px' }}>
168
-          <span>电话:{data.tel}</span>
96
+        <p className={Styles.statusText} > 状态 : {data.status === 1 ? '启用' : '停用'} </p>
97
+        <p className={Styles.phoneText} >
98
+          电话 : {data.phone}
169 99
         </p>
170 100
       </div>
171 101
 
@@ -173,31 +103,34 @@ function CartBody (props) {
173 103
   )
174 104
 }
175 105
 
176
-
177 106
 const header = (props) => {
178
-  const [data, setData] = useState({})
179
-  //   const [page, changePage] = useState({})
180
-
181
-  // useEffect(() => {
182
-  //   request({
183
-  //       url: '/api/admin/iBuildingDynamicList',
184
-  //       method: 'GET',
185
-  //       params: {pageNum: 1,pageSize: 10},
186
-  //   }).then((data) => {
187
-  //       console.log(data)
188
-  //       setData(data)
189
-  //   })
190
-  // })
191
-
192
-  // const getList = (e) => {
193
-  //   request({
194
-  //       url: '/api/xxx',
195
-  //       method: 'GET',
196
-  //       params: {},
197
-  //   }).then((data) => {
198
-  //       setData(data)
199
-  //   })
200
-  // }
107
+  const [tempData, setTempData] = useState([])
108
+  useEffect(() => {
109
+    getList({ pageNum: 1, pageSize: 10 });
110
+  }, [])
111
+
112
+  const getList = (params) => {
113
+    request({ ...apis.staff.taUser, params: { ...params } }).then((data) => {
114
+      console.log(data, "listData")
115
+      setTempData(data.records)
116
+    })
117
+  }
118
+
119
+  // 分页
120
+  const onChange = (pageNumber) => {
121
+    getList({ pageNum: pageNumber, pageSize: 10 });
122
+  }
123
+
124
+  // 提交事件
125
+  const handleSubmit = (e, props) => {
126
+    e.preventDefault();
127
+    props.form.validateFields((err, values) => {
128
+      if (!err) {
129
+        console.log('提交数据: ', values)
130
+        getList({ pageNum: 1, pageSize: 10, ...values })
131
+      }
132
+    });
133
+  }
201 134
 
202 135
   const { getFieldDecorator } = props.form
203 136
   return (
@@ -205,7 +138,7 @@ const header = (props) => {
205 138
     <>
206 139
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
207 140
         <Form.Item>
208
-          {getFieldDecorator('name')(
141
+          {getFieldDecorator('userName')(
209 142
             <Input
210 143
               prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
211 144
               placeholder="姓名"
@@ -213,7 +146,7 @@ const header = (props) => {
213 146
           )}
214 147
         </Form.Item>
215 148
         <Form.Item>
216
-          {getFieldDecorator('tel')(
149
+          {getFieldDecorator('phone')(
217 150
             <Input
218 151
               prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
219 152
               placeholder="电话"
@@ -223,30 +156,13 @@ const header = (props) => {
223 156
 
224 157
         <Form.Item>
225 158
 
226
-          {getFieldDecorator('goodState')(
227
-            <Select style={{ width: '180px' }} placeholder="状态" onChange={handleSelectChange}>
159
+          {getFieldDecorator('status')(
160
+            <Select style={{ width: '180px' }} placeholder="状态" >
228 161
               <Option value="1">启用</Option>
229 162
               <Option value="0">停用</Option>
230 163
             </Select>,
231 164
           )}
232 165
         </Form.Item>
233
-        <Form.Item>
234
-          {getFieldDecorator('isMain')(
235
-            <Select style={{ width: '180px' }} placeholder="请选择" onChange={handleSelectChange}>
236
-              <Option value="1">职业顾问</Option>
237
-              <Option value="0">其他</Option>
238
-            </Select>,
239
-          )}
240
-        </Form.Item>
241
-        <Form.Item>
242
-          {getFieldDecorator('name')(
243
-            <Input
244
-              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
245
-              placeholder="标签"
246
-            />,
247
-          )}
248
-        </Form.Item>
249
-
250 166
 
251 167
         <Form.Item>
252 168
           <Button type="primary" htmlType="submit" className={styles.searchBtn}>
@@ -254,22 +170,20 @@ const header = (props) => {
254 170
           </Button>
255 171
         </Form.Item>
256 172
       </Form>
257
-      <Button type="danger" className={styles.addBtn} onClick={toEditStaff}>新增</Button>
258
-
173
+      <Button type="danger" style={{ margin: '20px 0', padding: '2px 36px' }} onClick={toEditStaff()}>新增</Button>
259 174
       <Row style={{ padding: ' 0 10px' }}>
260 175
         {
261 176
           tempData.map((item, index) => (
262 177
             <Col span={6}>
263
-              <CartBody data={item} />
178
+              <CartBody data={item} onFresh={()=> getList({ pageNum: 1, pageSize: 10 })}/>
264 179
             </Col>
265 180
           ))
266 181
         }
267 182
       </Row>
268 183
 
269
-      {/* <Table dataSource={data.records} columns={columns} /> */}
270 184
       {/* 分页  */}
271 185
       <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
272
-        <Pagination showQuickJumper defaultCurrent={1} total={500} onChange={onChange} />
186
+        <Pagination showQuickJumper defaultCurrent={1} total={tempData.total} onChange={onChange} />
273 187
       </div>
274 188
     </>
275 189
   )

+ 235
- 129
src/pages/staff/list/addRole.jsx Datei anzeigen

@@ -1,9 +1,12 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Checkbox, Input, Card } from 'antd';
2
+import { Checkbox, Input, Card, Form, Button,Row,Col } from 'antd';
3 3
 import { connect } from 'dva';
4 4
 import XForm, { FieldTypes } from '../../../components/XForm';
5 5
 import request from '../../../utils/request';
6 6
 import channels from './channelList.less';
7
+import { resolve, join } from 'path';
8
+import router from 'umi/router';
9
+import apis from '../../../services/apis';
7 10
 
8 11
 const { TextArea } = Input;
9 12
 
@@ -14,149 +17,252 @@ const { TextArea } = Input;
14 17
  * @param {*} props
15 18
  * @returns
16 19
  */
17
-const Edit = props => {
18
-  console.log('props,props', props.user.currentUser)
20
+const Poster = props => {
19 21
   const userMenus = props.user.currentUser.menus;
20 22
   const userBtns = props.user.currentUser.buttons;
21 23
 
22
-
24
+  // 获取当前所有菜单
23 25
   const [data, setData] = useState({ data: [] })
24
- // 获取当前所有菜单
26
+  const [buutonDate, setBuutonDate] = useState({})
27
+
28
+  // 展示要显示的菜单和按钮----(编辑)
29
+  const [dataMenuId, setDataMenuId] = useState([])
30
+  const [dataButtonId, setDataButtonId] = useState([])
31
+
25 32
   useEffect(() => {
26
-    localStorage.removeItem('value');
27
-    menuList({ pageNum: 1, pageSize: 100 })
33
+    // 新增和编辑用一个页面
34
+    if (props.location.query) {
35
+      const { id } = props.location.query
36
+      if (id) {
37
+        buttonAndMenuList('', id)
38
+      }
39
+    }
40
+    // menuList({ pageNum: 1, pageSize: 100 })
41
+    buttonList({ pageNum: 1, pageSize: 100 })
28 42
   }, [])
29
-
43
+  // 当前所有的菜单
44
+  // function menuList(params) {
45
+  //   request({
46
+  //     url: '/api/admin/menuList',
47
+  //     method: 'GET',
48
+  //     params: { ...params },
49
+  //     // eslint-disable-next-line no-shadow
50
+  //   }).then(data => {
51
+  //     setData(data)
52
+  //   })
53
+  // }
30 54
   function menuList(params) {
31
-    request({
32
-      url: '/api/admin/menuList',
33
-      method: 'GET',
34
-      params: { ...params },
35
-  // eslint-disable-next-line no-shadow
36
-  }).then(data => {
55
+    request({ ...apis.role.menuList, params: { ...params } }).then((data) => {
56
+      setData(data)
57
+  }).catch((err) => {
58
+      console.log(err)
59
+      message.info(err.msg || err.message)
60
+  })
61
+  }
62
+
63
+  // 所有按钮
64
+  // function buttonList(params) {
65
+  //   request({
66
+  //     url: '/api/admin/buttonList',
67
+  //     method: 'GET',
68
+  //     params: { ...params },
69
+  //     // eslint-disable-next-line no-shadow
70
+  //   }).then(data => {
71
+  //     console.log(data)
72
+  //     setBuutonDate(data)
73
+  //   })
74
+  // }
75
+
76
+  function buttonList(params) {
77
+    request({ ...apis.role.buttonList, params: { ...params } }).then((data) => {
78
+      setBuutonDate(data)
79
+  }).catch((err) => {
80
+      console.log(err)
81
+  })
82
+  }
83
+
84
+
85
+  // 根据角色id查询当前的菜单及其按钮
86
+  // function buttonAndMenuList(params, id) {
87
+  //   console.log('id: ', id)
88
+  //   request({
89
+  //     url: `/api/admin/taRole/details/${id}`,
90
+  //     method: 'GET',
91
+  //     params: { ...params },
92
+  //     // eslint-disable-next-line no-shadow
93
+  //   }).then(data => {
94
+  //     console.log('data.roleName: ', data)
95
+  //     props.form.setFieldsValue({ roleName: data.roleName })
96
+  //     console.log(data)
97
+  //     setData(data)
98
+
99
+  //     // 获取所有的权限Id
100
+  //     if (data.sysMenuList) {
101
+  //       setDataMenuId(data.sysMenuList.map(item => item.menuId))
102
+  //       setDataButtonId((data.sysMenuList.map(item => item.sysButtonInMenu && item.sysButtonInMenu.map(btn => btn.btnId).join(',')).filter(f => f !== '').join(',').split(',')).map(a => parseInt(a)))
103
+  //     }
104
+  //   })
105
+  // }
106
+
107
+  function buttonAndMenuList(params, ids) {
108
+    request({ ...apis.role.buttonAndMenuList, urlData: { id: ids }, params: { ...params } }).then(data => {
109
+      props.form.setFieldsValue({ roleName: data.roleName })
37 110
       console.log(data)
38 111
       setData(data)
112
+
113
+      // 获取所有的权限Id
114
+      if (data.sysMenuList) {
115
+        setDataMenuId(data.sysMenuList.map(item => item.menuId))
116
+        setDataButtonId((data.sysMenuList.map(item => item.sysButtonInMenu && item.sysButtonInMenu.map(btn => btn.btnId).join(',')).filter(f => f !== '').join(',').split(',')).map(a => parseInt(a)))
117
+      }
118
+  }).catch((err) => {
119
+      console.log(err)
120
+      message.info(err.msg || err.message)
39 121
   })
40 122
   }
41 123
 
42
-  // function SuBmenu(params) {
43
-  //  return Array.from(userMenus).map(Item =>
44
-  //  <Checkbox value={ Item.menuId }> { Item.name }</Checkbox>)
124
+  // const [menus, setMenus] = useState([]);
125
+  // 判断menus是否有值
126
+  const [menus, setMenus] = useState([]);
127
+
128
+  const addMenus = m => setMenus([...menus, m])
129
+  const delMenus = m => setMenus(menus.filter(x => x.menuId !== m.menuId));
130
+
131
+  const handleMenuChange = m => e => {
132
+    if (e.target.checked) {
133
+      setDataMenuId(dataMenuId.concat(m.menuId))
134
+      addMenus(m)
135
+    } else {
136
+      setDataMenuId(dataMenuId.filter(item => item !== m.menuId));
137
+      delMenus(m)
138
+    }
139
+  }
140
+
141
+  const [but, setBut] = useState([]);
142
+  // 判断menus是否有值
143
+  const addBut = m => setBut([...but, m])
144
+  const delBut = m => setBut(but.filter(x => x.menuId !== m.menuId));
145
+  const handleButChange = m => e => {
146
+    if (e.target.checked) {
147
+      setDataButtonId(dataButtonId.concat(m.btnId))
148
+      addBut(m)
149
+    } else {
150
+      setDataButtonId(dataButtonId.filter(item => item !== m.btnId));
151
+      delBut(m)
152
+    }
153
+  }
154
+  const gridStyle1 = {
155
+    width: '17%',
156
+    textAlign: 'left',
157
+  };
158
+  const gridStyle2 = {
159
+    width: '80%',
160
+    textAlign: 'left',
161
+    height: '72px',
162
+  };
163
+
164
+  function toRoleList() {
165
+    router.push({
166
+      pathname: '/staff/RoleList',
167
+    });
168
+  }
169
+  // function updateAuthMenu(params) {
170
+  //   request({
171
+  //     url: '/api/admin/updateAuthMenu',
172
+  //     method: 'POST',
173
+  //     data: { ...params },
174
+  //     // eslint-disable-next-line no-shadow
175
+  //   }).then(data => {
176
+  //     toRoleList()
177
+  //   })
45 178
   // }
46
-  // const [tab, changeTab] = useState('basic')
47
-
48
-  const Permission = [
49
-    '项目管理',
50
-    '员工管理',
51
-    '客户管理',
52
-    '系统管理',
53
-    '渠道管理',
54
-    '轮播图管理',
55
-    '资讯管理',
56
-    '活动管理',
57
-    '积分商城',
58
-    '首页数据',
59
-  ]
60
-
61
-  const Poster = props => {
62
-    const dataSource = [
63
-      {
64
-        name: '员工管理',
65
-        per: [
66
-          '111111',
67
-          '22222',
68
-          '33333',
69
-        ],
70
-      },
71
-      {
72
-        name: '角色管理',
73
-        per: [
74
-          '444',
75
-          '555',
76
-          '666',
77
-        ],
78
-      },
79
-    ];
80
-
81
-
82
-    const gridStyle1 = {
83
-      width: '20%',
84
-      textAlign: 'left',
85
-    };
86
-    const gridStyle2 = {
87
-      width: '80%',
88
-      textAlign: 'left',
89
-      height: '69px',
90
-    };
91
-
92
-    return (
93
-    <>
94
-      <div style={{}}>
95
-        {userMenus.map(item => (
96
-          <Card title={<Checkbox>{item.name}</Checkbox>} bordered style={{ width: '100%' }}>
97
-              {
98
-                   userMenus.map(menu => (
99
-
100
-                    (item.menuId === menu.menuRoot && item.menuId !== menu.menuId) &&
101
-                    <>
102
-                      <Card.Grid style={gridStyle1} >
103
-                          <Checkbox>{menu.name}</Checkbox>
104
-                      </Card.Grid>
105
-                      <Card.Grid style={gridStyle2}>
106
-                        {userBtns.map(btn => (
107
-                          <>
108
-                            {
109
-                              btn.menuId === menu.menuId &&
110
-                              <Checkbox>{btn.name}</Checkbox>
111
-                            }
112
-                          </>
113
-                        ))}
114
-                      </Card.Grid>
115
-                   </>
116
-                   ))
117
-              }
118
-          </Card>
119
-        ))}
120
-      </div>
121
-    </>
122
-    )
179
+
180
+  function updateAuthMenu(data) {
181
+    request({ ...apis.role.updateAuthMenu, data: { ...data } }).then((data) => {
182
+      toRoleList()
183
+  }).catch((err) => {
184
+      console.log(err)
185
+  })
123 186
   }
124 187
 
125
-  const fields = [
126
-    {
127
-      label: '角色名称',
128
-      name: 'roleName',
129
-      type: FieldTypes.Text,
130
-      // placeholder: '名称',
131
-      value: ''
132
-    },
133
-    {
134
-      label: '简介',
135
-      name: 'roleIntroduction',
136
-      render: <TextArea className={channels.inpuitTxt} ></TextArea>,
137
-      value: ''
138
-
139
-    },
140
-
141
-    {
142
-      label: '菜单权限',
143
-      name: 'rolePermission',
144
-      render:
145
-        <>
146
-          <div>
147
-
148
-            <Poster />
149
-          </div>
150
-        </>,
151
-    },
152
-
153
-  ]
154
-
155
-  const handleSubmit = val => {
156
-    window.console.log('submit data --->', val)
188
+
189
+  function handleSubmit(e) {
190
+    e.preventDefault();
191
+    props.form.validateFields((err, values) => {
192
+      if (props.location.query.id !== undefined) {
193
+        console.log('menus', menus)
194
+      
195
+        const sumitMenu = userMenus.filter(item => dataMenuId.includes(item.menuId))
196
+        const sumitBtn = buutonDate.filter(item => dataButtonId.includes(item.btnId))
197
+        // console.log('sumitMenu', sumitMenu)
198
+        // console.log('sumitBtn', sumitBtn)
199
+        // console.log('sumitMenu', sumitMenu)
200
+        // const sumitBut = data.sysMenuList[0].sysButtonInMenu.concat(but)
201
+        updateAuthMenu({ sysMenu: sumitMenu, name: values.roleName, id: props.location.query.id, sysButton: sumitBtn })
202
+      } else {
203
+        updateAuthMenu({ sysMenu: menus, name: values.roleName, id: props.location.query.id, sysButton: but })
204
+        }
205
+    });
157 206
   }
158
-  return <XForm onSubmit={handleSubmit} fields={fields}></XForm>
159
-}
207
+  const { getFieldDecorator } = props.form;
208
+  return (
209
+    <>
210
+      <div >
211
+        <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
212
+          <Form.Item label="角色名称">
213
+            {getFieldDecorator('roleName', {
214
+              rules: [{ required: true, message: '请输入角色名称' }],
215
+            })(<Input className={channels.inpuit} />)}
216
+
217
+          </Form.Item>
218
+          {userMenus.map(item => (
219
+            (item.parentCode === '-1') &&
220
+            <Row >
221
+              <Col span={7}>
222
+
223
+              </Col>
224
+              <Col span={17}>
160 225
 
161 226
 
162
-export default connect(({ user }) => ({ user }))(Edit);
227
+                <Card title={<Checkbox checked={dataMenuId.includes(item.menuId)} onChange={handleMenuChange(item)}>{item.name}</Checkbox>} bordered style={{ width: '100%', alignItems: 'center' }} >
228
+                  {
229
+                    userMenus.map(menu => (
230
+
231
+                      (item.menuId === menu.menuRoot && item.menuId !== menu.menuId) &&
232
+                      <>
233
+                        <Card.Grid style={gridStyle1} >
234
+                          <Checkbox checked={dataMenuId.includes(menu.menuId)} onChange={handleMenuChange(menu)}>{menu.name}</Checkbox>
235
+                        </Card.Grid>
236
+                        <Card.Grid style={gridStyle2}>
237
+                          {buutonDate.length > 0 && buutonDate.map(btn => (
238
+                            <>
239
+                              {
240
+                                btn.menuId === menu.menuId &&
241
+                                <Checkbox checked={dataButtonId.includes(btn.btnId)} onChange={handleButChange(btn)}>{btn.name}</Checkbox>
242
+                              }
243
+                            </>
244
+                          ))}
245
+                        </Card.Grid>
246
+                      </>
247
+                    ))
248
+                  }
249
+                </Card>
250
+              </Col>
251
+
252
+            </Row>
253
+          ))}
254
+          <Form.Item wrapperCol={{ span: 15, offset: 7 }} style={{ marginTop: '10px' }}>
255
+            <Button type="primary" htmlType="submit">
256
+              保存
257
+          </Button>
258
+            <Button className={channels.formButton} htmlType="submit" onChange = {toRoleList}>
259
+              取消
260
+          </Button>
261
+          </Form.Item>
262
+        </Form>
263
+      </div>
264
+    </>
265
+  )
266
+}
267
+const WrappedNormalLoginForm = Form.create({ name: 'Poster' })(Poster);
268
+export default connect(({ user }) => ({ user }))(WrappedNormalLoginForm);

+ 86
- 140
src/pages/staff/list/editRole.jsx Datei anzeigen

@@ -1,12 +1,10 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Checkbox, Row, Col, Input, Menu, Dropdown, Button, Icon, message, Table, Tooltip, Tabs, Radio, Divider, Tag, DatePicker, Select, Form, Alert, Card } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import styles from '../../style/GoodsList.less';
2
+import { Checkbox, Input, Card } from 'antd';
3
+import { connect } from 'dva';
5 4
 import XForm, { FieldTypes } from '../../../components/XForm';
6
-import Wangedit from '../../../components/Wangedit/Wangedit';
7 5
 import request from '../../../utils/request';
8 6
 import channels from './channelList.less';
9
-import Tagss from '../components/Tagss.jsx';
7
+import { resolve } from 'path';
10 8
 
11 9
 const { TextArea } = Input;
12 10
 
@@ -17,7 +15,11 @@ const { TextArea } = Input;
17 15
  * @param {*} props
18 16
  * @returns
19 17
  */
20
-const Edit = (props) => {
18
+const Edit = props => {
19
+  console.log('props,props', props.user.currentUser)
20
+  const userMenus = props.user.currentUser.menus;
21
+  const userBtns = props.user.currentUser.buttons;
22
+
21 23
   const [data, setData] = useState({ data: [] })
22 24
  // 获取当前所有菜单
23 25
   useEffect(() => {
@@ -36,6 +38,11 @@ const Edit = (props) => {
36 38
       setData(data)
37 39
   })
38 40
   }
41
+
42
+  // function SuBmenu(params) {
43
+  //  return Array.from(userMenus).map(Item =>
44
+  //  <Checkbox value={ Item.menuId }> { Item.name }</Checkbox>)
45
+  // }
39 46
   // const [tab, changeTab] = useState('basic')
40 47
 
41 48
   const Permission = [
@@ -51,80 +58,47 @@ const Edit = (props) => {
51 58
     '首页数据',
52 59
   ]
53 60
 
54
-  // const Basic = (props) => {
55
-
56
-  //   const dataSource = [
57
-
58
-
59
-  //     {
60
-  //       name: '员工管理',
61
-  //       per: [
62
-  //         '111111',
63
-  //         '22222',
64
-  //         '33333',
65
-  //       ]
66
-  //     },
67
-  //     {
68
-  //       name: '角色管理',
69
-  //       per: [
70
-  //         '444',
71
-  //         '555',
72
-  //         '666',
73
-  //       ]
74
-  //     },
75
-  //   ];
76
-
77
-  //   const columns = [
78
-  //     // {
79
-  //     //   title: '商品图片',
80
-  //     //   dataIndex: 'img',
81
-  //     //   key: 'img',
82
-  //     //   align: 'center',
83
-
84
-  //     //   render: (text, record) => <img src={record.img} className={channels.touxiang} />,
85
-  //     // },
86
-  //     {
87
-  //       title: '员工管理',
88
-  //       dataIndex: 'name',
89
-  //       key: 'name',
90
-  //       align: 'left',
91
-  //       render: text => <a>{text}</a>,
92
-  //     },
93
-
94
-  //     {
95
-  //       // title: '操作  ',
96
-  //       dataIndex: 'status',
97
-  //       key: 'per',
98
-  //       align: 'left',
99
-  //       render: () => <>
100
-  //         {/* {pre.map((item,index)=>(
101
-  //       <Checkbox>{item[index]}</Checkbox>
102
-
103
-
104
-  //               ))} */}
105
-  //       </>,
106
-  //     },
107
-  //   ];
108
-  //   return <Table dataSource={dataSource} columns={columns} />
109
-
110
-
61
+  const Poster = props => {
62
+    const [menus, setMenus] = useState([]);
63
+// 判断menus是否有值
64
+    const addMenus = m => setMenus([...menus, m]);
65
+    const delMenus = m => setMenus(menus.filter(x => x.menuId !== m.menuId));
66
+    const handleMenuChange = m => e => {
67
+      console.log('e', m)
68
+      if (e.target.checked) {
69
+        addMenus(m)
70
+      } else {
71
+        delMenus(m)
72
+      }
73
+      console.log('menus', menus)
74
+    }
111 75
 
76
+    const [but, setBut] = useState([]);
77
+    // 判断menus是否有值
78
+        const addBut = m => setBut([...but, m]);
79
+        const delBut = m => setBut(but.filter(x => x.menuId !== m.menuId));
80
+        const handleButChange = m => e => {
81
+          console.log('e', m)
82
+          if (e.target.checked) {
83
+            addBut(m)
84
+          } else {
85
+            delBut(m)
86
+          }
87
+          // console.log('menus', menus)
112 88
 
113
-  // }
114
-  // const [Card] = useState('Poster')
89
+          console.log('menus', menus)
90
+          console.log('but', but)
91
+        }
115 92
 
116
-  const Poster = props => {
117 93
 
118 94
     const dataSource = [
119
-
120
-
121 95
       {
122 96
         name: '员工管理',
123 97
         per: [
124 98
           '111111',
125 99
           '22222',
126 100
           '33333',
127
-        ]
101
+        ],
128 102
       },
129 103
       {
130 104
         name: '角色管理',
@@ -132,7 +106,7 @@ const Edit = (props) => {
132 106
           '444',
133 107
           '555',
134 108
           '666',
135
-        ]
109
+        ],
136 110
       },
137 111
     ];
138 112
 
@@ -144,45 +118,45 @@ const Edit = (props) => {
144 118
     const gridStyle2 = {
145 119
       width: '80%',
146 120
       textAlign: 'left',
121
+      height: '69px',
147 122
     };
148 123
 
149
-    {/* <Checkbox>{Permission[index]}</Checkbox> */ }
150
-    return <>
124
+    return (
125
+    <>
151 126
       <div style={{}}>
152
-      {Array.from(data).map(Item =>
153
-                <Checkbox value={ Item.menuId }> { Item.name } </Checkbox>,
154
-              )}
155
-        {Permission.map((item, index) => (
156
-          <Card title={<Checkbox>{Permission[index]}</Checkbox>} bordered={true} style={{ width: '100%' }}>
157
-            
158
-              {dataSource.map((items, indexs) => (
159
-              <>
160
-                <Card.Grid style={gridStyle1}><Checkbox value=''>{items.name}</Checkbox></Card.Grid>
161
-
162
-                <Card.Grid style={gridStyle2}>
163
-                  {items.per.map((itemss, indexss) => (
164
-                    <Checkbox value=''>{items.per[indexss]}</Checkbox>
165
-                  ))}
166
-                </Card.Grid>
167
-              </>
168
-            ))}
169
-
127
+        {/* { console.log('userMenus', userMenus) }
128
+        { console.log('userBtns', userBtns) } */}
129
+        {userMenus.map(item => (
130
+          (item.parentCode === '-1') &&
131
+          <Card title={<Checkbox onChange={handleMenuChange(item)}>{item.name}</Checkbox>} bordered style={{ width: '100%' }}>
132
+              {
133
+                   userMenus.map(menu => (
134
+
135
+                    (item.menuId === menu.menuRoot && item.menuId !== menu.menuId) &&
136
+                    <>
137
+                      <Card.Grid style={gridStyle1} >
138
+                          <Checkbox onChange={handleMenuChange(menu)}>{menu.name}</Checkbox>
139
+                      </Card.Grid>
140
+                      <Card.Grid style={gridStyle2}>
141
+                        {userBtns.map(btn => (
142
+                          <>
143
+                            {
144
+                              btn.menuId === menu.menuId &&
145
+                              <Checkbox onChange={handleButChange(btn)}>{btn.name}</Checkbox>
146
+                            }
147
+                          </>
148
+                        ))}
149
+                      </Card.Grid>
150
+                   </>
151
+                   ))
152
+              }
170 153
           </Card>
171
-
172
-
173
-
174 154
         ))}
175 155
       </div>
176 156
     </>
157
+    )
177 158
   }
178 159
 
179
-  const Share = (props) => {
180
-    return <div>Share</div>
181
-  }
182
-
183
-
184
-
185
-
186 160
   const fields = [
187 161
     {
188 162
       label: '角色名称',
@@ -191,9 +165,6 @@ const Edit = (props) => {
191 165
       // placeholder: '名称',
192 166
       value: ''
193 167
     },
194
-
195
-
196
-
197 168
     {
198 169
       label: '简介',
199 170
       name: 'roleIntroduction',
@@ -208,50 +179,25 @@ const Edit = (props) => {
208 179
       render:
209 180
         <>
210 181
           <div>
211
-
212
-            <Poster />
213
-
214
-            {/* <Radio.Group value={tab} defaultValue="1" buttonStyle="solid">
215
-             
216
-        <Checkbox>Checkbox</Checkbox>
217
-                {Permission.map((item,index)=>(
218
-                  <Radio.Button style={BottonStyle} value="{index}">{Permission[index]}</Radio.Button>
219
-                 
220
-                ))}
221
-            </Radio.Group>
222
-          
223
-          </div>
224
-          <div>
225
-             
226
-          <Table dataSource={Permission[index]} columns={columns} />
227
-           
228
-             */}
182
+            <Poster/>
229 183
           </div>
230 184
         </>,
231
-
232
-    }
233
-    // {
234
-    //   label: '状态',
235
-    //   name: 'roleState',
236
-    //   render: <Radio.Group>
237
-    //     <Radio.Button style={{background:'#f0f0f0'}} value="a">禁用</Radio.Button>
238
-    //     <Radio.Button style={{background:'#f0f0f0',color:'#ff7e48'}} value="b">启用</Radio.Button>
239
-    //   </Radio.Group>,
240
-    //   value: 'b'
241
-    // },
185
+    },
242 186
 
243 187
   ]
244 188
 
245 189
   const handleSubmit = val => {
246 190
     window.console.log('submit data --->', val)
191
+    request({
192
+      url: '/api/admin/menuList',
193
+      method: 'POST',
194
+      params: { ...params },
195
+  // eslint-disable-next-line no-shadow
196
+  }).then(data => {
197
+      console.log(data)
198
+      setData(data)
199
+  })
247 200
   }
248 201
   return <XForm onSubmit={handleSubmit} fields={fields}></XForm>
249
-
250
-
251
-
252
-
253 202
 }
254
-
255
-
256
-
257
-export default Edit
203
+export default connect(({ user }) => ({ user }))(Edit);

+ 88
- 51
src/pages/staff/list/editStaff.jsx Datei anzeigen

@@ -1,15 +1,19 @@
1
-import React, { useState } from 'react';
1
+import React, { useState, useEffect } from 'react';
2 2
 
3 3
 import { Input, Menu, Dropdown, Button, Icon, message, Table, Tooltip, Tabs, Radio, Divider, Tag, Select, Form, Alert } from 'antd';
4 4
 import { FormattedMessage } from 'umi-plugin-react/locale';
5
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
6
+import router from 'umi/router';
5 7
 import styles from '../../style/GoodsList.less';
6 8
 import XForm, { FieldTypes } from '../../../components/XForm';
7 9
 import Wangedit from '../../../components/Wangedit/Wangedit'
8 10
 import channels from './channelList.less';
9
-
10 11
 import Tagss from '../components/Tagss.jsx';
12
+import apis from '../../../services/apis';
13
+import request from '../../../utils/request'
11 14
 
12 15
 const { TextArea } = Input;
16
+const { Option } = Select;
13 17
 
14 18
 
15 19
 /**
@@ -19,113 +23,146 @@ const { TextArea } = Input;
19 23
  * @returns
20 24
  */
21 25
 const Edit = (props) => {
26
+  const userId = props.location.query.userId
27
+  const [userData, setUserData] = useState({})
28
+  const [tagData, setTagData] = useState([])
29
+
30
+  const getTagList = () => {
31
+    request({ ...apis.staff.taTags, params: {pageNum:1,pageSize:999} }).then((data) => {
32
+      setTagData(data.records)
33
+    })
34
+  }
35
+
36
+  // 查询列表
37
+  const getUserData = (userId) => {
38
+    request({ ...apis.staff.getTaUser, urlData: {id:userId} }).then((data) => {
39
+      console.log(data,"tauser")
40
+      setUserData(data)
41
+    })
42
+  }
43
+
44
+  useEffect(() => {
45
+    getTagList();
46
+    if (userId) {
47
+      getUserData(userId);
48
+    }
49
+  }, [])
50
+
51
+  const tagsChange = (value) => {
52
+    console.log(`selected ${value}`);
53
+  }
54
+
55
+  const handleSubmit = val => {
56
+    if(userId){
57
+      request({ ...apis.staff.updateTaUser, urlData: {id:userId},data: val, }).then((data) => {
58
+        console.log(data,"tauser")
59
+        message.info("保存成功")
60
+        router.go(-1)
61
+      })
62
+    }else{
63
+      request({ ...apis.staff.addTaUser, data: val, }).then((data) => {
64
+        console.log(data,"tauser")
65
+        message.info("保存成功")
66
+        router.go(-1)
67
+      })
68
+    }
69
+  }
22 70
 
23 71
   const fields = [
24 72
     {
25 73
       label: '名称',
26
-      name: 'staffName',
74
+      name: 'userName',
27 75
       type: FieldTypes.Text,
28
-      // placeholder: '名称',
29
-      value: ''
76
+      value: userData.userName
30 77
     },
31 78
     {
32 79
       label: '公司',
33
-      name: 'staffCompany',
80
+      name: 'orgName',
34 81
       type: FieldTypes.Text,
35 82
       placeholder: '请输入公司名称',
36
-      value: ''
83
+      value: userData.orgName
37 84
     },
38 85
     {
39 86
       label: '部门',
40
-      name: 'staffDepartment',
87
+      name: 'department',
41 88
       type: FieldTypes.Text,
42 89
       placeholder: '请输入部门',
43
-      value: ''
90
+      value: userData.department
44 91
     },
45 92
     {
46 93
       label: '职位',
47
-      name: 'staffPosition',
94
+      name: 'position',
48 95
       type: FieldTypes.Text,
49 96
       placeholder: '请输入职位',
50
-      value: ''
97
+      value: userData.position
51 98
     },
52 99
     {
53 100
       label: '电话',
54
-      name: 'staffTel',
101
+      name: 'phone',
55 102
       type: FieldTypes.Text,
56 103
       placeholder: '请输入电话号码',
57
-      value: ''
58
-      // rules: [
59
-      //   { message: '请输入电话号码'}
60
-      // ]
104
+      value: userData.phone,
61 105
     },
62 106
     {
63 107
       label: '标签',
64
-      name: 'staffTag',
65
-      render: 
66
-      <Tagss/>
67
-     
68
-   
108
+      name: 'taTags',
109
+      render: <Select
110
+                mode="multiple"
111
+                style={{ width: '100%' }}
112
+                placeholder="请选择标签"
113
+                onChange={tagsChange} >
114
+                  {tagData.map(item => (
115
+                    <Select.Option key={item.tagId} value={item.tagId}>
116
+                      {item.tagName}
117
+                    </Select.Option>
118
+                  ))}
119
+              </Select>,
120
+      value: userData.taTags,
69 121
     },
70 122
     {
71 123
       label: '地址',
72
-      name: 'staffAddress',
124
+      name: 'address',
73 125
       type: FieldTypes.Text,
74 126
       placeholder: '请输入地址',
75
-      value: ''
127
+      value: userData.address
76 128
 
77 129
     },
78 130
     {
79 131
       label: '授权项目',
80
-      name: 'staffProject',
81
-      type: FieldTypes.Select,
82
-      placeholder: '请选择',
83
-      value: ''
132
+      name: 'buildingId',
133
+      render: <BuildSelect />,
134
+      value: userData.buildingId
84 135
     },
85
-
86
-    // {
87
-    //   label: '授权项目',
88
-    //   name: 'staffProject',
89
-    //   type: FieldTypes.Text,
90
-    //   placeholder: '请选择'
91
-    // },
92
-
93 136
     {
94 137
       label: '图片',
95
-      name: 'staffImage',
138
+      name: 'photo',
96 139
       type: FieldTypes.ImageUploader,
97 140
       extra: '建议图片大小 640 * 640',
98
-      value: ''
141
+      value: userData.photo
99 142
     },
100 143
 
101 144
 
102 145
     {
103 146
       label: '简介',
104
-      name: 'staffIntroduction',
147
+      name: 'description',
105 148
       render: <TextArea className={channels.inpuitTxt} ></TextArea>,
106
-      value: ''
149
+      value: userData.description
107 150
 
108 151
     },
109 152
     {
110 153
       label: '状态',
111
-      name: 'staffstate',
154
+      name: 'status',
112 155
       render: <Radio.Group>
113
-        <Radio.Button style={{background:'#f0f0f0'}} value="a">禁用</Radio.Button>
114
-        <Radio.Button style={{background:'#f0f0f0',color:'#ff7e48'}} value="b">启用</Radio.Button>
156
+        <Radio.Button style={{background:'#f0f0f0'}} value="0">禁用</Radio.Button>
157
+        <Radio.Button style={{background:'#f0f0f0',color:'#ff7e48'}} value="1">启用</Radio.Button>
115 158
       </Radio.Group>,
116
-      value: 'b'
159
+      value: null != userData.status ? userData.status : '1'
117 160
     },
118
-
119 161
   ]
120 162
 
121
-  const handleSubmit = val => {
122
-    window.console.log('submit data --->', val)
123
-  }
124
-  return <XForm onSubmit={handleSubmit} fields={fields} push={8}></XForm>
125
-
126
-
127
-
163
+  console.log('--------->', fields)
128 164
 
165
+  return <XForm onSubmit={handleSubmit} fields={fields}></XForm>
129 166
 }
130 167
 
131 168
 

+ 28
- 36
src/pages/staff/list/style.less Datei anzeigen

@@ -11,78 +11,70 @@
11 11
   border: 1px solid #dbdbdb;
12 12
 }
13 13
 
14
-.addButton {
15
-  // background: #50be00;
16
-  border-radius: 4px;
17
-  border: 0px;
18
-  margin: 10px 0px;
19
-}
20 14
 
21 15
 .card {
22
-  width: 348px;
23
-  height: 244px;
16
+  min-width: 240px;
17
+  margin-right: 0.1rem;
18
+  height: 240px;
24 19
   background: rgba(255, 255, 255, 1);
25 20
   box-shadow: 0px 0px 16px 2px rgba(0, 0, 0, 0.12);
26 21
   border-radius: 12px;
27 22
   margin-bottom: 40px;
28
-
23
+  position: relative;
24
+  
29 25
 }
30 26
 
31 27
 .cardText {
32
-
33
-  height: 28px;
34
-  font-size: 20px;
35
-  font-weight: 400;
28
+  font-size: 0.12rem;
36 29
   color: rgba(102, 102, 102, 1);
37
-  line-height: 28px;
38
-  margin-top: 10px;
39
-  margin-bottom: 0;
40
-
30
+  position: absolute;
31
+  bottom:0.28rem;
32
+}
33
+.statusText {
34
+  font-size: 0.12rem;
35
+  color: rgba(102, 102, 102, 1);
36
+  position: absolute;
37
+  bottom:0.28rem;
38
+  right: 20px;
39
+}
40
+.phoneText{
41
+  font-size: 0.12rem;
42
+  color: rgba(102, 102, 102, 1);
43
+  position: absolute;
44
+  bottom:0.05rem;
41 45
 }
42 46
 
43 47
 .cardItem {
44
-  font-size: 18px;
45
-  font-weight: 400;
46 48
   color: #666;
47
-  line-height: 24px;
48 49
   display: flex;
49 50
   align-items: center;
51
+  line-height: 1.5;
52
+  font-size: 0.11rem;
53
+  margin-bottom: 0.08rem;
50 54
 }
51 55
 
52
-.ediText {
53
-  width: 36px;
54
-  height: 25px;
55
-  font-size: 18px;
56
-
57
-  font-weight: 400;
58
-  color: rgba(255, 146, 92, 1);
59
-  line-height: 25px;
60
-
61
-}
62 56
 
63 57
 .cardTag {
64
-  height: 18px;
65 58
   font-size: 10px;
66
-  // background: #fdce22;
67 59
   border-radius: 4px;
68 60
   color: #ffffff;
69
-  line-height: 14px;
61
+  line-height: 16px;
70 62
   margin-top: 10px;
71 63
   padding: 1px 3px;
64
+
72 65
 }
73 66
 
74 67
 .title {
75 68
   display: inline-block;
76
-  width: 84px;
69
+  width:  0.54rem;
77 70
   justify-content: space-between;
78 71
   text-align: justify;
79
-  text-align-last: justify
72
+  text-align-last: justify;
80 73
 }
81 74
 
82 75
 
83 76
 .roletext {
84 77
   font-size: 20px;
85
-
86 78
   font-weight: 400;
87 79
   color: rgba(51, 51, 51, 1);
88 80
   line-height: 28px;

+ 4
- 14
src/pages/system/editPolicy.jsx Datei anzeigen

@@ -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 Datei anzeigen

@@ -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: '' });

+ 6
- 13
src/pages/system/intention.jsx Datei anzeigen

@@ -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
   }
@@ -66,8 +59,8 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
66 59
         <BuildSelect onChange={changBuilding}/>
67 60
       </Col>
68 61
     </Row>
69
-    <Row>
70
-      <Col span={3} offset={3}>
62
+    <Row style={{margin:'10px 0'}}>
63
+      <Col span={5} offset={2}>
71 64
         用户操作
72 65
       </Col>
73 66
       <Col span={3} offset={3}>
@@ -76,7 +69,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
76 69
     </Row>
77 70
     {data.map((x) => {
78 71
       return <Row>
79
-                <Col span={3} offset={3}>
72
+                <Col span={5} offset={2}>
80 73
                   <Checkbox checked={x.checkbox} onChange={changeBox(x)}>{x.eventName}</Checkbox>
81 74
                 </Col>
82 75
                 <Col span={3} offset={3}>

+ 2
- 6
src/pages/system/messageList.jsx Datei anzeigen

@@ -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 Datei anzeigen

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

+ 1
- 1
src/pages/user/login/components/Login/index.jsx Datei anzeigen

@@ -118,7 +118,7 @@ class Login extends Component {
118 118
           <div className={styles.con}>
119 119
             <p className={styles.welcome}>Welcome</p>
120 120
             <div className={styles.title}>
121
-              <span style={{fontSize:'18px',lineHeight:'18px'}}>ying xiao yun</span>
121
+              <span style={{fontSize:' 0.11rem',lineHeight:' 0.11rem'}}>ying xiao yun</span>
122 122
               <p className={styles.name}>营销云·系统</p>
123 123
             </div>
124 124
           </div>

+ 11
- 4
src/pages/user/login/components/Login/index.less Datei anzeigen

@@ -38,11 +38,11 @@ position: relative;
38 38
 }
39 39
 .login {
40 40
   background-color: #fff;
41
-  width:580px;
42
-  height:480px;
43
-  padding:120px 50px;
41
+  width:100%;
42
+  height:58vh;
44 43
   border-radius:0px 30px 30px 0px;
45 44
   margin: 0 auto;
45
+  padding: 10vh 0;
46 46
   :global {
47 47
     .ant-tabs .ant-tabs-bar {
48 48
       margin-bottom: 24px;
@@ -52,6 +52,13 @@ position: relative;
52 52
     .ant-form-item {
53 53
       margin: 0 2px 24px;
54 54
     }
55
+    .ant-input-affix-wrapper,.ant-form-item-control{ 
56
+      width: 36vw;
57
+      max-width: 600px;
58
+      min-width: 200px;
59
+      margin: 0 auto;
60
+      display: block;
61
+      }
55 62
   }
56 63
 
57 64
   .getCaptcha {
@@ -84,7 +91,7 @@ position: relative;
84 91
 
85 92
   .prefixIcon {
86 93
     color: #fff;
87
-    font-size: 18px;
94
+    font-size:  0.11rem;
88 95
     background-color: #EF273A;
89 96
     padding: 3px 4px;
90 97
   }

+ 2
- 6
src/pages/user/login/index.jsx Datei anzeigen

@@ -91,9 +91,7 @@ class Login extends Component {
91 91
         >
92 92
           <UserName
93 93
             name="loginName"
94
-            placeholder={`${formatMessage({
95
-              id: 'user-login.login.userName',
96
-            })}: admin or user`}
94
+            placeholder="请输入用户名"
97 95
             rules={[
98 96
               {
99 97
                 required: true,
@@ -105,9 +103,7 @@ class Login extends Component {
105 103
           />
106 104
           <Password
107 105
             name="loginPassword"
108
-            placeholder={`${formatMessage({
109
-              id: 'user-login.login.password',
110
-            })}: ant.design`}
106
+            placeholder="请输入密码"
111 107
             rules={[
112 108
               {
113 109
                 required: true,

+ 1
- 1
src/pages/user/login/style.less Datei anzeigen

@@ -4,7 +4,7 @@
4 4
   // width: 368px;
5 5
   margin: 0 auto;
6 6
   @media screen and (max-width: @screen-sm) {
7
-    width: 95%;
7
+    width: 100%;
8 8
   }
9 9
 
10 10
   .icon {

+ 360
- 47
src/services/apis.js Datei anzeigen

@@ -2,147 +2,189 @@ const prefix = '/api/admin'
2 2
 
3 3
 export default {
4 4
   image: {
5
-    upload: {
5
+    uploadForAnt: {
6 6
       url: `${prefix}/antd/image`,
7 7
       method: 'POST',
8
-    }
8
+    },
9
+    upload: {
10
+      url: `${prefix}/image`,
11
+      method: 'POST',
12
+    },
9 13
   },
10 14
   user: {
11 15
     current: {
12 16
       method: 'GET',
13 17
       url: `${prefix}/taUser/current`,
18
+      action: 'admin.taUser.current.get',
14 19
     },
15 20
     signin: {
16 21
       method: 'POST',
17 22
       url: `${prefix}/taUser/signin`,
23
+      login: true,
24
+      action: 'admin.taUser.signin.post',
18 25
     },
19 26
     signout: {
20 27
       method: 'POST',
21 28
       url: `${prefix}/taUser/signout`,
29
+      logout: true
22 30
     },
23 31
   },
24 32
   building: {
25 33
     getList: {
26 34
       method: 'GET',
27 35
       url: `${prefix}/buildinglist`,
36
+      action: 'admin.buildinglist.get',
28 37
     },
29 38
     updateStatus: {
30 39
       method: 'PUT',
31 40
       url: `${prefix}/building/update/status`,
41
+      action: 'admin.building.update.status.put',
32 42
     },
33 43
     addBuilding: {
34 44
       method: 'POST',
35 45
       url: `${prefix}/building/add`,
46
+      action: 'admin.building.add.post',
47
+    },
48
+    updateBuilding: {
49
+      method: 'PUT',
50
+      url: `${prefix}/building/update`,
51
+      action: 'admin.building.update.put',
36 52
     },
37 53
     buildingGetById: {
38 54
       method: 'GET',
39 55
       url: `${prefix}/buildingSelectId/id`,
56
+      action: 'admin.buildingSelectId.id.get',
40 57
     },
41 58
     deleteBuilding: {
42 59
       method: 'DELETE',
43 60
       url: `${prefix}/building/delete/id`,
61
+      action: 'admin.building.delete.id.delete',
44 62
     },
45 63
     buildingApartment: {
46 64
       method: 'GET',
47 65
       url: `${prefix}/buildingApartment/buildingId/id`,
66
+      action: 'admin.buildingApartment.buildingId.id.get',
48 67
     },
49 68
     buildingApartmentGetById: {
50 69
       method: 'GET',
51 70
       url: `${prefix}/buildingApartment/id`,
71
+      action: 'admin.buildingApartment.id.get',
52 72
     },
53 73
     buildingApartmentUpdate: {
54 74
       method: 'PUT',
55 75
       url: `${prefix}/buildingApartment/update`,
76
+      action: 'admin.buildingApartment.update.put',
56 77
     },
57 78
     buildingApartmentAdd: {
58 79
       method: 'POST',
59 80
       url: `${prefix}/buildingApartment/add`,
81
+      action: 'admin.buildingApartment.add.post',
60 82
     },
61 83
     buildingApartmentDelete: {
62 84
       method: 'DELETE',
63 85
       url: `${prefix}/apartment/deleted/id`,
86
+      action: 'admin.apartment.deleted.id.delete',
64 87
     },
65 88
   },
66 89
   buildingType: {
67 90
     getList: {
68 91
       method: 'GET',
69 92
       url: `${prefix}/tdBuildingType`,
93
+      action: 'admin.tdBuildingType.get',
70 94
     },
71 95
     delete: {
72 96
       method: 'DELETE',
73 97
       url: `${prefix}/tdBuildingType/id`,
98
+      action: 'admin.tdBuildingType.id.delete',
74 99
     },
75 100
     update: {
76 101
       method: 'PUT',
77 102
       url: `${prefix}/tdBuildingType/id`,
103
+      action: 'admin.tdBuildingType.id.put',
78 104
     },
79 105
     add: {
80 106
       method: 'POST',
81 107
       url: `${prefix}/tdBuildingType`,
108
+      action: 'admin.tdBuildingType.post',
82 109
     },
83 110
     getById: {
84 111
       method: 'GET',
85 112
       url: `${prefix}/tdBuildingType/id`,
113
+      action: 'admin.tdBuildingType.id.get',
86 114
     },
87 115
   },
88 116
   news: {
89 117
     getList: {
90 118
       method: 'GET',
91 119
       url: `${prefix}/taNews`,
120
+      action: 'admin.taNews.get',
92 121
     },
93 122
   },
94 123
   customer: {
95 124
     drift: {
96 125
       method: 'GET',
97 126
       url: `${prefix}/customer/recommend/drift`,
127
+      action: 'admin.customer.recommend.drift.get',
98 128
     },
99 129
     report: {
100 130
       method: 'GET',
101 131
       url: `${prefix}/customer/recommend/report`,
132
+      action: 'admin.customer.recommend.report.get',
102 133
     },
103 134
     recommender: {
104 135
       method: 'GET',
105 136
       url: `${prefix}/customer/recommend/recommender`,
137
+      action: 'admin.customer.recommend.recommender.get',
106 138
     },
107 139
     auto: {
108 140
       method: 'PUT',
109 141
       url: `${prefix}/customer/recommend/verify/id`,
142
+      action: 'admin.customer.recommend.verify.id.put',
110 143
     },
111 144
     recommendGetById: {
112 145
       method: 'GET',
113 146
       url: `${prefix}/customer/recommend/getById/id`,
147
+      action: 'admin.customer.recommend.getById.id.get',
114 148
     },
115 149
     agents: {
116 150
       method: 'GET',
117 151
       url: `${prefix}/customer/agents`,
152
+      action: 'admin.customer.agents.get',
118 153
     },
119 154
     customerRecommend: {
120 155
       method: 'GET',
121 156
       url: `${prefix}/customer/recommend`,
157
+      action: 'admin.customer.recommend.get',
122 158
     },
123 159
     consultant: {
124 160
       method: 'GET',
125 161
       url: `${prefix}/consultant`,
162
+      action: 'admin.consultant.get',
126 163
     },
127 164
     recommendEdit: {
128 165
       method: 'PUT',
129 166
       url: `${prefix}/customer/recommend/edit/id`,
167
+      action: 'admin.customer.recommend.edit.id.put',
130 168
     },
131 169
     taPointsRecords: {
132 170
       method: 'GET',
133 171
       url: `${prefix}/mine/taPointsRecords/id`,
172
+      action: 'admin.mine.taPointsRecords.id.get',
134 173
     },
135 174
     recommend: {
136 175
       method: 'GET',
137 176
       url: `${prefix}/customer/recommend/id`,
177
+      action: 'admin.customer.recommend.id.get',
138 178
     },
139 179
     InviteClientsList: {
140 180
       method: 'GET',
141 181
       url: `${prefix}/channel/InviteClientsList`,
182
+      action: 'admin.channel.InviteClientsList.get',
142 183
     },
143 184
     CustomerRecommendGet: {
144 185
       method: 'GET',
145 186
       url: `${prefix}/customer/recommend/get/id`,
187
+      action: 'admin.customer.recommend.get.id.get',
146 188
     },
147 189
   },
148 190
   indexEcharts: {
@@ -181,49 +223,320 @@ export default {
181 223
       url: `${prefix}/selectIntentionUser`
182 224
     },
183 225
 
184
-  }
185
-  // indexEcharts:{
186
-  //   list:{
187
-  //     method:'get',
188
-  //     url: `${commPrefix}/indexStatistical`
189
-  //   },
190
-  //   userResource: {
191
-  //       method:'get',
192
-  //       url: `${commPrefix}/selectUserResource`
193
-  //   },
194
-  //   userConversion: {
195
-  //     method:'get',
196
-  //     url: `${commPrefix}/selectConversion`
197
-  //   },
198
-  //   userActive: {
199
-  //     method:'get',
200
-  //     url: `${commPrefix}/selectActiveUserCount`
201
-  //   },
202
-  //   newUser: {
203
-  //     method:'get',
204
-  //     url: `${commPrefix}/selectNewsUserCount`
205
-  //   },
206
-  //   userBehavior: {
207
-  //     summary: {
208
-  //       method:'get',
209
-  //       url: `${commPrefix}/selectUserBehavior`
210
-  //     },
211
-  //     profile: {
212
-  //       method:'get',
213
-  //       url: `${commPrefix}/selectEventAll`
214
-  //     },
215
-  //   },
216
-  //   intentionUsers: {
217
-  //     method:'get',
218
-  //     url: `${commPrefix}/selectIntentionUser`
219
-  //   },
220
-  //   userSex: {
221
-  //     method:'get',
222
-  //     url: `${commPrefix}/selectSexUser`
223
-  //   },
224
-  //   userCity: {
225
-  //     method:'get',
226
-  //     url: `${commPrefix}/selectCityUser`
227
-  //   },
228
-  // },
226
+    userCity: {
227
+      method:'get',
228
+      url: `${prefix}/selectCityUser`,
229
+      action: 'admin.selectCityUser.get'
230
+    },
231
+
232
+  },
233
+  activity: {
234
+      list: {
235
+        method: 'GET',
236
+        url: `${prefix}/iBuildingDynamicList`,
237
+        action: 'admin.iBuildingDynamicList.get',
238
+      },
239
+      weight: {
240
+        method: 'PUT',
241
+        url: `${prefix}/buildingDynamic/weight`,
242
+        action: 'admin.buildingDynamic.weight.put',
243
+      },
244
+      cancel: {
245
+        method: 'PUT',
246
+        url: `${prefix}/buildingDynamic/cancel/:id`,
247
+        action: 'admin.buildingDynamic.cancel.dynamicId.put'
248
+      },
249
+      send: {
250
+        url: `${prefix}/buildingDynamic/send/:id`,
251
+        method: 'PUT',
252
+        action: 'admin.buildingDynamic.send.dynamicId.put'
253
+      },
254
+      finish: {
255
+        url: `${prefix}/buildingDynamic/finish`,
256
+        method: 'PUT',
257
+        action: 'admin.buildingDynamic.finish.put'
258
+      },
259
+      details: {
260
+        url: `${prefix}/buildingDynamic/Details`,
261
+        method: 'GET',
262
+        action: 'admin.buildingDynamic.Details.get',
263
+      },
264
+      update: {
265
+        url: `${prefix}/buildingDynamic/update`,
266
+        method: 'PUT',
267
+        action: 'admin.buildingDynamic.update.put',
268
+      },
269
+      add: {
270
+        url: `${prefix}/buildingDynamic/add`,
271
+        method: 'POST',
272
+        action: 'admin.buildingDynamic.add.post',
273
+      },
274
+      poster: {
275
+        url: `${prefix}/poster`,
276
+        method: 'GET',
277
+        action: 'admin.poster.get',
278
+      },
279
+      updatePoster: {
280
+        url: `${prefix}/poster/:id`,
281
+        method: 'PUT',
282
+        action: 'admin.poster.id.put',
283
+      },
284
+      addPoster: {
285
+        url: `${prefix}/poster`,
286
+        method: 'POST',
287
+        action: 'admin.poster.post',
288
+      },
289
+      shareContent: {
290
+        url: `${prefix}/shareContent`,
291
+        method: 'GET',
292
+        action: 'admin.shareContent.get',
293
+      },
294
+      updateShareContent: {
295
+        url: `${prefix}/shareContent/:id`,
296
+        method: 'PUT',
297
+        action: 'admin.shareContent.id.put',
298
+      },
299
+      addShareContent: {
300
+        url: `${prefix}/shareContent`,
301
+        method: 'POST',
302
+        action: 'admin.shareContent.post',
303
+      },
304
+      signList: {
305
+        url: `${prefix}/SignList`,
306
+        method: 'GET',
307
+        action: 'admin.SignList.get',
308
+      }
309
+  },
310
+  integralMall: {
311
+    tdPointsRules: {
312
+      url: `${prefix}/tdPointsRules`,
313
+      method: 'GET',
314
+      action: 'admin.tdPointsRules.get',
315
+    },
316
+    change: {
317
+      url: `${prefix}/tdPointsRules/change`,
318
+      method: 'PUT',
319
+      action: 'admin.tdPointsRules.change.put',
320
+    },
321
+    taGoods: {
322
+      url: `${prefix}/taGoods/:id`,
323
+      method: 'GET',
324
+      action: 'admin.taGoods.id.get',
325
+    },
326
+    updateTaGoods: {
327
+      url: `${prefix}/taGoods`,
328
+      method: 'PUT',
329
+      action: 'admin.taGoods.put',
330
+    },
331
+    addTaGoods: {
332
+      url: `${prefix}/taGoods/add`,
333
+      method: 'POST',
334
+      action: 'admin.taGoods.add.post',
335
+    },
336
+    taPointsExchange: {
337
+      url: `${prefix}/taPointsExchange`,
338
+      method: 'GET',
339
+      action: 'admin.taPointsExchange.get',
340
+    },
341
+    getTaGoods: {
342
+      url: `${prefix}/taGoods`,
343
+      method: 'GET',
344
+      action: 'admin.taGoods.get',
345
+    },
346
+    changeTaGoods: {
347
+      url: `${prefix}/taGoods/change`,
348
+      method: 'PUT',
349
+      action: 'admin.taGoods.change.put',
350
+    },
351
+    changeTaPointsExchange: {
352
+      url: `${prefix}/taPointsExchange/change`,
353
+      method: 'PUT',
354
+      action: 'admin.taPointsExchange.change.put',
355
+    }
356
+  },
357
+  carsuseFigure: {
358
+    extendContent: {
359
+      url: `${prefix}/extendContent`,
360
+      method: 'GET',
361
+      action: 'admin.extendContent.get',
362
+    },
363
+    finish: {
364
+      url: `${prefix}/buildingDynamic/finish`,
365
+      method: 'PUT',
366
+      action: 'admin.buildingDynamic.finish.put',
367
+    },
368
+    updataExtendContent: {
369
+      url: `${prefix}/extendContent/:id`,
370
+      method: 'PUT',
371
+      action: 'admin.extendContent.id.put',
372
+    },
373
+    getExtendContent: {
374
+      url: `${prefix}/extendContent/:id`,
375
+      method: 'GET',
376
+      action: 'admin.extendContent.id.get',
377
+    },
378
+    addExtendContent: {
379
+      url: `${prefix}/extendContent`,
380
+      method: 'POST',
381
+      action: 'admin.extendContent.post',
382
+    }
383
+  },
384
+  system: {
385
+    taPolicy: {
386
+      url: `${prefix}/taPolicy/:id`,
387
+      method: 'GET',
388
+      action: 'admin.taPolicy.id.get',
389
+    },
390
+    updateTaPolicy: {
391
+      url: `${prefix}/taPolicy/:id`,
392
+      method: 'PUT',
393
+      action: 'admin.taPolicy.id.put',
394
+    },
395
+    addTaPolicy: {
396
+      url: `${prefix}/taPolicy`,
397
+      method: 'POST',
398
+      action: 'admin.taPolicy.post',
399
+    },
400
+    getTaPolicy: {
401
+      url: `${prefix}/taPolicy`,
402
+      method: 'GET',
403
+      action: 'admin.taPolicy.get',
404
+    },
405
+    deleteTaPolicy: {
406
+      url: `${prefix}/taPolicy/:id`,
407
+      method: 'DELETE',
408
+      action: 'admin.taPolicy.id.delete',
409
+    },
410
+    tdBizEventIntention: {
411
+      url: `${prefix}/tdBizEventIntention`,
412
+      method: 'GET',
413
+      action: 'admin.tdBizEventIntention.get',
414
+    },
415
+    taBuildingIntentionAddOrUpdate: {
416
+      url: `${prefix}/taBuildingIntentionAddOrUpdate/:id`,
417
+      method: 'POST',
418
+      action: 'admin.taBuildingIntentionAddOrUpdate.buildingId.post',
419
+    },
420
+    taCustomerMessage: {
421
+      url: `${prefix}/taCustomerMessage`,
422
+      method: 'GET',
423
+      action: 'admin.taCustomerMessage.get',
424
+    },
425
+    tdReports: {
426
+      url: `${prefix}/tdReports`,
427
+      method: 'GET',
428
+      action: 'admin.tdReports.get',
429
+    },
430
+    taBuildingReports: {
431
+      url: `${prefix}/taBuildingReports`,
432
+      method: 'GET',
433
+      action: 'admin.taBuildingReports.get',
434
+    },
435
+    addTaBuildingReports: {
436
+      url: `${prefix}/taBuildingReport/add`,
437
+      method: 'POST',
438
+      action: 'admin.taBuildingReport.add.post',
439
+    }
440
+  },
441
+  staff: {
442
+    taUser: {
443
+      url: `${prefix}/taUser`,
444
+      method: 'GET',
445
+      action: 'admin.taUser.get',
446
+    },
447
+    taTags: {
448
+      url: `${prefix}/taTags`,
449
+      method: 'GET',
450
+      action: 'admin.taTags.get',
451
+    },
452
+    getTaUser: {
453
+      url: `${prefix}/taUser/:id`,
454
+      method: 'GET',
455
+      action: 'admin.taUser.id.get',
456
+    },
457
+    updateTaUser: {
458
+      url: `${prefix}/taUser/:id`,
459
+      method: 'PUT',
460
+      action: 'admin.taUser.id.put',
461
+    },
462
+    addTaUser: {
463
+      url: `${prefix}/taUser`,
464
+      method: 'POST',
465
+      action: 'admin.taUser.post',
466
+    },
467
+    change: {
468
+      url: `${prefix}/turn/taUser/:id/:type`,
469
+      method: 'PUT',
470
+      action: 'admin.turn.taUser.put',  
471
+    },
472
+  },
473
+  channelList: {
474
+    getList: {
475
+      url: `${prefix}/channel`,
476
+      method: 'GET',
477
+      action: 'admin.channel.get',
478
+    },
479
+    addChannel: {
480
+      url: `${prefix}/channel`,
481
+      method: 'POST',
482
+      action: 'admin.channel.post',
483
+    },
484
+    getById: {
485
+      url: `${prefix}/channel/:id`,
486
+      method: 'GET',
487
+      action: 'admin.channel.id.get',
488
+    },
489
+    editChannel: {
490
+      url: `${prefix}/channel/:id`,
491
+      method: 'PUT',
492
+      action: 'admin.channel.id.put',
493
+    },
494
+    getListBroker: {
495
+      url: `${prefix}/channel/broker`,
496
+      method: 'GET',
497
+      action: 'admin.channel.broker.get',
498
+    },
499
+    getListRecommend: {
500
+      url: `${prefix}/customer/recommend/:id`,
501
+      method: 'GET',
502
+      action: 'admin.customer.recommend.id.get',
503
+    },
504
+    getListInvite: {
505
+      url: `${prefix}/channel/InviteClientsList`,
506
+      method: 'GET',
507
+      action: 'admin.InviteClientsList.get',
508
+    },
509
+ },
510
+ role: {
511
+  getRoleList: {
512
+    url: `${prefix}/taRole`,
513
+    method: 'GET',
514
+    action: 'admin.taRole.get',
515
+  },
516
+  stop: {
517
+    url: `${prefix}/taRole/stop/:id`,
518
+    method: 'PUT',
519
+    action: 'admin.taRole.stop.id.PUT',
520
+  },
521
+  menuList: {
522
+    url: `${prefix}/menuList`,
523
+    method: 'GET',
524
+    action: 'admin.menuList.get',
525
+  },
526
+  buttonList: {
527
+    url: `${prefix}/buttonList`,
528
+    method: 'GET',
529
+    action: 'admin.buttonList.get',
530
+  },
531
+  buttonAndMenuList: {
532
+    url: `${prefix}/taRole/details/:id`,
533
+    method: 'GET',
534
+    action: 'admin.taRole.details.id.get'
535
+  },
536
+  updateAuthMenu: {
537
+    url: `${prefix}/updateAuthMenu`,
538
+    method: 'POST',
539
+    action: 'admin.updateAuthMenu.post',
540
+  },
541
+ },
229 542
 }

+ 1
- 1
src/utils/mixStr.js Datei anzeigen

@@ -12,7 +12,7 @@ const fill2Len = (str, len) => {
12 12
   return str.repeat(Math.floor(len / orginLen)) + str.substr(0, len % orginLen)
13 13
 }
14 14
 
15
-const mixChars = window.navigator.userAgent + (new Date).toUTCString().replace(/\d{2}:\d{2}:\d{2}/, '')
15
+const mixChars = window.navigator.userAgent // + (new Date).toUTCString().replace(/\d{2}:\d{2}:\d{2}/, '')
16 16
 
17 17
 const strXOR = (str, mix) => {
18 18
   if (!str) return str

+ 6
- 3
src/utils/request.js Datei anzeigen

@@ -33,15 +33,17 @@ const replaceURLParams = (url, params = {}) => {
33 33
 }
34 34
 
35 35
 request.interceptors.request.use((url, options) => {
36
-  const { urlData, headers = {}, logout = false, data, ...opts } = options
36
+  const { urlData, headers = {}, logout = false, login = false, action, data, ...opts } = options
37 37
   const apiURL = urlData ? replaceURLParams(url, urlData) : url
38 38
   const token = mixStr(window.localStorage.getItem('test-foobar'))
39
-  const authHeader = token ? { Authorization: `Bearer ${token}` } : {}
40 39
 
41
-  if (logout) {
40
+  if (login || logout) {
42 41
     window.localStorage.removeItem('test-foobar')
43 42
   }
44 43
 
44
+  const authHeader = !login ? { Authorization: `Bearer ${token}` } : {}
45
+  const actionHeader = action ? { 'X-ACTION': action  }: {}
46
+
45 47
   return (
46 48
     {
47 49
       url: apiURL,
@@ -49,6 +51,7 @@ request.interceptors.request.use((url, options) => {
49 51
         ...opts,
50 52
         headers: {
51 53
           ...authHeader,
54
+          ...actionHeader,
52 55
           ...headers,
53 56
         },
54 57
         data,

+ 33
- 5
src/utils/upload.js Datei anzeigen

@@ -1,11 +1,39 @@
1
-import apis from '../services/apis';
1
+import { fetch, apis } from './request';
2
+import mixStr from './mixStr';
3
+
4
+const getToken = () => mixStr(window.localStorage.getItem('test-foobar'))
5
+
6
+const uploadImage = fetch(apis.image.upload)
2 7
 
3 8
 const uploaderProps = {
4 9
   name: 'file',
5
-  action: apis.image.upload.url,
6
-  headers: {
7
-    Authorization: `Bearer ${window.localStorage.getItem('x-token')}`
8
-  }
10
+  // action: apis.image.uploadForAnt.url,
11
+  accept: '.png, .jpg, .jpeg, .gif',
12
+  // headers: {
13
+  //   Authorization: `Bearer ${getToken()}`
14
+  // },
15
+  customRequest({
16
+    action,
17
+    file,
18
+    headers,
19
+    onError,
20
+    onProgress,
21
+    onSuccess,
22
+    withCredentials,
23
+  }) {
24
+    const data = new FormData()
25
+    data.append('file', file)
26
+
27
+    uploadImage({ data }).then((img) => {
28
+      onSuccess(img, file);
29
+    }).catch(onError);
30
+
31
+    return {
32
+      abort() {
33
+        console.log('upload progress is aborted.');
34
+      },
35
+    };
36
+  },
9 37
 }
10 38
 
11 39
 export { uploaderProps }