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

View File

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

View File

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

View File

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

View File

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