|
|
|
@ -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] : '', |
|
|
|
|