Update main.js

This commit is contained in:
姜棚 2021-12-02 15:49:55 +08:00
parent 60912f9a29
commit 7a717c6b5e
1 changed files with 38 additions and 11 deletions

View File

@ -81,13 +81,6 @@ export default class edittemplate extends React.Component{
{
myInfo = JSON.parse(myInfo)
if(myInfo.creator == 0)
{
this.setState({isSystemModel:true})
}
let model = {
id:myInfo.id,
images:myInfo.images.length == 3 ? myInfo.images : this.state.model.images ,
@ -98,6 +91,14 @@ export default class edittemplate extends React.Component{
title:myInfo.title,
thumb:myInfo.thumb
}
if(myInfo.creator == 0)
{
this.setState({isSystemModel:true})
model.sort = myInfo.sort;
}
if(myInfo.href)
{
@ -152,7 +153,11 @@ export default class edittemplate extends React.Component{
return;
}
var re = new RegExp("^([1-9][0-9]*){1,3}$");
if (!re.test(this.state.model.sort)) {
Notify.error("权重请输入正整数")
return;
}
let formdata = {
"title": this.state.model.title,
@ -203,7 +208,7 @@ export default class edittemplate extends React.Component{
if(this.state.isSystemModel)
{
formdata.sort = this.state.model.sort;
putSystemTemplate(this.state.model.id,formdata).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("保存成功")
@ -411,7 +416,11 @@ export default class edittemplate extends React.Component{
const rules = {
title: [
{ type: "required", message: "请输入营销计划名称"},
]
],
level:[
{ type: "required", message: "请输入权重"},
{ type: "regExp", message: "请输入正整数",reg:"^([1-9][0-9]*){1,3}$"},
]
}
@ -593,6 +602,24 @@ export default class edittemplate extends React.Component{
<span style={{"margin-top":"10px","margin-left":"10px","font-size":"16px"}}>{this.state.model.button_color}</span>
</div>
</FormItem>
{
this.state.isSystemModel ? (
<FormItem labelname="权重" prop="sort" id="sort" labelwidth="80px">
<Ipt onChange={(e)=>{
let model2 = this.state.model;
model2.sort = e;
this.setState({model:model2})
}}
onClearItem={(e)=>{
let model2 = this.state.model;
model2.sort = "";
this.setState({model:model2})
}}
value={this.state.model.sort} placeholder={"请输入"} labelWidth={'0px'} maxLength={3} height={'36px'} width={'250px'} alignment={'left'}/>
</FormItem>) : null
}
{
this.state.isExchangePage ? (
<FormItem labelname="样式选择" prop="list" style={{marginTop:'15px'}}>