周立森 il y a 5 ans
Parent
révision
c083b9cda0
36 fichiers modifiés avec 1082 ajouts et 246 suppressions
  1. 20
    7
      config/config.js
  2. BIN
      src/assets/bottom.png
  3. BIN
      src/assets/poster1.png
  4. BIN
      src/assets/poster2.png
  5. BIN
      src/assets/touxiang.jpg
  6. BIN
      src/assets/yinhao.png
  7. 3
    3
      src/components/GlobalHeader/AvatarDropdown.jsx
  8. 7
    1
      src/components/SelectButton/BuildSelect.jsx
  9. 1
    1
      src/components/SelectButton/NewTypeSelect.jsx
  10. 4
    4
      src/components/XForm/ImageUpload.jsx
  11. 1
    2
      src/models/login.js
  12. 3
    2
      src/models/user.js
  13. 136
    39
      src/pages/activity/editActivity.jsx
  14. 4
    10
      src/pages/building/list/add/components/base.jsx
  15. 39
    5
      src/pages/building/list/add/components/imageSet.jsx
  16. 223
    0
      src/pages/building/list/add/components/modalImage.jsx
  17. 1
    1
      src/pages/building/list/add/components/tags.jsx
  18. 2
    2
      src/pages/building/list/index.jsx
  19. 0
    1
      src/pages/building/list/style.css
  20. 0
    1
      src/pages/building/list/style.less
  21. 0
    1
      src/pages/building/list/style.wxss
  22. 1
    0
      src/pages/channel/InviteClients.jsx
  23. 3
    3
      src/pages/channel/brokerList.jsx
  24. 8
    8
      src/pages/channel/channelList.jsx
  25. 7
    3
      src/pages/channel/channelList.less
  26. 6
    2
      src/pages/channel/editChannel.jsx
  27. 1
    0
      src/pages/channel/recommendClients.jsx
  28. 1
    1
      src/pages/customer/independentList/index.jsx
  29. 135
    143
      src/pages/news/list/NewsList.jsx
  30. 115
    0
      src/pages/system/editPolicy.jsx
  31. 202
    0
      src/pages/system/housingPolicy.jsx
  32. 96
    0
      src/pages/system/intention.jsx
  33. 4
    2
      src/pages/system/report.jsx
  34. 16
    0
      src/services/apis.js
  35. 31
    0
      src/utils/mixStr.js
  36. 12
    4
      src/utils/request.js

+ 20
- 7
config/config.js Voir le fichier

@@ -23,11 +23,11 @@ const plugins = [
23 23
         // default true, when it is true, will use `navigator.language` overwrite default
24 24
         baseNavigator: true,
25 25
       },
26
-      // dynamicImport: {
27
-      //   loadingComponent: './components/PageLoading/index',
28
-      //   webpackChunkName: true,
29
-      //   level: 3,
30
-      // },
26
+      dynamicImport: {
27
+        loadingComponent: './components/PageLoading/index',
28
+        webpackChunkName: true,
29
+        level: 3,
30
+      },
31 31
       pwa: pwa
32 32
         ? {
33 33
           workboxPluginMode: 'InjectManifest',
@@ -329,8 +329,21 @@ export default {
329 329
                   name: '报表',
330 330
                   component: './indexEcharts/index',
331 331
                 },
332
-                
333
-
332
+                {
333
+                  path: '/system/intention',
334
+                  name: '意向值',
335
+                  component: './system/intention',
336
+                },
337
+                {
338
+                  path: '/system/housingPolicy',
339
+                  name: '购房政策维护',
340
+                  component: './system/housingPolicy',
341
+                },
342
+                {
343
+                  path: '/system/editPolicy',
344
+                  name: '',
345
+                  component: './system/editPolicy',
346
+                },
334 347
               ],
335 348
             },
336 349
             {

BIN
src/assets/bottom.png Voir le fichier


BIN
src/assets/poster1.png Voir le fichier


BIN
src/assets/poster2.png Voir le fichier


BIN
src/assets/touxiang.jpg Voir le fichier


BIN
src/assets/yinhao.png Voir le fichier


+ 3
- 3
src/components/GlobalHeader/AvatarDropdown.jsx Voir le fichier

@@ -29,7 +29,7 @@ class AvatarDropdown extends React.Component {
29 29
     const {
30 30
       currentUser = {
31 31
         avatar: '',
32
-        name: '',
32
+        userName: '',
33 33
       },
34 34
       menu,
35 35
     } = this.props;
@@ -55,11 +55,11 @@ class AvatarDropdown extends React.Component {
55 55
         </Menu.Item>
56 56
       </Menu>
57 57
     );
58
-    return currentUser && currentUser.name ? (
58
+    return currentUser && currentUser.userName ? (
59 59
       <HeaderDropdown overlay={menuHeaderDropdown}>
60 60
         <span className={`${styles.action} ${styles.account}`}>
61 61
           <Avatar size="small" className={styles.avatar} src={currentUser.avatar} alt="avatar" />
62
-          <span className={styles.name}>{currentUser.name}</span>
62
+          <span className={styles.name}>{currentUser.userName}</span>
63 63
         </span>
64 64
       </HeaderDropdown>
65 65
     ) : (

+ 7
- 1
src/components/SelectButton/BuildSelect.jsx Voir le fichier

@@ -13,6 +13,7 @@ const { Option } = Select;
13 13
  */
14 14
 const BuildingSelect = (props) => {
15 15
   const [ data, setData ] = useState([])
16
+  const [ value, setValue ] = useState(props.value)
16 17
 
17 18
   useEffect(() => {
18 19
     getCityList();
@@ -28,8 +29,13 @@ const BuildingSelect = (props) => {
28 29
     })
29 30
   }
30 31
 
32
+  const handleChange = (e) => {
33
+    setValue(e)
34
+    props.onChange(e)
35
+  }
36
+
31 37
   return (
32
-      <Select value={props.value} style={{ width: '180px' }} placeholder="请选择项目" onChange={props.onChange}>
38
+      <Select value={value} style={{ width: '180px' }} placeholder="请选择项目" onChange={handleChange}>
33 39
           {data.map(building => (
34 40
             <Option key={building.buildingId}>{building.buildingName}</Option>
35 41
           ))}

+ 1
- 1
src/components/SelectButton/NewTypeSelect.jsx Voir le fichier

@@ -29,7 +29,7 @@ const NewsTypeSelect = (props) => {
29 29
   }
30 30
 
31 31
   return (
32
-      <Select value={props.value} style={{ width: '180px' }} placeholder="请选择咨询类型" onChange={props.onChange}>
32
+      <Select value={props.value} style={{ width: '180px' }} placeholder="请选择类型" onChange={props.onChange}>
33 33
           {data.map(type => (
34 34
             <Option key={type.newsTypeId}>{type.newsTypeName}</Option>
35 35
           ))}

+ 4
- 4
src/components/XForm/ImageUpload.jsx Voir le fichier

@@ -34,10 +34,10 @@ class ImageUpload extends React.Component {
34 34
     }
35 35
   };
36 36
 
37
-  render () {
37
+  render() {
38 38
     const uploadButton = (
39 39
       <div>
40
-        <Icon style={{ fontSize: '2em', color: '#aaa' }} type={this.state.loading ? "loading" : "plus"} />        
40
+        <Icon style={{ fontSize: '2em', color: '#aaa' }} type={this.state.loading ? "loading" : "plus"} />
41 41
       </div>
42 42
     );
43 43
 
@@ -56,8 +56,8 @@ class ImageUpload extends React.Component {
56 56
         {(this.state.imageUrl || value) ? (
57 57
           <img src={this.state.imageUrl || value} alt="avatar" style={{ width: "100%" }} />
58 58
         ) : (
59
-          uploadButton
60
-        )}
59
+            uploadButton
60
+          )}
61 61
       </Upload>
62 62
     );
63 63
   }

+ 1
- 2
src/models/login.js Voir le fichier

@@ -36,7 +36,6 @@ const Model = {
36 36
       }
37 37
 
38 38
       yield put(routerRedux.replace(redirect || '/'));
39
-      
40 39
     },
41 40
 
42 41
     *getCaptcha({ payload }, { call }) {
@@ -60,7 +59,7 @@ const Model = {
60 59
   },
61 60
   reducers: {
62 61
     changeLoginStatus(state, { payload }) {
63
-      setAuthority('admin');
62
+      setAuthority((payload.user.roles || []).map(x => x.roleId));
64 63
       return { ...state, status: 'ok', type: payload.type };
65 64
     },
66 65
   },

+ 3
- 2
src/models/user.js Voir le fichier

@@ -5,6 +5,7 @@ const UserModel = {
5 5
   namespace: 'user',
6 6
   state: {
7 7
     currentUser: {},
8
+    menuList: [],
8 9
   },
9 10
   effects: {
10 11
     // *fetch(_, { call, put }) {
@@ -25,8 +26,8 @@ const UserModel = {
25 26
     },
26 27
   },
27 28
   reducers: {
28
-    saveCurrentUser(state, action) {
29
-      return { ...state, currentUser: action.payload || {} };
29
+    saveCurrentUser(state, { payload = {} }) {
30
+      return { ...state, currentUser: payload.taUser || {}, menuList: payload.menuList || [] };
30 31
     },
31 32
     changeNotifyCount(
32 33
       state = {

+ 136
- 39
src/pages/activity/editActivity.jsx Voir le fichier

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message } from 'antd';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5 5
 import moment from 'moment';
@@ -8,37 +8,47 @@ import BuildSelect from '../../components/SelectButton/BuildSelect'
8 8
 import XForm, { FieldTypes } from '../../components/XForm';
9 9
 import Wangedit from '../../components/Wangedit/Wangedit'
10 10
 import request from '../../utils/request'
11
+import PosterBottom from '../../assets/bottom.png'
12
+import yinhao from '../../assets/yinhao.png'
13
+import ImageUploader from '../../components/XForm/ImageUpload';
14
+import logo from '../../assets/logo.png';
15
+import touxiang from '../../assets/touxiang.jpg';
16
+import poster1 from '../../assets/poster1.png';
17
+import poster2 from '../../assets/poster2.png';
11 18
 
12 19
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
20
+const { TextArea } = Input;
21
+
13 22
 /**
14 23
  *
15 24
  *
16 25
  * @param {*} props
17 26
  * @returns
18 27
  */
19
- const Edit = (props) => {
20
-  const [ tab, changeTab ] = useState('basic')
28
+const Edit = (props) => {
29
+  const [tab, changeTab] = useState('poster')
30
+  // const [tab, changeTab] = useState('basic')
21 31
   const dynamicId = props.location.query.dynamicId
22
-  const [ dynamicData, setDynamicData ] = useState({})
23
-  if(dynamicId){
32
+  const [dynamicData, setDynamicData] = useState({})
33
+  if (dynamicId) {
24 34
     useEffect(() => {
25 35
       getDynamicData(dynamicId);
26
-    },[])
36
+    }, [])
27 37
 
28
-  // 查询列表
29
-  const getDynamicData = (dynamicId) => {
30
-    request({
38
+    // 查询列表
39
+    const getDynamicData = (dynamicId) => {
40
+      request({
31 41
         url: '/api/admin/buildingDynamic/Details',
32 42
         method: 'GET',
33 43
         params: { dynamicId },
34
-    }).then((data) => {
44
+      }).then((data) => {
35 45
         console.log(data)
36 46
         setDynamicData(data)
37
-    })
38
-  }
47
+      })
48
+    }
39 49
   }
40 50
 
41
-  const cancelPage = () =>{
51
+  const cancelPage = () => {
42 52
     router.push({
43 53
       pathname: '/activity/ActivityList',
44 54
     });
@@ -52,7 +62,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
52 62
         render: <BuildSelect />,
53 63
         value: dynamicData.buildingId,
54 64
         rules: [
55
-          {required: true, message: '请选择所属项目'},
65
+          { required: true, message: '请选择所属项目' },
56 66
         ]
57 67
       },
58 68
       {
@@ -67,16 +77,16 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
67 77
         type: FieldTypes.Text,
68 78
         value: dynamicData.title,
69 79
         rules: [
70
-          {required: true, message: '请输入活动标题'},
80
+          { required: true, message: '请输入活动标题' },
71 81
         ]
72 82
       },
73 83
       {
74 84
         label: '活动时间',
75 85
         name: 'activityTime',
76 86
         type: FieldTypes.RangePicker,
77
-        value: dynamicData.startDate != null ?  [moment(dynamicData.startDate,'YYYY-MM-DD'),moment(dynamicData.endDate,'YYYY-MM-DD')] : null,
87
+        value: dynamicData.startDate != null ? [moment(dynamicData.startDate, 'YYYY-MM-DD'), moment(dynamicData.endDate, 'YYYY-MM-DD')] : null,
78 88
         rules: [
79
-          {required: true, message: '请选择活动时间'},
89
+          { required: true, message: '请选择活动时间' },
80 90
         ]
81 91
       },
82 92
       {
@@ -85,7 +95,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
85 95
         type: FieldTypes.Text,
86 96
         value: dynamicData.address,
87 97
         rules: [
88
-          {required: true, message: '请输入活动地点'},
98
+          { required: true, message: '请输入活动地点' },
89 99
         ]
90 100
       },
91 101
       {
@@ -94,7 +104,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
94 104
         type: FieldTypes.Text,
95 105
         value: dynamicData.enlistNum,
96 106
         rules: [
97
-          {required: true, message: '请输入活动人数'},
107
+          { required: true, message: '请输入活动人数' },
98 108
         ]
99 109
       },
100 110
       {
@@ -107,24 +117,24 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
107 117
         label: '是否需要报名',
108 118
         name: 'isEnlist',
109 119
         render: <Radio.Group name="radiogroup">
110
-                  <Radio value={1}>是</Radio>
111
-                  <Radio value={0}>否</Radio>
112
-                </Radio.Group>,
113
-        value: dynamicData.isEnlist != null ? dynamicData.isEnlist-0 : 1,
120
+          <Radio value={1}>是</Radio>
121
+          <Radio value={0}>否</Radio>
122
+        </Radio.Group>,
123
+        value: dynamicData.isEnlist != null ? dynamicData.isEnlist - 0 : 1,
114 124
       },
115 125
       {
116 126
         label: '报名时间',
117 127
         name: 'signupTime',
118 128
         type: FieldTypes.RangePicker,
119
-        value: dynamicData.enlistStart != null ?  [moment(dynamicData.enlistStart,'YYYY-MM-DD'),moment(dynamicData.enlistEnd,'YYYY-MM-DD')] : null,
129
+        value: dynamicData.enlistStart != null ? [moment(dynamicData.enlistStart, 'YYYY-MM-DD'), moment(dynamicData.enlistEnd, 'YYYY-MM-DD')] : null,
120 130
         rules: [
121
-          {required: true, message: '请选择报名时间'},
131
+          { required: true, message: '请选择报名时间' },
122 132
         ]
123 133
       },
124 134
     ]
125
-  
126
-    const handleSubmit = val => { 
127
-      let {activityTime,signupTime, ...submitValue} = val
135
+
136
+    const handleSubmit = val => {
137
+      let { activityTime, signupTime, ...submitValue } = val
128 138
       const [startDate, endDate] = activityTime
129 139
       submitValue.startDate = moment(startDate).format('YYYY-MM-DD');
130 140
       submitValue.endDate = moment(endDate).format('YYYY-MM-DD');
@@ -132,7 +142,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
132 142
       submitValue.enlistStart = moment(enlistStart).format('YYYY-MM-DD');
133 143
       submitValue.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD');
134 144
       console.log('submit data --->', submitValue)
135
-      if(dynamicId){
145
+      if (dynamicId) {
136 146
         submitValue.dynamicId = dynamicId
137 147
         request({
138 148
           url: '/api/admin/buildingDynamic/update',
@@ -143,7 +153,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
143 153
         }).catch((err) => {
144 154
           message.info(err.msg || err.message)
145 155
         })
146
-      }else{
156
+      } else {
147 157
         request({
148 158
           url: '/api/admin/buildingDynamic/add',
149 159
           method: 'POST',
@@ -155,16 +165,103 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
155 165
         })
156 166
       }
157 167
     }
158
-    
168
+
159 169
     return <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
160 170
   }
161
-  
171
+
162 172
   const Poster = (props) => {
163
-   return <div>Poster</div>
173
+    const [inputValue, changeInput] = useState('')
174
+    const [textAreaValue, changeTextArea] = useState('')
175
+    const [imgValue, changeImg] = useState('')
176
+    return <div>
177
+      <div style={{ display: 'flex' }}>
178
+        <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
179
+          <div style={{ width: '375px', height: '785px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
180
+            <img style={{ width: '100%', height: '300px' }} src={imgValue ? imgValue : poster1} alt="" />
181
+            <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
182
+              <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
183
+              <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
184
+              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您阅读</span>
185
+              <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
186
+            </div>
187
+            <p style={{
188
+              margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
189
+              display: '-webkit-box', lineClamp: '3', height: '60px',
190
+              WebkitLineClamp: '2',
191
+              WebkitBoxOrient: 'vertical',
192
+              overflow: 'hidden',
193
+              textOverflow: 'ellipsis'
194
+            }}>{inputValue ? inputValue : '海报标题'}</p>
195
+
196
+            <img src={yinhao} style={{ width: '30px', marginLeft: '10px' }} alt="" />
197
+            <p style={{
198
+              margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
199
+              display: '-webkit-box', lineClamp: '3', height: '76px',
200
+              WebkitLineClamp: '3',
201
+              WebkitBoxOrient: 'vertical',
202
+              overflow: 'hidden',
203
+              textOverflow: 'ellipsis'
204
+            }}>{textAreaValue ? textAreaValue : '海报描述'}</p>
205
+            <img src={PosterBottom} style={{ width: '100%' }} alt="" />
206
+          </div>
207
+          <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
208
+        </div>
209
+
210
+        <div >
211
+          <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
212
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片</p>
213
+            <ImageUploader onChange={e => changeImg(e)} />
214
+          </div>
215
+          <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>
217
+            <Input style={{ width: '20vw' }} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
218
+          </div>
219
+          <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>
221
+            <TextArea rows={5} onChange={e => changeTextArea(e.target.value)} />
222
+          </div>
223
+
224
+        </div>
225
+      </div>
226
+      <Button type="primary" onClick={() => router.go(-1)} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
227
+      <Button onClick={() => router.go(-1)}>取消</Button>
228
+    </div>
229
+
164 230
   }
165
- 
231
+
232
+
233
+
166 234
   const Share = (props) => {
167
-    return <div>Share</div>
235
+    const [inputValue, changeInput] = useState('')
236
+    const [imgValue, changeImg] = useState('')
237
+    // const changeInputValue = e => {
238
+    //   changeInput(e.target.value)
239
+    // }
240
+
241
+    // const handleSubmit = (values) => {
242
+
243
+    // }
244
+
245
+    return <div style={{ padding: '20px' }}>
246
+      <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
247
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
248
+        <div>
249
+          <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}><img src={logo} style={{ width: '22px', marginRight: '10px' }} />知与行互动</p>
250
+          <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue ? inputValue : '置业V客厅 精准获客平台'}</p>
251
+          <img style={{ width: '200px', height: '140px' }} src={imgValue ? imgValue : poster2} alt="" />
252
+        </div>
253
+      </div>
254
+      <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
255
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
256
+        <Input placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
257
+      </div>
258
+      <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
259
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片</p>
260
+        <ImageUploader onChange={e => changeImg(e)} />
261
+      </div>
262
+      <Button type="primary" htmlType="submit" style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
263
+      <Button onClick={() => router.go(-1)}>取消</Button>
264
+    </div>
168 265
   }
169 266
 
170 267
   return (
@@ -177,13 +274,13 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
177 274
         </Radio.Group>
178 275
       </div>
179 276
       <div>
180
-        { tab === 'basic' && <Basic /> }
181
-        { tab === 'poster' && <Poster /> }
182
-        { tab === 'share' && <Share /> }
277
+        {tab === 'basic' && <Basic />}
278
+        {tab === 'poster' && <Poster />}
279
+        {tab === 'share' && <Share />}
183 280
       </div>
184 281
     </div>
185 282
   );
186
- }
283
+}
187 284
 
188 285
 
189 286
 

+ 4
- 10
src/pages/building/list/add/components/base.jsx Voir le fichier

@@ -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, Radio, Tag, Tooltip, Tabs } from 'antd';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, InputNumber } from 'antd';
3 3
 import moment from 'moment';
4 4
 import request from '../../../../../utils/request';
5 5
 import apis from '../../../../../services/apis';
@@ -24,12 +24,6 @@ const formItemLayout = {
24 24
 };
25 25
 
26 26
 function AddBuilding(props) {
27
-  // eslint-disable-next-line react-hooks/rules-of-hooks
28
-  const [dataSource, setDataSource] = useState({ records: [] })
29
-
30
-  const [buildingAreaTags, setBuildingAreaTags] = useState({ tags: ['Unremovable', 'Tag 2', 'Tag 3'], inputVisible: false, inputValue: '' })
31
-
32
-
33 27
   const { getFieldDecorator } = props.form;
34 28
 
35 29
   function handleSubmit(e) {
@@ -80,7 +74,7 @@ function AddBuilding(props) {
80 74
           <Form.Item label="标签" hasFeedback>
81 75
             {getFieldDecorator('tags')(
82 76
               <Select mode="multiple" placeholder="标签" style={{ width: '1016px' }}>
83
-              <Option value="未知">未知</Option>
77
+                <Option value="未知">未知</Option>
84 78
               </Select>,
85 79
             )}
86 80
           </Form.Item>
@@ -172,7 +166,7 @@ function AddBuilding(props) {
172 166
             {getFieldDecorator('parkingRate')(<Input />)}
173 167
           </Form.Item>
174 168
           <Form.Item label="规划户数" hasFeedback>
175
-            {getFieldDecorator('familyNum')(<Input />)}
169
+            {getFieldDecorator('familyNum')(<InputNumber />)}
176 170
           </Form.Item>
177 171
           <Form.Item label="物业公司" hasFeedback>
178 172
             {getFieldDecorator('serviceCompany')(<Input />)}
@@ -187,7 +181,7 @@ function AddBuilding(props) {
187 181
             {getFieldDecorator('receivedDate')(<DatePicker />)}
188 182
           </Form.Item>
189 183
           <Form.Item label="产权年限" hasFeedback>
190
-            {getFieldDecorator('rightsYear')(<Input />)}
184
+            {getFieldDecorator('rightsYear')(<InputNumber />)}
191 185
           </Form.Item>
192 186
           <Form.Item label="预售许可证" hasFeedback>
193 187
             {getFieldDecorator('decoration')(

+ 39
- 5
src/pages/building/list/add/components/imageSet.jsx Voir le fichier

@@ -5,6 +5,7 @@ import request from '../../../../../utils/request';
5 5
 import apis from '../../../../../services/apis';
6 6
 import Styles from '../style.less';
7 7
 import { router } from 'umi';
8
+import ModalImage from './modalImage';
8 9
 
9 10
 
10 11
 const saleType = [
@@ -32,6 +33,9 @@ function imageSet(props) {
32 33
   // eslint-disable-next-line react-hooks/rules-of-hooks
33 34
   const [data, setData] = useState([])
34 35
 
36
+  // eslint-disable-next-line react-hooks/rules-of-hooks
37
+  const [visibleData, setVisibleData] = useState({ visible: false, apartmentId: '', buildingId: '' })
38
+
35 39
   // eslint-disable-next-line react-hooks/rules-of-hooks
36 40
   useEffect(() => {
37 41
     getList()
@@ -46,7 +50,6 @@ function imageSet(props) {
46 50
   }
47 51
 
48 52
   function getList(params) {
49
-    console.log(props)
50 53
     // 网路请求
51 54
     const { url, method } = apis.building.buildingApartment
52 55
     const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(props.building.buildingId)
@@ -54,7 +57,34 @@ function imageSet(props) {
54 57
     request({ url: tempUrl, method, params: { ...params } }).then(res => {
55 58
       setData(res)
56 59
     }).catch(err => {
57
-      openNotificationWithIcon('error', err)
60
+      openNotificationWithIcon('error', err.message)
61
+    })
62
+  }
63
+
64
+  /**
65
+   *打开编辑页
66
+   *
67
+   * @param {*} record
68
+   */
69
+  function showEdi(record) {
70
+    setVisibleData({ visible: true, apartmentId: record === undefined ? '' : record.apartmentId, buildingId: props.building.buildingId })
71
+  }
72
+
73
+  /**
74
+   * 删除
75
+   *
76
+   * @param {*} record
77
+   */
78
+  function deleteApartment(record) {
79
+    // 网路请求
80
+    const { url, method } = apis.building.buildingApartmentDelete
81
+    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(record.apartmentId)
82
+
83
+    request({ url: tempUrl, method }).then(res => {
84
+      getList()
85
+      openNotificationWithIcon('error', '操作成功')
86
+    }).catch(err => {
87
+      openNotificationWithIcon('error', err.message)
58 88
     })
59 89
   }
60 90
 
@@ -94,8 +124,8 @@ function imageSet(props) {
94 124
       key: 'apartmentId',
95 125
       render: (_, record) => (
96 126
         <>
97
-          <Button type="link" style={{ color: 'red' }}>编辑</Button>
98
-          <Button type="link" style={{ color: 'red' }}>删除</Button>
127
+          <Button type="link" style={{ color: 'red' }} onClick={() => showEdi(record)}>编辑</Button>
128
+          <Button type="link" style={{ color: 'red' }} onClick={() => deleteApartment(record)}>删除</Button>
99 129
         </>
100 130
       ),
101 131
     },
@@ -103,8 +133,12 @@ function imageSet(props) {
103 133
 
104 134
   return (
105 135
     <>
106
-      <Button type="primary">新增图片库</Button>
136
+      <Button type="primary" onClick={() => showEdi()}>新增图片库</Button>
107 137
       <Table dataSource={data} columns={columns} pagination={false} />
138
+
139
+      {/* 编辑页 */}
140
+      {/*  onSuccess是子组件传递事件信息  */}
141
+      <ModalImage visibleData={visibleData} key={visibleData.apartmentId} onSuccess={getList}/>
108 142
     </>
109 143
   )
110 144
 }

+ 223
- 0
src/pages/building/list/add/components/modalImage.jsx Voir le fichier

@@ -0,0 +1,223 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions, notification } from 'antd';
3
+import moment from 'moment';
4
+import request from '../../../../../utils/request';
5
+import apis from '../../../../../services/apis';
6
+import Styles from '../style.less';
7
+import ImageUpload from '../../../../../components/XForm/ImageUpload'
8
+import Wangedit from '../../../../../components/Wangedit/Wangedit'
9
+
10
+
11
+const { Option } = Select;
12
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
13
+const { Meta } = Card;
14
+
15
+const { TextArea } = Input;
16
+
17
+
18
+const formItemLayout = {
19
+  labelCol: {
20
+    xs: { span: 24 },
21
+    sm: { span: 2 },
22
+  },
23
+  wrapperCol: {
24
+    xs: { span: 24 },
25
+    sm: { span: 16 },
26
+  },
27
+};
28
+
29
+const saleType = [
30
+  {
31
+    id: 1,
32
+    name: '待定',
33
+  },
34
+  {
35
+    id: 2,
36
+    name: '售罄',
37
+  },
38
+  {
39
+    id: 3,
40
+    name: '在售',
41
+  },
42
+]
43
+
44
+/**
45
+ * 图片信息
46
+ *
47
+ * @param {*} props
48
+ * @returns
49
+ */
50
+class ModalImage extends React.Component {
51
+  constructor(props) {
52
+    super(props);
53
+    this.state = {
54
+       visibleData: { visible: false, apartmentId: '', buildingId: '' },
55
+    }
56
+  }
57
+
58
+  // 挂载之后
59
+  // componentDidMount() {
60
+  //
61
+  // }
62
+
63
+  componentDidUpdate(preProps, preState) {
64
+    console.log(this.props.visibleData)
65
+    if (this.props.visibleData.visible !== preState.visibleData.visible) {
66
+      this.getById()
67
+      this.setState({ visibleData: this.props.visibleData });
68
+    }
69
+  }
70
+
71
+  // 弹框确定按钮
72
+  // eslint-disable-next-line react/sort-comp
73
+  handleOk() {
74
+    this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } })
75
+  }
76
+
77
+  // 弹框取消按钮
78
+  handleCancel() {
79
+    this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } })
80
+  }
81
+
82
+  getById(params) {
83
+    const { apartmentId } = this.props.visibleData
84
+    if (apartmentId === '' || apartmentId === undefined) {
85
+      return
86
+    }
87
+
88
+    // 网路请求
89
+    const { url, method } = apis.building.buildingApartmentGetById
90
+    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(apartmentId)
91
+
92
+    request({ url: tempUrl, method , params: { ...params } }).then(res => {
93
+      // res.img = res.buildingImgList.map((item, _) => item.url)
94
+      res.img = res.buildingImgList[0].url
95
+      this.props.form.setFieldsValue(res)
96
+    }).catch(err => {
97
+     this.openNotificationWithIcon('error', err)
98
+    })
99
+  }
100
+
101
+  openNotificationWithIcon = (type, message) => {
102
+    notification[type]({
103
+      message,
104
+      description:
105
+        '',
106
+    });
107
+  };
108
+
109
+  // 提交
110
+  handleSubmit(e) {
111
+    e.preventDefault();
112
+    this.props.form.validateFields((err, values) => {
113
+      if (!err) {
114
+        this.submitData(values)
115
+      }
116
+    });
117
+  }
118
+
119
+  submitData(data) {
120
+    // TODO 这里应该是要支持多图,但是封装的控件没有
121
+    data.img = [{ imgType: 'aparment', url: data.img, orderNo: 1 }]
122
+    data.buildingId = this.props.visibleData.buildingId;
123
+    const api = data.apartmentId !== undefined ? apis.building.buildingApartmentUpdate : apis.building.buildingApartmentAdd;
124
+
125
+    // 网路请求
126
+    request({ ...api, data: { ...data } }).then(() => {
127
+      // eslint-disable-next-line no-unused-expressions
128
+      this.openNotificationWithIcon('success', '操作成功')
129
+
130
+      // 传递父组件事件
131
+      // onSuccess() 是自定义
132
+      this.props.onSuccess()
133
+
134
+      this.handleCancel()
135
+    }).catch(err => {
136
+      // eslint-disable-next-line no-unused-expressions
137
+      this.openNotificationWithIcon('error', err)
138
+    })
139
+  }
140
+
141
+  /**
142
+   * 取消按钮
143
+   *
144
+   * @memberof ModalImage
145
+   */
146
+  closeModal() {
147
+    this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } })
148
+  }
149
+
150
+  render() {
151
+    const { getFieldDecorator } = this.props.form;
152
+    return (
153
+      <>
154
+        <Modal
155
+            title="图片信息"
156
+            width={1100}
157
+            destroyOnClose="true"
158
+            footer={null}
159
+            visible={this.state.visibleData.visible}
160
+            onOk={() => this.handleOk()}
161
+            onCancel={e => this.handleCancel(e)}
162
+          >
163
+            <Form {...formItemLayout} onSubmit={e => this.handleSubmit(e)}>
164
+              <Form.Item label="编号" style={{ display: 'none' }}>
165
+                  {getFieldDecorator('apartmentId')(<Input />)}
166
+              </Form.Item>
167
+              <Form.Item label="名称">
168
+                {getFieldDecorator('apartmentName')(<Input />)}
169
+              </Form.Item>
170
+              <Form.Item label="类型">
171
+                {getFieldDecorator('apartmentType')(
172
+                  <Select placeholder="类型">
173
+                    <Option value="apart">户型</Option>
174
+                    <Option value="photo">相册</Option>
175
+                  </Select>,
176
+                )}
177
+              </Form.Item>
178
+              <Form.Item label="销售状态">
179
+                {getFieldDecorator('marketStatus')(
180
+                  <Select placeholder="销售状态">
181
+                    {
182
+                      saleType.map((item, _) => <Option value={item.id}>{item.name}</Option>)
183
+                    }
184
+                  </Select>,
185
+                )}
186
+              </Form.Item>
187
+              <Form.Item label="图片">
188
+              {getFieldDecorator('img')(
189
+                <ImageUpload />,
190
+              )}
191
+              </Form.Item>
192
+              <Form.Item label="面积">
193
+                {getFieldDecorator('buildingArea')(<Input />)}
194
+              </Form.Item>
195
+              <Form.Item label="套内面积">
196
+                {getFieldDecorator('insideArea')(<Input />)}
197
+              </Form.Item>
198
+              <Form.Item label="户型总价">
199
+                {getFieldDecorator('apartmentPrice')(<Input />)}
200
+              </Form.Item>
201
+              <Form.Item label="户型简介">
202
+                {getFieldDecorator('apartmentDescription')(
203
+                  <Wangedit />,
204
+                )}
205
+              </Form.Item>
206
+              <Form.Item label="备注">
207
+                {getFieldDecorator('remark')(<TextArea rows={10} />)}
208
+              </Form.Item>
209
+              <Form.Item style={{ width: '400px', margin: 'auto', display: 'flex', justifyContent: 'space-between' }}>
210
+                <Button type="primary" htmlType="submit">保存</Button>
211
+                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
212
+                <Button onClick={() => this.closeModal()}>取消</Button>
213
+              </Form.Item>
214
+            </Form>
215
+        </Modal>
216
+      </>
217
+    );
218
+  }
219
+}
220
+
221
+const WrappedModalImageForm = Form.create({ name: 'modalImage' })(ModalImage);
222
+
223
+export default WrappedModalImageForm

+ 1
- 1
src/pages/building/list/add/components/tags.jsx Voir le fichier

@@ -45,7 +45,7 @@ class EditableTagGroup extends React.Component {
45 45
         {tags.map((tag, index) => {
46 46
           const isLongTag = tag.length > 20;
47 47
           const tagElem = (
48
-            <Tag key={tag} closable={index !== 0} onClose={() => this.handleClose(tag)}>
48
+            <Tag key={tag} closable onClose={() => this.handleClose(tag)}>
49 49
               {isLongTag ? `${tag.slice(0, 20)}...` : tag}
50 50
             </Tag>
51 51
           );

+ 2
- 2
src/pages/building/list/index.jsx Voir le fichier

@@ -201,12 +201,12 @@ function body(props) {
201 201
           )}
202 202
         </Form.Item>
203 203
         <Form.Item>
204
-          <Button type="primary" htmlType="submit" className={Styles.SubmitButton}>
204
+          <Button type="primary" htmlType="submit">
205 205
             搜索
206 206
           </Button>
207 207
         </Form.Item>
208 208
       </Form>
209
-      <Button type="primary" className={Styles.addButton} onClick={() => toAdd()}>
209
+      <Button type="danger" className={Styles.addButton} onClick={() => toAdd()}>
210 210
         新增楼盘
211 211
       </Button>
212 212
 

+ 0
- 1
src/pages/building/list/style.css Voir le fichier

@@ -10,7 +10,6 @@
10 10
   border: 1px solid #dbdbdb;
11 11
 }
12 12
 .addButton {
13
-  background: #50be00;
14 13
   border-radius: 4px;
15 14
   border: 0px;
16 15
   margin: 10px 0px;

+ 0
- 1
src/pages/building/list/style.less Voir le fichier

@@ -10,7 +10,6 @@
10 10
   border: 1px solid #dbdbdb;
11 11
 }
12 12
 .addButton {
13
-  background: #50be00;
14 13
   border-radius: 4px;
15 14
   border: 0px;
16 15
   margin: 10px 0px;

+ 0
- 1
src/pages/building/list/style.wxss Voir le fichier

@@ -10,7 +10,6 @@
10 10
   border: 1px solid #dbdbdb;
11 11
 }
12 12
 .addButton {
13
-  background: #50be00;
14 13
   border-radius: 4px;
15 14
   border: 0px;
16 15
   margin: 10px 0px;

+ 1
- 0
src/pages/channel/InviteClients.jsx Voir le fichier

@@ -37,6 +37,7 @@ const columns = [
37 37
     dataIndex: 'sex',
38 38
     key: 'sex',
39 39
     align: 'center',
40
+    render: (text, record) => <a style={ { color: '#66B3FF' } } >{ record.sex === 1 ? '男' : '女' }</a>,
40 41
   },
41 42
 ];
42 43
 const header = props => {

+ 3
- 3
src/pages/channel/brokerList.jsx Voir le fichier

@@ -54,7 +54,7 @@ const columns = [
54 54
     dataIndex: 'sex',
55 55
     key: 'sex',
56 56
     align: 'center',
57
-    render: (text, list) => <a style={ { color: '#66B3FF' } } >{ list.sex === 1 ? '男' : '女' }</a>,
57
+    render: (text, list) => <a>{ list.sex === 1 ? '男' : '女' }</a>,
58 58
   },
59 59
   {
60 60
     title: '推荐客户',
@@ -155,7 +155,7 @@ const header = props => {
155 155
 return (
156 156
   <>
157 157
     <div className={ channels.searchBox }>
158
-      <div>
158
+      <div style = {{ marginLeft: '-5px' }}>
159 159
         <span className={ channels.selectName }>姓名</span>
160 160
         <Input onChange = { onInputChangePhone } style ={{ width: 150 }} />
161 161
         <span className={ channels.selectName }>电话</span>
@@ -163,7 +163,7 @@ return (
163 163
       </div>
164 164
       <div>
165 165
       <Button type="primary" onClick={() => queryList() }>查询</Button>
166
-      <Button onClick={() => refurbishList() }>重置</Button>
166
+      {/* <Button onClick={() => refurbishList() }>重置</Button> */}
167 167
     </div>
168 168
     </div>
169 169
     <Table dataSource={data.list} columns={columns} pagination={{ pageSize: 10, total: data.total, onChange }} />

+ 8
- 8
src/pages/channel/channelList.jsx Voir le fichier

@@ -59,20 +59,20 @@ const columns = [
59 59
   },
60 60
   {
61 61
     title: '经纪人数',
62
-    dataIndex: 'agentsNum',
63
-    key: 'agentsNum',
62
+    dataIndex: 'brokerCount',
63
+    key: 'brokerCount',
64 64
     align: 'center',
65 65
   },
66 66
   {
67 67
     title: '推荐客户有效',
68
-    dataIndex: 'recommendEffective',
69
-    key: 'recommendEffective',
68
+    dataIndex: 'recommendCount',
69
+    key: 'recommendCount',
70 70
     align: 'center',
71 71
   },
72 72
   {
73 73
     title: '邀请经济人',
74
-    dataIndex: 'agentsInvite',
75
-    key: 'agentsInvite',
74
+    dataIndex: 'inviteCount',
75
+    key: 'inviteCount',
76 76
     align: 'center',
77 77
   },
78 78
   {
@@ -168,10 +168,10 @@ const header = props => {
168 168
         </dvi>
169 169
         <div >
170 170
         <Button type="primary" onClick={() => queryList() }>查询</Button>
171
-        <Button onClick={() => reset() }>重置</Button>
171
+        {/* <Button onClick={() => reset() }>重置</Button> */}
172 172
         </div>
173 173
       </div>
174
-      <Button type="danger" onClick={toAdd}>新增</Button>
174
+      <Button type="danger" onClick={toAdd} className={channels.about} >新增</Button>
175 175
       <Table dataSource={data.result.records} columns={columns} pagination={{ pageSize: 10, total: data.result.total, onChange }} />
176 176
   </>
177 177
   )

+ 7
- 3
src/pages/channel/channelList.less Voir le fichier

@@ -32,13 +32,12 @@
32 32
 .about {
33 33
   padding: 0 30px;
34 34
   height: 36px;
35
-  background-color:rgba(255,255,255,1);
36
-  color: #fff;
37 35
   margin: 30px 0;
36
+  margin-left:8px;
38 37
 }
39 38
 
40 39
 .selectName {
41
-  font-size: 17px;
40
+  font-size: 14px;
42 41
   padding: 0 10px;
43 42
   height: 36px;
44 43
   color: rgb(10, 10, 10);
@@ -62,3 +61,8 @@
62 61
   float: 'left'; 
63 62
   width: 500
64 63
 }
64
+.brokerTable{
65
+  padding: 0 30px;
66
+  height: 36px;
67
+  margin: 30px 0;
68
+}

+ 6
- 2
src/pages/channel/editChannel.jsx Voir le fichier

@@ -27,7 +27,6 @@ const header = props => {
27 27
 
28 28
   // 编辑
29 29
   function editChannel(data) {
30
-    alert(1111111)
31 30
       request({
32 31
         url: `/api/admin/channel/${props.location.query.id}`,
33 32
         method: 'PUT',
@@ -48,6 +47,11 @@ const header = props => {
48 47
       }
49 48
     });
50 49
   }
50
+  function go() {
51
+    router.push({
52
+      pathname: '/channel/channelList',
53
+    });
54
+  }
51 55
 
52 56
   const { getFieldDecorator } = props.form;
53 57
 
@@ -77,7 +81,7 @@ const header = props => {
77 81
           <Button type="primary" htmlType="submit">
78 82
             保存
79 83
           </Button>
80
-          <Button className={channels.formButton} onClick = {() => router.go(-1)} type="primary" htmlType="submit">
84
+          <Button className={channels.formButton} onClick = { go } type="primary" htmlType="submit">
81 85
             取消
82 86
           </Button>
83 87
         </Form.Item>

+ 1
- 0
src/pages/channel/recommendClients.jsx Voir le fichier

@@ -70,6 +70,7 @@ const columns = [
70 70
     dataIndex: 'sex',
71 71
     key: 'sex',
72 72
     align: 'center',
73
+    render: (text, record) => <a style={ { color: '#66B3FF' } } >{ record.sex === 1 ? '男' : '女' }</a>,
73 74
   },
74 75
   {
75 76
     title: '意向项目',

+ 1
- 1
src/pages/customer/independentList/index.jsx Voir le fichier

@@ -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, Table, Avatar, notification } from 'antd';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, notification, Modal } from 'antd';
3 3
 import moment from 'moment';
4 4
 import request from '../../../utils/request';
5 5
 import apis from '../../../services/apis';

+ 135
- 143
src/pages/news/list/NewsList.jsx Voir le fichier

@@ -63,7 +63,7 @@ function body(props) {
63 63
   }
64 64
 
65 65
   // 跳转到编辑资讯列表
66
-  const toEditList = (id) => ()  => {
66
+  const toEditList = (id) => () => {
67 67
     router.push({
68 68
       pathname: '/news/list/editNewsList',
69 69
       query: {
@@ -74,153 +74,145 @@ function body(props) {
74 74
 
75 75
 
76 76
 
77
-/**
78
- *卡片
79
- *
80
- * @returns
81
- */
82
-function CartBody(props) {
83
-  const { data } = props
84
-  console.log(data);
85
-  const cancelPage = () =>{
86
-    router.push({
87
-      pathname: '/news/list/NewsList',
88
-    });
89
-  }
90
-
91
-  //删除资讯
92
-  const changeNewsListStatus = (newsId) => () => {
93
-    Modal.confirm({
94
-      title: '确认删除该资讯?',
95
-      okText: '确认',
96
-      cancelText: '取消',
97
-      onOk() {
98
-        request({
99
-          url: '/api/admin/taNews/' + newsId,
100
-          method: 'DELETE',
101
-          // data: { ...row },
102
-        }).then((data) => {
103
-          message.info('操作成功!')
104
-          getList({ pageNum: 1, pageSize: 10 });
105
-        })
106
-      }
107
-    });
108
-  }
109
-
110
-  // 跳转到编辑资讯列表
111
-  const toEditList = (newsId) => ()  => {
112
-    router.push({
113
-      pathname: '/news/list/editNewsList',
114
-      query: {
115
-        newsId
116
-      },
117
-    });
118
-  } 
77
+  /**
78
+   *卡片
79
+   *
80
+   * @returns
81
+   */
82
+  function CartBody(props) {
83
+    const { data } = props
84
+    console.log(data);
85
+    const cancelPage = () => {
86
+      router.push({
87
+        pathname: '/news/list/NewsList',
88
+      });
89
+    }
119 90
 
120
-  function cancelRelease (newsId, newsStatus, buildingId,newsTypeId) {
121
-    console.log("newsId" + newsId + "status" + newsStatus);
122
-    if (newsStatus === 1){
91
+    //删除资讯
92
+    const changeNewsListStatus = (newsId) => () => {
123 93
       Modal.confirm({
124
-        title: '确认取消该资讯?',
94
+        title: '确认删除该资讯?',
125 95
         okText: '确认',
126 96
         cancelText: '取消',
127
-        onOk () {
97
+        onOk() {
128 98
           request({
129 99
             url: '/api/admin/taNews/' + newsId,
130
-            method: 'PUT',
131
-            data: { "newsStatus": newsStatus, "buildingId":buildingId, "newsTypeId":newsTypeId },
100
+            method: 'DELETE',
101
+            // data: { ...row },
132 102
           }).then((data) => {
133 103
             message.info('操作成功!')
134 104
             getList({ pageNum: 1, pageSize: 10 });
135 105
           })
136
-        },
137
-        onCancel () {
138
-          console.log('Cancel');
139
-        },
106
+        }
140 107
       });
141
-    }else if (newsStatus === 0){
142
-      Modal.confirm({
143
-        title: '确认发布该资讯?',
144
-        okText: '确认',
145
-        cancelText: '取消',
146
-        onOk () {
147
-          request({
148
-            url: '/api/admin/taNews/' + newsId,
149
-            method: 'PUT',
150
-            data: { "newsStatus": newsStatus, "buildingId":buildingId, "newsTypeId":newsTypeId },
151
-          }).then((data) => {
152
-            message.info('操作成功!')
153
-            getList({ pageNum: 1, pageSize: 10 });
154
-          })
155
-        },
156
-        onCancel () {
157
-          console.log('Cancel');
108
+    }
109
+
110
+    // 跳转到编辑资讯列表
111
+    const toEditList = (newsId) => () => {
112
+      router.push({
113
+        pathname: '/news/list/editNewsList',
114
+        query: {
115
+          newsId
158 116
         },
159 117
       });
160
-    }  
161
-  }
118
+    }
162 119
 
163
-  return (
164
-          <Card
165
-            hoverable
166
-            style={{ minWidth: '400px', borderRadius: '12px', margin: '10px', boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)' }}
167
-            cover={<img alt="example" src={ data.newsImg } style={{ borderRadius: '12px 12px 0 0', width: '100%', height: '14vw' }}></img>}
168
-            bodyStyle={{ padding: '10px 20px' }}
169
-          >
170
-            <p className={Styles.cardText}>
171
-              <span className={Styles.title}>资讯类型</span>
172
-              <span >:{ data.newsType.newsTypeName }</span>
173
-              <span className={Styles.ediText} onClick={toEditList(data.newsId)}>
174
-                编辑
120
+    function cancelRelease(newsId, newsStatus, buildingId, newsTypeId) {
121
+      console.log("newsId" + newsId + "status" + newsStatus);
122
+      if (newsStatus === 1) {
123
+        Modal.confirm({
124
+          title: '确认取消该资讯?',
125
+          okText: '确认',
126
+          cancelText: '取消',
127
+          onOk() {
128
+            request({
129
+              url: '/api/admin/taNews/' + newsId,
130
+              method: 'PUT',
131
+              data: { "newsStatus": newsStatus, "buildingId": buildingId, "newsTypeId": newsTypeId },
132
+            }).then((data) => {
133
+              message.info('操作成功!')
134
+              getList({ pageNum: 1, pageSize: 10 });
135
+            })
136
+          },
137
+          onCancel() {
138
+            console.log('Cancel');
139
+          },
140
+        });
141
+      } else if (newsStatus === 0) {
142
+        Modal.confirm({
143
+          title: '确认发布该资讯?',
144
+          okText: '确认',
145
+          cancelText: '取消',
146
+          onOk() {
147
+            request({
148
+              url: '/api/admin/taNews/' + newsId,
149
+              method: 'PUT',
150
+              data: { "newsStatus": newsStatus, "buildingId": buildingId, "newsTypeId": newsTypeId },
151
+            }).then((data) => {
152
+              message.info('操作成功!')
153
+              getList({ pageNum: 1, pageSize: 10 });
154
+            })
155
+          },
156
+          onCancel() {
157
+            console.log('Cancel');
158
+          },
159
+        });
160
+      }
161
+    }
162
+
163
+    return (
164
+      <Card
165
+        hoverable
166
+        style={{ height: '255px', minWidth: '640px', borderRadius: '12px', margin: '10px', boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)', position: 'relative' }}
167
+        cover={<img alt="example" src={data.newsImg} style={{ borderRadius: '12px 0 0 12px', width: '260px', height: '253px' }}></img>}
168
+        bodyStyle={{ padding: '10px 20px' }}
169
+      >
170
+        <span style={{ position: 'absolute', right: '20px', top: '20px', fontSize: '18px', color: '#FF7E48' }} onClick={toEditList(data.newsId)}>
171
+          编辑
175 172
                 <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
176
-              </span>
177
-            </p>
178
-            <p className={Styles.cardText}>
179
-              <span className={Styles.title}>状态</span>
180
-              <span >:{ data.newsStatus == 0 ? "已发布" : "未发布" }</span>
181
-            </p>
182
-            <p className={Styles.cardItem}>
183
-              <span className={Styles.title}>阅读数量</span>
184
-              <span > :{ data.pvNum }</span>
185
-            </p>
186
-            <p className={Styles.cardItem}>
187
-              <span className={Styles.title}>转发数量</span>
188
-              <span>:{ data.shareNum }</span>
189
-            </p>
190
-            <p className={Styles.cardItem}>
191
-              <span className={Styles.title}>点赞数量</span>     
192
-              <span >:{ data.favorNum }</span>         
193
-            </p>
194
-            <p className={Styles.cardItem}>
195
-              <span className={Styles.title}>收藏数量</span>
196
-              <span >:{ data.saveNum }</span>
197
-            </p>
198
-            <p className={Styles.cardItem}>
199
-              <span className={Styles.title}>录入时间</span>
200
-              <span >:{ data.createDate }</span>
201
-            </p>
202
-            <p style={{ margin: '15px 0', position: 'relative', fontSize: '18px' }}>
203
-              {data.newsStatus === 0 ? 
204
-              <span style={{ color: '#1990FF' }} onClick={cancelRelease.bind(this,data.newsId, 1, data.buildingId, data.newsType.newsTypeId)}>
205
-              取消发布
173
+        </span>
174
+        {data.newsStatus === 0 ?
175
+          <span style={{ position: 'absolute', left: '280px', bottom: '18px', fontSize: '18px', color: '#FF7E48' }} onClick={cancelRelease.bind(this, data.newsId, 1, data.buildingId, data.newsType.newsTypeId)}>
176
+            取消发布
206 177
               <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
207
-              </span>:
208
-              <span style={{ color: '#1990FF' }} onClick={cancelRelease.bind(this,data.newsId, 0, data.buildingId, data.newsType.newsTypeId)}>
209
-              发布
178
+          </span> :
179
+          <span style={{ position: 'absolute', left: '280px', bottom: '18px', fontSize: '18px', color: '#FF7E48' }} onClick={cancelRelease.bind(this, data.newsId, 0, data.buildingId, data.newsType.newsTypeId)}>
180
+            发布
210 181
               <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
211
-              </span>
212
-              }
213
-              
214
-              <span style={{
215
-                color: '#FF4A4A', position: 'absolute', right: '0',
216
-              }} onClick={changeNewsListStatus(data.newsId)}>
217
-                删除
182
+          </span>
183
+        }
184
+
185
+        <span style={{ position: 'absolute', right: '20px', bottom: '18px', fontSize: '18px', color: '#FF7E48' }} onClick={changeNewsListStatus(data.newsId)}>
186
+          删除
218 187
                 <Icon type="rest" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
219
-              </span>
220
-            </p>
221
-          </Card>
222
-  )
223
-}
188
+        </span>
189
+        <div style={{ position: 'absolute', left: '260px', top: '0px', padding: '20px' }}>
190
+          <p style={{
191
+            fontSize: '18px', color: '#333', fontWeight: '600', marginBottom: '10px', overflow: 'hidden',
192
+            textOverflow: 'ellipsis',
193
+            whiteSpace: 'nowrap',
194
+            width: '300px',
195
+          }}>{data.newsName}</p>
196
+          <p style={{ fontSize: '18px', color: '#555', marginBottom: '10px' }}>
197
+            <span style={{ display: 'inline-block', width: '190px' }}>咨询类型:{data.newsType.newsTypeName}</span>
198
+            <span>状态:{data.newsStatus == 0 ? "已发布" : "未发布"}</span>
199
+          </p>
200
+
201
+          <p style={{ fontSize: '18px', color: '#555', marginBottom: '10px' }}>
202
+            <span style={{ display: 'inline-block', width: '190px' }}>阅读数量:{data.pvNum}</span>
203
+            <span>转发数量:{data.shareNum}</span>
204
+          </p>
205
+
206
+          <p style={{ fontSize: '18px', color: '#555', marginBottom: '10px' }}>
207
+            <span style={{ display: 'inline-block', width: '190px' }}>点赞数量:{data.favorNum}</span>
208
+            <span>收藏数量:{data.saveNum}</span>
209
+          </p>
210
+
211
+          <p style={{ fontSize: '18px', color: '#999', marginBottom: '10px' }}>发布时间:{data.createDate}</p>
212
+        </div>
213
+      </Card>
214
+    )
215
+  }
224 216
 
225 217
 
226 218
   // Change 事件
@@ -232,7 +224,7 @@ function CartBody(props) {
232 224
   // 分页
233 225
   function onChange(pageNumber) {
234 226
     // eslint-disable-next-line react-hooks/rules-of-hooks
235
-      getList({ pageNum: pageNumber, pageSize: 6 })
227
+    getList({ pageNum: pageNumber, pageSize: 6 })
236 228
   }
237 229
 
238 230
   function getDate(value, dateString) {
@@ -246,27 +238,27 @@ function CartBody(props) {
246 238
 
247 239
         <Form.Item>
248 240
           {getFieldDecorator('cityId')(
249
-            <SelectCity />,  
241
+            <SelectCity />,
250 242
           )}
251 243
         </Form.Item>
252 244
         <Form.Item>
253 245
           {getFieldDecorator('buildingId')(
254
-              <BuildSelect />,
255
-            )}
246
+            <BuildSelect />,
247
+          )}
256 248
         </Form.Item>
257
-        <Form.Item>
249
+        {/* <Form.Item>
258 250
           {getFieldDecorator('title')(
259 251
             <Input
260 252
               prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
261 253
               placeholder="请输入标题"
262 254
             />,
263 255
           )}
264
-        </Form.Item>
256
+        </Form.Item> */}
265 257
         <Form.Item>
266 258
           {getFieldDecorator('newsTypeId')(
267 259
             <NewsTypeSelect />,
268 260
           )}
269
-        </Form.Item>       
261
+        </Form.Item>
270 262
         <Form.Item>
271 263
           {getFieldDecorator('newsStatus')(
272 264
             <Select style={{ width: '180px' }} placeholder="状态">
@@ -276,12 +268,12 @@ function CartBody(props) {
276 268
           )}
277 269
         </Form.Item>
278 270
         <Form.Item>
279
-          <Button type="primary" htmlType="submit" className={Styles.SubmitButton}>
271
+          <Button type="primary" htmlType="submit" >
280 272
             搜索
281 273
           </Button>
282 274
         </Form.Item>
283 275
       </Form>
284
-      <Button type="primary" className={Styles.addButton} onClick={toEditList()}>
276
+      <Button type="danger" style={{ padding: '0 40px', margin: '20px 0' }} onClick={toEditList()}>
285 277
         新增
286 278
       </Button>
287 279
 
@@ -289,10 +281,10 @@ function CartBody(props) {
289 281
       <Row style={{ padding: ' 0 10px' }}>
290 282
         {
291 283
           dataSource.records.map((item, index) => (
292
-              <Col span={8}>
293
-                <CartBody data={item} key={item.buildingId}/>
294
-              </Col>
295
-            ))
284
+            <Col span={12}>
285
+              <CartBody data={item} key={item.buildingId} />
286
+            </Col>
287
+          ))
296 288
         }
297 289
       </Row>
298 290
       {/* 分页 */}

+ 115
- 0
src/pages/system/editPolicy.jsx Voir le fichier

@@ -0,0 +1,115 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import moment from 'moment';
6
+import router from 'umi/router';
7
+import BuildSelect from '../../components/SelectButton/BuildSelect'
8
+import SelectCity from '../../components/SelectButton/CitySelect'
9
+import XForm, { FieldTypes } from '../../components/XForm';
10
+import Wangedit from '../../components/Wangedit/Wangedit'
11
+import request from '../../utils/request'
12
+
13
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14
+/**
15
+ *
16
+ *
17
+ * @param {*} props
18
+ * @returns
19
+ */
20
+ const Edit = (props) => {
21
+  const policyId = props.location.query.policyId
22
+  const [ policyData, setPolicyData ] = useState({})
23
+  if(policyId){
24
+    useEffect(() => {
25
+      getPolicyData(policyId);
26
+    },[])
27
+
28
+  // 查询列表
29
+  const getPolicyData = (policyId) => {
30
+    request({
31
+        url: '/api/admin/taPolicy/' + policyId,
32
+        method: 'GET',
33
+    }).then((data) => {
34
+        console.log(data)
35
+        setPolicyData(data)
36
+    })
37
+  }
38
+  }
39
+
40
+  const cancelPage = () =>{
41
+    router.push({
42
+      pathname: '/system/housingPolicy',
43
+    });
44
+  }
45
+    const fields = [
46
+      {
47
+        label: '城市',
48
+        name: 'cityId',
49
+        render: <SelectCity />,
50
+        value: policyData.cityId,
51
+      },
52
+      {
53
+        label: '政策图片',
54
+        name: 'policyImg',
55
+        type: FieldTypes.ImageUploader,
56
+        value: policyData.policyImg,
57
+      },
58
+      {
59
+        label: '政策标题',
60
+        name: 'title',
61
+        type: FieldTypes.Text,
62
+        value: policyData.title,
63
+      },
64
+      {
65
+        label: '政策详情',
66
+        name: 'body',
67
+        render: <Wangedit />,
68
+        value: policyData.body,
69
+      },
70
+      {
71
+        label: '状态',
72
+        name: 'publishStatus',
73
+        type: FieldTypes.Select,
74
+        dict: [{label:"未发布",value:0},{label:"已发布",value:1}],
75
+        value: policyData.publishStatus != null ? policyData.publishStatus : 1,
76
+      },
77
+    ]
78
+  
79
+    const handleSubmit = val => { 
80
+      console.log('submit data --->', val)
81
+      if(policyId){
82
+        val.policyId = policyId
83
+        request({
84
+          url: '/api/admin/taPolicy/'+policyId,
85
+          method: 'PUT',
86
+          data: val,
87
+        }).then((data) => {
88
+          message.info("保存成功")
89
+          cancelPage()
90
+        }).catch((err) => {
91
+          message.info(err.msg || err.message)
92
+        })
93
+      }else{
94
+        request({
95
+          url: '/api/admin/taPolicy',
96
+          method: 'POST',
97
+          data: val,
98
+        }).then((data) => {
99
+          message.info("保存成功")
100
+          cancelPage()
101
+        }).catch((err) => {
102
+          message.info(err.msg || err.message)
103
+        })
104
+      }
105
+    }
106
+     
107
+
108
+  return (
109
+    <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
110
+  );
111
+ }
112
+
113
+
114
+
115
+export default Edit

+ 202
- 0
src/pages/system/housingPolicy.jsx Voir le fichier

@@ -0,0 +1,202 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import router from 'umi/router';
6
+import moment from 'moment';
7
+import SelectCity from '../../components/SelectButton/CitySelect'
8
+import BuildSelect from '../../components/SelectButton/BuildSelect'
9
+
10
+import request from '../../utils/request'
11
+
12
+const { Option } = Select;
13
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14
+
15
+const header = (props) => {
16
+  const [ data, setData ] = useState({})
17
+
18
+  useEffect(() => {
19
+    getList({ pageNum: 1, pageSize: 10,cityId: '' });
20
+  },[])
21
+
22
+  // 查询列表
23
+  const getList = (params) => {
24
+    request({
25
+        url: '/api/admin/taPolicy',
26
+        method: 'GET',
27
+        params: { ...params },
28
+    }).then((data) => {
29
+        console.log(data)
30
+        setData(data)
31
+    })
32
+  }
33
+
34
+  
35
+// 跳转到编辑商品
36
+const toEditPolicy = (policyId) => () => {
37
+    router.push({
38
+      pathname: '/system/editPolicy',
39
+      query: {
40
+        policyId
41
+      },
42
+    });
43
+  }
44
+  
45
+  /**
46
+   *
47
+   *
48
+   * @param {*} props
49
+   * @returns
50
+   */
51
+  
52
+  const columns = [
53
+    {
54
+      title: '购房政策主图',
55
+      dataIndex: 'policyImg',
56
+      key: 'policyImg',
57
+      align: 'center',
58
+      render: (policyImg) => <img src={policyImg} className={styles.touxiang} />,
59
+    },
60
+    {
61
+      title: '标题',
62
+      dataIndex: 'title',
63
+      key: 'title',
64
+      align: 'center',
65
+    },
66
+    {
67
+      title: '城市',
68
+      dataIndex: 'cityName',
69
+      key: 'cityName',
70
+      align: 'center',
71
+    },
72
+    {
73
+      title: '创建时间',
74
+      dataIndex: 'createDate',
75
+      key: 'createDate',
76
+      align: 'center',
77
+      render: (createDate) => <><span>{moment(createDate).format('YYYY-MM-DD')}</span></>
78
+    },
79
+    {
80
+      title: '状态',
81
+      dataIndex: 'publishStatus',
82
+      key: 'publishStatus',
83
+      align: 'center',
84
+      render: (publishStatus)=> <><span>{publishStatus === 1 ? '已发布' : '未发布' }</span></>
85
+    },
86
+    {
87
+      title: '操作',
88
+      dataIndex: 'handle',
89
+      key: 'handle',
90
+      align: 'center',
91
+      render: (x,row) => <>
92
+                           <span style={{ color: '#1990FF' }} onClick={publicOrNoPublic(row)}>{ row.publishStatus === 0 ? '发布' : '取消发布' }<Icon type="close-circle" className={styles.edit} /></span>
93
+                           <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={topPolicy(row)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
94
+                           <span style={{ color: '#FF925C' }} onClick={toEditPolicy(row.policyId)}>编辑<Icon type="form" className={styles.edit} /></span>
95
+                           <span style={{ color: '#FF925C' }} onClick={deletePolicy(row.policyId)}>删除<Icon type="form" className={styles.edit} /></span>
96
+                         </>
97
+    },
98
+  ];
99
+  
100
+  // 删除
101
+const deletePolicy = (policyId) => () => {
102
+  Modal.confirm({
103
+    title: '是否继续删除此政策?',
104
+    okText: '确定',
105
+    cancelText: '取消',
106
+    onOk() {
107
+        request({
108
+            url: '/api/admin/taPolicy/'+policyId,
109
+            method: 'DELETE',
110
+        }).then((data) => {
111
+            message.info('操作成功!')
112
+            getList({ pageNum: 1, pageSize: 10,cityId: '' });
113
+        }).catch((err) => {
114
+            console.log(err)
115
+            message.info(err.msg || err.message)
116
+        })
117
+    },
118
+  });
119
+}
120
+
121
+
122
+//   置顶
123
+  const topPolicy = (row) => () => {
124
+      const weight = Math.abs(row.weight - 1)
125
+      row.weight = weight
126
+      request({
127
+          url: '/api/admin/taPolicy/'+row.policyId,
128
+          method: 'PUT',
129
+          data: row,
130
+      }).then((data) => {
131
+          console.log(data)
132
+          message.info('操作成功!')
133
+          getList({ pageNum: 1, pageSize: 10,cityId: '' });
134
+      }).catch((err) => {
135
+          console.log(err)
136
+          message.info(err.msg || err.message)
137
+      })
138
+  }
139
+  
140
+  const publicOrNoPublic = (row) => () => {
141
+      if (row.publishStatus === 1) {
142
+        row.publishStatus = 0
143
+      } else {
144
+        row.publishStatus = 1
145
+      }
146
+
147
+      request({
148
+        url: '/api/admin/taPolicy/'+row.policyId,
149
+        method: 'PUT',
150
+        data: row,
151
+      }).then((data) => {
152
+          console.log(data)
153
+          message.info('操作成功!')
154
+          getList({ pageNum: 1, pageSize: 10,cityId: '' });
155
+      }).catch((err) => {
156
+          console.log(err)
157
+          message.info(err.msg || err.message)
158
+      })
159
+  }
160
+  
161
+  const changePageNum = (pageNumber) => {
162
+      getList({ pageNum: pageNumber, pageSize: 10 })
163
+  }
164
+
165
+  // 提交事件
166
+const handleSubmit = (e, props) => {
167
+    e.preventDefault();
168
+    props.form.validateFields((err, values) => {
169
+      if (!err) {
170
+        console.log('提交数据: ', values)
171
+        getList({ pageNum: 1, pageSize: 10, ...values })
172
+      }
173
+    });
174
+  }
175
+
176
+  const { getFieldDecorator } = props.form
177
+  return (
178
+
179
+    <>
180
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
181
+        <Form.Item>
182
+          {getFieldDecorator('cityId')(
183
+            <SelectCity />,
184
+          )}
185
+        </Form.Item>
186
+        <Form.Item>
187
+          <Button type="primary" htmlType="submit" className={styles.searchBtn}>
188
+            搜索
189
+          </Button>
190
+        </Form.Item>
191
+      </Form>
192
+      <Button type="primary" className={styles.addBtn} onClick={toEditPolicy()}>新增</Button>
193
+      <Table dataSource={data.records} columns={columns} pagination={false}/>
194
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
195
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
196
+      </div>
197
+    </>
198
+  )
199
+}
200
+const WrappedHeader = Form.create({ name: 'header' })(header);
201
+
202
+export default WrappedHeader

+ 96
- 0
src/pages/system/intention.jsx Voir le fichier

@@ -0,0 +1,96 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message,Checkbox,Row, Col } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import moment from 'moment';
6
+import router from 'umi/router';
7
+import BuildSelect from '../../components/SelectButton/BuildSelect'
8
+import XForm, { FieldTypes } from '../../components/XForm';
9
+import Wangedit from '../../components/Wangedit/Wangedit'
10
+import request from '../../utils/request'
11
+import SelectCity from '../../components/SelectButton/CitySelect'
12
+
13
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14
+/**
15
+ *
16
+ *
17
+ * @param {*} props
18
+ * @returns
19
+ */
20
+ const Edit = (props) => {
21
+  const [ data, setData ] = useState([])
22
+  const [ buildingIdValue, setBuildingIdData ] = useState('')
23
+
24
+  const changBuilding = (buildingId) => {
25
+    setBuildingIdData(buildingId)
26
+    request({
27
+      url: '/api/admin/tdBizEventIntention',
28
+      method: 'GET',
29
+      params: {pageNum: 1, pageSize: 999,buildingId}
30
+    }).then((data) => {
31
+      console.log(data)
32
+      setData(data.records)
33
+    })
34
+  }
35
+
36
+  const changeBox = (x) => (e) => {
37
+    setData(data.map((item) => {
38
+      return x.eventId === item.eventId ? {...item, checkbox: e.target.checked} : item
39
+    }))
40
+  }
41
+
42
+  const changeInput = (x) => (e) => {
43
+    setData(data.map((item) => {
44
+      return x.eventId === item.eventId ? {...item, intention: e.target.value} : item
45
+    }))
46
+  }
47
+
48
+  const submitValue = () => {
49
+    console.log(buildingIdValue)
50
+    if(buildingIdValue === ''){
51
+      return
52
+    }
53
+    request({
54
+      url: '/api/admin/taBuildingIntentionAddOrUpdate/' + buildingIdValue,
55
+      method: 'POST',
56
+      data
57
+    }).then((data) => {
58
+      message.info("保存成功")
59
+    })
60
+  }
61
+
62
+  return (
63
+    <>
64
+    <Row>
65
+      <Col span={12}>
66
+        <BuildSelect onChange={changBuilding}/>
67
+      </Col>
68
+    </Row>
69
+    <Row>
70
+      <Col span={3} offset={3}>
71
+        用户操作
72
+      </Col>
73
+      <Col span={3} offset={3}>
74
+        意向值
75
+      </Col>
76
+    </Row>
77
+    {data.map((x) => {
78
+      return <Row>
79
+                <Col span={3} offset={3}>
80
+                  <Checkbox checked={x.checkbox} onChange={changeBox(x)}>{x.eventName}</Checkbox>
81
+                </Col>
82
+                <Col span={3} offset={3}>
83
+                  <Input value={x.intention} onChange={changeInput(x)}/>
84
+                </Col>
85
+              </Row>
86
+    })}
87
+    <Row>
88
+      <Button type="primary" className={styles.searchBtn} onClick={submitValue}>确定</Button>
89
+    </Row>
90
+    </>
91
+  );
92
+ }
93
+
94
+
95
+
96
+export default Edit

+ 4
- 2
src/pages/system/report.jsx Voir le fichier

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message,Checkbox } from 'antd';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message,Checkbox,Row, Col  } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5 5
 import moment from 'moment';
@@ -62,7 +62,9 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
62 62
 
63 63
   return (
64 64
     <>
65
-      <Checkbox.Group options={data} value={checkData} onChange={onChange} />
65
+      <Row>
66
+        <Checkbox.Group options={data} value={checkData} onChange={onChange} />
67
+      </Row>
66 68
       <Button type="primary" className={styles.searchBtn} onClick={saveCheckedReport}>提交</Button>
67 69
     </>
68 70
   );

+ 16
- 0
src/services/apis.js Voir le fichier

@@ -26,6 +26,22 @@ export default {
26 26
       method: 'GET',
27 27
       url: `${prefix}/buildingApartment/buildingId/id`,
28 28
     },
29
+    buildingApartmentGetById: {
30
+      method: 'GET',
31
+      url: `${prefix}/buildingApartment/id`,
32
+    },
33
+    buildingApartmentUpdate: {
34
+      method: 'PUT',
35
+      url: `${prefix}/buildingApartment/update`,
36
+    },
37
+    buildingApartmentAdd: {
38
+      method: 'POST',
39
+      url: `${prefix}/buildingApartment/add`,
40
+    },
41
+    buildingApartmentDelete: {
42
+      method: 'DELETE',
43
+      url: `${prefix}/apartment/deleted/id`,
44
+    },
29 45
   },
30 46
   buildingType: {
31 47
     getList: {

+ 31
- 0
src/utils/mixStr.js Voir le fichier

@@ -0,0 +1,31 @@
1
+
2
+const fill2Len = (str, len) => {
3
+  if (!str) {
4
+    return '*'.repeat(len)
5
+  }
6
+
7
+  const orginLen = str.length
8
+  if (len <= orginLen) {
9
+    return str.substr(0, len)
10
+  }
11
+
12
+  return str.repeat(Math.floor(len / orginLen)) + str.substr(0, len % orginLen)
13
+}
14
+
15
+const mixChars = window.navigator.userAgent + (new Date).toUTCString().replace(/\d{2}:\d{2}:\d{2}/, '')
16
+
17
+const strXOR = (str, mix) => {
18
+  if (!str) return str
19
+
20
+  const strLen = str.length
21
+  const mixStr = fill2Len(mix, strLen)
22
+
23
+  const result = []
24
+  for (let i = 0; i < strLen; i ++) {
25
+    result.push(String.fromCharCode(str.charCodeAt(i) ^ mixStr.charCodeAt(i)))
26
+  }
27
+
28
+  return result.join('')
29
+}
30
+
31
+export default str => strXOR(str, mixChars)

+ 12
- 4
src/utils/request.js Voir le fichier

@@ -4,6 +4,9 @@
4 4
  */
5 5
 import request from 'umi-request';
6 6
 import { notification } from 'antd';
7
+import apis from '../services/apis';
8
+import mixStr from './mixStr';
9
+
7 10
 const codeMessage = {
8 11
   200: '服务器成功返回请求的数据。',
9 12
   201: '新建或修改数据成功。',
@@ -25,18 +28,18 @@ const codeMessage = {
25 28
 const replaceURLParams = (url, params = {}) => {
26 29
   return Object.keys(params).reduce((acc, k) => { // 此方法对每个元素进行处理
27 30
     const re = new RegExp(`:${k}(?!w)`, 'i')
28
-    return acc.replace(re, args[k])
31
+    return acc.replace(re, params[k])
29 32
   }, url)
30 33
 }
31 34
 
32 35
 request.interceptors.request.use((url, options) => {
33 36
   const { urlData, headers = {}, logout = false, data, ...opts } = options
34 37
   const apiURL = urlData ? replaceURLParams(url, urlData) : url
35
-  const token = window.localStorage.getItem('x-token')
38
+  const token = mixStr(window.localStorage.getItem('test-foobar'))
36 39
   const authHeader = token ? { Authorization: `Bearer ${token}` } : {}
37 40
 
38 41
   if (logout) {
39
-    window.localStorage.removeItem('x-token')
42
+    window.localStorage.removeItem('test-foobar')
40 43
   }
41 44
 
42 45
   return (
@@ -79,7 +82,7 @@ request.interceptors.response.use(async (response, options) => {
79 82
       }
80 83
 
81 84
       if (data && data.token) {
82
-        window.localStorage.setItem('x-token', data.token)
85
+        window.localStorage.setItem('test-foobar', mixStr(data.token))
83 86
       }
84 87
 
85 88
       return data;
@@ -92,6 +95,9 @@ request.interceptors.response.use(async (response, options) => {
92 95
   }
93 96
 });
94 97
 
98
+
99
+const fetch = api => options => request(api.url, {...api, ...options || {}})
100
+
95 101
 export default config => {
96 102
   if (typeof config === 'string') {
97 103
     return request(config);
@@ -100,3 +106,5 @@ export default config => {
100 106
     return request(url, options);
101 107
   }
102 108
 };
109
+
110
+export { fetch, apis }