dingxin 5 년 전
부모
커밋
a272512609

+ 10
- 10
src/pages/activity/editActivity.jsx 파일 보기

@@ -277,17 +277,17 @@ const Edit = props => {
277 277
             <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
278 278
               <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
279 279
               <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
280
-              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您阅读</span>
280
+              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您参与</span>
281 281
               <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
282 282
             </div>
283 283
             <p style={{
284 284
               margin: '10px 20px',
285
-fontSize: '20px',
286
-color: '#222',
287
-fontWeight: '600',
285
+              fontSize: '20px',
286
+              color: '#222',
287
+              fontWeight: '600',
288 288
               display: '-webkit-box',
289
-lineClamp: '3',
290
-height: '60px',
289
+              lineClamp: '3',
290
+              height: '60px',
291 291
               WebkitLineClamp: '2',
292 292
               WebkitBoxOrient: 'vertical',
293 293
               overflow: 'hidden',
@@ -297,11 +297,11 @@ height: '60px',
297 297
             <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
298 298
             <p style={{
299 299
               margin: '16px 20px 28px 20px',
300
-fontSize: '17px',
301
-color: '#999',
300
+              fontSize: '17px',
301
+              color: '#999',
302 302
               display: '-webkit-box',
303
-lineClamp: '3',
304
-height: '72px',
303
+              lineClamp: '3',
304
+              height: '72px',
305 305
               WebkitLineClamp: '3',
306 306
               WebkitBoxOrient: 'vertical',
307 307
               overflow: 'hidden',

+ 8
- 8
src/pages/activity/groupActivity/editGroupActivity.jsx 파일 보기

@@ -140,7 +140,7 @@ const Edit = props => {
140 140
       submitValue.endTime = moment(endTime).format('YYYY-MM-DD HH:mm');
141 141
       console.log('submit data --->', submitValue)
142 142
       if (groupActivityId) {
143
-        submitValue.groupActicityId = groupActivityId
143
+        submitValue.groupActivityId = groupActivityId
144 144
         request({ ...apis.groupActivity.update, data: submitValue }).then((data) => {
145 145
           message.info("保存成功")
146 146
           cancelPage()
@@ -222,7 +222,7 @@ const Edit = props => {
222 222
             <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
223 223
               <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
224 224
               <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
225
-              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您阅读</span>
225
+              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您参与</span>
226 226
               <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
227 227
             </div>
228 228
             <p style={{
@@ -254,15 +254,15 @@ const Edit = props => {
254 254
 
255 255
         <div >
256 256
           <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
257
-            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片1</p>
257
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片</p>
258 258
             <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
259 259
           </div>
260 260
           <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
261
-            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题1</p>
261
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
262 262
             <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
263 263
           </div>
264 264
           <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
265
-            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述1</p>
265
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
266 266
             <TextArea rows={5} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
267 267
           </div>
268 268
 
@@ -319,7 +319,7 @@ const Edit = props => {
319 319
 
320 320
     return <div style={{ padding: '20px' }}>
321 321
       <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
322
-        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板1</p>
322
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
323 323
         <div>
324 324
           <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}><img src={logo} style={{ width: '22px', marginRight: '10px' }} />知与行互动</p>
325 325
           <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue ? inputValue : '置业V客厅 精准获客平台'}</p>
@@ -327,11 +327,11 @@ const Edit = props => {
327 327
         </div>
328 328
       </div>
329 329
       <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
330
-        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题1</p>
330
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题</p>
331 331
         <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
332 332
       </div>
333 333
       <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
334
-        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片1</p>
334
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片</p>
335 335
         <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
336 336
       </div>
337 337
       <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>

+ 0
- 1
src/pages/activity/groupActivity/helpRecord.jsx 파일 보기

@@ -32,7 +32,6 @@ class InviteTable extends React.Component {
32 32
 
33 33
   componentDidUpdate (preProps, preState) {
34 34
     const { groupActivityId } = this.props.visibleData
35
-    console.log("groupActivityId",this.props.visibleData);
36 35
     if (this.props.visibleData.visible !== preState.visibleData.visible) {
37 36
       this.getList({ ...this.props.visibleData, pageNumber: 1, pageSize: 5 })
38 37
       this.setState({ visibleData: this.props.visibleData });

+ 6
- 6
src/pages/activity/groupActivity/list.jsx 파일 보기

@@ -101,7 +101,7 @@ const toEditActivity = (groupActivityId) => () => {
101 101
           {row.activityStatus === 0 &&
102 102
           <AuthButton name="admin.SignList.get" noRight={null}>
103 103
         
104
-            <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.groupActicityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span>
104
+            <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.groupActivityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span>
105 105
             <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={endGroupActivity(row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
106 106
             <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row, row.weight)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
107 107
             <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{ row.sort === true ? '取消推荐首页' : '推荐首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
@@ -109,7 +109,7 @@ const toEditActivity = (groupActivityId) => () => {
109 109
 
110 110
           {row.activityStatus === 1 &&
111 111
            <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
112
-                      <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditActivity(row.groupActicityId)}>编辑<Icon type="form" className={styles.edit} /></span>
112
+                      <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditActivity(row.groupActivityId)}>编辑<Icon type="form" className={styles.edit} /></span>
113 113
                       <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={endGroupActivity(row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
114 114
                       <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row, row.weight)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
115 115
             <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{ row.sort === true ? '取消推荐首页' : '推荐首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
@@ -118,7 +118,7 @@ const toEditActivity = (groupActivityId) => () => {
118 118
 
119 119
           {row.activityStatus === 2 &&
120 120
         <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
121
-           <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.groupActicityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span>
121
+           <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.groupActivityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span>
122 122
            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row, row.weight)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
123 123
             <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{ row.sort === true ? '取消推荐首页' : '推荐首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
124 124
         </AuthButton>
@@ -156,7 +156,7 @@ const toEditActivity = (groupActivityId) => () => {
156 156
   
157 157
   //结束活动
158 158
   const endGroupActivity = (row) => () => {
159
-      request({ ...apis.groupActivity.finish, urlData: { id: row.groupActicityId} }).then((data) => {
159
+      request({ ...apis.groupActivity.finish, urlData: { id: row.groupActivityId} }).then((data) => {
160 160
           console.log(data)
161 161
           message.info('操作成功!')
162 162
           getList({ pageNum: 1, pageSize: 10 })
@@ -168,7 +168,7 @@ const toEditActivity = (groupActivityId) => () => {
168 168
 
169 169
   //置顶
170 170
   const topGroupActivity = (row, weight) => () => {
171
-    request({ ...apis.groupActivity.top, data: { groupActicityId: row.groupActicityId, weight: weight } }).then((data) => {
171
+    request({ ...apis.groupActivity.top, data: { groupActivityId: row.groupActivityId, weight: weight } }).then((data) => {
172 172
         console.log(data)
173 173
         message.info('操作成功!')
174 174
         getList({ pageNum: 1, pageSize: 10 })
@@ -180,7 +180,7 @@ const toEditActivity = (groupActivityId) => () => {
180 180
 
181 181
   //首页推荐
182 182
   const recommendGroupActivity = (row, code) => () => {
183
-    request({ ...apis.groupActivity.top, data: { groupActicityId: row.groupActicityId, sort: row.sort } }).then((data) => {
183
+    request({ ...apis.groupActivity.top, data: { groupActivityId: row.groupActivityId, sort: row.sort } }).then((data) => {
184 184
         console.log(data)
185 185
         message.info('操作成功!')
186 186
         getList({ pageNum: 1, pageSize: 10 })

+ 1
- 1
src/pages/activity/helpActivity/edithelpActivity.jsx 파일 보기

@@ -341,7 +341,7 @@ const Edit = props => {
341 341
             <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
342 342
               <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
343 343
               <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
344
-              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您阅读</span>
344
+              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您参与</span>
345 345
               <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
346 346
             </div>
347 347
             <p style={{

+ 8
- 1
src/pages/carouselFigure/SelectActivity.jsx 파일 보기

@@ -56,7 +56,14 @@ export default (props) => {
56 56
         }}
57 57
         onCancel={() => setVisible(false)}
58 58
       >
59
-        <Select defaultValue={chooseVal} onChange={handleChange} style={{ width: '90%' }}>
59
+        <Select
60
+        showSearch
61
+        filterOption={(input, option) =>
62
+          option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
63
+        }
64
+        defaultValue={chooseVal} 
65
+        onChange={handleChange} 
66
+        style={{ width: '90%' }}>
60 67
           {
61 68
             list.map(x => (<Select.Option key={x.dynamicId} value={x.dynamicId}>{x.title}</Select.Option>))
62 69
           }

+ 74
- 0
src/pages/carouselFigure/SelectGroup.jsx 파일 보기

@@ -0,0 +1,74 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Select, Modal } from 'antd';
3
+import { apis, fetch } from '../../utils/request';
4
+
5
+const getGroupList = fetch(apis.groupActivity.list)
6
+
7
+export default props => {
8
+  const {
9
+    value,
10
+    onChange,
11
+    ...rest
12
+  } = props;
13
+
14
+  const [list, setList] = useState([]);
15
+  const [visible, setVisible] = useState(false);
16
+  const [group, setGroup] = useState({ groupId: undefined, groupName: '请选择拼团' })
17
+  const getGroupTitle = val => {
18
+    return (list.filter(x => x.groupActicityId == val)[0] || {}).activityName || '请选择拼团'
19
+  }
20
+  const updateGroup = val => setGroup({ groupId: val, groupName: getGroupTitle(val) })
21
+
22
+  const buildingId = props.buildingId()
23
+
24
+  useEffect(() => {
25
+    getGroupList({
26
+      params: {
27
+        buildingId,
28
+        pageNum: 1,
29
+        pageSize: 999,
30
+      },
31
+    }).then(data => {
32
+      setList(data.records || [])
33
+
34
+      updateGroup(buildingId ? undefined : value);
35
+    })
36
+  }, [buildingId]);
37
+
38
+  if (value !== group.groupId) {
39
+    updateGroup(value);
40
+  }
41
+
42
+  const handleChange = val => {
43
+      onChange(val)
44
+  }
45
+
46
+  return (
47
+    <div>
48
+      <div onClick={() => setVisible(true)}>{group.groupName}</div>
49
+      <Modal
50
+        title="请选择拼团"
51
+        visible={visible}
52
+        onOk={() => {
53
+          updateGroup(value)
54
+          onChange(value)
55
+          setVisible(false)
56
+        }}
57
+        onCancel={() => setVisible(false)}
58
+      >
59
+        <Select
60
+          showSearch
61
+          value={value ? parseInt(value) : undefined}
62
+          onChange={handleChange}
63
+          style={{ width: '90%' }}
64
+          filterOption={(input, option) =>
65
+            option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
66
+          }>
67
+          {
68
+            list.map(x => (<Select.Option key={x.groupActicityId} value={x.groupActicityId}>{x.activityName}</Select.Option>))
69
+          }
70
+        </Select>
71
+      </Modal>
72
+    </div>
73
+  );
74
+}

+ 76
- 0
src/pages/carouselFigure/SelectHelp.jsx 파일 보기

@@ -0,0 +1,76 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Select, Modal } from 'antd';
3
+import { apis, fetch } from '../../utils/request';
4
+
5
+const getHelpList = fetch(apis.helpActivity.list)
6
+
7
+export default props => {
8
+  const {
9
+    value,
10
+    onChange,
11
+    ...rest
12
+  } = props;
13
+
14
+  const [list, setList] = useState([]);
15
+  const [visible, setVisible] = useState(false);
16
+  const [help, setHelp] = useState({ helpId: undefined, helpName: '请选择助力' })
17
+  const getHelpTitle = val => {
18
+    return (list.filter(x => x.helpActivityId == val)[0] || {}).title || '请选择助力'
19
+  }
20
+
21
+  const updateHelp = val => setHelp({ helpId: val, helpName: getHelpTitle(val) })
22
+
23
+  const buildingId = props.buildingId()
24
+
25
+  useEffect(() => {
26
+    getHelpList({
27
+      params: {
28
+        buildingId,
29
+        pageNum: 1,
30
+        pageSize: 999,
31
+      },
32
+    }).then(data => {
33
+      setList(data.records || [])
34
+
35
+      updateHelp(value ? undefined : value);
36
+    })
37
+  }, [buildingId]);
38
+
39
+  if (value !== help.helpId) {
40
+    updateHelp(value);
41
+  }
42
+
43
+  const handleChange = val => {
44
+    onChange(val)
45
+  }
46
+
47
+  return (
48
+    <div>
49
+      <div onClick={() => setVisible(true)}>{help.helpName}</div>
50
+      <Modal
51
+        title="请选择助力"
52
+        visible={visible}
53
+        onOk={() => {
54
+          updateHelp(value)
55
+          onChange(value)
56
+          setVisible(false)
57
+        }}
58
+        onCancel={() => setVisible(false)}
59
+      >
60
+        <Select
61
+          placeholder="请选择助力"
62
+          showSearch
63
+          value={value ? parseInt(value) : undefined}
64
+          onChange={handleChange}
65
+          style={{ width: '90%' }}
66
+          filterOption={(input, option) =>
67
+            option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
68
+          }>
69
+          {
70
+            list.map(x => (<Select.Option key={x.helpActivityId} value={x.helpActivityId}>{x.title}</Select.Option>))
71
+          }
72
+        </Select>
73
+      </Modal>
74
+    </div>
75
+  );
76
+}

+ 14
- 6
src/pages/carouselFigure/SelectNews.jsx 파일 보기

@@ -37,9 +37,9 @@ export default (props) => {
37 37
     updateNews(value);
38 38
   }
39 39
 
40
-  let chooseVal = value
41
-
42
-  const handleChange = val => chooseVal = val
40
+  const handleChange = val => {
41
+    onChange(val)
42
+  }
43 43
 
44 44
   return (
45 45
     <div>
@@ -48,13 +48,21 @@ export default (props) => {
48 48
         title="请选择资讯"
49 49
         visible={visible}
50 50
         onOk={() => {
51
-          updateNews(chooseVal)
52
-          onChange(chooseVal)
51
+          updateNews(value)
52
+          onChange(value)
53 53
           setVisible(false)
54 54
         }}
55 55
         onCancel={() => setVisible(false)}
56 56
       >
57
-        <Select defaultValue={chooseVal} onChange={handleChange} style={{ width: '90%' }}>
57
+        <Select
58
+          showSearch
59
+          value={value ? parseInt(value) : undefined}
60
+          onChange={handleChange}
61
+          style={{ width: '90%' }}
62
+          filterOption={(input, option) =>
63
+            option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
64
+          }
65
+        >
58 66
           {
59 67
             list.map(x => (<Select.Option key={x.newsId} value={x.newsId}>{x.newsName}</Select.Option>))
60 68
           }

+ 1
- 1
src/pages/carouselFigure/advertisingList.jsx 파일 보기

@@ -53,7 +53,7 @@ const toEdit = (contentId) => () => {
53 53
       dataIndex: 'contentType',
54 54
       key: 'contentType',
55 55
       align: 'center',
56
-      render: (contentType) => <span>{ contentType === 'project' ? '项目' : contentType === 'activity' ? '活动' : contentType === 'news' ? '资讯' : contentType === 'other' ? '其他' : '' }</span>
56
+      render: (contentType) => <span>{ contentType === 'project' ? '项目' : contentType === 'activity' ? '活动' : contentType === 'news' ? '资讯' : contentType === 'other' ? '其他' : contentType === 'help' ? '助力' : contentType === 'group' ? '拼团' : '' }</span>
57 57
     },
58 58
     {
59 59
       title: '发布位置',

+ 1
- 1
src/pages/carouselFigure/carouselFigureList.jsx 파일 보기

@@ -53,7 +53,7 @@ const toEditCarouse = (contentId) => () => {
53 53
       dataIndex: 'contentType',
54 54
       key: 'contentType',
55 55
       align: 'center',
56
-      render: (contentType) => <span>{ contentType === 'project' ? '项目' : contentType === 'activity' ? '活动' : contentType === 'news' ? '资讯' : contentType === 'other' ? '其他' : '' }</span>
56
+      render: (contentType) => <span>{ contentType === 'project' ? '项目' : contentType === 'activity' ? '活动' : contentType === 'news' ? '资讯' : contentType === 'other' ? '其他' : contentType === 'help' ? '助力' : contentType === 'group' ? '拼团' : '' }</span>
57 57
     },
58 58
     {
59 59
       title: '发布位置',

+ 29
- 0
src/pages/carouselFigure/editAdvertising.jsx 파일 보기

@@ -11,6 +11,8 @@ import SelectActivity from './SelectActivity';
11 11
 import SelectNews from './SelectNews';
12 12
 import apis from '../../services/apis';
13 13
 import request from '../../utils/request'
14
+import SelectHelp from './SelectHelp';
15
+import SelectGroup from './SelectGroup';
14 16
 
15 17
 /**
16 18
  *
@@ -22,12 +24,17 @@ import request from '../../utils/request'
22 24
   let contentVisible = false
23 25
   let activityVisible = false
24 26
   let newsVisible = false
27
+  let helpVisible = false
28
+  let groupVisible = false
25 29
   let buildingId = ''
26 30
 
27 31
   const setExtraData = (data) => {
28 32
     contentVisible = data.contentType === 'other';
29 33
     activityVisible = data.contentType === 'activity';
30 34
     newsVisible = data.contentType === 'news';
35
+    helpVisible = data.contentType === 'help';
36
+    groupVisible = data.contentType === 'group';
37
+
31 38
     buildingId = data.buildingId
32 39
   }
33 40
   
@@ -101,6 +108,14 @@ import request from '../../utils/request'
101 108
         {
102 109
           label: '其他',
103 110
           value: 'other'
111
+        },
112
+        {
113
+          label: '拼团',
114
+          value: 'group'
115
+        },
116
+        {
117
+          label: '助力',
118
+          value: 'help'
104 119
         }],
105 120
         value: data.contentType,
106 121
       },
@@ -125,6 +140,20 @@ import request from '../../utils/request'
125 140
         value: data.content,
126 141
         hidden: () => !contentVisible,
127 142
       },
143
+      {
144
+        label: '发布助力',
145
+        name: 'targetId',
146
+        render: <SelectHelp buildingId={() => buildingId} />,
147
+        hidden: () => !helpVisible,
148
+        value: data.targetId,
149
+      },
150
+      {
151
+        label: '发布拼团',
152
+        name: 'targetId',
153
+        render: <SelectGroup buildingId={() => buildingId} />,
154
+        hidden: () => !groupVisible,
155
+        value: data.targetId,
156
+      },
128 157
       {
129 158
         label: '状态',
130 159
         name: 'status',

+ 180
- 111
src/pages/carouselFigure/editCarousel.jsx 파일 보기

@@ -1,14 +1,18 @@
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 } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import styles from '../style/GoodsList.less';
5 4
 import moment from 'moment';
6 5
 import router from 'umi/router';
6
+import styles from '../style/GoodsList.less';
7 7
 import BuildSelect from '../../components/SelectButton/BuildSelect'
8
-import XForm, { FieldTypes } from '../../components/XForm';
8
+import { createForm, FieldTypes } from '../../components/XForm';
9 9
 import Wangedit from '../../components/Wangedit/Wangedit'
10 10
 import apis from '../../services/apis';
11 11
 import request from '../../utils/request'
12
+import SelectHelp from './SelectHelp';
13
+import SelectGroup from './SelectGroup';
14
+import SelectNews from './SelectNews';
15
+import SelectActivity from './SelectActivity';
12 16
 
13 17
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14 18
 /**
@@ -17,130 +21,195 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
17 21
  * @param {*} props
18 22
  * @returns
19 23
  */
20
- const Edit = (props) => {
21
-  const [ tab, changeTab ] = useState('basic')
22
-  const contentId = props.location.query.contentId
23
-  const [ data, setData ] = useState({})
24
-  if(contentId){
25
-    useEffect(() => {
26
-      getDetail(contentId);
27
-    },[])
24
+ const Edit = props => {
25
+  let contentVisible = false
26
+  let activityVisible = false
27
+  let newsVisible = false
28
+  let helpVisible = false
29
+  let groupVisible = false
30
+  let buildingId = ''
28 31
 
29
-  // 查询列表
30
-  const getDetail = (contentId) => {
31
-    request({ ...apis.carsuseFigure.getExtendContent,urlData:{id: contentId}}).then((data) => {
32
-        console.log(data)
33
-        setData(data)
34
-    })
35
-  }
32
+  const setExtraData = data => {
33
+    contentVisible = data.contentType === 'other';
34
+    activityVisible = data.contentType === 'activity';
35
+    newsVisible = data.contentType === 'news';
36
+    helpVisible = data.contentType === 'help';
37
+    groupVisible = data.contentType === 'group';
38
+
39
+    buildingId = data.buildingId
36 40
   }
37 41
 
38
-  const cancelPage = () =>{
39
-    router.push({
40
-      pathname: '/carouselFigure/carouselFigureList',
41
-    });
42
+    
43
+  const handleFormValueChange = (props, changedValues, allValues) => {
44
+    setExtraData(allValues)
42 45
   }
43
- 
44
-    const fields = [
45
-      {
46
-        label: '所属项目',
47
-        name: 'buildingId',
48
-        render: <BuildSelect />,
49
-        value: data.buildingId,
50
-      },
51
-      {
52
-        label: '商品图片',
53
-        name: 'image',
54
-        type: FieldTypes.ImageUploader,
55
-        value: data.image,
56
-        help: '建议图片尺寸:640px*330px',
57
-      },
58
-      {
59
-        label: '标题',
60
-        name: 'title',
61
-        type: FieldTypes.Text,
62
-        value: data.title,
63
-      },
64
-      {
65
-        label: '发布位置',
66
-        name: 'showPosition',
67
-        type: FieldTypes.Select,
68
-        dict: [{
69
-          label: '首页',
70
-          value: 'index'
46
+
47
+  const XForm = createForm({ onValuesChange: handleFormValueChange })
48
+
49
+  return (props) => {
50
+
51
+    const [tab, changeTab] = useState('basic')
52
+    const { contentId } = props.location.query
53
+    const [data, setData] = useState({})
54
+    if (contentId) {
55
+      // eslint-disable-next-line react-hooks/rules-of-hooks
56
+      useEffect(() => {
57
+        getDetail(contentId);
58
+      }, [])
59
+
60
+    // 查询列表
61
+    const getDetail = contentId => {
62
+      request({ ...apis.carsuseFigure.getExtendContent, urlData: { id: contentId } }).then(data => {
63
+          console.log(data)
64
+          setExtraData(data)
65
+          setData(data)
66
+      })
67
+    }
68
+    }
69
+
70
+    const cancelPage = () => {
71
+      router.push({
72
+        pathname: '/carouselFigure/carouselFigureList',
73
+      });
74
+    }
75
+
76
+      const fields = [
77
+        {
78
+          label: '所属项目',
79
+          name: 'buildingId',
80
+          render: <BuildSelect />,
81
+          value: data.buildingId,
71 82
         },
72 83
         {
73
-          label: '商城',
74
-          value: 'mall'
75
-        }],
76
-        value: data.showPosition,
77
-      },
78
-      {
79
-        label: '类型',
80
-        name: 'contentType',
81
-        type: FieldTypes.Select,
82
-        dict: [{
83
-          label: '活动',
84
-          value: 'activity'
84
+          label: '商品图片',
85
+          name: 'image',
86
+          type: FieldTypes.ImageUploader,
87
+          value: data.image,
88
+          help: '建议图片尺寸:640px*330px',
85 89
         },
86 90
         {
87
-          label: '项目',
88
-          value: 'project'
91
+          label: '标题',
92
+          name: 'title',
93
+          type: FieldTypes.Text,
94
+          value: data.title,
89 95
         },
90 96
         {
91
-          label: '资讯',
92
-          value: 'news'
97
+          label: '发布位置',
98
+          name: 'showPosition',
99
+          type: FieldTypes.Select,
100
+          dict: [{
101
+            label: '首页',
102
+            value: 'index',
103
+          },
104
+          {
105
+            label: '商城',
106
+            value: 'mall',
107
+          }],
108
+          value: data.showPosition,
93 109
         },
94 110
         {
95
-          label: '其他',
96
-          value: 'other'
97
-        }],
98
-        value: data.contentType,
99
-      },
100
-      {
101
-        label: '发布内容',
102
-        name: 'content',
103
-        render: <Wangedit />,
104
-        value: data.content,
105
-      },
106
-      {
107
-        label: '状态',
108
-        name: 'status',
109
-        type: FieldTypes.Select,
110
-        dict: [{
111
-          label: "启用",
112
-          value: 1
111
+          label: '类型',
112
+          name: 'contentType',
113
+          type: FieldTypes.Select,
114
+          dict: [{
115
+            label: '活动',
116
+            value: 'activity',
117
+          },
118
+          {
119
+            label: '项目',
120
+            value: 'project',
121
+          },
122
+          {
123
+            label: '资讯',
124
+            value: 'news',
125
+          },
126
+          {
127
+            label: '其他',
128
+            value: 'other',
129
+          },
130
+          {
131
+            label: '拼团',
132
+            value: 'group',
133
+          },
134
+          {
135
+            label: '助力',
136
+            value: 'help',
137
+          }],
138
+          value: data.contentType,
113 139
         },
114 140
         {
115
-          label: "停用",
116
-          value: 0
117
-        },],
118
-        value: data.status != null ? data.status : 1,
119
-      },
120
-    ]
121
-  
122
-    const handleSubmit = val => { 
123
-      val.showType = 'banner'
124
-      if(contentId){
125
-        request({ ...apis.carsuseFigure.updataExtendContent,urlData:{id: contentId}, data: val,}).then((data) => {
126
-          cancelPage()
127
-        }).catch((err) => {
128
-          message.info(err.msg || err.message)
129
-        })
130
-      }else{
131
-        request({ ...apis.carsuseFigure.addExtendContent, data: val,}).then((data) => {
132
-          cancelPage()
133
-        }).catch((err) => {
134
-          message.info(err.msg || err.message)
135
-        })
141
+          label: '发布活动',
142
+          name: 'targetId',
143
+          render: <SelectActivity buildingId={() => buildingId} />,
144
+          hidden: () => !activityVisible,
145
+          value: data.targetId,
146
+        },
147
+        {
148
+          label: '发布资讯',
149
+          name: 'targetId',
150
+          render: <SelectNews buildingId={() => buildingId} />,
151
+          hidden: () => !newsVisible,
152
+          value: data.targetId,
153
+        },
154
+        {
155
+          label: '发布内容',
156
+          name: 'content',
157
+          render: <Wangedit />,
158
+          value: data.content,
159
+          hidden: () => !contentVisible,
160
+        },
161
+        {
162
+          label: '发布助力',
163
+          name: 'targetId',
164
+          render: <SelectHelp buildingId={() => buildingId} />,
165
+          hidden: () => !helpVisible,
166
+          value: data.targetId,
167
+        },
168
+        {
169
+          label: '发布拼团',
170
+          name: 'targetId',
171
+          render: <SelectGroup buildingId={() => buildingId} />,
172
+          hidden: () => !groupVisible,
173
+          value: data.targetId,
174
+        },
175
+        {
176
+          label: '状态',
177
+          name: 'status',
178
+          type: FieldTypes.Select,
179
+          dict: [{
180
+            label: '启用',
181
+            value: 1,
182
+          },
183
+          {
184
+            label: '停用',
185
+            value: 0,
186
+          } ],
187
+          value: data.status != null ? data.status : 1,
188
+        },
189
+      ]
190
+
191
+      const handleSubmit = val => {
192
+        val.showType = 'banner'
193
+        if (contentId) {
194
+          request({ ...apis.carsuseFigure.updataExtendContent, urlData: { id: contentId }, data: val  }).then(data => {
195
+            cancelPage()
196
+          }).catch(err => {
197
+            message.info(err.msg || err.message)
198
+          })
199
+        } else{
200
+          request({ ...apis.carsuseFigure.addExtendContent, data: val  }).then(data => {
201
+            cancelPage()
202
+          }).catch(err => {
203
+            message.info(err.msg || err.message)
204
+          })
205
+        }
136 206
       }
137
-    }
138 207
 
139
-  return (
140
-    <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
141
-  );
208
+    return (
209
+      <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
210
+    );
211
+  }
142 212
  }
143 213
 
144 214
 
145
-
146
-export default Edit
215
+export default Edit()