diff --git a/apps/server/src/queue/models/post/utils.ts b/apps/server/src/queue/models/post/utils.ts index 57129a3..7e3c3f1 100755 --- a/apps/server/src/queue/models/post/utils.ts +++ b/apps/server/src/queue/models/post/utils.ts @@ -66,8 +66,6 @@ export async function updatePostViewCount(id: string, type: VisitType) { where: { id }, select: { id: true, meta: true, type: true }, }); - console.log(post?.type); - console.log('updatePostViewCount'); const metaFieldMap = { [VisitType.READED]: 'views', [VisitType.LIKE]: 'likes', @@ -105,7 +103,6 @@ export async function updatePostViewCount(id: string, type: VisitType) { type: type, }, }); - console.log(courseViews); await db.post.update({ where: { id: course.id }, data: { @@ -126,7 +123,6 @@ export async function updatePostViewCount(id: string, type: VisitType) { type: type, }, }); - console.log('totalViews', totalViews); await db.post.update({ where: { id }, data: { diff --git a/apps/web/src/components/common/editor/MindEditor.tsx b/apps/web/src/components/common/editor/MindEditor.tsx index 6a4e540..00f57e8 100755 --- a/apps/web/src/components/common/editor/MindEditor.tsx +++ b/apps/web/src/components/common/editor/MindEditor.tsx @@ -25,14 +25,17 @@ export default function MindEditor({ id }: { id?: string }) { const containerRef = useRef(null); const [instance, setInstance] = useState(null); const { isAuthenticated, user, hasSomePermissions } = useAuth(); - const { read } = useVisitor() + const { read } = useVisitor(); const { data: post, isLoading }: { data: PathDto; isLoading: boolean } = - api.post.findFirst.useQuery({ - where: { - id, + api.post.findFirst.useQuery( + { + where: { + id, + }, + select: postDetailSelect, }, - select: postDetailSelect, - }, { enabled: Boolean(id) }); + { enabled: Boolean(id) } + ); const canEdit: boolean = useMemo(() => { const isAuth = isAuthenticated && user?.id === post?.author?.id; return !!id || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST); @@ -64,8 +67,8 @@ export default function MindEditor({ id }: { id?: string }) { deptIds: deptIds, }; post.terms?.forEach((term) => { - formData[term.taxonomyId] = term.id // 假设 taxonomyName是您在 Form.Item 中使用的name - }) + formData[term.taxonomyId] = term.id; // 假设 taxonomyName是您在 Form.Item 中使用的name + }); form.setFieldsValue(formData); } }, [post, form, instance, id]); @@ -159,22 +162,18 @@ export default function MindEditor({ id }: { id?: string }) { } console.log(result); }, - (error) => { }, + (error) => {}, `mind-thumb-${new Date().toString()}` ); }; useEffect(() => { - containerRef.current.style.height = `${Math.floor(window.innerHeight - 271)}px`; }, []); return ( -
{canEdit && taxonomies && ( -
+
{taxonomies.map((tax, index) => ( @@ -203,14 +202,16 @@ export default function MindEditor({ id }: { id?: string }) { />
- {canEdit && } + {canEdit && ( + + )}
)} @@ -220,24 +221,20 @@ export default function MindEditor({ id }: { id?: string }) { onContextMenu={(e) => e.preventDefault()} /> {canEdit && instance && } - { - isLoading && ( -
- -
- ) - } - { - !post && id && !isLoading && ( -
- -
- ) - } -
+ {isLoading && ( +
+ +
+ )} + {!post && id && !isLoading && ( +
+ +
+ )} + ); } diff --git a/apps/web/src/components/models/post/PostSelect/PostSelect.tsx b/apps/web/src/components/models/post/PostSelect/PostSelect.tsx new file mode 100644 index 0000000..2af8ec2 --- /dev/null +++ b/apps/web/src/components/models/post/PostSelect/PostSelect.tsx @@ -0,0 +1,15 @@ +import { api } from "@nice/client"; +import { Select } from "antd"; +import { useState } from "react"; + +export default function PostSelect() { + api.post.findMany.useQuery({}); + const [search, setSearch] = useState(""); + return ( + <> + + + ); +}