傅行帆 5 years ago
parent
commit
cd51ede958
1 changed files with 50 additions and 18 deletions
  1. 50
    18
      src/pages/activity/editActivity.jsx

+ 50
- 18
src/pages/activity/editActivity.jsx View File

16
 import poster1 from '../../assets/poster1.png';
16
 import poster1 from '../../assets/poster1.png';
17
 import poster2 from '../../assets/poster2.png';
17
 import poster2 from '../../assets/poster2.png';
18
 import xiaochengxu from '../../assets/xiaochengxu.png'
18
 import xiaochengxu from '../../assets/xiaochengxu.png'
19
-import PosterCard from '../../components/Cards/PosterCard'
20
 
19
 
21
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
20
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
22
 const { TextArea } = Input;
21
 const { TextArea } = Input;
224
     if (dynamicId) {
223
     if (dynamicId) {
225
       console.log(dynamicId, 'dynamicId')
224
       console.log(dynamicId, 'dynamicId')
226
       useEffect(() => {
225
       useEffect(() => {
227
-        request({ ...apis.activity.usedPoster, params: { targetId: dynamicId, targetType: 'activity' } }).then((data) => {
226
+        request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } }).then((data) => {
228
           console.log(data, "2222")
227
           console.log(data, "2222")
229
-          if (data) {
230
-            setPosterId(data.posterId)
231
-            changeImg(data.posterImg)
232
-            changeTextArea(data.posterDescription)
233
-            changeInput(data.posterTitle)
228
+          if (data.length > 0) {
229
+            setPosterId(data[0].posterId)
230
+            changeImg(data[0].posterImg)
231
+            changeTextArea(data[0].posterDescription)
232
+            changeInput(data[0].posterTitle)
234
           }
233
           }
235
         }).catch((err) => {
234
         }).catch((err) => {
236
           message.info(err.msg || err.message)
235
           message.info(err.msg || err.message)
249
       })
248
       })
250
     }
249
     }
251
 
250
 
252
-    //获取选中的模板
253
-    const [ checkList, setCheckList ] = useState([])
254
-
255
-    const cardChange = (e) => {
256
-      console.log(e,"123")
257
-      setCheckList(e)
258
-    }
259
-
260
     const submitPoster = () => {
251
     const submitPoster = () => {
261
       if (dynamicId) {
252
       if (dynamicId) {
262
         if (posterId) {
253
         if (posterId) {
263
-          request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue, templateIds: checkList }, }).then((data) => {
254
+          request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
264
             message.info("保存成功")
255
             message.info("保存成功")
265
           }).catch((err) => {
256
           }).catch((err) => {
266
             message.info(err.msg || err.message)
257
             message.info(err.msg || err.message)
267
           })
258
           })
268
         } else {
259
         } else {
269
-          request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue, templateIds: checkList }, }).then((data) => {
260
+          request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
270
             setPosterId(data.posterId)
261
             setPosterId(data.posterId)
271
             message.info("保存成功")
262
             message.info("保存成功")
272
           }).catch((err) => {
263
           }).catch((err) => {
281
     return <div>
272
     return <div>
282
       <div style={{ display: 'flex' }}>
273
       <div style={{ display: 'flex' }}>
283
         <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
274
         <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
284
-           <PosterCard postType="dynamic"  checkedList={checkList} onChange={cardChange} />
275
+          <div style={{ width: '375px', height: '700px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
276
+            <img style={{ width: '100%', height: '300px' }} src={imgValue ? imgValue : poster1} alt="" />
277
+            <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
278
+              <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
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>
281
+              <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
282
+            </div>
283
+            <p style={{
284
+              margin: '10px 20px',
285
+              fontSize: '20px',
286
+              color: '#222',
287
+              fontWeight: '600',
288
+              display: '-webkit-box',
289
+              lineClamp: '3',
290
+              height: '60px',
291
+              WebkitLineClamp: '2',
292
+              WebkitBoxOrient: 'vertical',
293
+              overflow: 'hidden',
294
+              textOverflow: 'ellipsis'
295
+            }}>{inputValue ? inputValue : '海报标题'}</p>
296
+
297
+            <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
298
+            <p style={{
299
+              margin: '16px 20px 28px 20px',
300
+              fontSize: '17px',
301
+              color: '#999',
302
+              display: '-webkit-box',
303
+              lineClamp: '3',
304
+              height: '72px',
305
+              WebkitLineClamp: '3',
306
+              WebkitBoxOrient: 'vertical',
307
+              overflow: 'hidden',
308
+              textOverflow: 'ellipsis'
309
+            }}>{textAreaValue ? textAreaValue : '海报描述'}</p>
310
+            <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc', position: 'relative' }}>
311
+              <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
312
+              <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入<span style={{ margin: '0 5px', fontSize: '18px', color: '#333', fontWeight: '600' }}>{miniappName || '置业V顾问'}</span>报名活动</p>
313
+              <img style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }} src={xiaochengxu} alt="" />
314
+            </div>
315
+          </div>
316
+          <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
285
         </div>
317
         </div>
286
 
318
 
287
         <div >
319
         <div >