Commit e04c538a authored by zhanglw's avatar zhanglw

调整

parent 85580398
......@@ -104,6 +104,21 @@ export default {
type: 'warning',
duration: 5000
})
} else {
const newValue = this.formData.phone.replace(/[^0-9]/gi, '')
if (this.formData.phone !== newValue) {
return this.$notify({
message: '请输入正确的手机号',
type: 'warning',
duration: 5000
})
} else if (newValue.length !== 11) {
return this.$notify({
message: '请输入正确的手机号',
type: 'warning',
duration: 5000
})
}
}
if (!this.formData.content) {
return this.$notify({
......
......@@ -30,6 +30,16 @@ import { HttpReq } from '@/api/common'
export default {
data() {
const validateMobile = (rule, value, callback) => {
const newValue = value.replace(/[^0-9]/gi, '')
if (value !== newValue) {
callback(new Error('请输入正确的手机号'))
} else if (newValue.length !== 11) {
callback(new Error('请输入正确的手机号'))
} else {
callback()
}
}
return {
typeDict: {
'product': '询 价',
......@@ -49,7 +59,7 @@ export default {
consultType: null,
rules: {
name: { required: true, message: '请填写姓名', trigger: 'blur' },
phone: { required: true, message: '请填写联系电话', trigger: 'blur' },
phone: [{ required: true, trigger: 'blur', message: '请填写联系电话' }, { validator: validateMobile, trigger: 'blur' }],
content: { required: true, message: '请填写咨询内容', trigger: 'blur' }
}
}
......
<template>
<div class="page-body">
<div class="head-box" style="pointer-events: none;">
<div class="head-box-top">
<div class="head-box" @click="openTip">
<div class="head-box-top" style="pointer-events: none;">
<div class="top-call" />
<div class="top-call"><img src="@/assets/home_images/cisnet_logo_b.png" class="touch" @click="$router.push('/home')"></div>
<div class="top-call"><title-menus ref="titleMenus" menu-index="99" style="padding-top: 15px" /></div>
......@@ -131,6 +131,14 @@ export default {
})
},
methods: {
openTip() {
this.$alert('当前操作需要您填写完成注册信息后才能进行。', '友情提示', {
confirmButtonText: '确定',
showClose: false,
center: true,
callback: action => {}
})
},
cancelView() {
this.$router.go(-1)
},
......
......@@ -104,6 +104,16 @@ export default {
components: { titleMenus, userLogin, languageSetting, homeFooter },
dicts: [],
data() {
const validateMobile = (rule, value, callback) => {
const newValue = value.replace(/[^0-9]/gi, '')
if (value !== newValue) {
callback(new Error('请输入正确的手机号'))
} else if (newValue.length !== 11) {
callback(new Error('请输入正确的手机号'))
} else {
callback()
}
}
return {
title: '',
uploadHeaders: { 'Authorization': getToken() },
......@@ -133,7 +143,7 @@ export default {
title: { required: true, message: '请填写标题', trigger: 'blur' },
consultationContent: { required: true, message: '请填写留言内容', trigger: 'blur' },
contactPerson: { required: true, message: '请留下姓名', trigger: 'blur' },
contactPersonPhone: { required: true, message: '请留下联系电话', trigger: 'blur' }
contactPersonPhone: [{ required: true, trigger: 'blur', message: '请填写联系电话' }, { validator: validateMobile, trigger: 'blur' }]
}
}
},
......
......@@ -101,6 +101,16 @@ export default {
components: { titleMenus, userLogin, languageSetting, homeFooter },
dicts: [],
data() {
const validateMobile = (rule, value, callback) => {
const newValue = value.replace(/[^0-9]/gi, '')
if (value !== newValue) {
callback(new Error('请输入正确的手机号'))
} else if (newValue.length !== 11) {
callback(new Error('请输入正确的手机号'))
} else {
callback()
}
}
return {
title: '',
uploadHeaders: { 'Authorization': getToken() },
......@@ -129,7 +139,7 @@ export default {
title: { required: true, message: '请选择建议类别', trigger: 'blur' },
consultationContent: { required: true, message: '请填写留言内容', trigger: 'blur' },
contactPerson: { required: true, message: '请留下姓名', trigger: 'blur' },
contactPersonPhone: { required: true, message: '请留下联系电话', trigger: 'blur' }
contactPersonPhone: [{ required: true, trigger: 'blur', message: '请填写联系电话' }, { validator: validateMobile, trigger: 'blur' }]
}
}
},
......
......@@ -104,6 +104,16 @@ export default {
components: { titleMenus, userLogin, languageSetting, homeFooter },
dicts: [],
data() {
const validateMobile = (rule, value, callback) => {
const newValue = value.replace(/[^0-9]/gi, '')
if (value !== newValue) {
callback(new Error('请输入正确的手机号'))
} else if (newValue.length !== 11) {
callback(new Error('请输入正确的手机号'))
} else {
callback()
}
}
return {
title: '',
uploadHeaders: { 'Authorization': getToken() },
......@@ -132,7 +142,7 @@ export default {
title: { required: true, message: '请填写标题', trigger: 'blur' },
consultationContent: { required: true, message: '请填写留言内容', trigger: 'blur' },
contactPerson: { required: true, message: '请留下姓名', trigger: 'blur' },
contactPersonPhone: { required: true, message: '请留下联系电话', trigger: 'blur' }
contactPersonPhone: [{ required: true, trigger: 'blur', message: '请填写联系电话' }, { validator: validateMobile, trigger: 'blur' }]
}
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment