diff --git a/src/pages/plan/product/add.js b/src/pages/plan/product/add.js index bed85967..60f25302 100644 --- a/src/pages/plan/product/add.js +++ b/src/pages/plan/product/add.js @@ -253,16 +253,29 @@ export default class adduserinfo extends React.Component { model2.product_name = cur_product.title model2.account_type = cur_product.account_type model2.show_url = picItem ? picItem.pic : '' - const flir = picItem?.describe_url.map((item) => { - return { src: item, name: 'xx' } + const obj1 = [] + const obj2 = [] + + picItem?.describe_url.map((item) => { + obj1.push({ + src: item, + name: 'xxx.png', + id: new Date().getTime() + }) + obj2.push({ + url: item, + name: 'xxx.png', + id: new Date().getTime() + }) }) - model2.describe_url = flir + model2.describe_url = obj1 model2.map_product_name = cur_product.title model2.detail_url = '' this.setState({ model: model2 }) this.setState({ - show_url: picItem ? [{ src: picItem.pic, id: new Date().getTime() }] : [] + show_url: picItem ? [{ src: picItem.pic, id: new Date().getTime() }] : [], + productpic: obj2 }) } onTypeChange(e) { @@ -371,12 +384,20 @@ export default class adduserinfo extends React.Component { (req, msg) => { path = req.path let obj = { + id: files[i].id, name: files[i].name, url: path } + let obj1 = { + name: files[i].name, + src: path, + id: files[i].id + } + const model = this.state.model + model.describe_url.push(obj1) let arr = this.state.productpic arr.push(obj) - this.setState({ arr }) + this.setState({ productpic: arr, model }) }, (err) => {} ) @@ -409,7 +430,17 @@ export default class adduserinfo extends React.Component { temp_arr[i] = temp } this.setState({ productpic: temp_arr }) + let left_temp_arr = temp_arr.map((item) => { + return { + ...item, + src: item.url + } + }) + let models = this.state.model + models.describe_url = left_temp_arr + this.setState({ model: models }) } + // if(this.mySwiper) // { // // this.refs.swiperwrapper