Browse Source

完善判断手机和邮箱的逻辑;

songjie/feature-20260331101525-后台整改需求
songjie 1 week ago
parent
commit
7b3db26b06
  1. 35
      src/views/UserPermissions/UserList.vue

35
src/views/UserPermissions/UserList.vue

@ -263,10 +263,28 @@ const fetchOriginList = async () => {
}
};
//
const isEmail = (value) => {
const trimmedValue = value?.trim() || '';
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(trimmedValue);
};
const isPhone = (value) => {
const trimmedValue = value?.trim() || '';
const phoneRegex = /^\d{11}$/;
return phoneRegex.test(trimmedValue);
};
//
const fetchTableData = async () => {
try {
tableLoading.value = true;
//
const registerType = searchForm.register_type?.trim() || '';
const isEmailValue = isEmail(registerType);
const isPhoneValue = isPhone(registerType);
const requestParams = {
token: token,
page: currentPage.value,
@ -276,9 +294,9 @@ const fetchTableData = async () => {
origin_id: searchForm.origin_id,
country: searchForm.country,
is_login: searchForm.is_login,
phone: searchForm.register_type,
is_phone: searchForm.register_type ? 1 : 0,
email: searchForm.register_type,
phone: isPhoneValue ? registerType : '',
is_phone: isPhoneValue ? 1 : 0,
email: isEmailValue ? registerType : '',
reg_time_start: searchForm.regTimeRange && searchForm.regTimeRange[0] ? searchForm.regTimeRange[0] : '',
reg_time_end: searchForm.regTimeRange && searchForm.regTimeRange[1] ? searchForm.regTimeRange[1] : '',
list_login_time_start: searchForm.loginTimeRange && searchForm.loginTimeRange[0] ? searchForm.loginTimeRange[0] : '',
@ -308,6 +326,11 @@ const handleSearch = () => {
// Excel
const handleExport = async () => {
try {
//
const registerType = searchForm.register_type?.trim() || '';
const isEmailValue = isEmail(registerType);
const isPhoneValue = isPhone(registerType);
const requestParams = {
token: token,
dccode: searchForm.dccode,
@ -315,9 +338,9 @@ const handleExport = async () => {
origin_id: searchForm.origin_id,
country: searchForm.country,
is_login: searchForm.is_login,
phone: searchForm.register_type,
is_phone: searchForm.register_type ? 1 : 0,
email: searchForm.register_type,
phone: isPhoneValue ? registerType : '',
is_phone: isPhoneValue ? 1 : 0,
email: isEmailValue ? registerType : '',
reg_time_start: searchForm.regTimeRange && searchForm.regTimeRange[0] ? searchForm.regTimeRange[0] : '',
reg_time_end: searchForm.regTimeRange && searchForm.regTimeRange[1] ? searchForm.regTimeRange[1] : '',
list_login_time_start: searchForm.loginTimeRange && searchForm.loginTimeRange[0] ? searchForm.loginTimeRange[0] : '',

Loading…
Cancel
Save