修改双击,更改手机号校验

This commit is contained in:
闫晓茹 2022-08-31 14:23:56 +08:00
parent d08fb71d3e
commit 8aa681d2f2
2 changed files with 12 additions and 6 deletions

View File

@ -51,7 +51,7 @@
append-to-body
:before-close="classcancel"
>
<el-table :data="classinfoList" align="center" style="margin-top: 10px">
<el-table :data="classinfoList" align="center" style="margin-top: 10px" @cell-dblclick="classclick">
<el-table-column label="请选择" width="70" align="center">
<template slot-scope="scope">
<el-button

View File

@ -250,7 +250,7 @@
</el-select>
</el-form-item>
<el-form-item label="联系人" prop="contacts">
<el-input v-model="form.contacts" placeholder="请输入联系人" />
<el-input v-model="form.contacts" placeholder="请输入联系人" maxlength="15" />
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input
@ -287,22 +287,28 @@ export default {
data() {
//
var checkMobile = (rule, value, cb) => {
console.log(value);
var str = String(value);
console.log(str);
//
const regMobile =
/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
/^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/
const reg = /^(0[0-9]{2,3}\-)([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$/;
const isTel = reg.test(value);
if (value.length == 11) {
if (regMobile.test(value)) {
if (str.length == 11) {
if (regMobile.test(str)) {
return cb();
}
} else if (11 < value.length <= 13) {
} else if (11 < str.length <= 13) {
if (isTel) {
return cb();
}
}
cb(new Error("请输入正确的联系电话"));
};
return {
//
loading: true,