From ab0c153fc62b9f2964211a05f3a2dbd15e1b46d0 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Fri, 24 Jun 2022 15:46:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=91=E6=8D=A2?= =?UTF-8?q?=E7=A0=81=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/plan/product/add.js | 41 ++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) 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 From a086ca2180f1758b6031da6d05f32f88f7d9cd18 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Fri, 24 Jun 2022 15:49:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=90=A5=E9=94=80?= =?UTF-8?q?=E8=AE=A1=E5=88=92=20=E5=95=86=E5=93=81=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/plan/product/add.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/plan/product/add.js b/src/pages/plan/product/add.js index 60f25302..b7ec5f3d 100644 --- a/src/pages/plan/product/add.js +++ b/src/pages/plan/product/add.js @@ -659,7 +659,7 @@ export default class adduserinfo extends React.Component { this.onUploadChange3(e) }} sortable - defaultFileList={this.state.model.describe_url} + fileList={this.state.model.describe_url} multiple ref='product_describe' />