diff --git a/src/components/pagination/main.js b/src/components/pagination/main.js index 9494398b..e8097c25 100644 --- a/src/components/pagination/main.js +++ b/src/components/pagination/main.js @@ -154,22 +154,11 @@ import _ from "lodash"; render() { const { data} = this.props; let page_num =Math.ceil( data.count / this.state.count); - - console.log(page_num) - - let btnPages = [] for(let i = 1;i diff --git a/src/pages/exchangecode/add/add.js b/src/pages/exchangecode/add/add.js index 4f769c3b..7d4c8b51 100644 --- a/src/pages/exchangecode/add/add.js +++ b/src/pages/exchangecode/add/add.js @@ -886,9 +886,6 @@ export default class acclist extends React.Component{ { type: "required", message: "请输入发放总量"}, { type: "regExp", message: "请输入正整数",reg:"^([1-9][0-9]*){1,3}$"}, ], - describe:[ - { type: "required", message: "请输入使用说明"}, - ] } diff --git a/src/pages/exchangecode/commodity/goodedit.js b/src/pages/exchangecode/commodity/goodedit.js index c1923b77..8f2045cf 100644 --- a/src/pages/exchangecode/commodity/goodedit.js +++ b/src/pages/exchangecode/commodity/goodedit.js @@ -213,6 +213,13 @@ export default class adduserinfo extends React.Component{ onUpload = (file, report) => { + + if(file.type.indexOf("image") < 0) + { + Notify.error("请上传图片格式的文件"); + return; + } + return new Promise((resolve, reject) => { let path = "" let formdata= new FormData(); @@ -263,6 +270,8 @@ export default class adduserinfo extends React.Component{ onUploadChange(files){ if(files.length > 0 && files[0].status == "success") { + + let model = this.state.model; model.show_url = files[0].src; this.setState({model,model}) diff --git a/src/pages/exchangecode/edit/edit.js b/src/pages/exchangecode/edit/edit.js index aece884a..35b69f60 100644 --- a/src/pages/exchangecode/edit/edit.js +++ b/src/pages/exchangecode/edit/edit.js @@ -492,10 +492,6 @@ export default class exchangedit extends React.Component{ { type: "required", message: "请输入兑换码名称"}, ], - - describe:[ - { type: "required", message: "请输入使用说明"}, - ] } diff --git a/src/pages/exchangecode/product/add.js b/src/pages/exchangecode/product/add.js index f6a77181..7ace0135 100644 --- a/src/pages/exchangecode/product/add.js +++ b/src/pages/exchangecode/product/add.js @@ -98,11 +98,6 @@ export default class adduserinfo extends React.Component{ Notify.error(`请上传商品展示图`); return } - if(this.state.model.describe_url == "") - { - Notify.error(`请上传商品描述`); - return; - } let temp = [] if(sessionStorage.getItem("productData")) @@ -207,6 +202,11 @@ export default class adduserinfo extends React.Component{ console.log(files) if(files.length > 0 ) { + if(files[0].type.indexOf("image") < 0) + { + Notify.error("请上传图片格式的文件"); + return; + } if(files[0].file.size > 20000) { Notify.error(`图片大小不能超过 20KB`); diff --git a/src/pages/exchangepage/edittemplate/main.js b/src/pages/exchangepage/edittemplate/main.js index ac5c9a8c..5fefb6b8 100644 --- a/src/pages/exchangepage/edittemplate/main.js +++ b/src/pages/exchangepage/edittemplate/main.js @@ -364,6 +364,11 @@ export default class edittemplate extends React.Component{ onUpload = (file, report) => { + if(file[0].type.indexOf("image") < 0) + { + Notify.error("请上传图片格式的文件"); + return; + } return new Promise((resolve, reject) => { let path = "" let formdata= new FormData(); diff --git a/src/pages/plan/add/step2.js b/src/pages/plan/add/step2.js index c68bac2d..814c17ca 100644 --- a/src/pages/plan/add/step2.js +++ b/src/pages/plan/add/step2.js @@ -691,9 +691,6 @@ export default class acclist extends React.Component{ { type: "required", message: "请输入发放总量"}, { type: "regExp", message: "请输入正整数",reg:"^([1-9][0-9]*){1,3}$"}, ], - describe:[ - { type: "required", message: "请输入使用说明"}, - ] } //基本规则 diff --git a/src/pages/plan/key/edit.js b/src/pages/plan/key/edit.js index 34a9f563..6b766014 100644 --- a/src/pages/plan/key/edit.js +++ b/src/pages/plan/key/edit.js @@ -812,9 +812,6 @@ export default class acclist extends React.Component{ { type: "required", message: "请输入发放总量"}, { type: "regExp", message: "请输入正整数",reg:"^([1-9][0-9]*){1,3}$"}, ], - describe:[ - { type: "required", message: "请输入使用说明"}, - ] } diff --git a/src/pages/plan/key/product/add.js b/src/pages/plan/key/product/add.js index 599afa6d..818d4ab8 100644 --- a/src/pages/plan/key/product/add.js +++ b/src/pages/plan/key/product/add.js @@ -91,11 +91,6 @@ export default class adduserinfo extends React.Component{ Notify.error(`请上传商品展示图`); return } - if(this.state.model.describe_url == "") - { - Notify.error(`请上传商品描述`); - return; - } let temp = [] if(sessionStorage.getItem("productData")) diff --git a/src/pages/plan/product/add.js b/src/pages/plan/product/add.js index b03af31a..baf3ba16 100644 --- a/src/pages/plan/product/add.js +++ b/src/pages/plan/product/add.js @@ -94,19 +94,11 @@ export default class adduserinfo extends React.Component{ Notify.error(`请上传商品展示图`); return } - if(this.state.model.describe_url == "") - { - Notify.error(`请上传商品描述`); - return; - } let temp = [] if(sessionStorage.getItem("productData")) { temp = JSON.parse(sessionStorage.getItem("productData")); - - - } let data = temp ? temp : []; data.push(this.state.model) @@ -186,6 +178,12 @@ export default class adduserinfo extends React.Component{ console.log(files) if(files.length > 0 ) { + + if(files[0].type.indexOf("image") < 0) + { + Notify.error("请上传图片格式的文件"); + return; + } if(files[0].file.size > 20000) { Notify.error(`图片大小不能超过 20KB`); @@ -213,8 +211,14 @@ export default class adduserinfo extends React.Component{ }; onUploadChange1(files){ + if(files.length > 0 ) { + if(files[0].type.indexOf("image") < 0) + { + Notify.error("请上传图片格式的文件"); + return; + } if(files[0].file.size > 20000) { Notify.error(`图片大小不能超过 20KB`); diff --git a/src/pages/system/customize/main.js b/src/pages/system/customize/main.js index f01a1c37..809aa6b3 100644 --- a/src/pages/system/customize/main.js +++ b/src/pages/system/customize/main.js @@ -58,6 +58,8 @@ export default class acclist extends React.Component{ //上传文件 onUploadFileChange = files => { if(files.length>0){ + + this.setState({file:files[0].file}); } }; @@ -127,7 +129,23 @@ export default class acclist extends React.Component{ model:model2 }); } + + onFileUpload(file){ + return new Promise((resolve, reject) => { + if(file.name.indexOf("zip") < 0 ) + { + Notify.error("请上传zip格式的压缩文件") + } + else{ + resolve(); + } + }) + } + + onUploadError = (type, data) => { + + if (type === 'overMaxSize') { Notify.error(`文件大小不能超过 ${data.formattedMaxSize}`); } @@ -185,11 +203,11 @@ export default class acclist extends React.Component{ maxSize={50 * 1024 } tips="单个文件不超过 50kb" onChange={(e)=>this.onUploadFileChange(e)} - onUpload={this.onUpload} + beforeUpload={this.onFileUpload} customUploadItem={CustomItem} onError={this.onUploadError} + accept=".zip" sortable - />