This commit is contained in:
longdayi 2025-02-27 23:50:23 +08:00
parent f2c10e6f41
commit 2a73e37b6e
7 changed files with 19 additions and 20 deletions

View File

@ -11,7 +11,7 @@ export function MainLayout() {
<MainProvider> <MainProvider>
<div className=" min-h-screen bg-gray-100"> <div className=" min-h-screen bg-gray-100">
<MainHeader /> <MainHeader />
<Content className="min-h-screen flex-grow pt-14 bg-gray-50 "> <Content className=" flex-grow pt-16 bg-gray-50 ">
<Outlet /> <Outlet />
</Content> </Content>
<MainFooter /> <MainFooter />

View File

@ -121,7 +121,7 @@ export default function StaffForm() {
name={"showname"} name={"showname"}
label="名称"> label="名称">
<Input <Input
placeholder="请输入" placeholder="请输入名"
allowClear allowClear
autoComplete="new-name" // 使用非标准的自动完成值 autoComplete="new-name" // 使用非标准的自动完成值
spellCheck={false} spellCheck={false}

View File

@ -23,6 +23,7 @@ const DeptInfo = ({ post }: { post: PostDto }) => {
{post && ( {post && (
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<span className="gap-1 text-xs font-medium text-gray-500 flex items-center"> <span className="gap-1 text-xs font-medium text-gray-500 flex items-center">
<EyeOutlined /> <EyeOutlined />
{`${post?.meta?.views || 0}`} {`${post?.meta?.views || 0}`}
</span> </span>

View File

@ -4,9 +4,7 @@ import { useParams } from "react-router-dom";
export default function PathEditorPage() { export default function PathEditorPage() {
const { id } = useParams(); const { id } = useParams();
return ( return <div className="">
<div className="p-2 min-h-screen">
<MindEditor id={id}></MindEditor> <MindEditor id={id}></MindEditor>
</div> </div>
);
} }

View File

@ -22,7 +22,6 @@ import { useAuth } from "@web/src/providers/auth-provider";
import { MIND_OPTIONS } from "./constant"; import { MIND_OPTIONS } from "./constant";
import { SaveOutlined } from "@ant-design/icons"; import { SaveOutlined } from "@ant-design/icons";
export default function MindEditor({ id }: { id?: string }) { export default function MindEditor({ id }: { id?: string }) {
//containerRef 容器ref instance 实例
const containerRef = useRef<HTMLDivElement>(null); const containerRef = useRef<HTMLDivElement>(null);
const [instance, setInstance] = useState<MindElixirInstance | null>(null); const [instance, setInstance] = useState<MindElixirInstance | null>(null);
const { isAuthenticated, user, hasSomePermissions } = useAuth(); const { isAuthenticated, user, hasSomePermissions } = useAuth();
@ -35,7 +34,6 @@ export default function MindEditor({ id }: { id?: string }) {
select: postDetailSelect, select: postDetailSelect,
}, { enabled: Boolean(id) }); }, { enabled: Boolean(id) });
const canEdit: boolean = useMemo(() => { const canEdit: boolean = useMemo(() => {
//登录了且是作者、超管、无id新建模式
const isAuth = isAuthenticated && user?.id === post?.author?.id; const isAuth = isAuthenticated && user?.id === post?.author?.id;
return !!id || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST); return !!id || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST);
}, [user]); }, [user]);
@ -166,13 +164,13 @@ export default function MindEditor({ id }: { id?: string }) {
); );
}; };
useEffect(() => { useEffect(() => {
containerRef.current.style.height = `${Math.floor(window.innerHeight / 1.25)}px`;
containerRef.current.style.height = `${Math.floor(window.innerHeight - 271)}px`;
}, []); }, []);
return ( return (
<div className={`grid grid-cols-1 flex-col w-[90vw] my-5 h-[${Math.floor(window.innerHeight/1.25)}px] border rounded-lg mx-auto`}> <div className={` flex-col flex border rounded-xl overflow-hidden`}>
{canEdit && taxonomies && ( {canEdit && taxonomies && (
<Form <Form
form={form} form={form}

View File

@ -1,4 +1,4 @@
import { Card, Typography, Button, Empty } from "antd"; import { Typography, Button, Empty, Card } from "antd";
import { PostDto } from "@nice/common"; import { PostDto } from "@nice/common";
import DeptInfo from "@web/src/app/main/path/components/DeptInfo"; import DeptInfo from "@web/src/app/main/path/components/DeptInfo";
@ -19,9 +19,9 @@ export default function PostCard({ post, onClick }: PostCardProps) {
onClick={() => handleClick(post)} onClick={() => handleClick(post)}
key={post?.id} key={post?.id}
hoverable hoverable
className="group overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2" className="group overflow-hidden rounded-2xl border border-gray-200 shadow-xl hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2"
cover={ cover={
<div className="relative h-56 bg-gradient-to-br from-gray-900 to-gray-800 overflow-hidden group"> <div className="relative h-56 overflow-hidden group">
{post?.meta?.thumbnail ? ( {post?.meta?.thumbnail ? (
<div <div
className="absolute inset-0 bg-cover bg-center transform transition-all duration-700 ease-out group-hover:scale-110" className="absolute inset-0 bg-cover bg-center transform transition-all duration-700 ease-out group-hover:scale-110"
@ -53,6 +53,7 @@ export default function PostCard({ post, onClick }: PostCardProps) {
<div className="pt-4 border-t border-gray-100 text-center"> <div className="pt-4 border-t border-gray-100 text-center">
<Button <Button
shape="round"
type="primary" type="primary"
size="large" size="large"
className="w-full shadow-[0_8px_20px_-6px_rgba(59,130,246,0.5)] hover:shadow-[0_12px_24px_-6px_rgba(59,130,246,0.6)] className="w-full shadow-[0_8px_20px_-6px_rgba(59,130,246,0.5)] hover:shadow-[0_12px_24px_-6px_rgba(59,130,246,0.6)]
@ -64,3 +65,4 @@ export default function PostCard({ post, onClick }: PostCardProps) {
</Card> </Card>
); );
} }

View File

@ -31,7 +31,7 @@ export default function TaxonomyForm() {
setTaxonomyModalOpen(false) setTaxonomyModalOpen(false)
}}> }}>
<Form.Item <Form.Item
rules={[{ required: true, message: "请输入" }]} rules={[{ required: true, message: "请输入名" }]}
name={"name"} name={"name"}
label="名称"> label="名称">
<Input></Input> <Input></Input>