|
|
|
@ -10,7 +10,7 @@ |
|
|
|
v-model="searchForm.dccode" |
|
|
|
placeholder="请输入ID" |
|
|
|
clearable |
|
|
|
style="width: 140px;" |
|
|
|
style="height: 36px; width: 140px;" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
<div class="search-item"> |
|
|
|
@ -19,7 +19,7 @@ |
|
|
|
v-model="searchForm.name" |
|
|
|
placeholder="请输入姓名" |
|
|
|
clearable |
|
|
|
style="width: 140px;" |
|
|
|
style="height: 36px; width: 140px;" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
<div class="search-item"> |
|
|
|
@ -54,7 +54,7 @@ |
|
|
|
v-for="region in regionList" |
|
|
|
:key="region.ID" |
|
|
|
:label="region.Name" |
|
|
|
:value="region.Name" |
|
|
|
:value="region.ID" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
@ -64,7 +64,7 @@ |
|
|
|
v-model="searchForm.is_login" |
|
|
|
placeholder="请选择是否登录" |
|
|
|
clearable |
|
|
|
style="width: 140px;" |
|
|
|
style="width: 160px;" |
|
|
|
> |
|
|
|
<el-option label="已登录" :value="1" /> |
|
|
|
<el-option label="未登录" :value="0" /> |
|
|
|
@ -117,12 +117,14 @@ |
|
|
|
|
|
|
|
<!-- 数据表格 --> |
|
|
|
<el-table |
|
|
|
ref="tableRef" |
|
|
|
:data="tableData" |
|
|
|
style="width: 100%; margin-top: 20px;" |
|
|
|
header-cell-class-name="table-header" |
|
|
|
class="table-rounded" |
|
|
|
:loading="tableLoading" |
|
|
|
:header-cell-style="{background:'#f5f7fa', color:'#606266', fontWeight:'600'}" |
|
|
|
@sort-change="handleSortChange" |
|
|
|
> |
|
|
|
<el-table-column prop="id" label="序号" align="center" header-align="center" width="60"> |
|
|
|
<template #default="scope"> |
|
|
|
@ -162,12 +164,12 @@ |
|
|
|
<el-tag v-else type="info" size="small" effect="light">未登录</el-tag> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="reg_time" label="注册时间" align="center" header-align="center" width="160"> |
|
|
|
<el-table-column prop="reg_time" label="注册时间" align="center" header-align="center" width="160" sortable="custom"> |
|
|
|
<template #default="scope"> |
|
|
|
{{ scope.row.reg_time }} |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="last_login_time" label="登录时间" align="center" header-align="center" width="160"> |
|
|
|
<el-table-column prop="last_login_time" label="登录时间" align="center" header-align="center" width="160" sortable="custom"> |
|
|
|
<template #default="scope"> |
|
|
|
{{ scope.row.last_login_time }} |
|
|
|
</template> |
|
|
|
@ -226,12 +228,35 @@ const isOriginLoading = ref(false); |
|
|
|
// 表格数据 |
|
|
|
const tableData = ref([]); |
|
|
|
const tableLoading = ref(false); |
|
|
|
const tableRef = ref(null) // 表格的引用 |
|
|
|
const total = ref(0); |
|
|
|
|
|
|
|
// 分页参数 |
|
|
|
const currentPage = ref(1); |
|
|
|
const pageSize = ref(10); |
|
|
|
|
|
|
|
// 排序参数 |
|
|
|
const sortParams = ref({ |
|
|
|
sortField: '', |
|
|
|
sortOrder: '' |
|
|
|
}) |
|
|
|
|
|
|
|
// 处理排序变化 |
|
|
|
const handleSortChange = ({ prop, order }) => { |
|
|
|
sortParams.value.sortField = prop || '' |
|
|
|
|
|
|
|
if (order === 'ascending') { |
|
|
|
sortParams.value.sortOrder = '1' |
|
|
|
} else if (order === 'descending') { |
|
|
|
sortParams.value.sortOrder = '0' |
|
|
|
} else { |
|
|
|
sortParams.value.sortField = '' |
|
|
|
sortParams.value.sortOrder = '' |
|
|
|
} |
|
|
|
|
|
|
|
fetchTableData() |
|
|
|
} |
|
|
|
|
|
|
|
// 获取地区列表 |
|
|
|
const fetchRegionList = async () => { |
|
|
|
try { |
|
|
|
@ -264,18 +289,12 @@ const fetchOriginList = async () => { |
|
|
|
}; |
|
|
|
|
|
|
|
// 判断输入是手机号还是邮箱 |
|
|
|
const isEmail = (value) => { |
|
|
|
const checkRegisterType = (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 { |
|
|
|
@ -283,8 +302,8 @@ const fetchTableData = async () => { |
|
|
|
|
|
|
|
// 根据输入判断是手机号还是邮箱 |
|
|
|
const registerType = searchForm.register_type?.trim() || ''; |
|
|
|
const isEmailValue = isEmail(registerType); |
|
|
|
const isPhoneValue = isPhone(registerType); |
|
|
|
const checkResult = checkRegisterType(registerType); |
|
|
|
|
|
|
|
const requestParams = { |
|
|
|
token: token, |
|
|
|
page: currentPage.value, |
|
|
|
@ -294,15 +313,15 @@ const fetchTableData = async () => { |
|
|
|
origin_id: searchForm.origin_id, |
|
|
|
country: searchForm.country, |
|
|
|
is_login: searchForm.is_login, |
|
|
|
phone: isPhoneValue ? registerType : '', |
|
|
|
is_phone: isPhoneValue ? 1 : 0, |
|
|
|
email: isEmailValue ? registerType : '', |
|
|
|
phone: checkResult ? '' : registerType, |
|
|
|
is_phone: checkResult ? 0 : 1, |
|
|
|
email: checkResult ? 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] : '', |
|
|
|
list_login_time_end: searchForm.loginTimeRange && searchForm.loginTimeRange[1] ? searchForm.loginTimeRange[1] : '', |
|
|
|
reg_time_asc: '', |
|
|
|
list_login_time_asc: '' |
|
|
|
reg_time_asc: sortParams.value.sortField === 'reg_time' ? sortParams.value.sortOrder : '', |
|
|
|
list_login_time_asc: sortParams.value.sortField === 'last_login_time' ? sortParams.value.sortOrder : '', |
|
|
|
}; |
|
|
|
|
|
|
|
const data = await userListApi(requestParams); |
|
|
|
@ -320,6 +339,8 @@ const fetchTableData = async () => { |
|
|
|
// 搜索 |
|
|
|
const handleSearch = () => { |
|
|
|
currentPage.value = 1; |
|
|
|
sortParams.value.sortField = ''; |
|
|
|
sortParams.value.sortOrder = ''; |
|
|
|
fetchTableData(); |
|
|
|
}; |
|
|
|
|
|
|
|
@ -328,8 +349,7 @@ const handleExport = async () => { |
|
|
|
try { |
|
|
|
// 根据输入判断是手机号还是邮箱 |
|
|
|
const registerType = searchForm.register_type?.trim() || ''; |
|
|
|
const isEmailValue = isEmail(registerType); |
|
|
|
const isPhoneValue = isPhone(registerType); |
|
|
|
const checkResult = checkRegisterType(registerType); |
|
|
|
|
|
|
|
const requestParams = { |
|
|
|
token: token, |
|
|
|
@ -338,13 +358,15 @@ const handleExport = async () => { |
|
|
|
origin_id: searchForm.origin_id, |
|
|
|
country: searchForm.country, |
|
|
|
is_login: searchForm.is_login, |
|
|
|
phone: isPhoneValue ? registerType : '', |
|
|
|
is_phone: isPhoneValue ? 1 : 0, |
|
|
|
email: isEmailValue ? registerType : '', |
|
|
|
phone: checkResult ? '' : registerType, |
|
|
|
is_phone: checkResult ? 0 : 1, |
|
|
|
email: checkResult ? 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] : '', |
|
|
|
list_login_time_end: searchForm.loginTimeRange && searchForm.loginTimeRange[1] ? searchForm.loginTimeRange[1] : '' |
|
|
|
list_login_time_end: searchForm.loginTimeRange && searchForm.loginTimeRange[1] ? searchForm.loginTimeRange[1] : '', |
|
|
|
reg_time_asc: sortParams.value.sortField === 'reg_time' ? sortParams.value.sortOrder : '', |
|
|
|
list_login_time_asc: sortParams.value.sortField === 'last_login_time' ? sortParams.value.sortOrder : '', |
|
|
|
}; |
|
|
|
|
|
|
|
await exportUserListApi(requestParams); |
|
|
|
@ -364,6 +386,7 @@ const handleViewExport = () => { |
|
|
|
|
|
|
|
// 重置 |
|
|
|
const handleReset = () => { |
|
|
|
tableRef.value.clearSort(); // 清空排序 |
|
|
|
searchForm.dccode = ''; |
|
|
|
searchForm.name = ''; |
|
|
|
searchForm.origin_id = ''; |
|
|
|
@ -372,6 +395,8 @@ const handleReset = () => { |
|
|
|
searchForm.register_type = ''; |
|
|
|
searchForm.regTimeRange = []; |
|
|
|
searchForm.loginTimeRange = []; |
|
|
|
sortParams.value.sortField = ''; |
|
|
|
sortParams.value.sortOrder = ''; |
|
|
|
currentPage.value = 1; |
|
|
|
pageSize.value = 10; |
|
|
|
fetchTableData(); |
|
|
|
@ -400,17 +425,24 @@ onMounted(() => { |
|
|
|
<style scoped> |
|
|
|
/* 页面容器 */ |
|
|
|
.page-container { |
|
|
|
padding: 20px; |
|
|
|
background: #fff; |
|
|
|
min-height: calc(100vh - 40px); |
|
|
|
position: relative; |
|
|
|
min-height: 600px; |
|
|
|
} |
|
|
|
|
|
|
|
/* 搜索区域 */ |
|
|
|
.search-container { |
|
|
|
background: #fefaf9; |
|
|
|
display: flex; |
|
|
|
height: auto; |
|
|
|
flex-direction: column; |
|
|
|
justify-content: center; |
|
|
|
align-items: flex-start; |
|
|
|
gap: 12px; |
|
|
|
align-self: stretch; |
|
|
|
border-radius: 8px; |
|
|
|
padding: 20px; |
|
|
|
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1); |
|
|
|
background: #FEFAF9; |
|
|
|
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.25); |
|
|
|
padding: 15px; |
|
|
|
margin-bottom: 20px; |
|
|
|
} |
|
|
|
|
|
|
|
.search-form { |
|
|
|
@ -433,10 +465,13 @@ onMounted(() => { |
|
|
|
} |
|
|
|
|
|
|
|
.form-label { |
|
|
|
font-size: 14px; |
|
|
|
font-weight: 800 !important; |
|
|
|
font-size: 15px; |
|
|
|
text-align: left; |
|
|
|
color: #333; |
|
|
|
white-space: nowrap; |
|
|
|
font-weight: 500; |
|
|
|
margin: 13px 0; |
|
|
|
font-family: "SimHei", "Heiti SC", "Microsoft YaHei", sans-serif !important; |
|
|
|
display: block; |
|
|
|
} |
|
|
|
|
|
|
|
.button-group { |
|
|
|
@ -475,8 +510,16 @@ onMounted(() => { |
|
|
|
/* 分页 */ |
|
|
|
.demo-pagination-block { |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
margin-top: 20px; |
|
|
|
padding: 10px 0; |
|
|
|
width: 100%; |
|
|
|
height: 44px; |
|
|
|
padding: 0 16px; |
|
|
|
align-items: center; |
|
|
|
gap: 16px; |
|
|
|
position: absolute; |
|
|
|
margin-top: 10px; |
|
|
|
border-radius: 0 0 3px 3px; |
|
|
|
border-top: 1px solid #EAEAEA; |
|
|
|
background: #FEFBFB; |
|
|
|
box-sizing: border-box; |
|
|
|
} |
|
|
|
</style> |