| | |
| | | } |
| | | return true; |
| | | }; |
| | | // 校验邮箱 |
| | | const validateEmail = () => { |
| | | if (!userInfo.value.email) return true // 允许为空 |
| | | const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/ |
| | | if (!emailRegex.test(userInfo.value.email)) { |
| | | ElMessage.error('请输入正确的邮箱地址') |
| | | return false |
| | | } |
| | | return true |
| | | } |
| | | const passwordForm = ref({ |
| | | oldPassword: '', |
| | | newPassword: '', |
| | |
| | | const emit = defineEmits(['logout']); |
| | | const submit = () => { |
| | | if (checked.value === 0) { |
| | | // if (!validatePhone()) return |
| | | if (!validatePhone() || !validateEmail()) return |
| | | userInfo.value.name = userInfo.value.realName; |
| | | updateInfo(userInfo.value).then(res => { |
| | | if (res.data.code === 200) { |