dingxin hace 5 años
padre
commit
8dbc54c96d

+ 5
- 5
config/config.js Ver fichero

@@ -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',

+ 7
- 1
src/components/SelectButton/BuildSelect.jsx Ver fichero

@@ -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
           ))}

+ 4
- 4
src/components/XForm/ImageUpload.jsx Ver fichero

@@ -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
   }

+ 2
- 0
src/layouts/SecurityLayout.jsx Ver fichero

@@ -25,6 +25,8 @@ class SecurityLayout extends React.Component {
25 25
     const { isReady } = this.state;
26 26
     const { children, loading, currentUser } = this.props;
27 27
 
28
+    console.log('------------>', loading, currentUser)
29
+
28 30
     if ((!currentUser.userId && loading) || !isReady) {
29 31
       return <PageLoading />;
30 32
     }

+ 1
- 2
src/models/login.js Ver fichero

@@ -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
   },

+ 85
- 61
src/pages/activity/editActivity.jsx Ver fichero

@@ -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';
@@ -14,6 +14,7 @@ import ImageUploader from '../../components/XForm/ImageUpload';
14 14
 import logo from '../../assets/logo.png';
15 15
 
16 16
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
17
+const { TextArea } = Input;
17 18
 
18 19
 /**
19 20
  *
@@ -22,7 +23,8 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
22 23
  * @returns
23 24
  */
24 25
 const Edit = (props) => {
25
-  const [tab, changeTab] = useState('basic')
26
+  const [tab, changeTab] = useState('poster')
27
+  // const [tab, changeTab] = useState('basic')
26 28
   const dynamicId = props.location.query.dynamicId
27 29
   const [dynamicData, setDynamicData] = useState({})
28 30
   if (dynamicId) {
@@ -165,77 +167,99 @@ const Edit = (props) => {
165 167
   }
166 168
 
167 169
   const Poster = (props) => {
170
+    const [inputValue, changeInput] = useState('')
171
+    const [textAreaValue, changeTextArea] = useState('')
172
+    const [imgValue, changeImg] = useState('')
173
+    return <div>
174
+      <div style={{ display: 'flex' }}>
175
+        <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
176
+          <div style={{ width: '375px', height: '785px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
177
+
178
+            <img style={{ width: '100%', height: '300px' }} src={imgValue ? imgValue : 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg'} alt="" />
168 179
 
169
-    return <div style={{ display: 'flex' }}>
170
-      <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
171
-        <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
+            <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
181
+              <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src="http://img0.imgtn.bdimg.com/it/u=3463541938,2540701974&fm=26&gp=0.jpg" alt="" />
182
+              <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
183
+              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您阅读</span>
184
+              <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
185
+            </div>
186
+            <p style={{
187
+              margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
188
+              display: '-webkit-box', lineClamp: '3', height: '60px',
189
+              WebkitLineClamp: '2',
190
+              WebkitBoxOrient: 'vertical',
191
+              overflow: 'hidden',
192
+              textOverflow: 'ellipsis'
193
+            }}>{inputValue ? inputValue : '海报标题'}</p>
172 194
 
173
-          <img style={{ width: '100%', height: '300px' }} src="http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg" alt="" />
195
+            <img src={yinhao} style={{ width: '30px', marginLeft: '10px' }} alt="" />
196
+            <p style={{
197
+              margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
198
+              display: '-webkit-box', lineClamp: '3', height: '76px',
199
+              WebkitLineClamp: '3',
200
+              WebkitBoxOrient: 'vertical',
201
+              overflow: 'hidden',
202
+              textOverflow: 'ellipsis'
203
+            }}>{textAreaValue ? textAreaValue : '海报描述'}</p>
204
+            <img src={PosterBottom} style={{ width: '100%' }} alt="" />
205
+          </div>
206
+          <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
207
+        </div>
174 208
 
175
-          <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
176
-            <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src="http://img0.imgtn.bdimg.com/it/u=3463541938,2540701974&fm=26&gp=0.jpg" alt="" />
177
-            <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
178
-            <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您阅读</span>
179
-            <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
209
+        <div >
210
+          <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
211
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片</p>
212
+            <ImageUploader onChange={e => changeImg(e)} />
213
+          </div>
214
+          <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
215
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
216
+            <Input style={{ width: '20vw' }} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
217
+          </div>
218
+          <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
219
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
220
+            <TextArea rows={5} onChange={e => changeTextArea(e.target.value)} />
180 221
           </div>
181
-          <p style={{
182
-            margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
183
-            display: '-webkit-box', lineClamp: '3', height: '60px',
184
-            WebkitLineClamp: '2',
185
-            WebkitBoxOrient: 'vertical',
186
-            overflow: 'hidden',
187
-            textOverflow: 'ellipsis'
188
-          }}>破晓·内容生态下半场的版权到企业高峰论坛会议破晓·内容生态下半场的版权到企业高峰论坛活动</p>
189 222
 
190
-          <img src={yinhao} style={{ width: '30px', marginLeft: '10px' }} alt="" />
191
-          <p style={{
192
-            margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
193
-            display: '-webkit-box', lineClamp: '3', height: '76px',
194
-            WebkitLineClamp: '3',
195
-            WebkitBoxOrient: 'vertical',
196
-            overflow: 'hidden',
197
-            textOverflow: 'ellipsis'
198
-          }}>活动描述:破晓·内容生态下半场的版权到企业高峰论坛活动破晓·内容生态下半场的版权到企业高峰论坛活动破晓·内容生态下半场的版权到企业高峰论坛活动</p>
199
-          <img src={PosterBottom} style={{ width: '100%' }} alt="" />
200 223
         </div>
201
-        <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
202 224
       </div>
203
-      <div></div>
225
+      <Button type="primary" onClick={() => router.go(-1)} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
226
+      <Button onClick={() => router.go(-1)}>取消</Button>
204 227
     </div>
228
+
205 229
   }
206 230
 
231
+
232
+
207 233
   const Share = (props) => {
208
-    const fields = [
209
-      {
210
-        label: '分享模板',
211
-        name: 'buildingId',
212
-        render: () => <div style={{ margin: ' 10px 20px' }}>
213
-          <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}><img src={logo} style={{ width: '22px', marginRight: '10px' }} />知与行互动</p>
214
-          <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>置业V客厅 精准获客平台</p>
215
-          <img style={{ width: '200px', height: '140px' }} src="http://house.china.com.cn/nanjing/UserFiles/20171124/11070256.jpg" alt="" />
216
-        </div>,
217
-      },
218
-      {
219
-        label: '海报标题',
220
-        name: 'newsTypeName',
221
-        type: FieldTypes.Text,
222
-        value: '',
223
-        rules: [
224
-          { required: true, message: '请输入咨询名称' },
225
-        ]
226
-      },
227
-      {
228
-        label: '类型图',
229
-        name: 'newsTypeImg',
230
-        type: FieldTypes.ImageUploader,
231
-        value: 'newsTypeImg',
232
-      },
233
-    ]
234
-    const handleSubmit = (values) => {
234
+    const [inputValue, changeInput] = useState('')
235
+    const [imgValue, changeImg] = useState('')
236
+    // const changeInputValue = e => {
237
+    //   changeInput(e.target.value)
238
+    // }
235 239
 
236
-    }
237
-    return <div>
238
-      <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
240
+    // const handleSubmit = (values) => {
241
+
242
+    // }
243
+
244
+    return <div style={{ padding: '20px' }}>
245
+      <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
246
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
247
+        <div>
248
+          <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}><img src={logo} style={{ width: '22px', marginRight: '10px' }} />知与行互动</p>
249
+          <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue ? inputValue : '置业V客厅 精准获客平台'}</p>
250
+          <img style={{ width: '200px', height: '140px' }} src={imgValue ? imgValue : 'http://house.china.com.cn/nanjing/UserFiles/20171124/11070256.jpg'} alt="" />
251
+        </div>
252
+      </div>
253
+      <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
254
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
255
+        <Input placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
256
+      </div>
257
+      <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
258
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片</p>
259
+        <ImageUploader onChange={e => changeImg(e)} />
260
+      </div>
261
+      <Button type="primary" htmlType="submit" style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
262
+      <Button onClick={() => router.go(-1)}>取消</Button>
239 263
     </div>
240 264
   }
241 265
 

+ 4
- 10
src/pages/building/list/add/components/base.jsx Ver fichero

@@ -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')(

+ 35
- 8
src/pages/system/intention.jsx Ver fichero

@@ -19,8 +19,10 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
19 19
  */
20 20
  const Edit = (props) => {
21 21
   const [ data, setData ] = useState([])
22
+  const [ buildingIdValue, setBuildingIdData ] = useState('')
22 23
 
23 24
   const changBuilding = (buildingId) => {
25
+    setBuildingIdData(buildingId)
24 26
     request({
25 27
       url: '/api/admin/tdBizEventIntention',
26 28
       method: 'GET',
@@ -31,6 +33,32 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
31 33
     })
32 34
   }
33 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
+
34 62
   return (
35 63
     <>
36 64
     <Row>
@@ -39,26 +67,25 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
39 67
       </Col>
40 68
     </Row>
41 69
     <Row>
42
-      <Col span={6} offset={6}>
70
+      <Col span={3} offset={3}>
43 71
         用户操作
44 72
       </Col>
45
-      <Col span={6} offset={6}>
73
+      <Col span={3} offset={3}>
46 74
         意向值
47 75
       </Col>
48 76
     </Row>
49 77
     {data.map((x) => {
50
-      console.log(x)
51 78
       return <Row>
52
-                <Col span={6} offset={6}>
53
-                {x.eventName}
79
+                <Col span={3} offset={3}>
80
+                  <Checkbox checked={x.checkbox} onChange={changeBox(x)}>{x.eventName}</Checkbox>
54 81
                 </Col>
55
-                <Col span={6} offset={6}>
56
-                  {x.intention}
82
+                <Col span={3} offset={3}>
83
+                  <Input value={x.intention} onChange={changeInput(x)}/>
57 84
                 </Col>
58 85
               </Row>
59 86
     })}
60 87
     <Row>
61
-      <Button type="primary" className={styles.searchBtn} >确定</Button>
88
+      <Button type="primary" className={styles.searchBtn} onClick={submitValue}>确定</Button>
62 89
     </Row>
63 90
     </>
64 91
   );

+ 4
- 2
src/pages/system/report.jsx Ver fichero

@@ -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
   );

+ 8
- 1
src/utils/request.js Ver fichero

@@ -4,6 +4,8 @@
4 4
  */
5 5
 import request from 'umi-request';
6 6
 import { notification } from 'antd';
7
+import apis from '../services/apis';
8
+
7 9
 const codeMessage = {
8 10
   200: '服务器成功返回请求的数据。',
9 11
   201: '新建或修改数据成功。',
@@ -25,7 +27,7 @@ const codeMessage = {
25 27
 const replaceURLParams = (url, params = {}) => {
26 28
   return Object.keys(params).reduce((acc, k) => { // 此方法对每个元素进行处理
27 29
     const re = new RegExp(`:${k}(?!w)`, 'i')
28
-    return acc.replace(re, args[k])
30
+    return acc.replace(re, params[k])
29 31
   }, url)
30 32
 }
31 33
 
@@ -92,6 +94,9 @@ request.interceptors.response.use(async (response, options) => {
92 94
   }
93 95
 });
94 96
 
97
+
98
+const fetch = api => options => request(api.url, {...api, ...options || {}})
99
+
95 100
 export default config => {
96 101
   if (typeof config === 'string') {
97 102
     return request(config);
@@ -100,3 +105,5 @@ export default config => {
100 105
     return request(url, options);
101 106
   }
102 107
 };
108
+
109
+export { fetch, apis }