1.商品描述和兑换码使用说明调整为非必填项
2.上传安全问题拦截
This commit is contained in:
姜棚 2021-12-15 17:04:50 +08:00
parent 382dc77706
commit c9879562a5
11 changed files with 51 additions and 44 deletions

View File

@ -154,22 +154,11 @@ import _ from "lodash";
render() { render() {
const { data} = this.props; const { data} = this.props;
let page_num =Math.ceil( data.count / this.state.count); let page_num =Math.ceil( data.count / this.state.count);
console.log(page_num)
let btnPages = [] let btnPages = []
for(let i = 1;i<page_num + 1;i++ ) for(let i = 1;i<page_num + 1;i++ )
{ {
console.log(1)
// let o = {}
// o.page = i;
// o.text = i ;
btnPages.push(i); btnPages.push(i);
} }
let btns = this.getPageArr(btnPages,this.state.page,8) let btns = this.getPageArr(btnPages,this.state.page,8)
return ( return (
<div className="pagination"> <div className="pagination">

View File

@ -886,9 +886,6 @@ export default class acclist extends React.Component{
{ type: "required", message: "请输入发放总量"}, { type: "required", message: "请输入发放总量"},
{ type: "regExp", message: "请输入正整数",reg:"^([1-9][0-9]*){1,3}$"}, { type: "regExp", message: "请输入正整数",reg:"^([1-9][0-9]*){1,3}$"},
], ],
describe:[
{ type: "required", message: "请输入使用说明"},
]
} }

View File

@ -213,6 +213,13 @@ export default class adduserinfo extends React.Component{
onUpload = (file, report) => { onUpload = (file, report) => {
if(file.type.indexOf("image") < 0)
{
Notify.error("请上传图片格式的文件");
return;
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let path = "" let path = ""
let formdata= new FormData(); let formdata= new FormData();
@ -263,6 +270,8 @@ export default class adduserinfo extends React.Component{
onUploadChange(files){ onUploadChange(files){
if(files.length > 0 && files[0].status == "success") if(files.length > 0 && files[0].status == "success")
{ {
let model = this.state.model; let model = this.state.model;
model.show_url = files[0].src; model.show_url = files[0].src;
this.setState({model,model}) this.setState({model,model})

View File

@ -492,10 +492,6 @@ export default class exchangedit extends React.Component{
{ type: "required", message: "请输入兑换码名称"}, { type: "required", message: "请输入兑换码名称"},
], ],
describe:[
{ type: "required", message: "请输入使用说明"},
]
} }

View File

@ -98,11 +98,6 @@ export default class adduserinfo extends React.Component{
Notify.error(`请上传商品展示图`); Notify.error(`请上传商品展示图`);
return return
} }
if(this.state.model.describe_url == "")
{
Notify.error(`请上传商品描述`);
return;
}
let temp = [] let temp = []
if(sessionStorage.getItem("productData")) if(sessionStorage.getItem("productData"))
@ -207,6 +202,11 @@ export default class adduserinfo extends React.Component{
console.log(files) console.log(files)
if(files.length > 0 ) if(files.length > 0 )
{ {
if(files[0].type.indexOf("image") < 0)
{
Notify.error("请上传图片格式的文件");
return;
}
if(files[0].file.size > 20000) if(files[0].file.size > 20000)
{ {
Notify.error(`图片大小不能超过 20KB`); Notify.error(`图片大小不能超过 20KB`);

View File

@ -364,6 +364,11 @@ export default class edittemplate extends React.Component{
onUpload = (file, report) => { onUpload = (file, report) => {
if(file[0].type.indexOf("image") < 0)
{
Notify.error("请上传图片格式的文件");
return;
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let path = "" let path = ""
let formdata= new FormData(); let formdata= new FormData();

View File

@ -691,9 +691,6 @@ export default class acclist extends React.Component{
{ type: "required", message: "请输入发放总量"}, { type: "required", message: "请输入发放总量"},
{ type: "regExp", message: "请输入正整数",reg:"^([1-9][0-9]*){1,3}$"}, { type: "regExp", message: "请输入正整数",reg:"^([1-9][0-9]*){1,3}$"},
], ],
describe:[
{ type: "required", message: "请输入使用说明"},
]
} }
//基本规则 //基本规则

View File

@ -812,9 +812,6 @@ export default class acclist extends React.Component{
{ type: "required", message: "请输入发放总量"}, { type: "required", message: "请输入发放总量"},
{ type: "regExp", message: "请输入正整数",reg:"^([1-9][0-9]*){1,3}$"}, { type: "regExp", message: "请输入正整数",reg:"^([1-9][0-9]*){1,3}$"},
], ],
describe:[
{ type: "required", message: "请输入使用说明"},
]
} }

View File

@ -91,11 +91,6 @@ export default class adduserinfo extends React.Component{
Notify.error(`请上传商品展示图`); Notify.error(`请上传商品展示图`);
return return
} }
if(this.state.model.describe_url == "")
{
Notify.error(`请上传商品描述`);
return;
}
let temp = [] let temp = []
if(sessionStorage.getItem("productData")) if(sessionStorage.getItem("productData"))

View File

@ -94,19 +94,11 @@ export default class adduserinfo extends React.Component{
Notify.error(`请上传商品展示图`); Notify.error(`请上传商品展示图`);
return return
} }
if(this.state.model.describe_url == "")
{
Notify.error(`请上传商品描述`);
return;
}
let temp = [] let temp = []
if(sessionStorage.getItem("productData")) if(sessionStorage.getItem("productData"))
{ {
temp = JSON.parse(sessionStorage.getItem("productData")); temp = JSON.parse(sessionStorage.getItem("productData"));
} }
let data = temp ? temp : []; let data = temp ? temp : [];
data.push(this.state.model) data.push(this.state.model)
@ -186,6 +178,12 @@ export default class adduserinfo extends React.Component{
console.log(files) console.log(files)
if(files.length > 0 ) if(files.length > 0 )
{ {
if(files[0].type.indexOf("image") < 0)
{
Notify.error("请上传图片格式的文件");
return;
}
if(files[0].file.size > 20000) if(files[0].file.size > 20000)
{ {
Notify.error(`图片大小不能超过 20KB`); Notify.error(`图片大小不能超过 20KB`);
@ -213,8 +211,14 @@ export default class adduserinfo extends React.Component{
}; };
onUploadChange1(files){ onUploadChange1(files){
if(files.length > 0 ) if(files.length > 0 )
{ {
if(files[0].type.indexOf("image") < 0)
{
Notify.error("请上传图片格式的文件");
return;
}
if(files[0].file.size > 20000) if(files[0].file.size > 20000)
{ {
Notify.error(`图片大小不能超过 20KB`); Notify.error(`图片大小不能超过 20KB`);

View File

@ -58,6 +58,8 @@ export default class acclist extends React.Component{
//上传文件 //上传文件
onUploadFileChange = files => { onUploadFileChange = files => {
if(files.length>0){ if(files.length>0){
this.setState({file:files[0].file}); this.setState({file:files[0].file});
} }
}; };
@ -127,7 +129,23 @@ export default class acclist extends React.Component{
model:model2 model:model2
}); });
} }
onFileUpload(file){
return new Promise((resolve, reject) => {
if(file.name.indexOf("zip") < 0 )
{
Notify.error("请上传zip格式的压缩文件")
}
else{
resolve();
}
})
}
onUploadError = (type, data) => { onUploadError = (type, data) => {
if (type === 'overMaxSize') { if (type === 'overMaxSize') {
Notify.error(`文件大小不能超过 ${data.formattedMaxSize}`); Notify.error(`文件大小不能超过 ${data.formattedMaxSize}`);
} }
@ -185,11 +203,11 @@ export default class acclist extends React.Component{
maxSize={50 * 1024 } maxSize={50 * 1024 }
tips="单个文件不超过 50kb" tips="单个文件不超过 50kb"
onChange={(e)=>this.onUploadFileChange(e)} onChange={(e)=>this.onUploadFileChange(e)}
onUpload={this.onUpload} beforeUpload={this.onFileUpload}
customUploadItem={CustomItem} customUploadItem={CustomItem}
onError={this.onUploadError} onError={this.onUploadError}
accept=".zip"
sortable sortable
/> />
</FormItem> </FormItem>
<FormItem labelname="截图上传" prop="picurl"> <FormItem labelname="截图上传" prop="picurl">