傅行帆 5 年之前
父節點
當前提交
a077512559
共有 2 個文件被更改,包括 21 次插入15 次删除
  1. 16
    15
      src/pages/activity/editActivity.jsx
  2. 5
    0
      src/services/apis.js

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

224
     if (dynamicId) {
224
     if (dynamicId) {
225
       console.log(dynamicId, 'dynamicId')
225
       console.log(dynamicId, 'dynamicId')
226
       useEffect(() => {
226
       useEffect(() => {
227
-        request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } }).then((data) => {
227
+        request({ ...apis.activity.usedPoster, params: { targetId: dynamicId, targetType: 'activity' } }).then((data) => {
228
           console.log(data, "2222")
228
           console.log(data, "2222")
229
-          if (data.length > 0) {
230
-            setPosterId(data[0].posterId)
231
-            changeImg(data[0].posterImg)
232
-            changeTextArea(data[0].posterDescription)
233
-            changeInput(data[0].posterTitle)
229
+          if (data) {
230
+            setPosterId(data.posterId)
231
+            changeImg(data.posterImg)
232
+            changeTextArea(data.posterDescription)
233
+            changeInput(data.posterTitle)
234
           }
234
           }
235
         }).catch((err) => {
235
         }).catch((err) => {
236
           message.info(err.msg || err.message)
236
           message.info(err.msg || err.message)
249
       })
249
       })
250
     }
250
     }
251
 
251
 
252
+    //获取选中的模板
253
+    const [ checkList, setCheckList ] = useState([])
254
+
255
+    const cardChange = (e) => {
256
+      console.log(e,"123")
257
+      setCheckList(e)
258
+    }
259
+
252
     const submitPoster = () => {
260
     const submitPoster = () => {
253
       if (dynamicId) {
261
       if (dynamicId) {
254
         if (posterId) {
262
         if (posterId) {
255
-          request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
263
+          request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue, templateIds: checkList }, }).then((data) => {
256
             message.info("保存成功")
264
             message.info("保存成功")
257
           }).catch((err) => {
265
           }).catch((err) => {
258
             message.info(err.msg || err.message)
266
             message.info(err.msg || err.message)
259
           })
267
           })
260
         } else {
268
         } else {
261
-          request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
269
+          request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue, templateIds: checkList }, }).then((data) => {
262
             setPosterId(data.posterId)
270
             setPosterId(data.posterId)
263
             message.info("保存成功")
271
             message.info("保存成功")
264
           }).catch((err) => {
272
           }).catch((err) => {
270
       }
278
       }
271
     }
279
     }
272
 
280
 
273
-    const [ checkList, setCheckList ] = useState([2])
274
-
275
-    const cardChange = (e) => {
276
-      console.log(e,"123")
277
-      setCheckList(e)
278
-    }
279
-
280
     return <div>
281
     return <div>
281
       <div style={{ display: 'flex' }}>
282
       <div style={{ display: 'flex' }}>
282
         <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
283
         <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>

+ 5
- 0
src/services/apis.js 查看文件

406
         method: 'GET',
406
         method: 'GET',
407
         action: 'admin.poster.get',
407
         action: 'admin.poster.get',
408
       },
408
       },
409
+      usedPoster: {
410
+        url: `${prefix}/used/poster`,
411
+        method: 'GET',
412
+        action: 'admin.used.poster.get',
413
+      },
409
       updatePoster: {
414
       updatePoster: {
410
         url: `${prefix}/poster/:id`,
415
         url: `${prefix}/poster/:id`,
411
         method: 'PUT',
416
         method: 'PUT',