周立森 5 年前
父节点
当前提交
0d7880c4aa

+ 94
- 15
config/config.js 查看文件

@@ -123,13 +123,23 @@ export default {
123 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 135
                   path: '/building/type',
127 136
                   name: '项目类型',
128 137
                   component: './building/type/index',
129 138
                 },
130 139
                 {
131 140
                   path: '/building/type/edi',
132
-                  name: '',
141
+                  name: '项目类型编辑',
142
+                  hideInMenu: true,
133 143
                   component: './building/type/edi',
134 144
                 },
135 145
               ],
@@ -145,6 +155,15 @@ export default {
145 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 167
                   path: '/customer/drift/list',
149 168
                   name: '游客列表',
150 169
                   component: './customer/drift/index',
@@ -161,7 +180,8 @@ export default {
161 180
                 },
162 181
                 {
163 182
                   path: '/customer/recommendCustomer/audit',
164
-                  name: '', //审核
183
+                  name: '客户审核', 
184
+                  hideInMenu: true,
165 185
                   component: './customer/recommendCustomer/audit',
166 186
                 },
167 187
                 {
@@ -188,7 +208,8 @@ export default {
188 208
                 },
189 209
                 {
190 210
                   path: '/integralMall/editGoods',
191
-                  name: '',
211
+                  name: '商品编辑',
212
+                  hideInMenu: true,
192 213
                   component: './integralMall/editGoods',
193 214
                 },
194 215
                 {
@@ -203,7 +224,8 @@ export default {
203 224
                 },
204 225
                 {
205 226
                   path: '/integralMall/verifyList',
206
-                  name: '',
227
+                  name: '商品核销列表',
228
+                  hideInMenu: true,
207 229
                   component: './integralMall/verifyList',
208 230
                 },
209 231
               ],
@@ -220,12 +242,14 @@ export default {
220 242
                 },
221 243
                 {
222 244
                   path: '/channel/addChannel',
223
-                  name: '',
245
+                  name: '添加渠道',
246
+                  hideInMenu: true,
224 247
                   component: './channel/addChannel',
225 248
                 },
226 249
                 {
227 250
                   path: '/channel/editChannel',
228
-                  name: '',
251
+                  name: '编辑渠道',
252
+                  hideInMenu: true,
229 253
                   component: './channel/editChannel',
230 254
                 },
231 255
                 {
@@ -235,12 +259,14 @@ export default {
235 259
                 },
236 260
                 {
237 261
                   path: '/channel/recommendClients',
238
-                  name: '',
262
+                  name: '渠道推荐',
263
+                  hideInMenu: true,
239 264
                   component: './channel/recommendClients',
240 265
                 },
241 266
                 {
242 267
                   path: '/channel/InviteClients',
243
-                  name: '',
268
+                  name: '邀请客户',
269
+                  hideInMenu: true,
244 270
                   component: './channel/InviteClients',
245 271
                 },
246 272
               ],
@@ -257,7 +283,8 @@ export default {
257 283
                 },
258 284
                 {
259 285
                   path: '/news/type/editNews',
260
-                  name: '',
286
+                  name: '编辑资讯类型',
287
+                  hideInMenu: true,
261 288
                   component: './news/type/editNews',
262 289
                 },
263 290
                 {
@@ -265,6 +292,15 @@ export default {
265 292
                   name: '资讯列表',
266 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,12 +315,14 @@ export default {
279 315
                 },
280 316
                 {
281 317
                   path: '/activity/editActivity',
282
-                  name: '',
318
+                  name: '编辑活动',
319
+                  hideInMenu: true,
283 320
                   component: './activity/editActivity',
284 321
                 },
285 322
                 {
286 323
                   path: '/activity/SignList',
287
-                  name: '',
324
+                  name: '报名列表',
325
+                  hideInMenu: true,
288 326
                   component: './activity/SignList',
289 327
                 },
290 328
               ],
@@ -302,7 +340,8 @@ export default {
302 340
                 },
303 341
                 {
304 342
                   path: '/staff/editStaff',
305
-                  name: '',
343
+                  name: '编辑员工',
344
+                  hideInMenu: true,
306 345
                   component: './staff/list/editStaff',
307 346
                 },
308 347
              
@@ -313,10 +352,49 @@ export default {
313 352
                 },
314 353
                 {
315 354
                   path: '/staff/editRole',
316
-                  name: '',
355
+                  name: '编辑角色',
356
+                  hideInMenu: true,
317 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,7 +424,8 @@ export default {
346 424
                 },
347 425
                 {
348 426
                   path: '/system/editPolicy',
349
-                  name: '',
427
+                  name: '购房政策编辑',
428
+                  hideInMenu: true,
350 429
                   component: './system/editPolicy',
351 430
                 },
352 431
               ],
@@ -414,7 +493,7 @@ export default {
414 493
 
415 494
   proxy: {
416 495
     '/api/': {
417
-      target: 'http://192.168.0.11:8080/',
496
+      target: 'http://192.168.0.84:8080/',
418 497
       changeOrigin: true,
419 498
       // pathRewrite: { '^/server': '' },
420 499
     },

+ 74
- 0
src/components/XForm/ImageListUpload.jsx 查看文件

@@ -0,0 +1,74 @@
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 查看文件

@@ -0,0 +1,13 @@
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 查看文件

@@ -6,3 +6,15 @@
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 查看文件

@@ -0,0 +1,13 @@
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 查看文件

@@ -47,77 +47,87 @@ ol {
47 47
   }
48 48
 }
49 49
 
50
-.ant-pro-global-header{
50
+.ant-layout-header .ant-pro-global-header{
51 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 54
   background:#EF273A;
55 55
   box-shadow: none;
56 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 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 查看文件

@@ -6,24 +6,16 @@
6 6
 import ProLayout from '@ant-design/pro-layout';
7 7
 import React, { useEffect } from 'react';
8 8
 import Link from 'umi/link';
9
+import Redirect from 'umi/redirect';
9 10
 import { connect } from 'dva';
10 11
 import { formatMessage } from 'umi-plugin-react/locale';
11 12
 import Authorized from '@/utils/Authorized';
12 13
 import RightContent from '@/components/GlobalHeader/RightContent';
13 14
 import { isAntDesignPro } from '@/utils/utils';
14 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 17
 const footerRender = () => {
25 18
   return (
26
-
27 19
     <div
28 20
       style={{
29 21
         padding: ' 44px 0',
@@ -32,14 +24,13 @@ const footerRender = () => {
32 24
         fontFamily: 'monospace',
33 25
         fontWeight: '200',
34 26
         color: 'rgba(102, 102, 102, 1)',
35
-    
36
-
37 27
       }}
38 28
     >
39 29
       copy Right @ 知与行
40 30
     </div>
41 31
   )
42 32
 }
33
+
43 34
 const BasicLayout = props => {
44 35
   const { dispatch, children, settings } = props;
45 36
   /**
@@ -69,6 +60,26 @@ const BasicLayout = props => {
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 83
   return (
73 84
     <ProLayout
74 85
       logo={logo}
@@ -106,12 +117,13 @@ const BasicLayout = props => {
106 117
       {...settings}
107 118
     // pageTitleRender={()=><></>}
108 119
     >
109
-      {children}
120
+      {checkRights(children)}
110 121
     </ProLayout>
111 122
   );
112 123
 };
113 124
 
114
-export default connect(({ global, settings }) => ({
125
+export default connect(({ global, settings, user }) => ({
115 126
   collapsed: global.collapsed,
116 127
   settings,
128
+  user
117 129
 }))(BasicLayout);

+ 5
- 2
src/models/user.js 查看文件

@@ -26,8 +26,11 @@ const UserModel = {
26 26
     },
27 27
   },
28 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 35
     changeNotifyCount(
33 36
       state = {

+ 109
- 15
src/pages/activity/editActivity.jsx 查看文件

@@ -26,8 +26,7 @@ const { TextArea } = Input;
26 26
  * @returns
27 27
  */
28 28
 const Edit = (props) => {
29
-  const [tab, changeTab] = useState('poster')
30
-  // const [tab, changeTab] = useState('basic')
29
+  const [tab, changeTab] = useState('basic')
31 30
   const dynamicId = props.location.query.dynamicId
32 31
   const [dynamicData, setDynamicData] = useState({})
33 32
   if (dynamicId) {
@@ -149,6 +148,7 @@ const Edit = (props) => {
149 148
           method: 'PUT',
150 149
           data: submitValue,
151 150
         }).then((data) => {
151
+          message.info("保存成功")
152 152
           cancelPage()
153 153
         }).catch((err) => {
154 154
           message.info(err.msg || err.message)
@@ -159,6 +159,7 @@ const Edit = (props) => {
159 159
           method: 'POST',
160 160
           data: submitValue,
161 161
         }).then((data) => {
162
+          message.info("保存成功")
162 163
           cancelPage()
163 164
         }).catch((err) => {
164 165
           message.info(err.msg || err.message)
@@ -173,6 +174,57 @@ const Edit = (props) => {
173 174
     const [inputValue, changeInput] = useState('')
174 175
     const [textAreaValue, changeTextArea] = useState('')
175 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 228
     return <div>
177 229
       <div style={{ display: 'flex' }}>
178 230
         <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
@@ -210,20 +262,20 @@ const Edit = (props) => {
210 262
         <div >
211 263
           <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
212 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 266
           </div>
215 267
           <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
216 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 270
           </div>
219 271
           <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
220 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 274
           </div>
223 275
 
224 276
         </div>
225 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 279
       <Button onClick={() => router.go(-1)}>取消</Button>
228 280
     </div>
229 281
 
@@ -234,13 +286,55 @@ const Edit = (props) => {
234 286
   const Share = (props) => {
235 287
     const [inputValue, changeInput] = useState('')
236 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 339
     return <div style={{ padding: '20px' }}>
246 340
       <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
@@ -253,13 +347,13 @@ const Edit = (props) => {
253 347
       </div>
254 348
       <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
255 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 351
       </div>
258 352
       <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
259 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 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 357
       <Button onClick={() => router.go(-1)}>取消</Button>
264 358
     </div>
265 359
   }

+ 60
- 13
src/pages/building/list/add/components/base.jsx 查看文件

@@ -1,11 +1,12 @@
1 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 3
 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 7
 import { router } from 'umi';
8 8
 import ImageUpload from '../../../../../components/XForm/ImageUpload'
9
+import ImageListUpload from '../../../../../components/XForm/ImageListUpload'
9 10
 import Wangedit from '../../../../../components/Wangedit/Wangedit'
10 11
 import TagGroup from './tags'
11 12
 
@@ -23,21 +24,67 @@ const formItemLayout = {
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 37
 function AddBuilding(props) {
27 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 62
   function handleSubmit(e) {
30 63
     e.preventDefault();
31 64
     props.form.validateFieldsAndScroll((err, values) => {
32 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 85
   return (
39 86
         <Form {...formItemLayout} onSubmit={handleSubmit}>
40
-          <Form.Item label="楼盘编号">
87
+          <Form.Item label="楼盘编号" hasFeedback>
41 88
             {getFieldDecorator('code')(<Input />)}
42 89
           </Form.Item>
43 90
           <Form.Item label="楼盘名称" hasFeedback>
@@ -47,13 +94,13 @@ function AddBuilding(props) {
47 94
             {getFieldDecorator('name')(<Input />)}
48 95
           </Form.Item>
49 96
           <Form.Item label="项目类型" hasFeedback>
50
-            {getFieldDecorator('name')(<Input />)}
97
+            {getFieldDecorator('buildingProjectType')(<Input />)}
51 98
           </Form.Item>
52 99
           <Form.Item label="均价" hasFeedback>
53 100
             {getFieldDecorator('price')(<Input />)}
54 101
           </Form.Item>
55 102
           <Form.Item label="开盘时间" hasFeedback>
56
-            {getFieldDecorator('openingDate')(<DatePicker />)}
103
+            {getFieldDecorator('openingDate')(<DatePicker format="YYYY/MM/DD" />)}
57 104
           </Form.Item>
58 105
           <Form.Item label="电话" hasFeedback>
59 106
             {getFieldDecorator('tel')(<Input />)}
@@ -79,17 +126,17 @@ function AddBuilding(props) {
79 126
             )}
80 127
           </Form.Item>
81 128
           <Form.Item label="项目主图" hasFeedback>
82
-            {getFieldDecorator('tags')(
83
-              <ImageUpload />,
129
+            {getFieldDecorator('avatarImage')(
130
+              <ImageListUpload />,
84 131
             )}
85 132
           </Form.Item>
86 133
           <Form.Item label="地址图片" hasFeedback>
87
-            {getFieldDecorator('tags')(
134
+            {getFieldDecorator('mapImg')(
88 135
               <ImageUpload />,
89 136
             )}
90 137
           </Form.Item>
91 138
           <Form.Item label="海报底图" hasFeedback>
92
-            {getFieldDecorator('tags')(
139
+            {getFieldDecorator('poster')(
93 140
               <ImageUpload />,
94 141
             )}
95 142
           </Form.Item>
@@ -123,11 +170,11 @@ function AddBuilding(props) {
123 170
           <Form.Item label="项目坐标" hasFeedback>
124 171
             {getFieldDecorator('coordinate')(<Input disabled />)}
125 172
           </Form.Item>
126
-          <Form.Item label="项目地址" hasFeedback>
127
-            {getFieldDecorator('coordinate')(<Input />)}
173
+          <Form.Item label="地图位置" hasFeedback>
174
+            {(<Input />)}
128 175
           </Form.Item>
129 176
           <Form.Item label="周边交通" hasFeedback>
130
-            {getFieldDecorator('buildingArea')(
177
+            {getFieldDecorator('buildingTransport')(
131 178
               <TagGroup />,
132 179
             )}
133 180
           </Form.Item>
@@ -184,7 +231,7 @@ function AddBuilding(props) {
184 231
             {getFieldDecorator('rightsYear')(<InputNumber />)}
185 232
           </Form.Item>
186 233
           <Form.Item label="预售许可证" hasFeedback>
187
-            {getFieldDecorator('decoration')(
234
+            {getFieldDecorator('preSalePermit')(
188 235
               <ImageUpload />,
189 236
             )}
190 237
           </Form.Item>

+ 1
- 1
src/pages/building/list/add/components/imageSet.jsx 查看文件

@@ -138,7 +138,7 @@ function imageSet(props) {
138 138
 
139 139
       {/* 编辑页 */}
140 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 查看文件

@@ -89,7 +89,7 @@ class ModalImage extends React.Component {
89 89
     const { url, method } = apis.building.buildingApartmentGetById
90 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 93
       // res.img = res.buildingImgList.map((item, _) => item.url)
94 94
       res.img = res.buildingImgList[0].url
95 95
       this.props.form.setFieldsValue(res)

+ 15
- 1
src/pages/building/list/add/components/tags.jsx 查看文件

@@ -34,15 +34,29 @@ class EditableTagGroup extends React.Component {
34 34
       inputVisible: false,
35 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 44
   saveInputRef = input => (this.input = input);
40 45
 
41 46
   render() {
42 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 57
     return (
44 58
       <div>
45
-        {tags.map((tag, index) => {
59
+        {data.map((tag, index) => {
46 60
           const isLongTag = tag.length > 20;
47 61
           const tagElem = (
48 62
             <Tag key={tag} closable onClose={() => this.handleClose(tag)}>

+ 10
- 21
src/pages/building/list/add/index.jsx 查看文件

@@ -29,35 +29,24 @@ const formItemLayout = {
29 29
 };
30 30
 
31 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 32
   function tabsCallback(key) {
50 33
     console.log(key);
51 34
   }
52 35
 
36
+  console.log(props.location)
37
+
53 38
   return (
54 39
     <Tabs defaultActiveKey="1" onChange={tabsCallback}>
55 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 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 50
     </Tabs>
62 51
   )
63 52
 }

+ 87
- 8
src/pages/building/list/index.jsx 查看文件

@@ -1,5 +1,5 @@
1 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 3
 import moment from 'moment';
4 4
 import request from '../../../utils/request';
5 5
 import apis from '../../../services/apis';
@@ -13,6 +13,14 @@ const { Meta } = Card;
13 13
 
14 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,6 +29,76 @@ const tempDate = [{ code: 's101' }]
21 29
 function CartBody(props) {
22 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 102
   return (
25 103
           <Card
26 104
             hoverable
@@ -31,7 +109,7 @@ function CartBody(props) {
31 109
             <p className={Styles.cardText}>
32 110
               <span className={Styles.title}>楼盘编号</span>
33 111
               <span >:{ data.code }</span>
34
-              <span className={Styles.ediText}>
112
+              <span className={Styles.ediText} onClick={() => toEdi(data)}>
35 113
                 编辑
36 114
                 <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
37 115
               </span>
@@ -52,20 +130,21 @@ function CartBody(props) {
52 130
             </p>
53 131
             <p className={Styles.cardItem}>
54 132
               <span className={Styles.title}>发布状态</span>
55
-              <span >:{ data.status === '1' ? '已发布' : '未发布' }</span>
133
+              <span >:{ data.status === 1 ? '已发布' : '未发布' }</span>
56 134
             </p>
57 135
             <p className={Styles.cardItem}>
58 136
               <span className={Styles.title}>录入时间</span>
59 137
               <span >:{ data.createDate }</span>
60 138
             </p>
61 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 143
                 <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
65 144
               </span>
66 145
               <span style={{
67 146
                 color: '#FF4A4A', position: 'absolute', right: '0',
68
-              }} >
147
+              }} onClick={() => deleteBuilding(data)}>
69 148
                 删除
70 149
                 <Icon type="rest" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
71 150
               </span>
@@ -213,9 +292,9 @@ function body(props) {
213 292
       {/* 卡片内容,显示楼盘项目  */}
214 293
       <Row style={{ padding: ' 0 10px' }}>
215 294
         {
216
-          dataSource.records.map((item, index) => (
295
+          dataSource.records.map((item, _) => (
217 296
               <Col span={8}>
218
-                <CartBody data={item} key={item.buildingId}/>
297
+                <CartBody data={item} key={item.buildingId} onSuccess={getList}/>
219 298
               </Col>
220 299
             ))
221 300
         }

+ 1
- 0
src/pages/channel/channelList.jsx 查看文件

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

+ 3
- 4
src/pages/customer/independentList/index.jsx 查看文件

@@ -374,11 +374,10 @@ function body(props) {
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 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 查看文件

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

+ 162
- 0
src/pages/staff/list/addRole.jsx 查看文件

@@ -0,0 +1,162 @@
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 查看文件

@@ -1,12 +1,11 @@
1
-import React, { useState } from 'react';
2
-
1
+import React, { useState, useEffect } from 'react';
3 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 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
5 4
 import styles from '../../style/GoodsList.less';
6 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 8
 import channels from './channelList.less';
9
-
10 9
 import Tagss from '../components/Tagss.jsx';
11 10
 
12 11
 const { TextArea } = Input;
@@ -19,9 +18,24 @@ const { TextArea } = Input;
19 18
  * @returns
20 19
  */
21 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 39
   // const [tab, changeTab] = useState('basic')
26 40
 
27 41
   const Permission = [
@@ -99,7 +113,7 @@ const Edit = (props) => {
99 113
   // }
100 114
   // const [Card] = useState('Poster')
101 115
 
102
-  const Poster = (props) => {
116
+  const Poster = props => {
103 117
 
104 118
     const dataSource = [
105 119
 
@@ -135,13 +149,13 @@ const Edit = (props) => {
135 149
     {/* <Checkbox>{Permission[index]}</Checkbox> */ }
136 150
     return <>
137 151
       <div style={{}}>
138
-
152
+      {Array.from(data).map(Item =>
153
+                <Checkbox value={ Item.menuId }> { Item.name } </Checkbox>,
154
+              )}
139 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 160
                 <Card.Grid style={gridStyle1}><Checkbox value=''>{items.name}</Checkbox></Card.Grid>
147 161
 

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

@@ -22,6 +22,22 @@ export default {
22 22
       method: 'GET',
23 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 41
     buildingApartment: {
26 42
       method: 'GET',
27 43
       url: `${prefix}/buildingApartment/buildingId/id`,