This commit is contained in:
ditiqi 2025-01-26 18:32:47 +08:00
parent 483058090d
commit 262dfade4e
5 changed files with 14 additions and 14 deletions

View File

@ -4,9 +4,10 @@ import {
CheckCircleOutlined,
DeleteOutlined,
} from "@ant-design/icons";
import { Upload, message, Progress, Button } from "antd";
import { Upload, Progress, Button } from "antd";
import type { UploadFile } from "antd";
import { useTusUpload } from "@web/src/hooks/useTusUpload";
import toast from "react-hot-toast";
export interface TusUploaderProps {
value?: string[];
@ -52,7 +53,7 @@ export const TusUploader = ({ value = [], onChange }: TusUploaderProps) => {
console.log("文件", files);
if (!files.every((f) => f instanceof File)) {
message.error("无效的文件格式");
toast.error("无效的文件格式");
return false;
}
@ -111,10 +112,9 @@ export const TusUploader = ({ value = [], onChange }: TusUploaderProps) => {
);
setUploadResults(newValue);
onChange?.(newValue);
message.success(`${files.length} 个文件上传成功`);
} catch (error) {
console.error("上传错误详情:", error);
message.error(
toast.error(
`上传失败: ${error instanceof Error ? error.message : "未知错误"}`
);
setUploadingFiles((prev) =>

View File

@ -117,8 +117,8 @@ export function LetterCard({ letter }: LetterCardProps) {
<span className="mr-1"></span>
{letter.views}
</Button>
<PostLikeButton post={letter as any}></PostLikeButton>
<PostHateButton post={letter as any}></PostHateButton>
<PostLikeButton post={letter as any}></PostLikeButton>
</div>
</div>
</div>

View File

@ -65,10 +65,10 @@ export default function PostCommentCard({
<PostSendButton
post={post}></PostSendButton>
)}
<PostLikeButton
post={post}></PostLikeButton>
<PostHateButton
post={post}></PostHateButton>
<PostLikeButton
post={post}></PostLikeButton>
<span className=" text-sm text-slate-500">{`#${index + 1}`}</span>
</div>
</div>

View File

@ -35,16 +35,16 @@ export default function PostLikeButton({ post }: { post: PostDto }) {
title={post?.liked ? "取消点赞" : "点赞"}
type={post?.liked ? "primary" : "default"}
shape="round"
style={{
boxShadow: "none", // 去除阴影
}}
icon={post?.liked ? <LikeFilled /> : <LikeOutlined />}
onClick={(e) => {
e.stopPropagation()
likeThisPost()
}}
>
e.stopPropagation();
likeThisPost();
}}>
<span className="mr-1"></span>
{post?.likes}
</Button>
);
}

View File

@ -26,8 +26,8 @@ export function StatsSection() {
<Button type="default" title="回复数" shape="round" icon={<CommentOutlined />}>
<span className="mr-1"></span>{post?.commentsCount}
</Button>
<PostLikeButton post={post}></PostLikeButton>
<PostHateButton post={post}></PostHateButton>
<PostLikeButton post={post}></PostLikeButton>
</div>
</div>