Skip to content

Commit

Permalink
fix: 调整移动端瀑布流组件列数及分页大小,修复数据库错误查询
Browse files Browse the repository at this point in the history
  • Loading branch information
besscroft committed May 6, 2024
1 parent 4634e68 commit c87877f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion components/Masonry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export default function Masonry(props : Readonly<ImageHandleProps>) {
<div className="w-full sm:w-4/5 mx-auto p-2">
<PhotoAlbum
columns={(containerWidth) => {
if (containerWidth < 640) return 1;
if (containerWidth < 768) return 2;
if (containerWidth < 1024) return 3;
return 4;
Expand Down
4 changes: 2 additions & 2 deletions server/lib/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export async function fetchClientImagesListByTag(pageNum: number, tag: string) {
tags.tag_value = ${tag}
GROUP BY image.id
ORDER BY image.sort DESC, image.create_time DESC, image.update_time DESC
LIMIT 8 OFFSET ${(pageNum - 1) * 12}
LIMIT 16 OFFSET ${(pageNum - 1) * 16}
`

return findAll;
Expand Down Expand Up @@ -256,7 +256,7 @@ export async function fetchClientImagesPageTotalByTag(tag: string) {
) AS unique_images;
`
// @ts-ignore
return Number(pageTotal[0].total) > 0 ? Math.ceil(Number(pageTotal[0].total) / 12) : 0
return Number(pageTotal[0].total) > 0 ? Math.ceil(Number(pageTotal[0].total) / 16) : 0
}

export async function fetchTagsShow() {
Expand Down

0 comments on commit c87877f

Please sign in to comment.