diff --git a/src/pages/exchangecode/commodity/goodedit.js b/src/pages/exchangecode/commodity/goodedit.js index e6d46ce6..303981b9 100644 --- a/src/pages/exchangecode/commodity/goodedit.js +++ b/src/pages/exchangecode/commodity/goodedit.js @@ -12,6 +12,7 @@ import "./goodedit.less" import Swiper from 'swiper/dist/js/swiper.js' import 'swiper/dist/css/swiper.min.css' var mySwiper = null; +var timer = null export default class adduserinfo extends React.Component{ constructor(props){ @@ -423,6 +424,9 @@ componentDidMount() { autoplay : 3000, }) + clearTimeout(timer); + timer = setTimeout(()=>{ + if(arr.length > this.state.productpic.length) { //新增 @@ -500,6 +504,8 @@ componentDidMount() { } this.setState({productpic:temp_arr}) } + + },500) }; onUploadChange2(files){ if(files.length > 0 ) diff --git a/src/pages/exchangecode/product/add.js b/src/pages/exchangecode/product/add.js index 8fbb1e5f..315ca5c6 100644 --- a/src/pages/exchangecode/product/add.js +++ b/src/pages/exchangecode/product/add.js @@ -11,7 +11,8 @@ import Bus from "../../../assets/eventBus.js" import {getProductInfoSelect,handelResponse,uploadImg} from "../../../assets/api.js" import _ from "lodash"; -var mySwiper = null; +var mySwiper = null; +var timer = null export default class adduserinfo extends React.Component{ constructor(props){ @@ -318,10 +319,12 @@ export default class adduserinfo extends React.Component{ } }; onUploadChange1(files,e){ + + let arr =_.map(files,(o)=>{ return o.name }) - + console.log("删除",files) if(mySwiper !==0) { @@ -334,8 +337,9 @@ export default class adduserinfo extends React.Component{ paginationClickable:true, autoplay : 3000, }) - console.log("保留的数据",arr) - + console.log("保留的数据",this.state.productpic) + clearTimeout(timer); + timer = setTimeout(()=>{ if(arr.length > this.state.productpic.length) { //新增 @@ -407,6 +411,9 @@ export default class adduserinfo extends React.Component{ } this.setState({productpic:temp_arr}) } + + },500) + }; onUploadError = (type, data) => { if (type === 'overMaxAmount') { @@ -559,7 +566,14 @@ export default class adduserinfo extends React.Component{ onError={this.onUploadError} defaultFileList={this.state.model.describe_url } multiple - onUpload={this.onUpload} + onUpload={ + + + this.onUpload + + + + } onChange={(e)=>{this.onUploadChange1(e)}} /> diff --git a/src/pages/plan/key/edit.js b/src/pages/plan/key/edit.js index 83b83a05..3ca1f37f 100644 --- a/src/pages/plan/key/edit.js +++ b/src/pages/plan/key/edit.js @@ -74,8 +74,8 @@ export default class acclist extends React.Component{ } componentDidMount(e){ - let batch_id=sessionStorage.getItem("keybatch_id") - let reseller_id =sessionStorage.getItem("key_reseller_id") + let batch_id = sessionStorage.getItem("keybatch_id") + let reseller_id = sessionStorage.getItem("key_reseller_id") let approval_id = sessionStorage.getItem("approval_id") //编辑 if(batch_id > 0) @@ -83,27 +83,31 @@ export default class acclist extends React.Component{ getReseller(reseller_id).then((res)=>{ handelResponse(res,(req,msg)=>{ - console.log("分销商数据") - console.log(req) this.setState({reseller:req}) this.setState({phone_list:req.contact_phone}) this.setState({email_list:req.contact_email}) }) }) + - this.setState({isEdit:true}) + + getKeyBatchDetail(batch_id).then((res)=>{ handelResponse(res,(req,msg)=>{ - - console.log("和编辑",req) - if(req.status == 7) { - this.setState({isCancel:true}) } + if(req.status == 1) + { + this.setState({isEdit:false}) + } + else{ + this.setState({isEdit:true}) + } + this.setState({pagetitle:"编辑key"}) req.code_batch = req.code_batch ? req.code_batch : [] let temp = []; @@ -298,10 +302,6 @@ export default class acclist extends React.Component{ Notify.success("保存成功") this.setState({drawerVisible2:false}) - - - - setTimeout(()=>{ let data = JSON.parse(sessionStorage.getItem("productData")); @@ -450,19 +450,13 @@ export default class acclist extends React.Component{ return obj }) temp.product = arr; - - console.log("dasdas",temp) - - if(this.state.rowIndex > -1) { - console.log("编辑") this.state.distdata[this.state.rowIndex] = temp; this.setState({distdata:this.state.distdata}) console.log(this.state.distdata) } else{ - console.log("新增") let tempdata = this.state.distdata; tempdata.push(temp) this.setState({distdata:tempdata}) diff --git a/src/pages/plan/product/add.js b/src/pages/plan/product/add.js index bf37bf93..f829a1d7 100644 --- a/src/pages/plan/product/add.js +++ b/src/pages/plan/product/add.js @@ -10,7 +10,7 @@ import {getProductInfoSelect,handelResponse,uploadImg} from "../../../assets/api import _ from "lodash"; import Swiper from 'swiper/dist/js/swiper.js' import 'swiper/dist/css/swiper.min.css' - +var timer = null var mySwiper = 0; export default class adduserinfo extends React.Component{ constructor(props){ @@ -377,6 +377,10 @@ export default class adduserinfo extends React.Component{ paginationClickable:true, autoplay : 3000, }) + + clearTimeout(timer); + timer = setTimeout(()=>{ + if(arr.length > this.state.productpic.length) { //新增 @@ -452,7 +456,7 @@ export default class adduserinfo extends React.Component{ // } - + },500) };