From d4becccaded31b452e3a97eae58e6d7fa4421ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E6=A3=9A?= <849005670@qq.com> Date: Thu, 25 Nov 2021 11:14:50 +0800 Subject: [PATCH 1/2] Update main.js --- src/pages/exchangepage/edittemplate/main.js | 23 +++++++-------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/pages/exchangepage/edittemplate/main.js b/src/pages/exchangepage/edittemplate/main.js index e99eb25a..3981382c 100644 --- a/src/pages/exchangepage/edittemplate/main.js +++ b/src/pages/exchangepage/edittemplate/main.js @@ -18,12 +18,12 @@ export default class edittemplate extends React.Component{ model:{ id:"", images:["https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/top.png","https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/center.png","https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/bottom.png"], - thumb:"", + thumb:null, title:"标题", client:1, bg_color:"", button_color:"", - top_img:"", + top_img:null, }, preview_visible:false, @@ -125,14 +125,7 @@ export default class edittemplate extends React.Component{ if(this.state.model.id > 0) { - - - - - - - - + putMyTheme(this.state.model.id,formdata).then((res)=>{ handelResponse(res,(req,msg)=>{ Notify.success("保存成功") @@ -380,7 +373,7 @@ export default class edittemplate extends React.Component{ onChange={(e)=>{this.onUploadChange(e)} } onUpload={this.onUpload} onError={this.onUploadError} - defaultFileList={ [{src: this.state.model.images[0]}] } + /> @@ -397,7 +390,7 @@ export default class edittemplate extends React.Component{ onChange={(e)=>{this.onUploadChange1(e)}} onUpload={this.onUpload} onError={this.onUploadError} - defaultFileList={ [{src: this.state.model.images[1]}] } + /> @@ -412,7 +405,7 @@ export default class edittemplate extends React.Component{ onChange={(e)=>{this.onUploadChange2(e)} } onUpload={this.onUpload} onError={this.onUploadError} - defaultFileList={ [{src: this.state.model.images[2]}] } + /> @@ -427,7 +420,7 @@ export default class edittemplate extends React.Component{ onChange={(e)=>{this.onUploadChange3(e)} } onUpload={this.onUpload} onError={this.onUploadError} - defaultFileList={ [{src: this.state.model.thumb}] } + /> @@ -442,7 +435,7 @@ export default class edittemplate extends React.Component{ onChange={(e)=>{this.onUploadChange4(e)} } onUpload={this.onUpload} onError={this.onUploadError} - defaultFileList={ [{src: this.state.model.top_img}] } + /> From b3f5b3c041330641f91d8261a8c8ec32dcf6d582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E6=A3=9A?= <849005670@qq.com> Date: Thu, 25 Nov 2021 11:57:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/exchangecode/commodity/goodedit.js | 57 +++++++++++--------- src/pages/exchangecode/edit/edit.js | 10 ++-- src/pages/exchangecode/product/add.js | 47 ++++++++-------- src/pages/login/loginform.js | 1 + src/pages/plan/list/list.js | 2 + src/pages/plan/product/add.js | 17 +++--- 6 files changed, 75 insertions(+), 59 deletions(-) diff --git a/src/pages/exchangecode/commodity/goodedit.js b/src/pages/exchangecode/commodity/goodedit.js index 6c871a38..cb7c7fef 100644 --- a/src/pages/exchangecode/commodity/goodedit.js +++ b/src/pages/exchangecode/commodity/goodedit.js @@ -77,32 +77,37 @@ export default class adduserinfo extends React.Component{ } //获取直连天下商品映射信息 getProductInfo(){ - // getProductInfoSelect().then((res)=>{ - // handelResponse(res,(req,msg)=>{ - let product_data = JSON.parse( sessionStorage.getItem("productData")) ; - let checked_product= product_data ? product_data : []; - - let arr = []; - _.map(data,(res)=>{ - let obj = {}; - obj.key = res.id; - obj.text= res.title; - obj.disabled = checked_product.findIndex((item)=>{return item.id == res.id}) > -1; - if(obj.disabled) - { - console.log(obj.text) - } - - arr.push(obj) - - return obj; - }) - console.log(arr) - this.setState({"productOption":arr}) - - // },(err)=>{ - // }) - // }) + getProductInfoSelect().then((res)=>{ + handelResponse(res,(req,msg)=>{ + let product_data = [] + if(sessionStorage.getItem("productData")) + { + product_data = JSON.parse( sessionStorage.getItem("productData")) ; + } + + let checked_product= product_data ? product_data : []; + + let arr = []; + _.map(req.data,(res)=>{ + let obj = {}; + obj.key = res.id; + obj.text= res.title; + obj.disabled = checked_product.findIndex((item)=>{return item.id == res.id}) > -1; + if(obj.disabled) + { + console.log(obj.text) + } + + arr.push(obj) + + return obj; + }) + console.log(arr) + this.setState({"productOption":arr}) + + },(err)=>{ + }) + }) } cancel(){ diff --git a/src/pages/exchangecode/edit/edit.js b/src/pages/exchangecode/edit/edit.js index b38351cf..b0b5a9d1 100644 --- a/src/pages/exchangecode/edit/edit.js +++ b/src/pages/exchangecode/edit/edit.js @@ -14,7 +14,7 @@ const data = [{"id":21,"title":"爱奇艺周卡组合商品测试专用","type": -export default class adduserinfo extends React.Component{ +export default class exchangedit extends React.Component{ constructor(props){ super(props) this.state={ @@ -107,8 +107,10 @@ export default class adduserinfo extends React.Component{ getProductInfo(){ // getProductInfoSelect().then((res)=>{ // handelResponse(res,(req,msg)=>{ - let product_data = JSON.parse( sessionStorage.getItem("productData")) ; - let checked_product= product_data ? product_data : []; + let productData = sessionStorage.getItem("productData"); + if(productData){ + let product_data = JSON.parse( productData) ; + let checked_product= product_data ? product_data : []; let arr = []; _.map(data,(res)=>{ @@ -127,7 +129,7 @@ export default class adduserinfo extends React.Component{ }) console.log(arr) this.setState({"productOption":arr}) - + } // },(err)=>{ // }) // }) diff --git a/src/pages/exchangecode/product/add.js b/src/pages/exchangecode/product/add.js index 89ed1e28..5fa539d1 100644 --- a/src/pages/exchangecode/product/add.js +++ b/src/pages/exchangecode/product/add.js @@ -46,32 +46,37 @@ export default class adduserinfo extends React.Component{ } //获取直连天下商品映射信息 getProductInfo(){ - // getProductInfoSelect().then((res)=>{ - // handelResponse(res,(req,msg)=>{ - let product_data = JSON.parse( sessionStorage.getItem("productData")) ; - let checked_product= product_data ? product_data : []; - - let arr = []; - _.map(data,(res)=>{ - let obj = {}; - obj.key = res.id; - obj.text= res.title; - obj.disabled = checked_product.findIndex((item)=>{return item.product_id == res.id}) > -1; - if(obj.disabled) + getProductInfoSelect().then((res)=>{ + handelResponse(res,(req,msg)=>{ + let product_data = [] + if(sessionStorage.getItem("productData")) { - console.log(obj.text) + product_data = JSON.parse( sessionStorage.getItem("productData")) ; } - arr.push(obj) + let checked_product= product_data ? product_data : []; - return obj; + let arr = []; + _.map(req.data,(res)=>{ + let obj = {}; + obj.key = res.id; + obj.text= res.title; + obj.disabled = checked_product.findIndex((item)=>{return item.id == res.id}) > -1; + if(obj.disabled) + { + console.log(obj.text) + } + + arr.push(obj) + + return obj; + }) + console.log(arr) + this.setState({"productOption":arr}) + + },(err)=>{ + }) }) - console.log(arr) - this.setState({"productOption":arr}) - - // },(err)=>{ - // }) - // }) } async submit(){ diff --git a/src/pages/login/loginform.js b/src/pages/login/loginform.js index 392bc052..17d21bf0 100644 --- a/src/pages/login/loginform.js +++ b/src/pages/login/loginform.js @@ -42,6 +42,7 @@ function FormDom(props) { let {authorization}=response; sessionStorage.setItem('authorization',authorization); sessionStorage.setItem('linkshowname',"营销计划管理"); + setTimeout(()=>{ props.history.push('/home/plan-list') },1000); diff --git a/src/pages/plan/list/list.js b/src/pages/plan/list/list.js index 3fba177d..4d9584cb 100644 --- a/src/pages/plan/list/list.js +++ b/src/pages/plan/list/list.js @@ -62,6 +62,8 @@ export default class acclist extends React.Component{ + + let data = { page:1, limit:10 diff --git a/src/pages/plan/product/add.js b/src/pages/plan/product/add.js index 462a86a7..97e9ac3a 100644 --- a/src/pages/plan/product/add.js +++ b/src/pages/plan/product/add.js @@ -46,8 +46,9 @@ export default class adduserinfo extends React.Component{ } //获取直连天下商品映射信息 getProductInfo(){ - // getProductInfoSelect().then((res)=>{ - // handelResponse(res,(req,msg)=>{ + + getProductInfoSelect().then((res)=>{ + handelResponse(res,(req,msg)=>{ let product_data = [] if(sessionStorage.getItem("productData")) { @@ -57,7 +58,7 @@ export default class adduserinfo extends React.Component{ let checked_product= product_data ? product_data : []; let arr = []; - _.map(data,(res)=>{ + _.map(req.data,(res)=>{ let obj = {}; obj.key = res.id; obj.text= res.title; @@ -73,11 +74,11 @@ export default class adduserinfo extends React.Component{ }) console.log(arr) this.setState({"productOption":arr}) - } - // },(err)=>{ - // }) - // }) - + + },(err)=>{ + }) + }) + } async submit(){ if(this.refs.form1.validator())