周立森 5 years ago
parent
commit
0d7880c4aa

+ 94
- 15
config/config.js View File

123
                   component: './building/list/index',
123
                   component: './building/list/index',
124
                 },
124
                 },
125
                 {
125
                 {
126
+<<<<<<< HEAD
127
+=======
128
+                  path: '/building/list/add',
129
+                  name: '项目添加', // 项目添加
130
+                  hideInMenu: true,
131
+                  component: './building/list/add/index',
132
+                },
133
+                {
134
+>>>>>>> ed52b30a02a5604a8626322e59d620f25aa7558d
126
                   path: '/building/type',
135
                   path: '/building/type',
127
                   name: '项目类型',
136
                   name: '项目类型',
128
                   component: './building/type/index',
137
                   component: './building/type/index',
129
                 },
138
                 },
130
                 {
139
                 {
131
                   path: '/building/type/edi',
140
                   path: '/building/type/edi',
132
-                  name: '',
141
+                  name: '项目类型编辑',
142
+                  hideInMenu: true,
133
                   component: './building/type/edi',
143
                   component: './building/type/edi',
134
                 },
144
                 },
135
               ],
145
               ],
145
                   component: './customer/customerlist/index',
155
                   component: './customer/customerlist/index',
146
                 },
156
                 },
147
                 {
157
                 {
158
+<<<<<<< HEAD
159
+=======
160
+                  path: '/customer/customerlist/customerDetail',
161
+                  name: '客户编辑',
162
+                  hideInMenu: true,
163
+                  component: './customer/customerlist/customerDetail',
164
+                },
165
+                {
166
+>>>>>>> ed52b30a02a5604a8626322e59d620f25aa7558d
148
                   path: '/customer/drift/list',
167
                   path: '/customer/drift/list',
149
                   name: '游客列表',
168
                   name: '游客列表',
150
                   component: './customer/drift/index',
169
                   component: './customer/drift/index',
161
                 },
180
                 },
162
                 {
181
                 {
163
                   path: '/customer/recommendCustomer/audit',
182
                   path: '/customer/recommendCustomer/audit',
164
-                  name: '', //审核
183
+                  name: '客户审核', 
184
+                  hideInMenu: true,
165
                   component: './customer/recommendCustomer/audit',
185
                   component: './customer/recommendCustomer/audit',
166
                 },
186
                 },
167
                 {
187
                 {
188
                 },
208
                 },
189
                 {
209
                 {
190
                   path: '/integralMall/editGoods',
210
                   path: '/integralMall/editGoods',
191
-                  name: '',
211
+                  name: '商品编辑',
212
+                  hideInMenu: true,
192
                   component: './integralMall/editGoods',
213
                   component: './integralMall/editGoods',
193
                 },
214
                 },
194
                 {
215
                 {
203
                 },
224
                 },
204
                 {
225
                 {
205
                   path: '/integralMall/verifyList',
226
                   path: '/integralMall/verifyList',
206
-                  name: '',
227
+                  name: '商品核销列表',
228
+                  hideInMenu: true,
207
                   component: './integralMall/verifyList',
229
                   component: './integralMall/verifyList',
208
                 },
230
                 },
209
               ],
231
               ],
220
                 },
242
                 },
221
                 {
243
                 {
222
                   path: '/channel/addChannel',
244
                   path: '/channel/addChannel',
223
-                  name: '',
245
+                  name: '添加渠道',
246
+                  hideInMenu: true,
224
                   component: './channel/addChannel',
247
                   component: './channel/addChannel',
225
                 },
248
                 },
226
                 {
249
                 {
227
                   path: '/channel/editChannel',
250
                   path: '/channel/editChannel',
228
-                  name: '',
251
+                  name: '编辑渠道',
252
+                  hideInMenu: true,
229
                   component: './channel/editChannel',
253
                   component: './channel/editChannel',
230
                 },
254
                 },
231
                 {
255
                 {
235
                 },
259
                 },
236
                 {
260
                 {
237
                   path: '/channel/recommendClients',
261
                   path: '/channel/recommendClients',
238
-                  name: '',
262
+                  name: '渠道推荐',
263
+                  hideInMenu: true,
239
                   component: './channel/recommendClients',
264
                   component: './channel/recommendClients',
240
                 },
265
                 },
241
                 {
266
                 {
242
                   path: '/channel/InviteClients',
267
                   path: '/channel/InviteClients',
243
-                  name: '',
268
+                  name: '邀请客户',
269
+                  hideInMenu: true,
244
                   component: './channel/InviteClients',
270
                   component: './channel/InviteClients',
245
                 },
271
                 },
246
               ],
272
               ],
257
                 },
283
                 },
258
                 {
284
                 {
259
                   path: '/news/type/editNews',
285
                   path: '/news/type/editNews',
260
-                  name: '',
286
+                  name: '编辑资讯类型',
287
+                  hideInMenu: true,
261
                   component: './news/type/editNews',
288
                   component: './news/type/editNews',
262
                 },
289
                 },
263
                 {
290
                 {
265
                   name: '资讯列表',
292
                   name: '资讯列表',
266
                   component: './news/list/NewsList',
293
                   component: './news/list/NewsList',
267
                 },
294
                 },
295
+<<<<<<< HEAD
296
+=======
297
+                {
298
+                  path: '/news/list/editNewsList',
299
+                  name: '编辑资讯',
300
+                  hideInMenu: true,
301
+                  component: './news/list/editNewsList',
302
+                },
303
+>>>>>>> ed52b30a02a5604a8626322e59d620f25aa7558d
268
               ],
304
               ],
269
             },
305
             },
270
             {
306
             {
279
                 },
315
                 },
280
                 {
316
                 {
281
                   path: '/activity/editActivity',
317
                   path: '/activity/editActivity',
282
-                  name: '',
318
+                  name: '编辑活动',
319
+                  hideInMenu: true,
283
                   component: './activity/editActivity',
320
                   component: './activity/editActivity',
284
                 },
321
                 },
285
                 {
322
                 {
286
                   path: '/activity/SignList',
323
                   path: '/activity/SignList',
287
-                  name: '',
324
+                  name: '报名列表',
325
+                  hideInMenu: true,
288
                   component: './activity/SignList',
326
                   component: './activity/SignList',
289
                 },
327
                 },
290
               ],
328
               ],
302
                 },
340
                 },
303
                 {
341
                 {
304
                   path: '/staff/editStaff',
342
                   path: '/staff/editStaff',
305
-                  name: '',
343
+                  name: '编辑员工',
344
+                  hideInMenu: true,
306
                   component: './staff/list/editStaff',
345
                   component: './staff/list/editStaff',
307
                 },
346
                 },
308
              
347
              
313
                 },
352
                 },
314
                 {
353
                 {
315
                   path: '/staff/editRole',
354
                   path: '/staff/editRole',
316
-                  name: '',
355
+                  name: '编辑角色',
356
+                  hideInMenu: true,
317
                   component: './staff/list/editRole',
357
                   component: './staff/list/editRole',
318
                 },
358
                 },
359
+<<<<<<< HEAD
319
              
360
              
361
+=======
362
+                {
363
+                  path: '/staff/list/addRole',
364
+                  name: '添加角色',
365
+                  hideInMenu: true,
366
+                  component: './staff/list/addRole',
367
+                },  
368
+              ],
369
+            },
370
+            {
371
+              path: '/carouselFigure',
372
+              name: '轮播图管理',
373
+              component: '../layouts/BlankLayout',
374
+              routes: [
375
+                {
376
+                  path: '/carouselFigure/carouselFigureList',
377
+                  name: '轮播图列表',
378
+                  component: './carouselFigure/carouselFigureList',
379
+                },
380
+                {
381
+                  path: '/carouselFigure/editCarousel',
382
+                  name: '轮播图编辑',
383
+                  hideInMenu: true,
384
+                  component: './carouselFigure/editCarousel',
385
+                },
386
+                {
387
+                  path: '/carouselFigure/advertisingList',
388
+                  name: '开屏广告',
389
+                  component: './carouselFigure/advertisingList',
390
+                },
391
+                {
392
+                  path: '/carouselFigure/editAdvertising',
393
+                  name: '开屏广告编辑',
394
+                  hideInMenu: true,
395
+                  component: './carouselFigure/editAdvertising',
396
+                },
397
+>>>>>>> ed52b30a02a5604a8626322e59d620f25aa7558d
320
               ],
398
               ],
321
             },
399
             },
322
             {
400
             {
346
                 },
424
                 },
347
                 {
425
                 {
348
                   path: '/system/editPolicy',
426
                   path: '/system/editPolicy',
349
-                  name: '',
427
+                  name: '购房政策编辑',
428
+                  hideInMenu: true,
350
                   component: './system/editPolicy',
429
                   component: './system/editPolicy',
351
                 },
430
                 },
352
               ],
431
               ],
414
 
493
 
415
   proxy: {
494
   proxy: {
416
     '/api/': {
495
     '/api/': {
417
-      target: 'http://192.168.0.11:8080/',
496
+      target: 'http://192.168.0.84:8080/',
418
       changeOrigin: true,
497
       changeOrigin: true,
419
       // pathRewrite: { '^/server': '' },
498
       // pathRewrite: { '^/server': '' },
420
     },
499
     },

+ 74
- 0
src/components/XForm/ImageListUpload.jsx View File

1
+import React from 'react';
2
+import { Upload, Icon, Modal } from 'antd';
3
+import './style.less';
4
+import { uploaderProps } from '../../utils/upload';
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
+class ImageListUpload extends React.Component {
16
+  state = {
17
+    previewVisible: false,
18
+    previewImage: '',
19
+    fileList: [],
20
+  };
21
+
22
+  handleCancel = () => this.setState({ previewVisible: false });
23
+
24
+  handlePreview = async file => {
25
+    if (!file.url && !file.preview) {
26
+      file.preview = await getBase64(file.originFileObj);
27
+    }
28
+
29
+    this.setState({
30
+      previewImage: file.url || file.preview,
31
+      previewVisible: true,
32
+    });
33
+  };
34
+
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))
41
+    }
42
+  };
43
+
44
+  render() {
45
+    const { previewVisible, previewImage, fileList } = this.state;
46
+
47
+    const { value } = this.props
48
+
49
+    const uploadButton = (
50
+      <div>
51
+        <Icon type="plus" />
52
+        <div className="ant-upload-text">Upload</div>
53
+      </div>
54
+    );
55
+    return (
56
+      <div className="clearfix">
57
+        <Upload
58
+          listType="picture-card"
59
+          fileList={fileList || value}
60
+          onPreview={this.handlePreview}
61
+          onChange={this.handleChange}
62
+          { ...uploaderProps }
63
+        >
64
+          {fileList.length >= 8 ? null : uploadButton}
65
+        </Upload>
66
+        <Modal visible={previewVisible} footer={null} onCancel={this.handleCancel}>
67
+          <img alt="example" style={{ width: '100%' }} src={previewImage} />
68
+        </Modal>
69
+      </div>
70
+    );
71
+  }
72
+}
73
+
74
+export default ImageListUpload;

+ 13
- 0
src/components/XForm/style.css View File

1
+:global .avatar-uploader > .ant-upload {
2
+  width: 128px;
3
+  height: 128px;
4
+}
5
+/* you can make up upload button and sample style by using stylesheets */
6
+.ant-upload-select-picture-card i {
7
+  font-size: 32px;
8
+  color: #999;
9
+}
10
+.ant-upload-select-picture-card .ant-upload-text {
11
+  margin-top: 8px;
12
+  color: #666;
13
+}

+ 12
- 0
src/components/XForm/style.less View File

6
     }
6
     }
7
   }
7
   }
8
 }
8
 }
9
+
10
+
11
+/* you can make up upload button and sample style by using stylesheets */
12
+.ant-upload-select-picture-card i {
13
+  font-size: 32px;
14
+  color: #999;
15
+}
16
+
17
+.ant-upload-select-picture-card .ant-upload-text {
18
+  margin-top: 8px;
19
+  color: #666;
20
+}

+ 13
- 0
src/components/XForm/style.wxss View File

1
+:global .avatar-uploader > .ant-upload {
2
+  width: 128px;
3
+  height: 128px;
4
+}
5
+/* you can make up upload button and sample style by using stylesheets */
6
+.ant-upload-select-picture-card i {
7
+  font-size: 32px;
8
+  color: #999;
9
+}
10
+.ant-upload-select-picture-card .ant-upload-text {
11
+  margin-top: 8px;
12
+  color: #666;
13
+}

+ 71
- 61
src/global.less View File

47
   }
47
   }
48
 }
48
 }
49
 
49
 
50
-.ant-pro-global-header{
50
+.ant-layout-header .ant-pro-global-header{
51
   background:#393C39;
51
   background:#393C39;
52
 }
52
 }
53
-.ant-pro-sider-menu-sider.light .ant-pro-sider-menu-logo{
53
+.ant-layout .ant-pro-sider-menu-sider.light .ant-pro-sider-menu-logo{
54
   background:#EF273A;
54
   background:#EF273A;
55
   box-shadow: none;
55
   box-shadow: none;
56
   border: none;
56
   border: none;
57
-}
58
-.ant-input-affix-wrapper .ant-input-prefix{
59
-  left:7px;
60
-}
61
-.ant-input-affix-wrapper .ant-input:not(:first-child) {
62
-  padding-left: 40px;
63
-}
64
-.ant-pro-global-header-trigger{
65
-  display: none;
66
-}
67
-.ant-pro-sider-menu-sider.light{
68
-  box-shadow: none;
69
-  .ant-pro-sider-menu-logo h1{
70
-    color: #fff;
57
+  a{
58
+    h1{
59
+      color: #fff;
60
+    }
71
   }
61
   }
72
 }
62
 }
73
-.ant-pro-page-header-wrap-page-header-warp{
74
-  background:rgba(240,240,240,1);
75
-}
76
-.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected{
77
-  background:rgb(230, 227, 227);
78
-  border: none;
79
-}
80
-.ant-menu-inline .ant-menu-selected::after, .ant-menu-inline .ant-menu-item-selected::after{
81
-  opacity: 0;
82
-}
83
-.ant-menu-inline > .ant-menu-item{
84
-  height: 45px;
85
-  line-height: 45px;
86
-  font-size: 16px;
87
-  margin: 0;
88
-}
89
-.ant-menu.ant-pro-sider-menu{
90
-  padding: 0!important;
91
-}
92
-
93
-.ant-breadcrumb + .ant-page-header-heading{
94
-  display: none;
63
+.antd-pro-layouts-user-layout-container{
64
+  .ant-input-affix-wrapper .ant-input-prefix{
65
+    left:7px;
66
+  }
67
+  .ant-input-affix-wrapper .ant-input:not(:first-child) {
68
+    padding-left: 40px;
69
+  }
95
 }
70
 }
96
-.ant-page-header{
97
-  height: 50px;
98
-  padding:0 30px;
99
-  line-height: 50px;
71
+ 
72
+.ant-layout{
73
+  .ant-pro-global-header-trigger{
74
+    display: none;
75
+  }
76
+  .ant-pro-sider-menu-sider.light{
77
+    box-shadow: none;
78
+    .ant-pro-sider-menu-logo h1{
79
+      color: #fff;
80
+    }
81
+  }
82
+  .ant-pro-page-header-wrap-page-header-warp{
83
+    background:rgba(240,240,240,1);
84
+  }
85
+   .ant-menu:not(.ant-menu-horizontal)  .ant-menu-item-selected{
86
+    background:rgb(230, 227, 227)!important;
87
+    border: none!important;
88
+  }
89
+  .ant-menu-inline .ant-menu-selected::after, .ant-menu-inline .ant-menu-item-selected::after{
90
+    opacity: 0;
91
+  }
92
+  .ant-menu-inline > .ant-menu-item{
93
+    height: 45px;
94
+    line-height: 45px;
95
+    font-size: 16px;
96
+    margin: 0;
97
+  }
98
+  .ant-menu.ant-pro-sider-menu{
99
+    padding: 0!important;
100
+  }
100
   
101
   
101
-  .ant-breadcrumb{
102
-    color: #333;
102
+  .ant-breadcrumb + .ant-page-header-heading{
103
+    display: none;
103
   }
104
   }
104
-}
105
-.ant-pro-sider-menu-logo img{
106
-  height: 41px;
107
-}
108
-.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active {
109
-  color: #FF7E48;
110
-}
111
-.ant-table{
112
-  line-height: 3;
113
-}
114
-.ant-modal-header{
115
-  border-bottom: none;
116
-  .ant-modal-title{
117
-    font-size: 24px;
105
+  .ant-page-header{
106
+    height: 50px;
107
+    padding:0 30px;
118
     line-height: 50px;
108
     line-height: 50px;
109
+    
110
+    .ant-breadcrumb{
111
+      color: #333;
112
+    }
113
+  }
114
+  .ant-pro-sider-menu-logo img{
115
+    height: 41px;
116
+  }
117
+  .ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active {
118
+    color: #FF7E48;
119
+  }
120
+  .ant-table{
121
+    line-height: 3;
122
+  }
123
+  .ant-modal-header{
124
+    border-bottom: none;
125
+    .ant-modal-title{
126
+      font-size: 24px;
127
+      line-height: 50px;
128
+    }
129
+  }
130
+  .ant-modal-footer{
131
+    border-top:none;
119
   }
132
   }
120
 }
133
 }
121
-.ant-modal-footer{
122
-  border-top:none;
123
-}

+ 26
- 14
src/layouts/BasicLayout.jsx View File

6
 import ProLayout from '@ant-design/pro-layout';
6
 import ProLayout from '@ant-design/pro-layout';
7
 import React, { useEffect } from 'react';
7
 import React, { useEffect } from 'react';
8
 import Link from 'umi/link';
8
 import Link from 'umi/link';
9
+import Redirect from 'umi/redirect';
9
 import { connect } from 'dva';
10
 import { connect } from 'dva';
10
 import { formatMessage } from 'umi-plugin-react/locale';
11
 import { formatMessage } from 'umi-plugin-react/locale';
11
 import Authorized from '@/utils/Authorized';
12
 import Authorized from '@/utils/Authorized';
12
 import RightContent from '@/components/GlobalHeader/RightContent';
13
 import RightContent from '@/components/GlobalHeader/RightContent';
13
 import { isAntDesignPro } from '@/utils/utils';
14
 import { isAntDesignPro } from '@/utils/utils';
14
 import logo from '../assets/logo.png';
15
 import logo from '../assets/logo.png';
15
-
16
-/**
17
- * use Authorized check all menu item
18
- */
19
-const menuDataRender = menuList =>
20
-  menuList.map(item => {
21
-    const localItem = { ...item, children: item.children ? menuDataRender(item.children) : [] };
22
-    return Authorized.check(item.authority, localItem, null);
23
-  });
16
+  
24
 const footerRender = () => {
17
 const footerRender = () => {
25
   return (
18
   return (
26
-
27
     <div
19
     <div
28
       style={{
20
       style={{
29
         padding: ' 44px 0',
21
         padding: ' 44px 0',
32
         fontFamily: 'monospace',
24
         fontFamily: 'monospace',
33
         fontWeight: '200',
25
         fontWeight: '200',
34
         color: 'rgba(102, 102, 102, 1)',
26
         color: 'rgba(102, 102, 102, 1)',
35
-    
36
-
37
       }}
27
       }}
38
     >
28
     >
39
       copy Right @ 知与行
29
       copy Right @ 知与行
40
     </div>
30
     </div>
41
   )
31
   )
42
 }
32
 }
33
+
43
 const BasicLayout = props => {
34
 const BasicLayout = props => {
44
   const { dispatch, children, settings } = props;
35
   const { dispatch, children, settings } = props;
45
   /**
36
   /**
69
     }
60
     }
70
   };
61
   };
71
 
62
 
63
+  const findAuthority = (path) => {
64
+    return ((props.user.menuList || []).filter(x => x.code === path)[0] || {}).roles || []
65
+  }
66
+  
67
+  /**
68
+   * use Authorized check all menu item
69
+   */
70
+  const menuDataRender = menuList =>
71
+    menuList.map(item => {
72
+      const localItem = { ...item, children: item.children ? menuDataRender(item.children) : [] };
73
+      const authority = findAuthority(item.path);
74
+      // return Authorized.check(item.authority, localItem, null);
75
+      return Authorized.check(authority, localItem, null);
76
+    });
77
+
78
+  const checkRights = (children) => {
79
+    const authority = findAuthority(props.location.pathname);
80
+    return Authorized.check(authority, children, <Redirect to="/exception/403" />);
81
+  }
82
+
72
   return (
83
   return (
73
     <ProLayout
84
     <ProLayout
74
       logo={logo}
85
       logo={logo}
106
       {...settings}
117
       {...settings}
107
     // pageTitleRender={()=><></>}
118
     // pageTitleRender={()=><></>}
108
     >
119
     >
109
-      {children}
120
+      {checkRights(children)}
110
     </ProLayout>
121
     </ProLayout>
111
   );
122
   );
112
 };
123
 };
113
 
124
 
114
-export default connect(({ global, settings }) => ({
125
+export default connect(({ global, settings, user }) => ({
115
   collapsed: global.collapsed,
126
   collapsed: global.collapsed,
116
   settings,
127
   settings,
128
+  user
117
 }))(BasicLayout);
129
 }))(BasicLayout);

+ 5
- 2
src/models/user.js View File

26
     },
26
     },
27
   },
27
   },
28
   reducers: {
28
   reducers: {
29
-    saveCurrentUser(state, { payload = {} }) {
30
-      return { ...state, currentUser: payload.taUser || {}, menuList: payload.menuList || [] };
29
+    saveCurrentUser(state, { payload }) {
30
+      const { taUser = {} , menuList = [] } = payload || {}
31
+      const currentUser = { ...taUser, roles: (taUser.roles || []).map(x => x.roleId) }
32
+
33
+      return { ...state, currentUser, menuList };
31
     },
34
     },
32
     changeNotifyCount(
35
     changeNotifyCount(
33
       state = {
36
       state = {

+ 109
- 15
src/pages/activity/editActivity.jsx View File

26
  * @returns
26
  * @returns
27
  */
27
  */
28
 const Edit = (props) => {
28
 const Edit = (props) => {
29
-  const [tab, changeTab] = useState('poster')
30
-  // const [tab, changeTab] = useState('basic')
29
+  const [tab, changeTab] = useState('basic')
31
   const dynamicId = props.location.query.dynamicId
30
   const dynamicId = props.location.query.dynamicId
32
   const [dynamicData, setDynamicData] = useState({})
31
   const [dynamicData, setDynamicData] = useState({})
33
   if (dynamicId) {
32
   if (dynamicId) {
149
           method: 'PUT',
148
           method: 'PUT',
150
           data: submitValue,
149
           data: submitValue,
151
         }).then((data) => {
150
         }).then((data) => {
151
+          message.info("保存成功")
152
           cancelPage()
152
           cancelPage()
153
         }).catch((err) => {
153
         }).catch((err) => {
154
           message.info(err.msg || err.message)
154
           message.info(err.msg || err.message)
159
           method: 'POST',
159
           method: 'POST',
160
           data: submitValue,
160
           data: submitValue,
161
         }).then((data) => {
161
         }).then((data) => {
162
+          message.info("保存成功")
162
           cancelPage()
163
           cancelPage()
163
         }).catch((err) => {
164
         }).catch((err) => {
164
           message.info(err.msg || err.message)
165
           message.info(err.msg || err.message)
173
     const [inputValue, changeInput] = useState('')
174
     const [inputValue, changeInput] = useState('')
174
     const [textAreaValue, changeTextArea] = useState('')
175
     const [textAreaValue, changeTextArea] = useState('')
175
     const [imgValue, changeImg] = useState('')
176
     const [imgValue, changeImg] = useState('')
177
+    const [posterId, setPosterId] = useState('')
178
+
179
+    if(dynamicId){
180
+      useEffect(() => {
181
+        request({
182
+          url: '/api/admin/poster',
183
+          method: 'GET',
184
+          params: {targetId: dynamicId,targetType: 'activity'},
185
+        }).then((data) => {
186
+          console.log(data,"2222")
187
+          if(data.length > 0){
188
+            setPosterId(data[0].posterId)
189
+            changeImg(data[0].posterImg)
190
+            changeTextArea(data[0].posterDescription)
191
+            changeInput(data[0].posterTitle)
192
+          }
193
+        }).catch((err) => {
194
+          message.info(err.msg || err.message)
195
+        })
196
+      }, [])
197
+    }
198
+
199
+    const submitPoster  = () => {
200
+       if(dynamicId){
201
+        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) => {
207
+            message.info("保存成功")
208
+          }).catch((err) => {
209
+            message.info(err.msg || err.message)
210
+          })
211
+         }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) => {
217
+            setPosterId(data.posterId)
218
+            message.info("保存成功")
219
+          }).catch((err) => {
220
+            message.info(err.msg || err.message)
221
+          })
222
+         }
223
+       }else{
224
+        message.warn("请先保存基本信息数据")
225
+       }
226
+    }
227
+
176
     return <div>
228
     return <div>
177
       <div style={{ display: 'flex' }}>
229
       <div style={{ display: 'flex' }}>
178
         <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
230
         <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
210
         <div >
262
         <div >
211
           <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
263
           <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
212
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片</p>
264
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片</p>
213
-            <ImageUploader onChange={e => changeImg(e)} />
265
+            <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
214
           </div>
266
           </div>
215
           <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
267
           <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
216
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
268
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
217
-            <Input style={{ width: '20vw' }} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
269
+            <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
218
           </div>
270
           </div>
219
           <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
271
           <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
220
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
272
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
221
-            <TextArea rows={5} onChange={e => changeTextArea(e.target.value)} />
273
+            <TextArea rows={5} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
222
           </div>
274
           </div>
223
 
275
 
224
         </div>
276
         </div>
225
       </div>
277
       </div>
226
-      <Button type="primary" onClick={() => router.go(-1)} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
278
+      <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
227
       <Button onClick={() => router.go(-1)}>取消</Button>
279
       <Button onClick={() => router.go(-1)}>取消</Button>
228
     </div>
280
     </div>
229
 
281
 
234
   const Share = (props) => {
286
   const Share = (props) => {
235
     const [inputValue, changeInput] = useState('')
287
     const [inputValue, changeInput] = useState('')
236
     const [imgValue, changeImg] = useState('')
288
     const [imgValue, changeImg] = useState('')
237
-    // const changeInputValue = e => {
238
-    //   changeInput(e.target.value)
239
-    // }
240
-
241
-    // const handleSubmit = (values) => {
289
+    const [shareContentId, setShareContentId] = useState('')
290
+    
291
+    if(dynamicId){
292
+      useEffect(() => {
293
+        request({
294
+          url: '/api/admin/shareContent',
295
+          method: 'GET',
296
+          params: {targetId: dynamicId,targetType: 'activity'},
297
+        }).then((data) => {
298
+          console.log(data,"2222")
299
+          if(data.length > 0){
300
+            setShareContentId(data[0].shareContentId)
301
+            changeImg(data[0].shareContentImg)
302
+            changeInput(data[0].shareContentTitle)
303
+          }
304
+        }).catch((err) => {
305
+          message.info(err.msg || err.message)
306
+        })
307
+      }, [])
308
+    }
242
 
309
 
243
-    // }
310
+    const submitShare = () => {
311
+      if(dynamicId){
312
+        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) => {
318
+            message.info("保存成功")
319
+          }).catch((err) => {
320
+            message.info(err.msg || err.message)
321
+          })
322
+         }else{
323
+          request({
324
+            url: '/api/admin/shareContent',
325
+            method: 'POST',
326
+            data: {targetId: dynamicId,shareContentType: 'activity',shareContentImg: imgValue,shareContentTitle: inputValue},
327
+          }).then((data) => {
328
+            setShareContentId(data.shareContentId)
329
+            message.info("保存成功")
330
+          }).catch((err) => {
331
+            message.info(err.msg || err.message)
332
+          })
333
+         }
334
+       }else{
335
+        message.warn("请先保存基本信息数据")
336
+       }
337
+    }
244
 
338
 
245
     return <div style={{ padding: '20px' }}>
339
     return <div style={{ padding: '20px' }}>
246
       <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
340
       <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
253
       </div>
347
       </div>
254
       <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
348
       <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
255
         <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
349
         <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
256
-        <Input placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
350
+        <Input placeholder="请输入海报标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
257
       </div>
351
       </div>
258
       <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
352
       <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
259
         <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片</p>
353
         <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片</p>
260
-        <ImageUploader onChange={e => changeImg(e)} />
354
+        <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
261
       </div>
355
       </div>
262
-      <Button type="primary" htmlType="submit" style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
356
+      <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
263
       <Button onClick={() => router.go(-1)}>取消</Button>
357
       <Button onClick={() => router.go(-1)}>取消</Button>
264
     </div>
358
     </div>
265
   }
359
   }

+ 60
- 13
src/pages/building/list/add/components/base.jsx View File

1
 import React, { useState, useEffect } from 'react';
1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, InputNumber } from 'antd';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, InputNumber, notification } from 'antd';
3
 import moment from 'moment';
3
 import moment from 'moment';
4
 import request from '../../../../../utils/request';
4
 import request from '../../../../../utils/request';
5
 import apis from '../../../../../services/apis';
5
 import apis from '../../../../../services/apis';
6
 import Styles from '../style.less';
6
 import Styles from '../style.less';
7
 import { router } from 'umi';
7
 import { router } from 'umi';
8
 import ImageUpload from '../../../../../components/XForm/ImageUpload'
8
 import ImageUpload from '../../../../../components/XForm/ImageUpload'
9
+import ImageListUpload from '../../../../../components/XForm/ImageListUpload'
9
 import Wangedit from '../../../../../components/Wangedit/Wangedit'
10
 import Wangedit from '../../../../../components/Wangedit/Wangedit'
10
 import TagGroup from './tags'
11
 import TagGroup from './tags'
11
 
12
 
23
   },
24
   },
24
 };
25
 };
25
 
26
 
27
+
28
+function openNotificationWithIcon(type, message) {
29
+  notification[type]({
30
+    message,
31
+    description:
32
+      '',
33
+  });
34
+}
35
+
36
+
26
 function AddBuilding(props) {
37
 function AddBuilding(props) {
27
   const { getFieldDecorator } = props.form;
38
   const { getFieldDecorator } = props.form;
28
 
39
 
40
+  if (props.building.buildingId !== undefined) {
41
+    const { buildingId } = props.building
42
+    if (buildingId !== '') {
43
+      // eslint-disable-next-line react-hooks/rules-of-hooks
44
+      useEffect(() => {
45
+        getById(buildingId)
46
+      }, [])
47
+    }
48
+  }
49
+
50
+   // 获取详情信息
51
+   function getById(currentId) {
52
+    const { url, method } = apis.building.buildingGetById
53
+    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(currentId)
54
+
55
+    request({ url: tempUrl, method }).then(res => {
56
+      res.openingDate = moment(res.openingDate)
57
+      res.receivedDate = moment(res.receivedDate)
58
+      props.form.setFieldsValue(res)
59
+    })
60
+  }
61
+
29
   function handleSubmit(e) {
62
   function handleSubmit(e) {
30
     e.preventDefault();
63
     e.preventDefault();
31
     props.form.validateFieldsAndScroll((err, values) => {
64
     props.form.validateFieldsAndScroll((err, values) => {
32
       if (!err) {
65
       if (!err) {
33
-        console.log('Received values of form: ', values);
66
+        addBuilding(values)
34
       }
67
       }
35
     });
68
     });
36
   }
69
   }
37
 
70
 
71
+  function addBuilding(data) {
72
+    data.openingDate = moment(data.openingDate, 'yyyy-MM-dd HH:mm:ss')
73
+    data.receivedDate = moment(data.receivedDate, 'yyyy-MM-dd HH:mm:ss')
74
+    data.buildingProjectType = []
75
+    // 项目主图
76
+    data.img = data.avatarImage && data.avatarImage.map((item, index) => ({ imgType: 'banner', url: item, orderNo: index + 1 }))
77
+
78
+    request({ ...apis.building.addBuilding, data: { ...data } }).then(() => {
79
+      openNotificationWithIcon('success', '操作成功')
80
+    }).catch(err => {
81
+      openNotificationWithIcon('error', err.message)
82
+    })
83
+  }
84
+
38
   return (
85
   return (
39
         <Form {...formItemLayout} onSubmit={handleSubmit}>
86
         <Form {...formItemLayout} onSubmit={handleSubmit}>
40
-          <Form.Item label="楼盘编号">
87
+          <Form.Item label="楼盘编号" hasFeedback>
41
             {getFieldDecorator('code')(<Input />)}
88
             {getFieldDecorator('code')(<Input />)}
42
           </Form.Item>
89
           </Form.Item>
43
           <Form.Item label="楼盘名称" hasFeedback>
90
           <Form.Item label="楼盘名称" hasFeedback>
47
             {getFieldDecorator('name')(<Input />)}
94
             {getFieldDecorator('name')(<Input />)}
48
           </Form.Item>
95
           </Form.Item>
49
           <Form.Item label="项目类型" hasFeedback>
96
           <Form.Item label="项目类型" hasFeedback>
50
-            {getFieldDecorator('name')(<Input />)}
97
+            {getFieldDecorator('buildingProjectType')(<Input />)}
51
           </Form.Item>
98
           </Form.Item>
52
           <Form.Item label="均价" hasFeedback>
99
           <Form.Item label="均价" hasFeedback>
53
             {getFieldDecorator('price')(<Input />)}
100
             {getFieldDecorator('price')(<Input />)}
54
           </Form.Item>
101
           </Form.Item>
55
           <Form.Item label="开盘时间" hasFeedback>
102
           <Form.Item label="开盘时间" hasFeedback>
56
-            {getFieldDecorator('openingDate')(<DatePicker />)}
103
+            {getFieldDecorator('openingDate')(<DatePicker format="YYYY/MM/DD" />)}
57
           </Form.Item>
104
           </Form.Item>
58
           <Form.Item label="电话" hasFeedback>
105
           <Form.Item label="电话" hasFeedback>
59
             {getFieldDecorator('tel')(<Input />)}
106
             {getFieldDecorator('tel')(<Input />)}
79
             )}
126
             )}
80
           </Form.Item>
127
           </Form.Item>
81
           <Form.Item label="项目主图" hasFeedback>
128
           <Form.Item label="项目主图" hasFeedback>
82
-            {getFieldDecorator('tags')(
83
-              <ImageUpload />,
129
+            {getFieldDecorator('avatarImage')(
130
+              <ImageListUpload />,
84
             )}
131
             )}
85
           </Form.Item>
132
           </Form.Item>
86
           <Form.Item label="地址图片" hasFeedback>
133
           <Form.Item label="地址图片" hasFeedback>
87
-            {getFieldDecorator('tags')(
134
+            {getFieldDecorator('mapImg')(
88
               <ImageUpload />,
135
               <ImageUpload />,
89
             )}
136
             )}
90
           </Form.Item>
137
           </Form.Item>
91
           <Form.Item label="海报底图" hasFeedback>
138
           <Form.Item label="海报底图" hasFeedback>
92
-            {getFieldDecorator('tags')(
139
+            {getFieldDecorator('poster')(
93
               <ImageUpload />,
140
               <ImageUpload />,
94
             )}
141
             )}
95
           </Form.Item>
142
           </Form.Item>
123
           <Form.Item label="项目坐标" hasFeedback>
170
           <Form.Item label="项目坐标" hasFeedback>
124
             {getFieldDecorator('coordinate')(<Input disabled />)}
171
             {getFieldDecorator('coordinate')(<Input disabled />)}
125
           </Form.Item>
172
           </Form.Item>
126
-          <Form.Item label="项目地址" hasFeedback>
127
-            {getFieldDecorator('coordinate')(<Input />)}
173
+          <Form.Item label="地图位置" hasFeedback>
174
+            {(<Input />)}
128
           </Form.Item>
175
           </Form.Item>
129
           <Form.Item label="周边交通" hasFeedback>
176
           <Form.Item label="周边交通" hasFeedback>
130
-            {getFieldDecorator('buildingArea')(
177
+            {getFieldDecorator('buildingTransport')(
131
               <TagGroup />,
178
               <TagGroup />,
132
             )}
179
             )}
133
           </Form.Item>
180
           </Form.Item>
184
             {getFieldDecorator('rightsYear')(<InputNumber />)}
231
             {getFieldDecorator('rightsYear')(<InputNumber />)}
185
           </Form.Item>
232
           </Form.Item>
186
           <Form.Item label="预售许可证" hasFeedback>
233
           <Form.Item label="预售许可证" hasFeedback>
187
-            {getFieldDecorator('decoration')(
234
+            {getFieldDecorator('preSalePermit')(
188
               <ImageUpload />,
235
               <ImageUpload />,
189
             )}
236
             )}
190
           </Form.Item>
237
           </Form.Item>

+ 1
- 1
src/pages/building/list/add/components/imageSet.jsx View File

138
 
138
 
139
       {/* 编辑页 */}
139
       {/* 编辑页 */}
140
       {/*  onSuccess是子组件传递事件信息  */}
140
       {/*  onSuccess是子组件传递事件信息  */}
141
-      <ModalImage visibleData={visibleData} key={visibleData.apartmentId} onSuccess={getList}/>
141
+      <ModalImage visibleData={visibleData} key={1} onSuccess={getList}/>
142
     </>
142
     </>
143
   )
143
   )
144
 }
144
 }

+ 1
- 1
src/pages/building/list/add/components/modalImage.jsx View File

89
     const { url, method } = apis.building.buildingApartmentGetById
89
     const { url, method } = apis.building.buildingApartmentGetById
90
     const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(apartmentId)
90
     const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(apartmentId)
91
 
91
 
92
-    request({ url: tempUrl, method , params: { ...params } }).then(res => {
92
+    request({ url: tempUrl, method, params: { ...params } }).then(res => {
93
       // res.img = res.buildingImgList.map((item, _) => item.url)
93
       // res.img = res.buildingImgList.map((item, _) => item.url)
94
       res.img = res.buildingImgList[0].url
94
       res.img = res.buildingImgList[0].url
95
       this.props.form.setFieldsValue(res)
95
       this.props.form.setFieldsValue(res)

+ 15
- 1
src/pages/building/list/add/components/tags.jsx View File

34
       inputVisible: false,
34
       inputVisible: false,
35
       inputValue: '',
35
       inputValue: '',
36
     });
36
     });
37
+
38
+    if (typeof this.props.onChange === 'function') {
39
+      const tempTags = tags.join(',')
40
+      this.props.onChange(tempTags);
41
+    }
37
   };
42
   };
38
 
43
 
39
   saveInputRef = input => (this.input = input);
44
   saveInputRef = input => (this.input = input);
40
 
45
 
41
   render() {
46
   render() {
42
     const { tags, inputVisible, inputValue } = this.state;
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
+    }
56
+
43
     return (
57
     return (
44
       <div>
58
       <div>
45
-        {tags.map((tag, index) => {
59
+        {data.map((tag, index) => {
46
           const isLongTag = tag.length > 20;
60
           const isLongTag = tag.length > 20;
47
           const tagElem = (
61
           const tagElem = (
48
             <Tag key={tag} closable onClose={() => this.handleClose(tag)}>
62
             <Tag key={tag} closable onClose={() => this.handleClose(tag)}>

+ 10
- 21
src/pages/building/list/add/index.jsx View File

29
 };
29
 };
30
 
30
 
31
 function AddBuilding(props) {
31
 function AddBuilding(props) {
32
-  // eslint-disable-next-line react-hooks/rules-of-hooks
33
-  const [dataSource, setDataSource] = useState({ records: [] })
34
-
35
-  const [buildingAreaTags, setBuildingAreaTags] = useState({ tags: ['Unremovable', 'Tag 2', 'Tag 3'], inputVisible: false, inputValue: '' })
36
-
37
-
38
-  const { getFieldDecorator } = props.form;
39
-
40
-  function handleSubmit(e) {
41
-    e.preventDefault();
42
-    props.form.validateFieldsAndScroll((err, values) => {
43
-      if (!err) {
44
-        console.log('Received values of form: ', values);
45
-      }
46
-    });
47
-  }
48
-
49
   function tabsCallback(key) {
32
   function tabsCallback(key) {
50
     console.log(key);
33
     console.log(key);
51
   }
34
   }
52
 
35
 
36
+  console.log(props.location)
37
+
53
   return (
38
   return (
54
     <Tabs defaultActiveKey="1" onChange={tabsCallback}>
39
     <Tabs defaultActiveKey="1" onChange={tabsCallback}>
55
       <TabPane tab="基本信息" key="1">
40
       <TabPane tab="基本信息" key="1">
56
-        <Base />
57
-      </TabPane>
58
-      <TabPane tab="图片" key="2">
59
-        <ImageSet building={{ buildingId: '159fd19bb973b6972c10fbebf07ddeb1' }} />
41
+        <Base building={{ buildingId: props.location.query && props.location.query.id }} />
60
       </TabPane>
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
+      }
61
     </Tabs>
50
     </Tabs>
62
   )
51
   )
63
 }
52
 }

+ 87
- 8
src/pages/building/list/index.jsx View File

1
 import React, { useState, useEffect } from 'react';
1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert } from 'antd';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, notification, Modal } from 'antd';
3
 import moment from 'moment';
3
 import moment from 'moment';
4
 import request from '../../../utils/request';
4
 import request from '../../../utils/request';
5
 import apis from '../../../services/apis';
5
 import apis from '../../../services/apis';
13
 
13
 
14
 const tempDate = [{ code: 's101' }]
14
 const tempDate = [{ code: 's101' }]
15
 
15
 
16
+function openNotificationWithIcon(type, message) {
17
+  notification[type]({
18
+    message,
19
+    description:
20
+      '',
21
+  });
22
+}
23
+
16
 /**
24
 /**
17
  *卡片
25
  *卡片
18
  *
26
  *
21
 function CartBody(props) {
29
 function CartBody(props) {
22
   const { data } = props
30
   const { data } = props
23
 
31
 
32
+
33
+  function toEdi(record) {
34
+    router.push({
35
+      pathname: '/building/list/add',
36
+      query: {
37
+        id: record.buildingId,
38
+      },
39
+    })
40
+  }
41
+
42
+  /**
43
+   *发布 取消 发布
44
+   *
45
+   * @param {*} record
46
+   */
47
+  function pulicAndUnPulic(record) {
48
+    const modal = Modal.confirm();
49
+    const buidingStatus = record.status === 1 ? 2 : 1
50
+    const title = record.status === 1 ? '确认取消发布此数据?' : '确认发布此数据?'
51
+
52
+    modal.update({
53
+      content: title,
54
+      okText: '确认',
55
+      cancelText: '关闭',
56
+      onOk: () => {
57
+        request({ ...apis.building.updateStatus, data: { id: record.buildingId, status: buidingStatus } }).then(() => {
58
+          openNotificationWithIcon('success', '操作成功')
59
+          props.onSuccess()
60
+        }).catch(err => {
61
+          openNotificationWithIcon('error', err.message)
62
+        })
63
+
64
+        modal.destroy();
65
+      },
66
+      onCancel: () => {
67
+        modal.destroy();
68
+      },
69
+    });
70
+  }
71
+
72
+  /**
73
+   *删除楼盘
74
+   *
75
+   * @param {*} record
76
+   */
77
+  function deleteBuilding(record) {
78
+    const { url, method } = apis.building.deleteBuilding
79
+    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(record.buildingId)
80
+
81
+    const modal = Modal.confirm();
82
+    modal.update({
83
+      content: '确定删除此楼盘?',
84
+      okText: '确认',
85
+      cancelText: '关闭',
86
+      onOk: () => {
87
+        request({ url: tempUrl, method }).then(() => {
88
+          openNotificationWithIcon('success', '操作成功')
89
+          props.onSuccess()
90
+        }).catch(err => {
91
+          openNotificationWithIcon('error', err.message)
92
+        })
93
+
94
+        modal.destroy();
95
+      },
96
+      onCancel: () => {
97
+        modal.destroy();
98
+      },
99
+    });
100
+  }
101
+
24
   return (
102
   return (
25
           <Card
103
           <Card
26
             hoverable
104
             hoverable
31
             <p className={Styles.cardText}>
109
             <p className={Styles.cardText}>
32
               <span className={Styles.title}>楼盘编号</span>
110
               <span className={Styles.title}>楼盘编号</span>
33
               <span >:{ data.code }</span>
111
               <span >:{ data.code }</span>
34
-              <span className={Styles.ediText}>
112
+              <span className={Styles.ediText} onClick={() => toEdi(data)}>
35
                 编辑
113
                 编辑
36
                 <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
114
                 <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
37
               </span>
115
               </span>
52
             </p>
130
             </p>
53
             <p className={Styles.cardItem}>
131
             <p className={Styles.cardItem}>
54
               <span className={Styles.title}>发布状态</span>
132
               <span className={Styles.title}>发布状态</span>
55
-              <span >:{ data.status === '1' ? '已发布' : '未发布' }</span>
133
+              <span >:{ data.status === 1 ? '已发布' : '未发布' }</span>
56
             </p>
134
             </p>
57
             <p className={Styles.cardItem}>
135
             <p className={Styles.cardItem}>
58
               <span className={Styles.title}>录入时间</span>
136
               <span className={Styles.title}>录入时间</span>
59
               <span >:{ data.createDate }</span>
137
               <span >:{ data.createDate }</span>
60
             </p>
138
             </p>
61
             <p style={{ margin: '15px 0', position: 'relative', fontSize: '18px' }}>
139
             <p style={{ margin: '15px 0', position: 'relative', fontSize: '18px' }}>
62
-              <span style={{ color: '#1990FF' }}>
63
-                取消发布
140
+              <span style={{ color: '#1990FF' }} onClick={() => pulicAndUnPulic(data)}>
141
+                {/* 已发布的时候,需要显示取消发布的字样 */}
142
+                { data.status === 1 ? '取消发布' : '发布' }
64
                 <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
143
                 <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
65
               </span>
144
               </span>
66
               <span style={{
145
               <span style={{
67
                 color: '#FF4A4A', position: 'absolute', right: '0',
146
                 color: '#FF4A4A', position: 'absolute', right: '0',
68
-              }} >
147
+              }} onClick={() => deleteBuilding(data)}>
69
                 删除
148
                 删除
70
                 <Icon type="rest" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
149
                 <Icon type="rest" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
71
               </span>
150
               </span>
213
       {/* 卡片内容,显示楼盘项目  */}
292
       {/* 卡片内容,显示楼盘项目  */}
214
       <Row style={{ padding: ' 0 10px' }}>
293
       <Row style={{ padding: ' 0 10px' }}>
215
         {
294
         {
216
-          dataSource.records.map((item, index) => (
295
+          dataSource.records.map((item, _) => (
217
               <Col span={8}>
296
               <Col span={8}>
218
-                <CartBody data={item} key={item.buildingId}/>
297
+                <CartBody data={item} key={item.buildingId} onSuccess={getList}/>
219
               </Col>
298
               </Col>
220
             ))
299
             ))
221
         }
300
         }

+ 1
- 0
src/pages/channel/channelList.jsx View File

109
   const [data, setData] = useState({ channelNmae: [], result: [] })
109
   const [data, setData] = useState({ channelNmae: [], result: [] })
110
   // eslint-disable-next-line react-hooks/rules-of-hooks
110
   // eslint-disable-next-line react-hooks/rules-of-hooks
111
   useEffect(() => {
111
   useEffect(() => {
112
+    localStorage.removeItem('value');
112
     getList({ pageNum: 1, pageSize: 10 })
113
     getList({ pageNum: 1, pageSize: 10 })
113
   }, [])
114
   }, [])
114
 
115
 

+ 3
- 4
src/pages/customer/independentList/index.jsx View File

374
         <>
374
         <>
375
           {
375
           {
376
             <>
376
             <>
377
-              <sapn style={{ color: 'rgba(239,39,58,1)' }}>查看详细</sapn>
377
+              {/* <sapn style={{ color: 'rgba(239,39,58,1)' }}>查看详细</sapn> */}
378
+              <a style={{ color: 'rgba(239,39,58,1)' }} onClick={() => Invite(record)}>邀请经纪人</a>
378
               &nbsp;&nbsp;&nbsp;&nbsp;
379
               &nbsp;&nbsp;&nbsp;&nbsp;
379
-              <sapn style={{ color: 'rgba(239,39,58,1)' }} onClick={() => Invite(record)}>邀请经纪人</sapn>
380
-              &nbsp;&nbsp;&nbsp;&nbsp;
381
-              <sapn style={{ color: 'rgba(239,39,58,1)' }} onClick={() => gM(record)}>推荐客户</sapn>
380
+              <a style={{ color: 'rgba(239,39,58,1)' }} onClick={() => gM(record)}>推荐客户</a>
382
             </>
381
             </>
383
           }
382
           }
384
         </>
383
         </>

+ 1
- 1
src/pages/staff/list/RoleList.jsx View File

25
 }
25
 }
26
 function toEditRole() {
26
 function toEditRole() {
27
   router.push({
27
   router.push({
28
-    pathname: '/staff/editRole',
28
+    pathname: '/staff/list/addRole',
29
     query: {
29
     query: {
30
       a: 'b',
30
       a: 'b',
31
     },
31
     },

+ 162
- 0
src/pages/staff/list/addRole.jsx View File

1
+import React, { useState, useEffect } from 'react';
2
+import { Checkbox, Input, Card } from 'antd';
3
+import { connect } from 'dva';
4
+import XForm, { FieldTypes } from '../../../components/XForm';
5
+import request from '../../../utils/request';
6
+import channels from './channelList.less';
7
+
8
+const { TextArea } = Input;
9
+
10
+
11
+/**
12
+ *
13
+ *
14
+ * @param {*} props
15
+ * @returns
16
+ */
17
+const Edit = props => {
18
+  console.log('props,props', props.user.currentUser)
19
+  const userMenus = props.user.currentUser.menus;
20
+  const userBtns = props.user.currentUser.buttons;
21
+
22
+
23
+  const [data, setData] = useState({ data: [] })
24
+ // 获取当前所有菜单
25
+  useEffect(() => {
26
+    localStorage.removeItem('value');
27
+    menuList({ pageNum: 1, pageSize: 100 })
28
+  }, [])
29
+
30
+  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 => {
37
+      console.log(data)
38
+      setData(data)
39
+  })
40
+  }
41
+
42
+  // function SuBmenu(params) {
43
+  //  return Array.from(userMenus).map(Item =>
44
+  //  <Checkbox value={ Item.menuId }> { Item.name }</Checkbox>)
45
+  // }
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
+    )
123
+  }
124
+
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)
157
+  }
158
+  return <XForm onSubmit={handleSubmit} fields={fields}></XForm>
159
+}
160
+
161
+
162
+export default connect(({ user }) => ({ user }))(Edit);

+ 28
- 14
src/pages/staff/list/editRole.jsx View File

1
-import React, { useState } from 'react';
2
-
1
+import React, { useState, useEffect } from 'react';
3
 import { Checkbox, Row, Col, Input, Menu, Dropdown, Button, Icon, message, Table, Tooltip, Tabs, Radio, Divider, Tag, DatePicker, Select, Form, Alert, Card } from 'antd';
2
 import { Checkbox, Row, Col, Input, Menu, Dropdown, Button, Icon, message, Table, Tooltip, Tabs, Radio, Divider, Tag, DatePicker, Select, Form, Alert, Card } from 'antd';
4
 import { FormattedMessage } from 'umi-plugin-react/locale';
3
 import { FormattedMessage } from 'umi-plugin-react/locale';
5
 import styles from '../../style/GoodsList.less';
4
 import styles from '../../style/GoodsList.less';
6
 import XForm, { FieldTypes } from '../../../components/XForm';
5
 import XForm, { FieldTypes } from '../../../components/XForm';
7
-import Wangedit from '../../../components/Wangedit/Wangedit'
6
+import Wangedit from '../../../components/Wangedit/Wangedit';
7
+import request from '../../../utils/request';
8
 import channels from './channelList.less';
8
 import channels from './channelList.less';
9
-
10
 import Tagss from '../components/Tagss.jsx';
9
 import Tagss from '../components/Tagss.jsx';
11
 
10
 
12
 const { TextArea } = Input;
11
 const { TextArea } = Input;
19
  * @returns
18
  * @returns
20
  */
19
  */
21
 const Edit = (props) => {
20
 const Edit = (props) => {
22
-
23
-
24
-
21
+  const [data, setData] = useState({ data: [] })
22
+ // 获取当前所有菜单
23
+  useEffect(() => {
24
+    localStorage.removeItem('value');
25
+    menuList({ pageNum: 1, pageSize: 100 })
26
+  }, [])
27
+
28
+  function menuList(params) {
29
+    request({
30
+      url: '/api/admin/menuList',
31
+      method: 'GET',
32
+      params: { ...params },
33
+  // eslint-disable-next-line no-shadow
34
+  }).then(data => {
35
+      console.log(data)
36
+      setData(data)
37
+  })
38
+  }
25
   // const [tab, changeTab] = useState('basic')
39
   // const [tab, changeTab] = useState('basic')
26
 
40
 
27
   const Permission = [
41
   const Permission = [
99
   // }
113
   // }
100
   // const [Card] = useState('Poster')
114
   // const [Card] = useState('Poster')
101
 
115
 
102
-  const Poster = (props) => {
116
+  const Poster = props => {
103
 
117
 
104
     const dataSource = [
118
     const dataSource = [
105
 
119
 
135
     {/* <Checkbox>{Permission[index]}</Checkbox> */ }
149
     {/* <Checkbox>{Permission[index]}</Checkbox> */ }
136
     return <>
150
     return <>
137
       <div style={{}}>
151
       <div style={{}}>
138
-
152
+      {Array.from(data).map(Item =>
153
+                <Checkbox value={ Item.menuId }> { Item.name } </Checkbox>,
154
+              )}
139
         {Permission.map((item, index) => (
155
         {Permission.map((item, index) => (
140
-
141
-
142
-          <Card title={<Checkbox value=''>{Permission[index]}</Checkbox>} bordered={true} style={{ width: '100%' }}>
143
-
144
-            {dataSource.map((items, indexs) => (
156
+          <Card title={<Checkbox>{Permission[index]}</Checkbox>} bordered={true} style={{ width: '100%' }}>
157
+            
158
+              {dataSource.map((items, indexs) => (
145
               <>
159
               <>
146
                 <Card.Grid style={gridStyle1}><Checkbox value=''>{items.name}</Checkbox></Card.Grid>
160
                 <Card.Grid style={gridStyle1}><Checkbox value=''>{items.name}</Checkbox></Card.Grid>
147
 
161
 

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

22
       method: 'GET',
22
       method: 'GET',
23
       url: `${prefix}/buildinglist`,
23
       url: `${prefix}/buildinglist`,
24
     },
24
     },
25
+    updateStatus: {
26
+      method: 'PUT',
27
+      url: `${prefix}/building/update/status`,
28
+    },
29
+    addBuilding: {
30
+      method: 'POST',
31
+      url: `${prefix}/building/add`,
32
+    },
33
+    buildingGetById: {
34
+      method: 'GET',
35
+      url: `${prefix}/buildingSelectId/id`,
36
+    },
37
+    deleteBuilding: {
38
+      method: 'DELETE',
39
+      url: `${prefix}/building/delete/id`,
40
+    },
25
     buildingApartment: {
41
     buildingApartment: {
26
       method: 'GET',
42
       method: 'GET',
27
       url: `${prefix}/buildingApartment/buildingId/id`,
43
       url: `${prefix}/buildingApartment/buildingId/id`,