Commit d2209bf3 by 高淑倩

add: 会员邮箱校验

parent 758b8a80
......@@ -60,11 +60,23 @@ wxService.page({
},
formSubmit(e) {
// 0 男 1 女
const {email} = e.detail.value
if(this.data.index == 0){
e.detail.value.sex = '男'
} else {
e.detail.value.sex = '女'
}
if(email) {
let emailFlag = utils.validateEmail(email)
if(!emailFlag){
wx.showToast({
title: `请输入正确的邮箱地址!`,
icon: 'none'
})
return false
}
}
const params = e.detail.value
// 保存接口
this.handelMemberUplate(params)
......
......@@ -159,6 +159,12 @@ function getAppUserInfo() {
return Promise.reject('userinfo is null')
}
}
/** 邮箱校验 */
function validateEmail(email) {
let str = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/
return str.test(email)
}
/**
* 处理分页数据安全加载,渲染
......@@ -305,6 +311,7 @@ module.exports = {
getTouchData,
getAccountInfo,
aspectRatio,
imageUtil
imageUtil,
validateEmail
// checkFullSucreen
}
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