表单校验几个细节问题
parent
7cbd2b698c
commit
31d9859f10
|
@ -65,7 +65,11 @@ export const INTEGER = {
|
|||
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个字符'
|
||||
|
|
|
@ -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, // 添加或编辑提交状态
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
},
|
||||
|
|
|
@ -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'"
|
||||
|
|
|
@ -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
|
||||
],
|
||||
},
|
||||
//管理端消息汇总
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<p slot="title">账单详细</p>
|
||||
|
||||
<div class="tips-status">
|
||||
<span>商品状态</span>
|
||||
<span>账单状态</span>
|
||||
|
||||
<span class="theme_color">{{
|
||||
bill.billStatus | unixSellerBillStatus
|
||||
|
|
Loading…
Reference in New Issue