zhanghe 6 лет назад
Родитель
Сommit
a33ae8b04c
1 измененных файлов с 18 добавлено и 5 удалено
  1. 18 5
      src/routes/Resource/AudioBook/AudioBookCreate.js

+ 18 - 5
src/routes/Resource/AudioBook/AudioBookCreate.js

@@ -65,22 +65,35 @@ export default class AudioBookCreatePage extends PureComponent {
     e.preventDefault();
     this.props.form.validateFieldsAndScroll((err, values) => {
       if (!err) {
-        const { id, img, audio, fileList } = this.state;
-        const { audioPath, audioFormat, ...params } = values;
+        const { id, img, audio } = this.state;
+        const { audioPath, audioFormat, fileList, ...params } = values;
         // 1.提取图片信息
         let newImg = {};
         if (Array.isArray(fileList) && fileList.length) {
           const { path, type, size, url } = fileList[0];
-          newImg = { ...img, url, path, size, format: type ? type.split('/')[1] : '' };
+          newImg = {
+            ...img,
+            url,
+            path,
+            size,
+            format: type ? type.split('/')[1] : '',
+            type: Hotax.RESOURCE_IMAGE,
+            status: (img || {}).status ? img.status : Hotax.STATUS_NORMAL,
+          };
         }
         // 2.提取音频信息
-        const newAudio = { ...audio, path: audioPath, format: audioFormat };
+        const newAudio = {
+          ...audio,
+          path: audioPath,
+          format: audioFormat,
+          type: Hotax.RESOURCE_AUDIOBOOK,
+          status: (audio || {}).status ? audio.status : Hotax.STATUS_NORMAL,
+        };
         // 3.需提交的数据
         const newParams = {
           ...params,
           img: newImg,
           audio: newAudio,
-          type: Hotax.RESOURCE_AUDIOBOOK,
           status: Hotax.STATUS_NORMAL,
         };
         const { UIParams, Queryers } = this.props.location.state || {};