张延森 5 年之前
父節點
當前提交
0f42610814
共有 2 個檔案被更改,包括 339 行新增339 行删除
  1. 2
    2
      src/pages/activity/editActivity.jsx
  2. 337
    337
      src/pages/activity/groupActivity/editGroupActivity.jsx

+ 2
- 2
src/pages/activity/editActivity.jsx 查看文件

@@ -258,7 +258,7 @@ const BasicForm = props => {
258 258
               //   message: '活动人数必须大于已报名人数',
259 259
               // },
260 260
             ],
261
-          })(<Input type="number"   />)}
261
+          })(<Input type="number" />)}
262 262
         </Form.Item>
263 263
         <Form.Item label="用户携带人数" help="每个用户最多可携带参与活动的人数">
264 264
           {getFieldDecorator('maxEnlistByPerson', {
@@ -321,7 +321,7 @@ const Edit = props => {
321 321
   const { dynamicId } = props.location.query
322 322
 
323 323
 
324
-  const Poster = (props) => {
324
+  const Poster = props => {
325 325
     const [inputValue, changeInput] = useState('')
326 326
     const [textAreaValue, changeTextArea] = useState('')
327 327
     const [imgValue, changeImg] = useState('')

+ 337
- 337
src/pages/activity/groupActivity/editGroupActivity.jsx 查看文件

@@ -27,385 +27,385 @@ const cancelPage = () => {
27 27
   });
28 28
 }
29 29
 
30
-/**
31
- *
32
- *
33
- * @param {*} props
34
- * @returns
35
- */
36
-const Edit = props => {
37
-  const [tab, changeTab] = useState('basic')
38
-  // 判断是否展示助力次数的输入框
39
-  const { groupActivityId } = props.location.query
40
-  const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
41
-  const [scoreData, setScoreData] = useState({})
42
-  const [activityStatus, setActivityStatus] = useState({})
43
-  const [disable, setDisable] = useState(false)
44 30
 
45
-  useEffect(() => {
46
-    request(apis.groupActivity.avgScore).then((data) => {
47
-      setScoreData(data);
48
-    })
49
-  }, [])
31
+const Basic = props => {
32
+  const { dynamicData, disable, activityStatus, scoreData, groupActivityId } = props;
50 33
 
51
-    useEffect(() => {
52
-      if (groupActivityId) {
53
-      getDynamicData(groupActivityId);
54
-    }
55
-    }, [groupActivityId])
34
+  const fields = [
35
+    {
36
+      label: '选择项目',
37
+      name: 'buildingId',
38
+      render: <BuildSelect disabled={disable}/>,
39
+      value: dynamicData.buildingId,
40
+      rules: [
41
+        { required: true, message: '请选择项目' },
42
+      ],
43
+    },
44
+    {
45
+      label: '活动标题',
46
+      name: 'activityName',
47
+      type: FieldTypes.Text,
48
+      value: dynamicData.activityName,
49
+      rules: [
50
+        { required: true, message: '请输入活动标题' },
51
+      ]
52
+    },
53
+    {
54
+      label: '拼团详情主图',
55
+      name: 'mainImg',
56
+      type: FieldTypes.ImageUploader,
57
+      value: dynamicData.mainImg,
58
+      rules: [
59
+        { required: true, message: '请输入拼团详情主图' },
60
+      ],
61
+      help: '建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:拼团活动详情',
62
+    },
63
+    {
64
+      label: '拼团封面图1',
65
+      name: 'listImg',
66
+      type: FieldTypes.ImageUploader,
67
+      value: dynamicData.listImg,
68
+      rules: [
69
+        { required: true, message: '请输入拼团封面图1' },
70
+      ],
71
+      help: '建议图片尺寸:750*420px,比例16:9,格式:jpg,用于:活动列表/首页推荐',
72
+    },
73
+    {
74
+      label: '拼团封面图2',
75
+      name: 'bannerListImg',
76
+      type: FieldTypes.ImageUploader,
77
+      value: dynamicData.bannerListImg,
78
+      rules: [
79
+        { required: true, message: '请输入拼团封面图2' },
80
+      ],
81
+      help: '建议图片尺寸:750*250px,比例3:1,格式:jpg,用于:项目详情页',
82
+    },
83
+    {
84
+      label: '活动时间',
85
+      name: 'activityTime',
86
+      type: FieldTypes.RangePicker,
87
+      value: dynamicData.startTime != null ? [moment(dynamicData.startTime, 'YYYY-MM-DD HH:mm'), moment(dynamicData.endTime, 'YYYY-MM-DD HH:mm')] : null,
88
+      props: { showTime: { format: 'HH:mm' } },
89
+      rules: [
90
+        { required: true, message: '请选择活动时间' },
91
+      ],
92
+    },
93
+    {
94
+      label: '成团人数',
95
+      name: 'groupBuyPeople',
96
+      type: FieldTypes.Text,
97
+      value: dynamicData.groupBuyPeople,
98
+      props: { disabled: activityStatus === 0 },
99
+      help: '注:成团所需人数',
100
+      rules: [
101
+        { required: true, message: '请输入成团人数' },
102
+      ]
103
+    },
104
+    {
105
+      label: '所需积分',
106
+      name: 'integral',
107
+      type: FieldTypes.Text,
108
+      value: dynamicData.integral,
109
+      props: { disabled: activityStatus === 0 },
110
+      help: `注:用户平均积分${scoreData.averageScore}`,
111
+      rules: [
112
+        { required: true, message: '请输入所需积分' },
113
+      ]
114
+    },
115
+    {
116
+      label: '活动说明',
117
+      name: 'descImg',
118
+      type: FieldTypes.ImageUploader,
119
+      value: dynamicData.descImg,
120
+      rules: [
121
+        { required: true, message: '请输入活动说明' },
122
+      ],
123
+      help: '建议宽度:750px,高度不限,格式:jpg,用于活动详情',
124
+    },
125
+    {
126
+      label: '权重',
127
+      name: 'heavy',
128
+      type: FieldTypes.Number,
129
+      render: <Input type="number" style={{ width: 80}} />,
130
+      value: dynamicData.heavy,
131
+      rules: [
132
+        { required: true, message: '请输入权重' },
133
+      ],
134
+      help: '数字越大越靠前',
135
+    },
136
+  ]
56 137
 
57
-    // 详情
58
-    const getDynamicData = (groupActivityId) => {
59
-      request({ ...apis.groupActivity.details, urlData: { id: groupActivityId } }).then((data) => {
60
-        setDynamicData(data)
61
-        setActivityStatus(data.activityStatus)
62
-        setDisable(data.activityStatus === 0 ? true : false)
63
-      })
138
+  function compareDate(dateTime1, dateTime2) {
139
+    return new Date(dateTime1) > new Date(dateTime2);
64 140
   }
65 141
 
66
-  const radioOnChange = e => {
67
-    console.log(e.target.value)
68
-    setDynamicData({ ...dynamicData, isEnlist: e.target.value })
69
-  }
142
+  const handleSubmit = val => {
143
+    const { activityTime, signupTime, ...submitValue } = val
70 144
 
71
-  const Basic = props => {
72
-    const fields = [
73
-      {
74
-        label: '选择项目',
75
-        name: 'buildingId',
76
-        render: <BuildSelect disabled={disable}/>,
77
-        value: dynamicData.buildingId,
78
-        rules: [
79
-          { required: true, message: '请选择项目' },
80
-        ],
81
-      },
82
-      {
83
-        label: '活动标题',
84
-        name: 'activityName',
85
-        type: FieldTypes.Text,
86
-        value: dynamicData.activityName,
87
-        rules: [
88
-          { required: true, message: '请输入活动标题' },
89
-        ]
90
-      },
91
-      {
92
-        label: '拼团详情主图',
93
-        name: 'mainImg',
94
-        type: FieldTypes.ImageUploader,
95
-        value: dynamicData.mainImg,
96
-        rules: [
97
-          { required: true, message: '请输入拼团详情主图' },
98
-        ],
99
-        help: '建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:拼团活动详情',
100
-      },
101
-      {
102
-        label: '拼团封面图1',
103
-        name: 'listImg',
104
-        type: FieldTypes.ImageUploader,
105
-        value: dynamicData.listImg,
106
-        rules: [
107
-          { required: true, message: '请输入拼团封面图1' },
108
-        ],
109
-        help: '建议图片尺寸:750*420px,比例16:9,格式:jpg,用于:活动列表/首页推荐',
110
-      },
111
-      {
112
-        label: '拼团封面图2',
113
-        name: 'bannerListImg',
114
-        type: FieldTypes.ImageUploader,
115
-        value: dynamicData.bannerListImg,
116
-        rules: [
117
-          { required: true, message: '请输入拼团封面图2' },
118
-        ],
119
-        help: '建议图片尺寸:750*250px,比例3:1,格式:jpg,用于:项目详情页',
120
-      },
121
-      {
122
-        label: '活动时间',
123
-        name: 'activityTime',
124
-        type: FieldTypes.RangePicker,
125
-        value: dynamicData.startTime != null ? [moment(dynamicData.startTime, 'YYYY-MM-DD HH:mm'), moment(dynamicData.endTime, 'YYYY-MM-DD HH:mm')] : null,
126
-        props: { showTime: { format: 'HH:mm' } },
127
-        rules: [
128
-          { required: true, message: '请选择活动时间' },
129
-        ],
130
-      },
131
-      {
132
-        label: '成团人数',
133
-        name: 'groupBuyPeople',
134
-        type: FieldTypes.Text,
135
-        value: dynamicData.groupBuyPeople,
136
-        props: {disabled: activityStatus === 0 ? true : false },
137
-        help: '注:成团所需人数',
138
-        rules: [
139
-          { required: true, message: '请输入成团人数' },
140
-        ]
141
-      },
142
-      {
143
-        label: '所需积分',
144
-        name: 'integral',
145
-        type: FieldTypes.Text,
146
-        value: dynamicData.integral,
147
-        props: {disabled: activityStatus === 0 ? true : false },
148
-        help: '注:用户平均积分' + scoreData.averageScore,
149
-        rules: [
150
-          { required: true, message: '请输入所需积分' },
151
-        ]
152
-      },
153
-      {
154
-        label: '活动说明',
155
-        name: 'descImg',
156
-        type: FieldTypes.ImageUploader,
157
-        value: dynamicData.descImg,
158
-        rules: [
159
-          { required: true, message: '请输入活动说明' },
160
-        ],
161
-        help: '建议宽度:750px,高度不限,格式:jpg,用于活动详情',
162
-      },
163
-      {
164
-        label: '权重',
165
-        name: 'heavy',
166
-        type: FieldTypes.Number,
167
-        render: <Input type="number" style={{ width: 80}} />,
168
-        value: dynamicData.heavy,
169
-        rules: [
170
-          { required: true, message: '请输入权重' },
171
-        ],
172
-        help: '数字越大越靠前',
173
-      },
174
-    ]
145
+    const [startTime, endTime] = activityTime
146
+    submitValue.startTime = moment(startTime).format('YYYY-MM-DD HH:mm');
147
+    submitValue.endTime = moment(endTime).format('YYYY-MM-DD HH:mm');
175 148
 
176
-    function compareDate(dateTime1, dateTime2) {
177
-      var formatDate1 = new Date(dateTime1)
178
-      var formatDate2 = new Date(dateTime2)
179
-      if (formatDate1 > formatDate2) {
180
-        return true;
181
-      }
182
-      else {
183
-        return false;
149
+    if (groupActivityId) {
150
+      const nowDate = new Date()
151
+      if (!compareDate(nowDate, startTime)) {
152
+        message.info('修改后的开始时间不得大于当前时间(会存在已经成功助力或者发起助力的用户)')
153
+        return
184 154
       }
155
+      submitValue.groupActivityId = groupActivityId
156
+      request({ ...apis.groupActivity.update, data: submitValue }).then(data => {
157
+        message.info('保存成功')
158
+        // cancelPage()
159
+      }).catch(() => {
160
+        // message.info(err.msg || err.message)
161
+      })
162
+    } else {
163
+      request({ ...apis.groupActivity.add, data: submitValue }).then(data => {
164
+        router.push({
165
+          pathname: '/activity/groupActivity/editGroupActivity',
166
+          query: {
167
+            groupActivityId: data,
168
+          },
169
+        });
170
+        message.info("保存成功")
171
+        // cancelPage()
172
+      }).catch(() => {
173
+        // message.info(err.msg || err.message)
174
+      })
185 175
     }
176
+  }
186 177
 
187
-    const handleSubmit = val => {
188
-      const { activityTime, signupTime, ...submitValue } = val
189
-      console.log('val', val)
190
-      const [startTime, endTime] = activityTime
191
-      submitValue.startTime = moment(startTime).format('YYYY-MM-DD HH:mm');
192
-      submitValue.endTime = moment(endTime).format('YYYY-MM-DD HH:mm');
193
-      console.log('submit data --->', submitValue)
194
-      if (groupActivityId) {
178
+  return <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
179
+}
195 180
 
196
-        const nowDate = new Date()
197
-        if (!compareDate(nowDate, startTime)) {
181
+const Poster = props => {
182
+  const { groupActivityId } = props;
183
+  const [inputValue, changeInput] = useState('')
184
+  const [textAreaValue, changeTextArea] = useState('')
185
+  const [imgValue, changeImg] = useState('')
186
+  const [posterId, setPosterId] = useState('')
187
+  // const [miniappName, setMiniappName] = useState('')
198 188
 
199
-          message.info("修改后的开始时间不得大于当前时间(会存在已经成功助力或者发起助力的用户)")
200
-          return
189
+  useEffect(() => {
190
+    if (groupActivityId) {
191
+      request({ ...apis.activity.poster, params: { targetId: groupActivityId, targetType: 'groupActivity' } }).then(data => {
192
+        if (data.length > 0) {
193
+          setPosterId(data[0].posterId)
194
+          changeImg(data[0].posterImg)
195
+          changeTextArea(data[0].posterDescription)
196
+          changeInput(data[0].posterTitle)
201 197
         }
202
-        submitValue.groupActivityId = groupActivityId
203
-        request({ ...apis.groupActivity.update, data: submitValue }).then((data) => {
204
-          message.info("保存成功")
205
-          // cancelPage()
206
-        }).catch((err) => {
207
-          // message.info(err.msg || err.message)
208
-        })
209
-      } else {
210
-        request({ ...apis.groupActivity.add, data: submitValue }).then((data) => {
211
-          router.push({
212
-            pathname: '/activity/groupActivity/editGroupActivity',
213
-            query: {
214
-              groupActivityId: data,
215
-            },
216
-          });
217
-          message.info("保存成功")
218
-          // cancelPage()
219
-        }).catch((err) => {
220
-          // message.info(err.msg || err.message)
221
-        })
222
-      }
198
+      }).catch(err => {
199
+        message.info(err.msg || err.message)
200
+      })
223 201
     }
224 202
 
225
-    return <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
226
-  }
203
+    // getMiniappName()
204
+  }, [])
227 205
 
228
-  const Poster = (props) => {
229
-    const [inputValue, changeInput] = useState('')
230
-    const [textAreaValue, changeTextArea] = useState('')
231
-    const [imgValue, changeImg] = useState('')
232
-    const [posterId, setPosterId] = useState('')
206
+  // // 获取小程序名称
207
+  // function getMiniappName() {
208
+  //   request({ ...apis.building.getMiniappName }).then(res => {
209
+  //     setMiniappName(res)
210
+  //   })
211
+  // }
233 212
 
213
+  const submitPoster = () => {
234 214
     if (groupActivityId) {
235
-      console.log(groupActivityId, 'groupActivityId')
236
-      useEffect(() => {
237
-        request({ ...apis.activity.poster, params: { targetId: groupActivityId, targetType: 'groupActivity' } }).then((data) => {
238
-          if (data.length > 0) {
239
-            setPosterId(data[0].posterId)
240
-            changeImg(data[0].posterImg)
241
-            changeTextArea(data[0].posterDescription)
242
-            changeInput(data[0].posterTitle)
243
-          }
244
-        }).catch((err) => {
215
+      if (posterId) {
216
+        request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: groupActivityId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then(data => {
217
+          message.info('保存成功')
218
+        }).catch(err => {
245 219
           message.info(err.msg || err.message)
246 220
         })
247
-        getMiniappName()
248
-      }, [])
249
-    }else{
250
-      getMiniappName()
251
-    }
252
-    // 获取小程序名称
253
-    const [miniappName, setMiniappName] = useState('')
254
-    function getMiniappName() {
255
-      request({ ...apis.building.getMiniappName }).then(res => {
256
-        console.log(res, "0000000000000")
257
-        setMiniappName(res)
258
-      })
259
-    }
260
-
261
-    const submitPoster = () => {
262
-      if (groupActivityId) {
263
-        if (posterId) {
264
-          request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: groupActivityId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
265
-            message.info("保存成功")
266
-          }).catch((err) => {
267
-            message.info(err.msg || err.message)
268
-          })
269
-        } else {
270
-          request({ ...apis.activity.addPoster, data: { targetId: groupActivityId, targetType: 'groupActivity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
271
-            setPosterId(data.posterId)
272
-            message.info("保存成功")
273
-          }).catch((err) => {
274
-            message.info(err.msg || err.message)
275
-          })
276
-        }
277 221
       } else {
278
-        message.warn("请先保存基本信息数据")
222
+        request({ ...apis.activity.addPoster, data: { targetId: groupActivityId, targetType: 'groupActivity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then(data => {
223
+          setPosterId(data.posterId)
224
+          message.info('保存成功')
225
+        }).catch(err => {
226
+          message.info(err.msg || err.message)
227
+        })
279 228
       }
229
+    } else {
230
+      message.warn('请先保存基本信息数据')
280 231
     }
232
+  }
281 233
 
282
-    return <div>
283
-      <div style={{ display: 'flex' }}>
284
-        <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
285
-          <div style={{ width: '375px', height: '700px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
286
-            <img style={{ width: '100%', height: '300px' }} src={imgValue ? imgValue : poster1} alt="" />
287
-            <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
288
-              <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
289
-              <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
290
-              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您参与</span>
291
-              <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
292
-            </div>
293
-            <p style={{
294
-              margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
295
-              display: '-webkit-box', lineClamp: '3', height: '60px',
296
-              WebkitLineClamp: '2',
297
-              WebkitBoxOrient: 'vertical',
298
-              overflow: 'hidden',
299
-              textOverflow: 'ellipsis'
300
-            }}>{inputValue ? inputValue : '海报标题'}</p>
301
-
302
-            <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
303
-            <p style={{
304
-              margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
305
-              display: '-webkit-box', lineClamp: '3', height: '72px',
306
-              WebkitLineClamp: '3',
307
-              WebkitBoxOrient: 'vertical',
308
-              overflow: 'hidden',
309
-              textOverflow: 'ellipsis'
310
-            }}>{textAreaValue ? textAreaValue : '海报描述'}</p>
311
-            <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc', position: 'relative' }}>
312
-              <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
313
-              <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入活动查看详情</p>
314
-              <img style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }} src={xiaochengxu} alt="" />
315
-            </div>
234
+  return <div>
235
+    <div style={{ display: 'flex' }}>
236
+      <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
237
+        <div style={{ width: '375px', height: '700px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
238
+          <img style={{ width: '100%', height: '300px' }} src={imgValue || poster1} alt="" />
239
+          <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
240
+            <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
241
+            <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
242
+            <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您参与</span>
243
+            <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
316 244
           </div>
317
-          <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
318
-        </div>
245
+          <p style={{
246
+            margin: '10px 20px',
247
+            fontSize: '20px',
248
+            color: '#222',
249
+            fontWeight: '600',
250
+            display: '-webkit-box',
251
+            lineClamp: '3',
252
+            height: '60px',
253
+            WebkitLineClamp: '2',
254
+            WebkitBoxOrient: 'vertical',
255
+            overflow: 'hidden',
256
+            textOverflow: 'ellipsis',
257
+          }}>{inputValue || '海报标题'}</p>
319 258
 
320
-        <div >
321
-          <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
322
-            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>拼团海报图</p>
323
-            <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
324
-          </div>
325
-          <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:750*600,比例5:4,格式:jpg,用于拼团活动海报</p>
326
-          <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
327
-            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
328
-            <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
329
-          </div>
330
-          <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
331
-            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
332
-            <TextArea rows={5} maxLength={1024} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
259
+          <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
260
+          <p style={{
261
+            margin: '16px 20px 28px 20px',
262
+            fontSize: '17px',
263
+            color: '#999',
264
+            display: '-webkit-box',
265
+            lineClamp: '3',
266
+            height: '72px',
267
+            WebkitLineClamp: '3',
268
+            WebkitBoxOrient: 'vertical',
269
+            overflow: 'hidden',
270
+            textOverflow: 'ellipsis',
271
+          }}>{ textAreaValue || '海报描述'}</p>
272
+          <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc', position: 'relative' }}>
273
+            <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
274
+            <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入活动查看详情</p>
275
+            <img style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }} src={xiaochengxu} alt="" />
333 276
           </div>
277
+        </div>
278
+        <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
279
+      </div>
334 280
 
281
+      <div >
282
+        <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
283
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>拼团海报图</p>
284
+          <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
285
+        </div>
286
+        <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:750*600,比例5:4,格式:jpg,用于拼团活动海报</p>
287
+        <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
288
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
289
+          <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
335 290
         </div>
291
+        <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
292
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
293
+          <TextArea rows={5} maxLength={1024} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
294
+        </div>
295
+
336 296
       </div>
337
-      <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
338
-      <Button onClick={() => cancelPage()}>取消</Button>
339 297
     </div>
340
-
341
-  }
298
+    <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
299
+    <Button onClick={() => cancelPage()}>取消</Button>
300
+  </div>
301
+}
342 302
 
343 303
 
304
+const Share = props => {
305
+  const { groupActivityId } = props
306
+  const [inputValue, changeInput] = useState('')
307
+  const [imgValue, changeImg] = useState('')
308
+  const [shareContentId, setShareContentId] = useState('')
344 309
 
345
-  const Share = (props) => {
346
-    const [inputValue, changeInput] = useState('')
347
-    const [imgValue, changeImg] = useState('')
348
-    const [shareContentId, setShareContentId] = useState('')
310
+  useEffect(() => {
311
+      if (groupActivityId) {
312
+      request({ ...apis.activity.shareContent, params: { targetId: groupActivityId, targetType: 'groupActivity' } }).then(data => {
313
+        if (data.length > 0) {
314
+          setShareContentId(data[0].shareContentId)
315
+          changeImg(data[0].shareContentImg)
316
+          changeInput(data[0].shareContentTitle)
317
+        }
318
+      }).catch(err => {
319
+        message.info(err.msg || err.message)
320
+      })
321
+    }
322
+  }, [])
349 323
 
324
+  const submitShare = () => {
350 325
     if (groupActivityId) {
351
-      useEffect(() => {
352
-        request({ ...apis.activity.shareContent, params: { targetId: groupActivityId, targetType: 'groupActivity' }, }).then((data) => {
353
-          console.log(data, "2222")
354
-          if (data.length > 0) {
355
-            setShareContentId(data[0].shareContentId)
356
-            changeImg(data[0].shareContentImg)
357
-            changeInput(data[0].shareContentTitle)
358
-          }
359
-        }).catch((err) => {
326
+      if (shareContentId) {
327
+        request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: groupActivityId, shareContentType: 'groupActivity', shareContentImg: imgValue, shareContentTitle: inputValue } }).then(data => {
328
+          message.info('保存成功')
329
+        }).catch(err => {
360 330
           message.info(err.msg || err.message)
361 331
         })
362
-      }, [])
363
-    }
364
-
365
-    const submitShare = () => {
366
-      if (groupActivityId) {
367
-        if (shareContentId) {
368
-          request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: groupActivityId, shareContentType: 'groupActivity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
369
-            message.info("保存成功")
370
-          }).catch((err) => {
371
-            message.info(err.msg || err.message)
372
-          })
373
-        } else {
374
-          request({ ...apis.activity.addShareContent, data: { targetId: groupActivityId, shareContentType: 'groupActivity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
375
-            setShareContentId(data.shareContentId)
376
-            message.info("保存成功")
377
-          }).catch((err) => {
378
-            message.info(err.msg || err.message)
379
-          })
380
-        }
381 332
       } else {
382
-        message.warn("请先保存基本信息数据")
333
+        request({ ...apis.activity.addShareContent, data: { targetId: groupActivityId, shareContentType: 'groupActivity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then(data => {
334
+          setShareContentId(data.shareContentId)
335
+          message.info('保存成功')
336
+        }).catch(err => {
337
+          message.info(err.msg || err.message)
338
+        })
383 339
       }
340
+    } else {
341
+      message.warn('请先保存基本信息数据')
384 342
     }
343
+  }
385 344
 
386
-    return <div style={{ padding: '20px' }}>
387
-      <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
388
-        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
389
-        <div>
390
-          <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}><img src={logo} style={{ width: '22px', marginRight: '10px' }} />橙蕉互动</p>
391
-          <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue ? inputValue : '置业V客厅 精准获客平台'}</p>
392
-          <img style={{ width: '200px', height: '160px' }} src={imgValue ? imgValue : poster2} alt="" />
393
-        </div>
394
-      </div>
395
-      <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
396
-        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题</p>
397
-        <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
398
-      </div>
399
-      <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
400
-        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>拼团分享图</p>
401
-        <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
345
+  return <div style={{ padding: '20px' }}>
346
+    <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
347
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
348
+      <div>
349
+        <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}><img src={logo} style={{ width: '22px', marginRight: '10px' }} />橙蕉互动</p>
350
+        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue || '置业V客厅 精准获客平台'}</p>
351
+        <img style={{ width: '200px', height: '160px' }} src={imgValue || poster2} alt="" />
402 352
       </div>
403
-      <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于拼团活动分享好友</p>
404
-      <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
405
-      <Button onClick={() => cancelPage()}>取消</Button>
406 353
     </div>
354
+    <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
355
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题</p>
356
+      <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
357
+    </div>
358
+    <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
359
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>拼团分享图</p>
360
+      <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
361
+    </div>
362
+    <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于拼团活动分享好友</p>
363
+    <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
364
+    <Button onClick={() => cancelPage()}>取消</Button>
365
+  </div>
366
+}
367
+
368
+
369
+/**
370
+ *
371
+ *
372
+ * @param {*} props
373
+ * @returns
374
+ */
375
+const Edit = props => {
376
+  const [tab, changeTab] = useState('basic')
377
+  // 判断是否展示助力次数的输入框
378
+  const { groupActivityId } = props.location.query
379
+  const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
380
+  const [scoreData, setScoreData] = useState({})
381
+  const [activityStatus, setActivityStatus] = useState({})
382
+  const [disable, setDisable] = useState(false)
383
+
384
+  // 详情
385
+  const getDynamicData = id => {
386
+    request({ ...apis.groupActivity.details, urlData: { id } }).then(data => {
387
+      setDynamicData(data)
388
+      setActivityStatus(data.activityStatus)
389
+      setDisable(data.activityStatus === 0)
390
+    })
407 391
   }
408 392
 
393
+  useEffect(() => {
394
+    request(apis.groupActivity.avgScore).then(data => {
395
+      setScoreData(data);
396
+    })
397
+  }, [])
398
+
399
+  useEffect(() => {
400
+    if (groupActivityId) {
401
+      getDynamicData(groupActivityId);
402
+    }
403
+  }, [groupActivityId])
404
+
405
+  // const radioOnChange = e => {
406
+  //   setDynamicData({ ...dynamicData, isEnlist: e.target.value })
407
+  // }
408
+
409 409
   return (
410 410
     <div>
411 411
       <div>
@@ -416,14 +416,14 @@ const Edit = props => {
416 416
         </Radio.Group>
417 417
       </div>
418 418
       <div>
419
-        {tab === 'basic' && <Basic />}
420
-        {tab === 'poster' && <Poster />}
419
+        {tab === 'basic' && <Basic dynamicData={dynamicData} disable={disable} activityStatus={activityStatus} scoreData={scoreData} groupActivityId={groupActivityId} />}
420
+        {tab === 'poster' && <Poster groupActivityId={groupActivityId}/>}
421 421
         {tab === 'share' && <Share />}
422 422
       </div>
423 423
       <Prompt message={location =>
424
-        location.pathname.startsWith("/activity/groupActivity")
424
+        (location.pathname.startsWith('/activity/groupActivity')
425 425
           ? true
426
-          : localStorage.removeItem("groupActivePageParams")} />
426
+          : localStorage.removeItem('groupActivePageParams'))} />
427 427
     </div>
428 428
   );
429 429
 }