This commit is contained in:
parent
8c14b34bc8
commit
8471d7a0f4
|
@ -48,6 +48,8 @@ export default class form extends React.Component {
|
|||
let rules_item = _.get(this.props.rules, prop)
|
||||
let item = formCompontent[0].firstChild;
|
||||
console.log("shuru")
|
||||
console.log(this.props.rules)
|
||||
console.log(prop)
|
||||
console.log(item)
|
||||
console.log(rules_item)
|
||||
for (let j = 0; j < rules_item.length; j++) {
|
||||
|
|
|
@ -170,89 +170,26 @@ export default class edittemplate extends React.Component{
|
|||
this.setState({preview_visible:true})
|
||||
}
|
||||
onUploadChange(files){
|
||||
console.log("文件")
|
||||
console.log(files)
|
||||
|
||||
if(files.length > 0 && files[0].file)
|
||||
{
|
||||
let formdata= new FormData();
|
||||
formdata.append("file",files[0].file)
|
||||
formdata.append("path","common_image")
|
||||
uploadImg(formdata).then((res)=>{
|
||||
handelResponse(res,(req,msg)=>{
|
||||
let model2 = this.state.model;
|
||||
model2.images[0] = req.path;
|
||||
this.setState({model:model2})
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
onUploadChange1(files){
|
||||
if(files.length > 0 && files[0].file)
|
||||
{
|
||||
let formdata= new FormData();
|
||||
formdata.append("file",files[0].file)
|
||||
formdata.append("path","common_image")
|
||||
uploadImg(formdata).then((res)=>{
|
||||
handelResponse(res,(req,msg)=>{
|
||||
let model2 = this.state.model;
|
||||
model2.images[1] = req.path;
|
||||
this.setState({model:model2})
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
onUploadChange2(files){
|
||||
if(files.length > 0 && files[0].file)
|
||||
{
|
||||
let formdata= new FormData();
|
||||
formdata.append("file",files[0].file)
|
||||
formdata.append("path","common_image")
|
||||
uploadImg(formdata).then((res)=>{
|
||||
handelResponse(res,(req,msg)=>{
|
||||
let model2 = this.state.model;
|
||||
model2.images[2] = req.path;
|
||||
this.setState({model:model2})
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
onUploadChange3(files){
|
||||
if(files.length > 0 && files[0].file)
|
||||
{
|
||||
let formdata= new FormData();
|
||||
formdata.append("file",files[0].file)
|
||||
formdata.append("path","common_image")
|
||||
uploadImg(formdata).then((res)=>{
|
||||
handelResponse(res,(req,msg)=>{
|
||||
let model2 = this.state.model;
|
||||
model2.thumb = req.path;
|
||||
this.setState({model:model2})
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
onUploadChange4(files){
|
||||
if(files.length > 0 && files[0].file)
|
||||
{
|
||||
let formdata= new FormData();
|
||||
formdata.append("file",files[0].file)
|
||||
formdata.append("path","common_image")
|
||||
uploadImg(formdata).then((res)=>{
|
||||
handelResponse(res,(req,msg)=>{
|
||||
let model2 = this.state.model;
|
||||
model2.top_img = req.path;
|
||||
this.setState({model:model2})
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -273,6 +210,219 @@ export default class edittemplate extends React.Component{
|
|||
this.setState({preview_visible:false})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
onUpload = (file, report) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let count = 0;
|
||||
const update = () => {
|
||||
if (count < 100) {
|
||||
count += 10;
|
||||
report(count);
|
||||
setTimeout(update, 500);
|
||||
} else {
|
||||
|
||||
let formdata= new FormData();
|
||||
formdata.append("file",file)
|
||||
formdata.append("path","common_image")
|
||||
uploadImg(formdata).then((res)=>{
|
||||
handelResponse(res,(req,msg)=>{
|
||||
let model2 = this.state.model;
|
||||
model2.images[0] = req.path;
|
||||
this.setState({model:model2})
|
||||
console.log(this.state.model)
|
||||
if (req.path) {
|
||||
|
||||
resolve(
|
||||
req.path
|
||||
);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
|
||||
|
||||
},(err)=>{
|
||||
reject();
|
||||
})
|
||||
});
|
||||
|
||||
// 随机成功或失败
|
||||
|
||||
}
|
||||
};
|
||||
setTimeout(update, 500);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
onUpload1 = (file, report) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let count = 0;
|
||||
const update = () => {
|
||||
if (count < 100) {
|
||||
count += 10;
|
||||
report(count);
|
||||
setTimeout(update, 500);
|
||||
} else {
|
||||
|
||||
let formdata= new FormData();
|
||||
formdata.append("file",file)
|
||||
formdata.append("path","common_image")
|
||||
uploadImg(formdata).then((res)=>{
|
||||
handelResponse(res,(req,msg)=>{
|
||||
let model2 = this.state.model;
|
||||
model2.images[1] = req.path;
|
||||
this.setState({model:model2})
|
||||
console.log(this.state.model)
|
||||
if (req.path) {
|
||||
|
||||
resolve(
|
||||
req.path
|
||||
);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
|
||||
|
||||
},(err)=>{
|
||||
reject();
|
||||
})
|
||||
});
|
||||
|
||||
// 随机成功或失败
|
||||
|
||||
}
|
||||
};
|
||||
setTimeout(update, 500);
|
||||
});
|
||||
};
|
||||
onUpload2 = (file, report) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let count = 0;
|
||||
const update = () => {
|
||||
if (count < 100) {
|
||||
count += 10;
|
||||
report(count);
|
||||
setTimeout(update, 500);
|
||||
} else {
|
||||
|
||||
let formdata= new FormData();
|
||||
formdata.append("file",file)
|
||||
formdata.append("path","common_image")
|
||||
uploadImg(formdata).then((res)=>{
|
||||
handelResponse(res,(req,msg)=>{
|
||||
let model2 = this.state.model;
|
||||
model2.images[2] = req.path;
|
||||
this.setState({model:model2})
|
||||
console.log(this.state.model)
|
||||
if (req.path) {
|
||||
|
||||
resolve(
|
||||
req.path
|
||||
);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
|
||||
|
||||
},(err)=>{
|
||||
reject();
|
||||
})
|
||||
});
|
||||
|
||||
// 随机成功或失败
|
||||
|
||||
}
|
||||
};
|
||||
setTimeout(update, 500);
|
||||
});
|
||||
};
|
||||
onUpload3 = (file, report) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let count = 0;
|
||||
const update = () => {
|
||||
if (count < 100) {
|
||||
count += 10;
|
||||
report(count);
|
||||
setTimeout(update, 500);
|
||||
} else {
|
||||
|
||||
let formdata= new FormData();
|
||||
formdata.append("file",file)
|
||||
formdata.append("path","common_image")
|
||||
uploadImg(formdata).then((res)=>{
|
||||
handelResponse(res,(req,msg)=>{
|
||||
let model2 = this.state.model;
|
||||
model2.images[3] = req.path;
|
||||
this.setState({model:model2})
|
||||
console.log(this.state.model)
|
||||
if (req.path) {
|
||||
|
||||
resolve(
|
||||
req.path
|
||||
);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
|
||||
|
||||
},(err)=>{
|
||||
reject();
|
||||
})
|
||||
});
|
||||
|
||||
// 随机成功或失败
|
||||
|
||||
}
|
||||
};
|
||||
setTimeout(update, 500);
|
||||
});
|
||||
};
|
||||
onUpload4 = (file, report) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let count = 0;
|
||||
const update = () => {
|
||||
if (count < 100) {
|
||||
count += 10;
|
||||
report(count);
|
||||
setTimeout(update, 500);
|
||||
} else {
|
||||
|
||||
let formdata= new FormData();
|
||||
formdata.append("file",file)
|
||||
formdata.append("path","common_image")
|
||||
uploadImg(formdata).then((res)=>{
|
||||
handelResponse(res,(req,msg)=>{
|
||||
let model2 = this.state.model;
|
||||
model2.top_img = req.path;
|
||||
this.setState({model:model2})
|
||||
console.log(this.state.model)
|
||||
if (req.path) {
|
||||
|
||||
resolve(
|
||||
req.path
|
||||
);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
|
||||
|
||||
},(err)=>{
|
||||
reject();
|
||||
})
|
||||
});
|
||||
|
||||
// 随机成功或失败
|
||||
|
||||
}
|
||||
};
|
||||
setTimeout(update, 500);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
render(){
|
||||
|
||||
const rules = {
|
||||
|
@ -306,7 +456,7 @@ export default class edittemplate extends React.Component{
|
|||
<img src={this.state.model.images[0]} id="top"/>
|
||||
</div>
|
||||
<div className="center" id="center">
|
||||
<img id="center-img" src={this.state.model.images[1]} style={{"position": "absolute","z-index": "1"}}/>
|
||||
<img id="center-img" src={this.state.model.images[1]} />
|
||||
<input className="key" maxlength="16" placeholder="请输入key" />
|
||||
<input className="code" maxlength="6" placeholder="请输入验证码" />
|
||||
<div className="submit"></div>
|
||||
|
@ -394,7 +544,7 @@ export default class edittemplate extends React.Component{
|
|||
sortable
|
||||
tips="单张图片不超过 5M"
|
||||
onChange={(e)=>{this.onUploadChange1(e)}}
|
||||
onUpload={this.onUpload}
|
||||
onUpload={this.onUpload1}
|
||||
onError={this.onUploadError}
|
||||
|
||||
/>
|
||||
|
@ -409,7 +559,7 @@ export default class edittemplate extends React.Component{
|
|||
sortable
|
||||
tips="单张图片不超过 5M"
|
||||
onChange={(e)=>{this.onUploadChange2(e)} }
|
||||
onUpload={this.onUpload}
|
||||
onUpload={this.onUpload2}
|
||||
onError={this.onUploadError}
|
||||
/>
|
||||
|
||||
|
@ -423,7 +573,7 @@ export default class edittemplate extends React.Component{
|
|||
sortable
|
||||
tips="单张图片不超过 5M"
|
||||
onChange={(e)=>{this.onUploadChange3(e)} }
|
||||
onUpload={this.onUpload}
|
||||
onUpload={this.onUpload3}
|
||||
onError={this.onUploadError}
|
||||
/>
|
||||
|
||||
|
@ -437,7 +587,7 @@ export default class edittemplate extends React.Component{
|
|||
sortable
|
||||
tips="单张图片不超过 5M"
|
||||
onChange={(e)=>{this.onUploadChange4(e)} }
|
||||
onUpload={this.onUpload}
|
||||
onUpload={this.onUpload4}
|
||||
onError={this.onUploadError}
|
||||
/>
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ export default class acclist extends React.Component{
|
|||
this.state={
|
||||
model:{ //数据模型不可少
|
||||
title:"",
|
||||
type:1,
|
||||
type:2,
|
||||
reseller:null,
|
||||
return_id:"1",
|
||||
date_time:""
|
||||
|
|
|
@ -136,8 +136,8 @@ export default class acclist extends React.Component{
|
|||
|
||||
</Button>
|
||||
</FormItem>
|
||||
<FormItem labelname="兑换入口交互" prop="link">
|
||||
<RadioGroup onChange={(e)=>{ this.onLinkChange(e)} } value={this.state.model.link}>
|
||||
<FormItem labelname="兑换入口交互" prop="use">
|
||||
<RadioGroup onChange={(e)=>{ this.onLinkChange(e)} } value={this.state.model.use}>
|
||||
<RadioButton value={2} disabled>二维码</RadioButton>
|
||||
<RadioButton value={1}>链接</RadioButton>
|
||||
</RadioGroup>
|
||||
|
@ -149,8 +149,8 @@ export default class acclist extends React.Component{
|
|||
<RadioButton value={3}>矩阵</RadioButton>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
<FormItem labelname="域名选择" prop="use">
|
||||
<RadioGroup onChange={(e)=>{this.onUserChange(e)} } value={this.state.model.use}>
|
||||
<FormItem labelname="域名选择" prop="link">
|
||||
<RadioGroup onChange={(e)=>{this.onUserChange(e)} } value={this.state.model.link}>
|
||||
<RadioButton value={1} disabled>大客户</RadioButton>
|
||||
<RadioButton value={2} disabled>普通商户</RadioButton>
|
||||
<RadioButton value={3}>备用</RadioButton>
|
||||
|
|
Loading…
Reference in New Issue