商品编辑
This commit is contained in:
parent
6f1eaf6fee
commit
f31deff8f1
|
@ -309,6 +309,7 @@ export default class exchangedit extends React.Component{
|
||||||
_object.product_type= o.product_type
|
_object.product_type= o.product_type
|
||||||
_object.quantity= o.quantity
|
_object.quantity= o.quantity
|
||||||
_object.show_url = o.show_url
|
_object.show_url = o.show_url
|
||||||
|
_object.detail_url = o.detail_url
|
||||||
_object.map_product_name = o.map_product_name
|
_object.map_product_name = o.map_product_name
|
||||||
updateProduct.push(_object)
|
updateProduct.push(_object)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ export default class adduserinfo extends React.Component{
|
||||||
describe_url:[],
|
describe_url:[],
|
||||||
stock:"",
|
stock:"",
|
||||||
usage:"",
|
usage:"",
|
||||||
goodDetail:"",
|
detail_url:"",
|
||||||
map_product_name:""
|
map_product_name:""
|
||||||
},
|
},
|
||||||
cur_product:null,
|
cur_product:null,
|
||||||
|
@ -47,18 +47,15 @@ export default class adduserinfo extends React.Component{
|
||||||
centeredSlides: true,
|
centeredSlides: true,
|
||||||
loop : true,
|
loop : true,
|
||||||
autoplay : 3000,
|
autoplay : 3000,
|
||||||
|
initialSlide :0,
|
||||||
observer: true, // 修改swiper自己或子元素时,自动初始化swiper
|
observer: true, // 修改swiper自己或子元素时,自动初始化swiper
|
||||||
observeParents: false, // 修改swiper的父元素时,自动初始化swiper
|
observeParents: true, // 修改swiper的父元素时,自动初始化swiper
|
||||||
pagination: '.swiper-pagination',
|
pagination: '.swiper-pagination',
|
||||||
watchSlidesVisibility: true,
|
|
||||||
virtual: {
|
|
||||||
slides:this.state.productpic,
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
componentWillReceiveProps() {
|
componentWillReceiveProps() {
|
||||||
console.log(1111);
|
this.mySwiper.update();
|
||||||
// this.mySwiper.update();
|
|
||||||
}
|
}
|
||||||
componentWillMount(e){
|
componentWillMount(e){
|
||||||
|
|
||||||
|
@ -75,7 +72,7 @@ export default class adduserinfo extends React.Component{
|
||||||
model.quantity = model_temp.quantity
|
model.quantity = model_temp.quantity
|
||||||
model.product_name = model_temp.product_name
|
model.product_name = model_temp.product_name
|
||||||
model.show_url = model_temp.show_url
|
model.show_url = model_temp.show_url
|
||||||
|
model.detail_url = model_temp.detail_url
|
||||||
let defaultPic = []
|
let defaultPic = []
|
||||||
let arr = []
|
let arr = []
|
||||||
|
|
||||||
|
@ -274,7 +271,6 @@ export default class adduserinfo extends React.Component{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
onUploadChange1(files,e){
|
onUploadChange1(files,e){
|
||||||
|
|
||||||
let arr =_.map(files,(o)=>{
|
let arr =_.map(files,(o)=>{
|
||||||
return o.name
|
return o.name
|
||||||
})
|
})
|
||||||
|
@ -321,17 +317,22 @@ export default class adduserinfo extends React.Component{
|
||||||
}
|
}
|
||||||
if(arr.length < this.state.productpic.length)
|
if(arr.length < this.state.productpic.length)
|
||||||
{
|
{
|
||||||
let temp_arr = [];
|
let temp_arr = Object.assign([],this.state.productpic);
|
||||||
for(let i = 0;i < this.state.productpic.length;i++ )
|
this.setState({productpic:[]})
|
||||||
|
this.state.productpic = []
|
||||||
|
let temp_arr2 = this.state.productpic
|
||||||
|
console.log(temp_arr)
|
||||||
|
console.log("删除前的数据",this.state.productpic)
|
||||||
|
for(let i = 0;i < temp_arr.length;i++ )
|
||||||
{
|
{
|
||||||
let temp = this.state.productpic[i]
|
let temp =temp_arr[i]
|
||||||
if(arr.indexOf(temp.name) > -1)
|
if(arr.indexOf(temp.name) > -1)
|
||||||
{
|
{
|
||||||
temp_arr.push(temp)
|
temp_arr2.push(temp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("移除后数据",temp_arr)
|
console.log("删除过后的数组",this.state.productpic)
|
||||||
this.setState({productpic:temp_arr})
|
this.setState({temp_arr2})
|
||||||
}
|
}
|
||||||
|
|
||||||
// //调整位置
|
// //调整位置
|
||||||
|
@ -346,11 +347,25 @@ export default class adduserinfo extends React.Component{
|
||||||
}
|
}
|
||||||
this.setState({productpic:temp_arr})
|
this.setState({productpic:temp_arr})
|
||||||
}
|
}
|
||||||
console.log(this.mySwiper)
|
// console.log("swiperwrapper",this.refs.swiperwrapper)
|
||||||
console.log( this.state.productpic)
|
// this.refs.swiperwrapper.innerHTML=""
|
||||||
this.mySwiper.update();
|
|
||||||
this.mySwiper.startAutoplay();
|
|
||||||
this.mySwiper.reLoop();
|
// this.mySwiper.destroy();
|
||||||
|
|
||||||
|
// this.mySwiper = new Swiper('.swiper-container', {
|
||||||
|
// slidesPerView: 1,
|
||||||
|
// centeredSlides: true,
|
||||||
|
// loop : true,
|
||||||
|
// autoplay : 3000,
|
||||||
|
// observer: true, // 修改swiper自己或子元素时,自动初始化swiper
|
||||||
|
// observeParents: true, // 修改swiper的父元素时,自动初始化swiper
|
||||||
|
// pagination: '.swiper-pagination',
|
||||||
|
// watchSlidesVisibility: true,
|
||||||
|
|
||||||
|
// })
|
||||||
|
// this.mySwiper.update();
|
||||||
|
// let swiperBox = this.refs.swiperwrapper
|
||||||
|
|
||||||
};
|
};
|
||||||
onUploadError = (type, data) => {
|
onUploadError = (type, data) => {
|
||||||
|
@ -370,7 +385,7 @@ export default class adduserinfo extends React.Component{
|
||||||
handelResponse(res,(req,msg)=>{
|
handelResponse(res,(req,msg)=>{
|
||||||
let path = req.path;
|
let path = req.path;
|
||||||
let model = this.state.model;
|
let model = this.state.model;
|
||||||
model.goodDetail = path;
|
model.detail_url = path;
|
||||||
|
|
||||||
this.setState({model:model})
|
this.setState({model:model})
|
||||||
},(err)=>{
|
},(err)=>{
|
||||||
|
@ -380,7 +395,7 @@ export default class adduserinfo extends React.Component{
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
let model = this.state.model;
|
let model = this.state.model;
|
||||||
model.goodDetail = "";
|
model.detail_url = "";
|
||||||
this.setState({model:model})
|
this.setState({model:model})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -507,13 +522,13 @@ export default class adduserinfo extends React.Component{
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem prop="goodDetail" labelname="商品详情" id="goodDetail" required={false}>
|
<FormItem prop="detail_url" labelname="商品详情" id="detail_url" required={false}>
|
||||||
<ImageUpload
|
<ImageUpload
|
||||||
className="zent-image-upload-demo"
|
className="zent-image-upload-demo"
|
||||||
maxSize={5 * 1024 * 1024}
|
maxSize={5 * 1024 * 1024}
|
||||||
tips="建议尺寸 30*30,图片不超过 20KB"
|
tips="建议尺寸 30*30,图片不超过 20KB"
|
||||||
maxAmount={1}
|
maxAmount={1}
|
||||||
fileList={this.state.model.goodDetail ? [{'src':this.state.model.goodDetail}] : null}
|
fileList={this.state.model.detail_url ? [{'src':this.state.model.detail_url}] : null}
|
||||||
onUpload={this.onUpload}
|
onUpload={this.onUpload}
|
||||||
onChange={(e)=>{this.onUploadChange2(e)}}
|
onChange={(e)=>{this.onUploadChange2(e)}}
|
||||||
/>
|
/>
|
||||||
|
@ -526,7 +541,7 @@ export default class adduserinfo extends React.Component{
|
||||||
this.state.productpic ?
|
this.state.productpic ?
|
||||||
(
|
(
|
||||||
<div className="swiper-container">
|
<div className="swiper-container">
|
||||||
<div className="swiper-wrapper">
|
<div className="swiper-wrapper" ref="swiperwrapper">
|
||||||
|
|
||||||
{
|
{
|
||||||
this.state.productpic.map((item, index) => {
|
this.state.productpic.map((item, index) => {
|
||||||
|
@ -554,8 +569,7 @@ export default class adduserinfo extends React.Component{
|
||||||
</div>
|
</div>
|
||||||
<div className="mobile_bottom">
|
<div className="mobile_bottom">
|
||||||
{
|
{
|
||||||
this.state.model.goodDetail ? (<img src={this.state.model.goodDetail} />) : null
|
this.state.model.detail_url ? (<img src={this.state.model.detail_url} />) : null
|
||||||
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue