Browse Source

Merge branch 'master' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager

许静 5 years ago
parent
commit
f1cf3bae2a

+ 2
- 0
config/config.js View File

83
   targets: {
83
   targets: {
84
     ie: 11,
84
     ie: 11,
85
   },
85
   },
86
+  publicPath: './',
87
+  history: 'hash',
86
   devtool: isAntDesignProPreview ? 'source-map' : false,
88
   devtool: isAntDesignProPreview ? 'source-map' : false,
87
   // umi routes: https://umijs.org/zh/guide/router.html
89
   // umi routes: https://umijs.org/zh/guide/router.html
88
   routes,
90
   routes,

+ 1
- 0
config/routes.js View File

189
               {
189
               {
190
                 path: '/channel/brokerList',
190
                 path: '/channel/brokerList',
191
                 name: '经纪人',
191
                 name: '经纪人',
192
+                hideInMenu: true,
192
                 component: './channel/brokerList',
193
                 component: './channel/brokerList',
193
               },
194
               },
194
               {
195
               {

+ 8
- 2
src/components/AuthButton/index.jsx View File

7
   const btn = allBtns.filter(x => x.code === name)[0]
7
   const btn = allBtns.filter(x => x.code === name)[0]
8
 
8
 
9
   // 没维护的按钮, 或者不需要权限的按钮直接通过
9
   // 没维护的按钮, 或者不需要权限的按钮直接通过
10
-  if (!btn || !btn.roles || !btn.roles.length) {
10
+  // if (!btn || !btn.roles || !btn.roles.length) {
11
+  //   return <>{children}</>
12
+  // }
13
+
14
+  // const hasRight = btn.roles.some(x => current.some(y => x === y))
15
+
16
+  if (!btn || !btn.rolesList || !btn.rolesList.length) {
11
     return <>{children}</>
17
     return <>{children}</>
12
   }
18
   }
13
 
19
 
14
-  const hasRight = btn.roles.some(x => current.some(y => x === y))
20
+  const hasRight = btn.rolesList.some(x => current.some(y => x.roleId === y))
15
   return hasRight ? <>{children}</> : <>{noRight}</>
21
   return hasRight ? <>{children}</> : <>{noRight}</>
16
 }
22
 }
17
 
23
 

+ 1
- 0
src/pages/building/list/index.jsx View File

200
         // eslint-disable-next-line no-console
200
         // eslint-disable-next-line no-console
201
         console.log('提交数据: ', values)
201
         console.log('提交数据: ', values)
202
         const { startDate } = values
202
         const { startDate } = values
203
+        values.startDate = `${moment(startDate).format('YYYY-MM-DDT00:00:00.000')}Z`
203
         getList({ pageNum: 1, pageSize: 9, ...values })
204
         getList({ pageNum: 1, pageSize: 9, ...values })
204
       }
205
       }
205
     });
206
     });

+ 2
- 2
src/pages/channel/brokerList.jsx View File

103
 //   const [page, changePage] = useState({})
103
 //   const [page, changePage] = useState({})
104
   // eslint-disable-next-line react-hooks/rules-of-hooks
104
   // eslint-disable-next-line react-hooks/rules-of-hooks
105
   useEffect(() => {
105
   useEffect(() => {
106
-    getListBroker()
106
+    getListBroker({ channelId: props.location.query.id, pageNum: 1, pageSize: 10 })
107
   }, [])
107
   }, [])
108
 
108
 
109
     function getListBroker(params) {
109
     function getListBroker(params) {
118
 
118
 
119
  // 查询
119
  // 查询
120
  function queryList() {
120
  function queryList() {
121
-  getListBroker({ ...queryData, pageNum: 1, pageSize: 10, channelId: localStorage.getItem('value') })
121
+  getListBroker({ ...queryData, pageNum: 1, pageSize: 10, channelId: props.location.query.id })
122
 }
122
 }
123
     // 分页
123
     // 分页
124
     function onChange(pageNumber) {
124
     function onChange(pageNumber) {

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

64
     dataIndex: 'brokerCount',
64
     dataIndex: 'brokerCount',
65
     key: 'brokerCount',
65
     key: 'brokerCount',
66
     align: 'center',
66
     align: 'center',
67
+      render: (text, record) => <a style={ { color: '#66B3FF' } } onClick= {() => toBroker(record)} >{ record.recommendCount }</a>,
67
   },
68
   },
68
   {
69
   {
69
     title: '推荐客户有效',
70
     title: '推荐客户有效',
86
       <AuthButton name="admin.channel.id.put" noRight={null}>
87
       <AuthButton name="admin.channel.id.put" noRight={null}>
87
         <a style={{ color: '#66B3FF' }} onClick={() => toedit(record.channelId)} >编辑</a>
88
         <a style={{ color: '#66B3FF' }} onClick={() => toedit(record.channelId)} >编辑</a>
88
       </AuthButton>
89
       </AuthButton>
89
-    )
90
+    ),
90
   },
91
   },
91
 ];
92
 ];
92
 
93
 
110
   });
111
   });
111
 }
112
 }
112
 
113
 
114
+// 经纪人页面
115
+function toBroker(record) {
116
+  if (record.brokerCount === 0) {
117
+    return
118
+  }
119
+  router.push({
120
+    pathname: '/channel/brokerList',
121
+    query: {
122
+      id: record.channelId,
123
+    },
124
+  });
125
+}
126
+
113
 const header = props => {
127
 const header = props => {
114
   // eslint-disable-next-line react-hooks/rules-of-hooks
128
   // eslint-disable-next-line react-hooks/rules-of-hooks
115
   const [data, setData] = useState({ channelNmae: [], result: [] })
129
   const [data, setData] = useState({ channelNmae: [], result: [] })

+ 1
- 4
src/pages/customer/customerlist/components/attribution.jsx View File

81
 
81
 
82
   // 提交
82
   // 提交
83
   submitGm(record) {
83
   submitGm(record) {
84
-    const { url, method } = apis.customer.recommendEdit
85
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(this.state.visibleData.customerId)
86
-
87
     // 网路请求
84
     // 网路请求
88
-    request({ url: tempUrl, method, data: { customerId: this.state.visibleData.customerId, realtyConsultant: record.personId } }).then(res => {
85
+    request({ ...apis.customer.recommendEdit, urlData: { id: this.state.visibleData.customerId }, data: { customerId: this.state.visibleData.customerId, realtyConsultant: record.personId } }).then(res => {
89
       // eslint-disable-next-line no-unused-expressions
86
       // eslint-disable-next-line no-unused-expressions
90
       this.openNotificationWithIcon('success', '操作成功')
87
       this.openNotificationWithIcon('success', '操作成功')
91
       this.handleCancel()
88
       this.handleCancel()

+ 1
- 4
src/pages/customer/customerlist/components/changeStatus.jsx View File

41
   };
41
   };
42
 
42
 
43
   submitButton = e => {
43
   submitButton = e => {
44
-    const { url, method } = apis.customer.recommendEdit
45
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(this.state.visibleData.customerId)
46
-
47
     // 网路请求
44
     // 网路请求
48
-    request({ url: tempUrl, method, data: { customerId: this.state.visibleData.customerId, status: this.state.value } }).then(res => {
45
+    request({ ...apis.customer.recommendEdit, urlData: { id: this.state.visibleData.customerId }, data: { customerId: this.state.visibleData.customerId, status: this.state.value } }).then(res => {
49
       // eslint-disable-next-line no-unused-expressions
46
       // eslint-disable-next-line no-unused-expressions
50
       this.openNotificationWithIcon('success', '操作成功')
47
       this.openNotificationWithIcon('success', '操作成功')
51
       this.handleCancel()
48
       this.handleCancel()

+ 1
- 4
src/pages/customer/customerlist/components/integralRecord.jsx View File

62
       return
62
       return
63
     }
63
     }
64
     // 网路请求
64
     // 网路请求
65
-    const { url, method } = apis.customer.taPointsRecords
66
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(customerId)
67
-
68
     // 网路请求
65
     // 网路请求
69
-    request({ url: tempUrl, method, params: { ...params } }).then(res => {
66
+    request({ ...apis.customer.taPointsRecords, urlData: { id: customerId }, params: { ...params } }).then(res => {
70
       this.setState({ dataSource: res })
67
       this.setState({ dataSource: res })
71
     }).catch(err => {
68
     }).catch(err => {
72
       this.openNotificationWithIcon('error', err)
69
       this.openNotificationWithIcon('error', err)

+ 1
- 3
src/pages/customer/customerlist/customerDetail.jsx View File

28
     if (id === '' || id === undefined) {
28
     if (id === '' || id === undefined) {
29
       return
29
       return
30
     }
30
     }
31
-    const { url, method } = apis.customer.CustomerRecommendGet
32
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(id)
33
 
31
 
34
-    request({ url: tempUrl, method, params: { ...params } }).then(res => {
32
+    request({ ...apis.customer.CustomerRecommendGet, urlData: { id }, params: { ...params } }).then(res => {
35
       setData(res)
33
       setData(res)
36
     })
34
     })
37
   }
35
   }

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

53
       return
53
       return
54
     }
54
     }
55
     // 网路请求
55
     // 网路请求
56
-    const { url, method } = apis.customer.recommend
57
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(customerId)
58
     // 网路请求
56
     // 网路请求
59
-    request({ url: tempUrl, method, params: { ...params } }).then(res => {
57
+    request({ ...apis.customer.recommend, urlData: { id: customerId }, params: { ...params } }).then(res => {
60
       this.setState({ dataSource: res })
58
       this.setState({ dataSource: res })
61
     }).catch(err => {
59
     }).catch(err => {
62
       // eslint-disable-next-line no-unused-expressions
60
       // eslint-disable-next-line no-unused-expressions

+ 2
- 8
src/pages/customer/recommendCustomer/audit.jsx View File

41
 
41
 
42
   // 获取详情信息
42
   // 获取详情信息
43
   function getById(currentId) {
43
   function getById(currentId) {
44
-    const { url, method } = apis.customer.recommendGetById
45
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(currentId)
46
-
47
-    request({ url: tempUrl, method }).then(res => {
44
+    request({ ...apis.customer.recommendGetById, urlData: { id: currentId } }).then(res => {
48
       props.form.setFieldsValue(res)
45
       props.form.setFieldsValue(res)
49
     })
46
     })
50
   }
47
   }
51
 
48
 
52
   function submitDate(params) {
49
   function submitDate(params) {
53
-    const { url, method } = apis.customer.auto
54
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(params.customerId)
55
-
56
     // props.form.setFieldsValue(res)
50
     // props.form.setFieldsValue(res)
57
-    request({ url: tempUrl, method, params: { verifyStatus: params.verifyStatus } }).then(() => {
51
+    request({ ...apis.customer.auto, urlData: { id: params.customerId }, params: { verifyStatus: params.verifyStatus } }).then(() => {
58
       // eslint-disable-next-line no-unused-expressions
52
       // eslint-disable-next-line no-unused-expressions
59
       <Alert
53
       <Alert
60
         style={{
54
         style={{

+ 19
- 19
src/pages/news/list/editNewsList.jsx View File

37
 
37
 
38
   // 查询列表
38
   // 查询列表
39
   const getDynamicData = (newsId) => {
39
   const getDynamicData = (newsId) => {
40
-    request({
41
-        url: '/api/admin/taNews/' + newsId,
42
-        method: 'GET',
43
-        params: { newsId },
44
-    }).then((data) => {
45
-        console.log(data)
40
+    request({ ...apis.news.get, urlData: { id: newsId },}).then((data) => {
46
         setDynamicData(data)
41
         setDynamicData(data)
42
+    }).catch((err) => {
43
+      console.log(err)
44
+      message.info(err.msg || err.message)
47
     })
45
     })
48
-  }
46
+
47
+    // request({
48
+    //     url: '/api/admin/taNews/' + newsId,
49
+    //     method: 'GET',
50
+    //     params: { newsId },
51
+    // }).then((data) => {
52
+    //     console.log(data)
53
+    //     setDynamicData(data)
54
+    // })
55
+    }
49
   }
56
   }
50
 
57
 
51
   const cancelPage = () =>{
58
   const cancelPage = () =>{
99
   
106
   
100
     const handleSubmit = val => { 
107
     const handleSubmit = val => { 
101
       let {...submitValue} = val
108
       let {...submitValue} = val
109
+      
102
       if(newsId){
110
       if(newsId){
103
         submitValue.newsId = newsId
111
         submitValue.newsId = newsId
104
-        request({
105
-          url: '/api/admin/taNews/' + newsId,
106
-          method: 'PUT',
107
-          data: submitValue,
108
-        }).then((data) => {
109
-          cancelPage()
112
+        request({ ...apis.news.put, urlData: {id: newsId}, data: { ...submitValue },}).then((data) => {
113
+          cancelPage();
110
         }).catch((err) => {
114
         }).catch((err) => {
111
           message.info(err.msg || err.message)
115
           message.info(err.msg || err.message)
112
         })
116
         })
113
       }else{
117
       }else{
114
-        request({
115
-          url: '/api/admin/taNews',
116
-          method: 'POST',
117
-          data: submitValue,
118
-        }).then((data) => {
119
-          cancelPage()
118
+        request({ ...apis.news.post, data: { ...submitValue },}).then((data) => {
119
+          cancelPage();
120
         }).catch((err) => {
120
         }).catch((err) => {
121
           message.info(err.msg || err.message)
121
           message.info(err.msg || err.message)
122
         })
122
         })

+ 0
- 8
src/pages/news/type/NewsType.jsx View File

68
           message.info(err.msg || err.message)
68
           message.info(err.msg || err.message)
69
         })
69
         })
70
 
70
 
71
-        // request({
72
-        //   url: '/api/admin/taNewsType/' + newsId,
73
-        //   method: 'DELETE',
74
-        //   data: { ...row },
75
-        // }).then((data) => {
76
-        //   message.info('操作成功!')
77
-        //   getList({ pageNum: 1, pageSize: 10 });
78
-        // })
79
       }
71
       }
80
     });
72
     });
81
   }
73
   }

+ 28
- 19
src/pages/news/type/editNews.jsx View File

5
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
5
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
6
 import XForm, { FieldTypes } from '../../../components/XForm';
6
 import XForm, { FieldTypes } from '../../../components/XForm';
7
 import router from 'umi/router';
7
 import router from 'umi/router';
8
+import apis from '../../../services/apis';
8
 import request from '../../../utils/request'
9
 import request from '../../../utils/request'
9
 
10
 
10
 const { TextArea } = Input;
11
 const { TextArea } = Input;
21
 
22
 
22
   // 查询列表
23
   // 查询列表
23
   const getNewsData = (newsId) => {
24
   const getNewsData = (newsId) => {
25
+    request({ ...apis.newsType.get, urlData: { id: newsId },}).then((data) => {
26
+      cancelPage();
27
+    }).catch((err) => {
28
+      message.info(err.msg || err.message)
29
+    })
30
+
24
     request({
31
     request({
25
         url: '/api/admin/taNewsType/' + newsId,
32
         url: '/api/admin/taNewsType/' + newsId,
26
         method: 'GET',
33
         method: 'GET',
61
    
68
    
62
   const handleSubmit = (values) => {
69
   const handleSubmit = (values) => {
63
     if(newsId){
70
     if(newsId){
64
-      values.newsTypeId = newsId
65
-      request({
66
-        url: '/api/admin/taNewsType/' + newsId,
67
-        method: 'PUT',
68
-        data: values,
69
-      }).then((data) => {
70
-        cancelPage()
71
-      }).catch((err) => {
72
-        message.info(err.msg || err.message)
73
-      })
71
+        values.newsTypeId = newsId
72
+        request({ ...apis.newsType.put, urlData: { id: newsId },}).then((data) => {
73
+          cancelPage();
74
+        }).catch((err) => {
75
+          message.info(err.msg || err.message)
76
+        })
74
       }else{
77
       }else{
75
-      request({
76
-        url: '/api/admin/taNewsType',
77
-        method: 'POST',
78
-        data: values,
79
-      }).then((data) => {
80
-        cancelPage()
81
-      }).catch((err) => {
82
-        message.info(err.msg || err.message)
83
-      })
78
+        request({ ...apis.newsType.post, data: { values },}).then((data) => {
79
+          cancelPage();
80
+        }).catch((err) => {
81
+          message.info(err.msg || err.message)
82
+        })
83
+
84
+      // request({
85
+      //   url: '/api/admin/taNewsType',
86
+      //   method: 'POST',
87
+      //   data: values,
88
+      // }).then((data) => {
89
+      //   cancelPage()
90
+      // }).catch((err) => {
91
+      //   message.info(err.msg || err.message)
92
+      // })
84
       }
93
       }
85
   }
94
   }
86
 
95
 

+ 36
- 6
src/services/apis.js View File

137
         url: `${prefix}/taNews/:id`,
137
         url: `${prefix}/taNews/:id`,
138
         action: 'admin.taNews.id.put',
138
         action: 'admin.taNews.id.put',
139
     },
139
     },
140
+    get: {
141
+        method: 'GET',
142
+        url: `${prefix}/taNews/:id`,
143
+        action: 'admin.taNews.id.get',
144
+    },
145
+    post: {
146
+      method: 'POST',
147
+      url: `${prefix}/taNews`,
148
+      action: 'admin.taNews.post',
149
+    },
150
+    put: {
151
+      method: 'PUT',
152
+      url: `${prefix}/taNews/:id`,
153
+      action: 'admin.taNews.id.put',
154
+    }
140
   },
155
   },
141
   newsType: {
156
   newsType: {
142
     list: {
157
     list: {
149
         url: `${prefix}/taNewsType/:id`,
164
         url: `${prefix}/taNewsType/:id`,
150
         action: 'admin.taNewsType.id.delete',
165
         action: 'admin.taNewsType.id.delete',
151
     },
166
     },
167
+    put: {
168
+      method: 'PUT',
169
+      url: `${prefix}/taNewsType/:id`,
170
+      action: 'admin.taNewsType.id.delete',
171
+    },
172
+    post: {
173
+      method: 'POST',
174
+      url: `${prefix}/taNewsType`,
175
+      action: 'admin.taNewsType.post',
176
+    },
177
+    get: {
178
+      method: 'GET',
179
+      url: `${prefix}/taNewsType/:id`,
180
+      action: 'admin.taNewsType.get',
181
+    }
152
   },
182
   },
153
   customer: {
183
   customer: {
154
     drift: {
184
     drift: {
168
     },
198
     },
169
     auto: {
199
     auto: {
170
       method: 'PUT',
200
       method: 'PUT',
171
-      url: `${prefix}/customer/recommend/verify/id`,
201
+      url: `${prefix}/customer/recommend/verify/:id`,
172
       action: 'admin.customer.recommend.verify.id.put',
202
       action: 'admin.customer.recommend.verify.id.put',
173
     },
203
     },
174
     recommendGetById: {
204
     recommendGetById: {
175
       method: 'GET',
205
       method: 'GET',
176
-      url: `${prefix}/customer/recommend/getById/id`,
206
+      url: `${prefix}/customer/recommend/getById/:id`,
177
       action: 'admin.customer.recommend.getById.id.get',
207
       action: 'admin.customer.recommend.getById.id.get',
178
     },
208
     },
179
     agents: {
209
     agents: {
193
     },
223
     },
194
     recommendEdit: {
224
     recommendEdit: {
195
       method: 'PUT',
225
       method: 'PUT',
196
-      url: `${prefix}/customer/recommend/edit/id`,
226
+      url: `${prefix}/customer/recommend/edit/:id`,
197
       action: 'admin.customer.recommend.edit.id.put',
227
       action: 'admin.customer.recommend.edit.id.put',
198
     },
228
     },
199
     taPointsRecords: {
229
     taPointsRecords: {
200
       method: 'GET',
230
       method: 'GET',
201
-      url: `${prefix}/mine/taPointsRecords/id`,
231
+      url: `${prefix}/mine/taPointsRecords/:id`,
202
       action: 'admin.mine.taPointsRecords.id.get',
232
       action: 'admin.mine.taPointsRecords.id.get',
203
     },
233
     },
204
     recommend: {
234
     recommend: {
205
       method: 'GET',
235
       method: 'GET',
206
-      url: `${prefix}/customer/recommend/id`,
236
+      url: `${prefix}/customer/recommend/:id`,
207
       action: 'admin.customer.recommend.id.get',
237
       action: 'admin.customer.recommend.id.get',
208
     },
238
     },
209
     InviteClientsList: {
239
     InviteClientsList: {
213
     },
243
     },
214
     CustomerRecommendGet: {
244
     CustomerRecommendGet: {
215
       method: 'GET',
245
       method: 'GET',
216
-      url: `${prefix}/customer/recommend/get/id`,
246
+      url: `${prefix}/customer/recommend/get/:id`,
217
       action: 'admin.customer.recommend.get.id.get',
247
       action: 'admin.customer.recommend.get.id.get',
218
     },
248
     },
219
     customerRecommendRecommenderExport: { // 导出数据(推荐客户)
249
     customerRecommendRecommenderExport: { // 导出数据(推荐客户)

+ 13
- 5
src/utils/request.js View File

84
 
84
 
85
       const { code, data, message } = await response.clone().json();
85
       const { code, data, message } = await response.clone().json();
86
       if (code != 1000) {
86
       if (code != 1000) {
87
-        notification.error({
88
-          message: `请求错误`,
89
-          description: message,
90
-        });
91
-        throw new Error(message);
87
+        if (code === 1001) {
88
+          notification.error({
89
+            message: `请求错误`,
90
+            description: '请登录系统',
91
+          });
92
+          throw new Error('请登录系统');
93
+        } else {
94
+          notification.error({
95
+            message: `请求错误`,
96
+            description: message,
97
+          });
98
+          throw new Error(message);
99
+        }
92
       }
100
       }
93
 
101
 
94
       if (data && data.token) {
102
       if (data && data.token) {