fix: 解决收藏夹和回收站切换每页数量不生效的问题 (#2797)

pull/2799/head
zhengkunwang 2023-11-03 18:21:46 +08:00 committed by GitHub
parent dc420256e2
commit 6546c10fb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -18,7 +18,7 @@ import (
// @Router /files/favorite/search [post] // @Router /files/favorite/search [post]
func (b *BaseApi) SearchFavorite(c *gin.Context) { func (b *BaseApi) SearchFavorite(c *gin.Context) {
var req dto.PageInfo var req dto.PageInfo
if err := helper.CheckBind(req, c); err != nil { if err := helper.CheckBindAndValidate(&req, c); err != nil {
return return
} }
total, list, err := favoriteService.Page(req) total, list, err := favoriteService.Page(req)

View File

@ -18,12 +18,12 @@ import { reactive, ref } from 'vue';
const paginationConfig = reactive({ const paginationConfig = reactive({
cacheSizeKey: 'favorite-page-size', cacheSizeKey: 'favorite-page-size',
currentPage: 1, currentPage: 1,
pageSize: 100, pageSize: 20,
total: 0, total: 0,
}); });
const req = reactive({ const req = reactive({
page: 1, page: 1,
pageSize: 100, pageSize: 20,
}); });
const open = ref(false); const open = ref(false);
const data = ref([]); const data = ref([]);
@ -40,6 +40,8 @@ const acceptParams = () => {
const search = async () => { const search = async () => {
try { try {
req.page = paginationConfig.currentPage;
req.pageSize = paginationConfig.pageSize;
const res = await SearchFavorite(req); const res = await SearchFavorite(req);
data.value = res.data.items; data.value = res.data.items;
paginationConfig.total = res.data.total; paginationConfig.total = res.data.total;

View File

@ -55,7 +55,7 @@ import Delete from './delete/index.vue';
const open = ref(false); const open = ref(false);
const req = reactive({ const req = reactive({
page: 1, page: 1,
pageSize: 100, pageSize: 20,
}); });
const data = ref([]); const data = ref([]);
const em = defineEmits(['close']); const em = defineEmits(['close']);
@ -66,7 +66,7 @@ const files = ref([]);
const paginationConfig = reactive({ const paginationConfig = reactive({
cacheSizeKey: 'recycle-page-size', cacheSizeKey: 'recycle-page-size',
currentPage: 1, currentPage: 1,
pageSize: 100, pageSize: 20,
total: 0, total: 0,
}); });
@ -87,6 +87,8 @@ const acceptParams = () => {
const search = async () => { const search = async () => {
try { try {
req.page = paginationConfig.currentPage;
req.pageSize = paginationConfig.pageSize;
const res = await getRecycleList(req); const res = await getRecycleList(req);
data.value = res.data.items; data.value = res.data.items;
paginationConfig.total = res.data.total; paginationConfig.total = res.data.total;