超管后台 - 客户池分页按钮
This commit is contained in:
@@ -282,6 +282,7 @@ export default function MomentsSyncPage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div className="grid grid-cols-2 gap-4 mb-4">
|
<div className="grid grid-cols-2 gap-4 mb-4">
|
||||||
<div className="text-sm text-gray-500">
|
<div className="text-sm text-gray-500">
|
||||||
<div>推送设备:{task.deviceCount} 个</div>
|
<div>推送设备:{task.deviceCount} 个</div>
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class TrafficPool extends Controller
|
|||||||
->join('wechat_friend wf', 'tp.wechatId = wf.wechatId', 'left')
|
->join('wechat_friend wf', 'tp.wechatId = wf.wechatId', 'left')
|
||||||
// 查询字段
|
// 查询字段
|
||||||
->field([
|
->field([
|
||||||
|
'distinct ts.identifier',
|
||||||
'tp.id',
|
'tp.id',
|
||||||
'tp.avatar',
|
'tp.avatar',
|
||||||
'tp.nickname',
|
'tp.nickname',
|
||||||
|
|||||||
@@ -376,15 +376,47 @@ export default function CustomersPage() {
|
|||||||
disabled={currentPage <= 1}
|
disabled={currentPage <= 1}
|
||||||
>
|
>
|
||||||
<ChevronLeft className="h-4 w-4" />
|
<ChevronLeft className="h-4 w-4" />
|
||||||
上一页
|
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
{/* 数字分页按钮 */}
|
||||||
|
{Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => {
|
||||||
|
// 显示当前页码前后2页,以及第一页和最后一页
|
||||||
|
const shouldShow =
|
||||||
|
page === 1 ||
|
||||||
|
page === totalPages ||
|
||||||
|
(page >= currentPage - 2 && page <= currentPage + 2);
|
||||||
|
|
||||||
|
if (!shouldShow) {
|
||||||
|
// 显示省略号
|
||||||
|
if (page === currentPage - 3 || page === currentPage + 3) {
|
||||||
|
return (
|
||||||
|
<span key={page} className="px-2">
|
||||||
|
...
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
key={page}
|
||||||
|
variant={page === currentPage ? "default" : "outline"}
|
||||||
|
size="sm"
|
||||||
|
onClick={() => goToPage(page)}
|
||||||
|
className="min-w-[2.5rem]"
|
||||||
|
>
|
||||||
|
{page}
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => goToPage(currentPage + 1)}
|
onClick={() => goToPage(currentPage + 1)}
|
||||||
disabled={currentPage >= totalPages}
|
disabled={currentPage >= totalPages}
|
||||||
>
|
>
|
||||||
下一页
|
|
||||||
<ChevronRight className="h-4 w-4" />
|
<ChevronRight className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user