var validateRadio = (rule, value, callback) => {
// debugger
if (value) {
// 当值为0的时候当做没选择
if (value == 0) {
callback(new Error('请选择'))
} else {
callback()
}
} else {
callback(new Error('请选择'))
}
}
rules: {
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
idCard: [{ required: true, message: '请输入身份证号', trigger: 'blur' }, {
pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
message: '请输入正确的身份证号码'
}],
phone: [{ required: true, message: '请输入联系方式', trigger: 'blur' },
{ min: 11, max: 11, message: '请输入11位手机号码', trigger: 'blur' },
{
pattern: /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/,
// pattern: /^1[3456789]\d{9}$/,
message: '请输入正确的手机号码'
}
]
},
this.$refs.commonform.validate(async valid => {
if (!valid) { return false }
try {
this.$message({
type: 'success',
message: '评价成功'
})
} catch (error) {
}
})