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>
<div className=" min-h-screen bg-gray-100">
<MainHeader />
<Content className="min-h-screen flex-grow pt-14 bg-gray-50 ">
<Content className=" flex-grow pt-16 bg-gray-50 ">
<Outlet />
</Content>
<MainFooter />

View File

@ -12,7 +12,7 @@ import toast from "react-hot-toast";
export default function StaffForm() {
const { user } = useAuth();
const { create, update } = useStaff(); // Ensure you have these methods in your hooks
const {formLoading,modalOpen,setModalOpen,domainId,setDomainId,form,setFormLoading,} = useContext(UserEditorContext);
const { formLoading, modalOpen, setModalOpen, domainId, setDomainId, form, setFormLoading, } = useContext(UserEditorContext);
const {
data,
isLoading,
@ -68,7 +68,7 @@ export default function StaffForm() {
}
useEffect(() => {
form.resetFields();
console.log('cc',data);
console.log('cc', data);
if (data) {
form.setFieldValue("username", data.username);
@ -121,7 +121,7 @@ export default function StaffForm() {
name={"showname"}
label="名称">
<Input
placeholder="请输入"
placeholder="请输入名"
allowClear
autoComplete="new-name" // 使用非标准的自动完成值
spellCheck={false}

View File

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

View File

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

View File

@ -22,7 +22,6 @@ import { useAuth } from "@web/src/providers/auth-provider";
import { MIND_OPTIONS } from "./constant";
import { SaveOutlined } from "@ant-design/icons";
export default function MindEditor({ id }: { id?: string }) {
//containerRef 容器ref instance 实例
const containerRef = useRef<HTMLDivElement>(null);
const [instance, setInstance] = useState<MindElixirInstance | null>(null);
const { isAuthenticated, user, hasSomePermissions } = useAuth();
@ -35,7 +34,6 @@ export default function MindEditor({ id }: { id?: string }) {
select: postDetailSelect,
}, { enabled: Boolean(id) });
const canEdit: boolean = useMemo(() => {
//登录了且是作者、超管、无id新建模式
const isAuth = isAuthenticated && user?.id === post?.author?.id;
return !!id || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST);
}, [user]);
@ -166,13 +164,13 @@ export default function MindEditor({ id }: { id?: string }) {
);
};
useEffect(() => {
containerRef.current.style.height = `${Math.floor(window.innerHeight / 1.25)}px`;
containerRef.current.style.height = `${Math.floor(window.innerHeight - 271)}px`;
}, []);
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 && (
<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 DeptInfo from "@web/src/app/main/path/components/DeptInfo";
@ -19,9 +19,9 @@ export default function PostCard({ post, onClick }: PostCardProps) {
onClick={() => handleClick(post)}
key={post?.id}
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={
<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 ? (
<div
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">
<Button
shape="round"
type="primary"
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)]
@ -64,3 +65,4 @@ export default function PostCard({ post, onClick }: PostCardProps) {
</Card>
);
}

View File

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