diff --git a/src/pages/plan/product/add.js b/src/pages/plan/product/add.js index a448f087..d7be4a07 100644 --- a/src/pages/plan/product/add.js +++ b/src/pages/plan/product/add.js @@ -45,7 +45,7 @@ export default class addUserinfo extends React.Component { }; } - componentDidMount() { + componentDidMount () { mySwiper = new Swiper(".swiper-container", { slidesPerView: 1, centeredSlides: true, @@ -58,7 +58,7 @@ export default class addUserinfo extends React.Component { paginationClickable: true }); } - componentWillMount(e) { + componentWillMount (e) { if (this.props.data) { console.log("商品数据 =>", this.props.data); let model_temp = this.props.data; @@ -117,12 +117,12 @@ export default class addUserinfo extends React.Component { this.getProductInfo(); } - componentWillReceiveProps() { + componentWillReceiveProps () { mySwiper.update(); } //获取直连天下商品映射信息 - getProductInfo() { + getProductInfo () { let productList = sessionStorage.getItem("productsList"); productList = JSON.parse(productList); let product_data = []; @@ -156,7 +156,7 @@ export default class addUserinfo extends React.Component { } } - async submit() { + async submit () { if (this.refs.form1.validator()) { if (this.props.data) { let temp = []; @@ -222,8 +222,7 @@ export default class addUserinfo extends React.Component { } } } - onProductChange(e) { - console.log("e ==>", e); + onProductChange (e) { this.setState({ cur_product: e }); let cur_product = this.state.products.find((item) => { return item.id == e.key; @@ -264,12 +263,17 @@ export default class addUserinfo extends React.Component { model2.describe_url = obj1; } else { model2.describe_url = [{ + id: 'common-pic-png', + name: 'common-pic', src: 'https://lsxdemall.oss-cn-beijing.aliyuncs.com/commonproductlogo/goods-pic/common-pic.png', - id: 'common-pic-png' , - name: 'common-pic' }]; + obj2.push({ + url: 'https://lsxdemall.oss-cn-beijing.aliyuncs.com/commonproductlogo/goods-pic/common-pic.png', + id: 'common-pic-png', + name: 'common-pic', + }); } - + model2.map_product_name = cur_product.title; model2.detail_url = ""; @@ -279,17 +283,17 @@ export default class addUserinfo extends React.Component { productpic: obj2 }); } - onTypeChange(e) { + onTypeChange (e) { let model2 = this.state.model; model2.product_type = e.target.value; this.setState({ model: model2 }); } onUpload = (file, report) => { - return new Promise((resolve, reject) => {}); + return new Promise((resolve, reject) => { }); }; - onUploadChange(files) { + onUploadChange (files) { console.log("files -1", files); if (files.length > 0) { let formdata = new FormData(); @@ -307,7 +311,7 @@ export default class addUserinfo extends React.Component { show_url: [{ src: req.path, id: new Date().getTime() }] }); }, - (err) => {} + (err) => { } ); }); } else { @@ -317,7 +321,7 @@ export default class addUserinfo extends React.Component { this.setState({ show_url: [] }); } } - onUploadChange1(files) { + onUploadChange1 (files) { if (files.length > 0) { let formdata = new FormData(); formdata.append("file", files[0].file); @@ -331,7 +335,7 @@ export default class addUserinfo extends React.Component { model.describe_url = path; this.setState({ model: model }); }, - (err) => {} + (err) => { } ); }); } else { @@ -349,7 +353,7 @@ export default class addUserinfo extends React.Component { } }; - onUploadChange3(files, e) { + onUploadChange3 (files, e) { let arr = map(files, (o) => { return o.name; }); @@ -400,7 +404,7 @@ export default class addUserinfo extends React.Component { arr.push(obj); this.setState({ productpic: arr, model }); }, - (err) => {} + (err) => { } ); }); } @@ -443,7 +447,7 @@ export default class addUserinfo extends React.Component { }, 500); } - onUploadChange2(files) { + onUploadChange2 (files) { if (files.length > 0) { let formdata = new FormData(); formdata.append("file", files[0].file); @@ -458,7 +462,7 @@ export default class addUserinfo extends React.Component { this.setState({ model: model }); }, - (err) => {} + (err) => { } ); }); } else { @@ -468,7 +472,7 @@ export default class addUserinfo extends React.Component { } } - isReduce() { + isReduce () { let num = this.props.full; if (num !== "" && num) { num = Number(num); @@ -494,7 +498,7 @@ export default class addUserinfo extends React.Component { } // 优惠券H5 - couponH5() { + couponH5 () { return (
@@ -521,7 +525,7 @@ export default class addUserinfo extends React.Component { } // 兑换码 - exchangecodeH5() { + exchangecodeH5 () { return (
@@ -534,7 +538,7 @@ export default class addUserinfo extends React.Component { ); } - render() { + render () { //校验规则 const rules = { product: [{ type: "required", message: "请选择映射商品" }],