Commit 2004ed5c authored by honghy's avatar honghy Committed by wux

【后台-会员等级】新增/修改页面中,“积分范围”要限制只能输入正整数

parent f568a273
......@@ -192,14 +192,14 @@ export default {
lowerCount: [
{
required: true,
message: this.$t("请输入积分最低值"),
validator: this.validatePositiveInteger,
trigger: "blur"
}
],
upperCount: [
{
required: true,
message: this.$t("请输入积分最高值"),
validator: this.validatePositiveInteger,
trigger: "blur"
}
],
......@@ -277,7 +277,18 @@ export default {
}
},
methods: {
validatePositiveInteger(rule, value, callback) {
if (!value) {
return callback(new Error(this.$t("请输入整数")));
} else {
const regex = /^[1-9]\d*$/;
if (regex.test(value)) {
callback();
} else {
callback(new Error(this.$t("请输入整数")));
}
}
},
handleMemberLevelDetails(){
memberLevelConfigDetails({ id: this.$route.query.id }).then(response => {
this.queryParams = response.data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment