diff --git a/manager/src/utils/regular.js b/manager/src/utils/regular.js index 1ef4ce13..2668a233 100644 --- a/manager/src/utils/regular.js +++ b/manager/src/utils/regular.js @@ -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个字符' diff --git a/manager/src/views/customWords/index.vue b/manager/src/views/customWords/index.vue index 5856769a..d65a580a 100644 --- a/manager/src/views/customWords/index.vue +++ b/manager/src/views/customWords/index.vue @@ -35,7 +35,7 @@ :width="500" >
- + @@ -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, // 添加或编辑提交状态 diff --git a/manager/src/views/page/article-manage/hotWords.vue b/manager/src/views/page/article-manage/hotWords.vue index bc04dc3b..eb991489 100644 --- a/manager/src/views/page/article-manage/hotWords.vue +++ b/manager/src/views/page/article-manage/hotWords.vue @@ -20,11 +20,12 @@ -
- + + - + @@ -39,6 +40,7 @@