Commit 221cbac2 authored by 武广's avatar 武广

fix: 修改拉取JD图片页面奔溃问题

parent 3cc33d48
/* eslint-disable guard-for-in */
/* eslint-disable no-restricted-syntax */
import React, { useState, useEffect, useContext, forwardRef, useImperativeHandle } from 'react';
import { Form, Button } from 'antd';
import { ServiceContext } from '../context';
......@@ -69,6 +71,11 @@ const FormRuleVPictures = forwardRef((props, ref) => {
onCheck,
setFieldsValue: obj => {
setDetailImageList(obj.detailImageList || []);
for (const key in obj.imageList) {
if (!obj.imageList[key]) {
obj.imageList[key] = [];
}
}
setImageList(obj.imageList || {});
form.setFieldsValue(obj);
},
......
......@@ -163,9 +163,8 @@ const ServiceGoods = options => {
const detailList = result.detailList || [];
const newImageList = imageList[result.firstSpecValue];
const carouseList = result.carouseList || [];
imageList[result.firstSpecValue] = newImageList
? [...newImageList, ...carouseList]
: carouseList;
imageList[result.firstSpecValue] =
(newImageList ? [...newImageList, ...carouseList] : carouseList) || [];
picturesRef.current.setFieldsValue({
imageList,
detailImageList: [...detailImageList, ...detailList],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment