💊 fix: 修复bug

This commit is contained in:
wangsongsole 2023-07-26 20:47:45 +08:00
parent 89c62c94ca
commit 9b160905f8
1 changed files with 28 additions and 24 deletions

View File

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