表单校验几个细节问题

master
Chopper 2021-10-19 14:20:20 +08:00
parent 7cbd2b698c
commit 31d9859f10
6 changed files with 42 additions and 23 deletions

View File

@ -62,10 +62,14 @@ export const TEL = /0\d{2,3}-\d{7,8}/
// 正整数
export const INTEGER = {
pattern: /^[0-9]\d{0,10}|0$/,
message:'请输入正整数'
pattern: /^[0-9]\d{0,10}|0$/,
message:'请输入正整数'
}
// 正整数
export const NUMBER = {
pattern: /^(\-|\+)?\d{0,10}$/,
message:'请输入数字'
}
export const VARCHAR5 = {
pattern:/^.{1,5}$/,
message:'长度应该限制在1-5个字符'

View File

@ -35,7 +35,7 @@
:width="500"
>
<Form ref="form" :model="form" :label-width="100" :rules="formValidate">
<FormItem label="自定义分词" prop="sn">
<FormItem label="自定义分词" prop="name">
<Input v-model="form.name" clearable style="width: 100%" />
</FormItem>
</Form>
@ -56,6 +56,8 @@ import {
insertCustomWords,
updateCustomWords
} from "@/api/index";
import { regular } from "@/utils";
export default {
name: "customWords",
data() {
@ -79,11 +81,8 @@ export default {
//
formValidate: {
name: [
{
required: true,
message: "请输入自定义分词",
trigger: "blur",
},
regular.REQUIRED,
regular.VARCHAR20
],
},
submitLoading: false, //

View File

@ -20,11 +20,12 @@
</Card>
<Modal :title="modalTitle" v-model="modalVisible" :mask-closable="false" :width="500">
<Form ref="form" :model="form" :label-width="100" >
<FormItem label="热词" prop="name">
<Form ref="form" :model="form" :label-width="100"
:rules="formValidate">
<FormItem label="热词" prop="keywords">
<Input v-model="form.keywords" clearable style="width: 100%" />
</FormItem>
<FormItem label="分数" prop="name">
<FormItem label="分数" prop="point">
<Input v-model="form.point" clearable style="width: 100%" />
</FormItem>
</Form>
@ -39,6 +40,7 @@
<script>
import { getHotWords, setHotWords } from "@/api/index";
import { regular } from "@/utils";
export default {
name: "hotWords",
components: {},
@ -53,6 +55,18 @@ export default {
point: 0,
},
data: [], //
//
formValidate: {
keywords:[
regular.REQUIRED,
regular.VARCHAR20,
],
point:[
regular.REQUIRED,
regular.NUMBER
]
},
};
},
methods: {
@ -94,7 +108,6 @@ export default {
this.form.keywords = "";
}
this.form.point = 1;
this.$refs.form.resetFields();
this.modalVisible = true;
},
},

View File

@ -14,7 +14,7 @@
<p slot="title">账单详细</p>
<div class="tips-status">
<span>商品状态</span>
<span>账单状态</span>
<span class="theme_color">{{bill.billStatus | unixSellerBillStatus}}</span>
<Button
v-if="bill.billStatus == 'CHECK'"
@ -54,12 +54,12 @@
<p>退单产生退还佣金金额</p>
<p class="increase-color">+{{bill.refundCommissionPrice || 0 | unitPrice('¥')}}</p>
</span>
<span>
<p>退单分销返现返还</p>
<p class="increase-color">+{{bill.distributionRefundCommission || 0 | unitPrice('¥')}}</p>
</span>
<span>
<p>退单平台优惠券返还</p>
<p class="increase-color">+{{bill.siteCouponRefundCommission || 0 | unitPrice('¥')}}</p>
@ -178,7 +178,7 @@ export default {
value: 0,
}
],
id: "", // id
id: "", // id
bill: {}, //
order: [], //
orderParam: { //
@ -297,13 +297,13 @@ export default {
title: "退款流水编号",
key: "sn",
minWidth: 120,
tooltip: true
tooltip: true
},
{
title: "订单编号",
key: "sn",
minWidth: 120,
tooltip: true
tooltip: true
},
{
title: "退款金额",

View File

@ -141,6 +141,7 @@
v-model="messageSendForm.content"
:rows="4"
type="textarea"
maxlength="200"
style="max-height:60vh;overflow:auto;width: 70%"
/>
</FormItem>
@ -288,7 +289,7 @@
import * as API_Other from "@/api/other.js";
import * as API_Shop from "@/api/shops.js";
import userList from "@/views/member/list/index";
import { regular } from "@/utils";
export default {
name: "noticeMessageTemplate",
components: {
@ -316,10 +317,12 @@
},
messageFormValidate: {
title: [
{required: true, message: '请输入消息标题', trigger: 'blur'},
regular.REQUIRED,
regular.VARCHAR20
],
content: [
{required: true, message: '请输入消息内容', trigger: 'blur'},
regular.REQUIRED,
regular.VARCHAR255
],
},
//

View File

@ -14,7 +14,7 @@
<p slot="title">账单详细</p>
<div class="tips-status">
<span>商品状态</span>
<span>账单状态</span>
<span class="theme_color">{{
bill.billStatus | unixSellerBillStatus