From 479c9c1fb0ced60e0587c52fa68871c0f1f21374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E6=A3=9A?= <849005670@qq.com> Date: Tue, 30 Nov 2021 01:16:59 +0800 Subject: [PATCH] Update add.js --- src/pages/plan/add/add.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/pages/plan/add/add.js b/src/pages/plan/add/add.js index 762e440e..d32dda89 100644 --- a/src/pages/plan/add/add.js +++ b/src/pages/plan/add/add.js @@ -198,6 +198,27 @@ export default class add extends React.Component{ email: this.state.email_radio ? this.state.email_list[this.state.email_radio] : this.state.email } + let phoneReg = new RegExp("^[1][3,4,5,6,7,8,9][0-9]{9}$"); + let emailReg = new RegExp( "^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$"); + + + // let data ={ + // phone: this.state.phone_radio ? this.state.phone_list[this.state.phone_radio] : this.state.phone , + // email: this.state.email_radio ? this.state.email_list[this.state.email_radio] : this.state.email + // } + + if (!phoneReg.test(data.phone)) { + + Notify.error("手机号格式不正确") + return; + } + if(!emailReg.test(data.email)){ + + Notify.error("邮箱格式不正确") + return; + + } + planSend(plan_id,data).then((res)=>{ handelResponse(res,(req,msg)=>{