feat(admin): 公共管理列表添加分页
后端 listForAdmin 支持 page/pageSize 分页查询,控制器接收分页参数并校验边界,前端 Contents 页面添加 el-pagination 组件并同步分页状态。 🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
@@ -2249,9 +2249,13 @@ export class AdminController {
|
||||
async listContents(
|
||||
@Query('type') type?: string,
|
||||
@Query('status') status?: string,
|
||||
@Query('page') page?: string,
|
||||
@Query('pageSize') pageSize?: string,
|
||||
) {
|
||||
const items = await this.content.listForAdmin(type, status);
|
||||
return jsonResponse(items);
|
||||
const p = Math.max(1, page ? parseInt(page, 10) || 1 : 1);
|
||||
const size = Math.min(Math.max(1, pageSize ? parseInt(pageSize, 10) : 20), 100);
|
||||
const result = await this.content.listForAdmin(type, status, p, size);
|
||||
return jsonResponse(result);
|
||||
}
|
||||
|
||||
@Get('contents/:id')
|
||||
|
||||
Reference in New Issue
Block a user