Kaynağa Gözat

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

许静 5 yıl önce
ebeveyn
işleme
f1cf3bae2a

+ 2
- 0
config/config.js Dosyayı Görüntüle

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

+ 1
- 0
config/routes.js Dosyayı Görüntüle

@@ -189,6 +189,7 @@ export default [
189 189
               {
190 190
                 path: '/channel/brokerList',
191 191
                 name: '经纪人',
192
+                hideInMenu: true,
192 193
                 component: './channel/brokerList',
193 194
               },
194 195
               {

+ 8
- 2
src/components/AuthButton/index.jsx Dosyayı Görüntüle

@@ -7,11 +7,17 @@ const AuthButton = ({ children, name, noRight }) => {
7 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 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 21
   return hasRight ? <>{children}</> : <>{noRight}</>
16 22
 }
17 23
 

+ 1
- 0
src/pages/building/list/index.jsx Dosyayı Görüntüle

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

+ 2
- 2
src/pages/channel/brokerList.jsx Dosyayı Görüntüle

@@ -103,7 +103,7 @@ const header = props => {
103 103
 //   const [page, changePage] = useState({})
104 104
   // eslint-disable-next-line react-hooks/rules-of-hooks
105 105
   useEffect(() => {
106
-    getListBroker()
106
+    getListBroker({ channelId: props.location.query.id, pageNum: 1, pageSize: 10 })
107 107
   }, [])
108 108
 
109 109
     function getListBroker(params) {
@@ -118,7 +118,7 @@ const header = props => {
118 118
 
119 119
  // 查询
120 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 124
     function onChange(pageNumber) {

+ 15
- 1
src/pages/channel/channelList.jsx Dosyayı Görüntüle

@@ -64,6 +64,7 @@ const columns = [
64 64
     dataIndex: 'brokerCount',
65 65
     key: 'brokerCount',
66 66
     align: 'center',
67
+      render: (text, record) => <a style={ { color: '#66B3FF' } } onClick= {() => toBroker(record)} >{ record.recommendCount }</a>,
67 68
   },
68 69
   {
69 70
     title: '推荐客户有效',
@@ -86,7 +87,7 @@ const columns = [
86 87
       <AuthButton name="admin.channel.id.put" noRight={null}>
87 88
         <a style={{ color: '#66B3FF' }} onClick={() => toedit(record.channelId)} >编辑</a>
88 89
       </AuthButton>
89
-    )
90
+    ),
90 91
   },
91 92
 ];
92 93
 
@@ -110,6 +111,19 @@ function toedit(channelId) {
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 127
 const header = props => {
114 128
   // eslint-disable-next-line react-hooks/rules-of-hooks
115 129
   const [data, setData] = useState({ channelNmae: [], result: [] })

+ 1
- 4
src/pages/customer/customerlist/components/attribution.jsx Dosyayı Görüntüle

@@ -81,11 +81,8 @@ class ModalAttribution extends React.Component {
81 81
 
82 82
   // 提交
83 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 86
       // eslint-disable-next-line no-unused-expressions
90 87
       this.openNotificationWithIcon('success', '操作成功')
91 88
       this.handleCancel()

+ 1
- 4
src/pages/customer/customerlist/components/changeStatus.jsx Dosyayı Görüntüle

@@ -41,11 +41,8 @@ class ChangeStatus extends React.Component {
41 41
   };
42 42
 
43 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 46
       // eslint-disable-next-line no-unused-expressions
50 47
       this.openNotificationWithIcon('success', '操作成功')
51 48
       this.handleCancel()

+ 1
- 4
src/pages/customer/customerlist/components/integralRecord.jsx Dosyayı Görüntüle

@@ -62,11 +62,8 @@ class ModalIntegralRecord extends React.Component {
62 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 67
       this.setState({ dataSource: res })
71 68
     }).catch(err => {
72 69
       this.openNotificationWithIcon('error', err)

+ 1
- 3
src/pages/customer/customerlist/customerDetail.jsx Dosyayı Görüntüle

@@ -28,10 +28,8 @@ function header(props) {
28 28
     if (id === '' || id === undefined) {
29 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 33
       setData(res)
36 34
     })
37 35
   }

+ 1
- 3
src/pages/customer/independentList/index.jsx Dosyayı Görüntüle

@@ -53,10 +53,8 @@ class ModalTable extends React.Component {
53 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 58
       this.setState({ dataSource: res })
61 59
     }).catch(err => {
62 60
       // eslint-disable-next-line no-unused-expressions

+ 2
- 8
src/pages/customer/recommendCustomer/audit.jsx Dosyayı Görüntüle

@@ -41,20 +41,14 @@ function body(props) {
41 41
 
42 42
   // 获取详情信息
43 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 45
       props.form.setFieldsValue(res)
49 46
     })
50 47
   }
51 48
 
52 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 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 52
       // eslint-disable-next-line no-unused-expressions
59 53
       <Alert
60 54
         style={{

+ 19
- 19
src/pages/news/list/editNewsList.jsx Dosyayı Görüntüle

@@ -37,15 +37,22 @@ const { TextArea } = Input;
37 37
 
38 38
   // 查询列表
39 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 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 58
   const cancelPage = () =>{
@@ -99,24 +106,17 @@ const { TextArea } = Input;
99 106
   
100 107
     const handleSubmit = val => { 
101 108
       let {...submitValue} = val
109
+      
102 110
       if(newsId){
103 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 114
         }).catch((err) => {
111 115
           message.info(err.msg || err.message)
112 116
         })
113 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 120
         }).catch((err) => {
121 121
           message.info(err.msg || err.message)
122 122
         })

+ 0
- 8
src/pages/news/type/NewsType.jsx Dosyayı Görüntüle

@@ -68,14 +68,6 @@ function header(props) {
68 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 Dosyayı Görüntüle

@@ -5,6 +5,7 @@ import channels from '../../channel/channelList.less';
5 5
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
6 6
 import XForm, { FieldTypes } from '../../../components/XForm';
7 7
 import router from 'umi/router';
8
+import apis from '../../../services/apis';
8 9
 import request from '../../../utils/request'
9 10
 
10 11
 const { TextArea } = Input;
@@ -21,6 +22,12 @@ const header = props => {
21 22
 
22 23
   // 查询列表
23 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 31
     request({
25 32
         url: '/api/admin/taNewsType/' + newsId,
26 33
         method: 'GET',
@@ -61,26 +68,28 @@ const header = props => {
61 68
    
62 69
   const handleSubmit = (values) => {
63 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 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 Dosyayı Görüntüle

@@ -137,6 +137,21 @@ export default {
137 137
         url: `${prefix}/taNews/:id`,
138 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 156
   newsType: {
142 157
     list: {
@@ -149,6 +164,21 @@ export default {
149 164
         url: `${prefix}/taNewsType/:id`,
150 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 183
   customer: {
154 184
     drift: {
@@ -168,12 +198,12 @@ export default {
168 198
     },
169 199
     auto: {
170 200
       method: 'PUT',
171
-      url: `${prefix}/customer/recommend/verify/id`,
201
+      url: `${prefix}/customer/recommend/verify/:id`,
172 202
       action: 'admin.customer.recommend.verify.id.put',
173 203
     },
174 204
     recommendGetById: {
175 205
       method: 'GET',
176
-      url: `${prefix}/customer/recommend/getById/id`,
206
+      url: `${prefix}/customer/recommend/getById/:id`,
177 207
       action: 'admin.customer.recommend.getById.id.get',
178 208
     },
179 209
     agents: {
@@ -193,17 +223,17 @@ export default {
193 223
     },
194 224
     recommendEdit: {
195 225
       method: 'PUT',
196
-      url: `${prefix}/customer/recommend/edit/id`,
226
+      url: `${prefix}/customer/recommend/edit/:id`,
197 227
       action: 'admin.customer.recommend.edit.id.put',
198 228
     },
199 229
     taPointsRecords: {
200 230
       method: 'GET',
201
-      url: `${prefix}/mine/taPointsRecords/id`,
231
+      url: `${prefix}/mine/taPointsRecords/:id`,
202 232
       action: 'admin.mine.taPointsRecords.id.get',
203 233
     },
204 234
     recommend: {
205 235
       method: 'GET',
206
-      url: `${prefix}/customer/recommend/id`,
236
+      url: `${prefix}/customer/recommend/:id`,
207 237
       action: 'admin.customer.recommend.id.get',
208 238
     },
209 239
     InviteClientsList: {
@@ -213,7 +243,7 @@ export default {
213 243
     },
214 244
     CustomerRecommendGet: {
215 245
       method: 'GET',
216
-      url: `${prefix}/customer/recommend/get/id`,
246
+      url: `${prefix}/customer/recommend/get/:id`,
217 247
       action: 'admin.customer.recommend.get.id.get',
218 248
     },
219 249
     customerRecommendRecommenderExport: { // 导出数据(推荐客户)

+ 13
- 5
src/utils/request.js Dosyayı Görüntüle

@@ -84,11 +84,19 @@ request.interceptors.response.use(async (response, options) => {
84 84
 
85 85
       const { code, data, message } = await response.clone().json();
86 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 102
       if (data && data.token) {