This commit is contained in:
Rao 2025-03-07 18:01:09 +08:00
commit 2818d7d8f4
4 changed files with 10 additions and 11 deletions

View File

@ -12,7 +12,7 @@ import PostSelect from "../../models/post/PostSelect/PostSelect";
import { Lecture, PostType } from "@nice/common"; import { Lecture, PostType } from "@nice/common";
import { xmindColorPresets } from "./constant"; import { xmindColorPresets } from "./constant";
import { api } from "@nice/client"; import { api } from "@nice/client";
import { env } from "@web/src/env"; import { useAuth } from "@web/src/providers/auth-provider";
interface NodeMenuProps { interface NodeMenuProps {
mind: MindElixirInstance; mind: MindElixirInstance;
@ -20,12 +20,13 @@ interface NodeMenuProps {
//管理节点样式状态 //管理节点样式状态
const NodeMenu: React.FC<NodeMenuProps> = ({ mind }) => { const NodeMenu: React.FC<NodeMenuProps> = ({ mind }) => {
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
const [selectedFontColor, setSelectedFontColor] = useState<string>(""); const [selectedFontColor, setSelectedFontColor] = useState<string>("");
const [selectedBgColor, setSelectedBgColor] = useState<string>(""); const [selectedBgColor, setSelectedBgColor] = useState<string>("");
const [selectedSize, setSelectedSize] = useState<string>(""); const [selectedSize, setSelectedSize] = useState<string>("");
const [isBold, setIsBold] = useState(false); const [isBold, setIsBold] = useState(false);
const { user} = useAuth();
const [urlMode, setUrlMode] = useState<"URL" | "POSTURL">("POSTURL"); const [urlMode, setUrlMode] = useState<"URL" | "POSTURL">("POSTURL");
const [url, setUrl] = useState<string>(""); const [url, setUrl] = useState<string>("");
const [postId, setPostId] = useState<string>(""); const [postId, setPostId] = useState<string>("");
@ -238,13 +239,15 @@ const NodeMenu: React.FC<NodeMenuProps> = ({ mind }) => {
{urlMode === "POSTURL" ? ( {urlMode === "POSTURL" ? (
<PostSelect <PostSelect
onChange={(value) => { onChange={(value) => {
if (typeof value === "string") { if (typeof value === "string" ) {
setPostId(value); setPostId(value);
} }
}} }}
params={{ params={{
where: { where: {
type: PostType.LECTURE, type: PostType.LECTURE,
deletedAt: null,
authorId: user?.id,
}, },
}} }}
/> />

View File

@ -23,15 +23,9 @@ export default function CourseDetailTitle() {
{!selectedLectureId ? course?.title : lecture?.title} {!selectedLectureId ? course?.title : lecture?.title}
</div> </div>
<div className="text-gray-600 flex w-full justify-start items-center gap-5"> <div className="text-gray-600 flex w-full justify-start items-center gap-5">
{course?.author?.showname && (
<div>
:
{course?.author?.showname}
</div>
)}
{course?.depts && course?.depts?.length > 0 && ( {course?.depts && course?.depts?.length > 0 && (
<div> <div>
:
{course?.depts?.map((dept) => dept.name)} {course?.depts?.map((dept) => dept.name)}
</div> </div>
)} )}

View File

@ -13,6 +13,7 @@ export default function PostSelect({
placeholder = "请选择课时", placeholder = "请选择课时",
params = { where: {}, select: {} }, params = { where: {}, select: {} },
className, className,
createdById,
}: { }: {
value?: string | string[]; value?: string | string[];
onChange?: (value: string | string[]) => void; onChange?: (value: string | string[]) => void;
@ -22,6 +23,7 @@ export default function PostSelect({
select?: Prisma.PostSelect<DefaultArgs>; select?: Prisma.PostSelect<DefaultArgs>;
}; };
className?: string; className?: string;
createdById?: string;
}) { }) {
const [searchValue, setSearch] = useState(""); const [searchValue, setSearch] = useState("");
const searchCondition: Prisma.PostWhereInput = useMemo(() => { const searchCondition: Prisma.PostWhereInput = useMemo(() => {