rht
This commit is contained in:
parent
1fc1aa368c
commit
f9533623d2
|
@ -134,7 +134,7 @@ export class PostService extends BaseTreeService<Prisma.PostDelegate> {
|
|||
return result;
|
||||
}
|
||||
async update(args: Prisma.PostUpdateArgs, staff?: UserProfile) {
|
||||
args.data.authorId = staff?.id;
|
||||
//args.data.authorId = staff?.id;
|
||||
args.data.updatedAt = dayjs().toDate();
|
||||
const result = await super.update(args);
|
||||
EventBus.emit('dataChanged', {
|
||||
|
|
|
@ -13,6 +13,7 @@ export function CoursesContainer() {
|
|||
pageSize: 12,
|
||||
where: {
|
||||
type: PostType.COURSE,
|
||||
deletedAt: null,
|
||||
...termsCondition,
|
||||
...searchCondition,
|
||||
},
|
||||
|
|
|
@ -92,6 +92,7 @@ const CoursesSection: React.FC<CoursesSectionProps> = ({
|
|||
page: 1,
|
||||
pageSize: initialVisibleCoursesCount,
|
||||
where: {
|
||||
deletedAt:null,
|
||||
terms: !(selectedCategory === "全部")
|
||||
? {
|
||||
some: {
|
||||
|
|
|
@ -14,6 +14,7 @@ export default function MyDutyPathContainer() {
|
|||
params={{
|
||||
pageSize: 12,
|
||||
where: {
|
||||
deletedAt: null,
|
||||
type: PostType.PATH,
|
||||
authorId: user?.id,
|
||||
...termsCondition,
|
||||
|
|
|
@ -15,6 +15,7 @@ export default function MyDutyListContainer() {
|
|||
params={{
|
||||
pageSize: 12,
|
||||
where: {
|
||||
deletedAt:null,
|
||||
type: PostType.COURSE,
|
||||
authorId: user.id,
|
||||
...termsCondition,
|
||||
|
|
|
@ -15,6 +15,7 @@ export default function MyLearningListContainer() {
|
|||
params={{
|
||||
pageSize: 12,
|
||||
where: {
|
||||
deletedAt: null,
|
||||
type: PostType.COURSE,
|
||||
students: {
|
||||
some: {
|
||||
|
|
|
@ -22,7 +22,7 @@ export default function MyPathListContainer() {
|
|||
id: user?.id,
|
||||
},
|
||||
},
|
||||
|
||||
deletedAt: null,
|
||||
...termsCondition,
|
||||
...searchCondition,
|
||||
},
|
||||
|
|
|
@ -16,6 +16,7 @@ export function PathListContainer() {
|
|||
type: PostType.PATH,
|
||||
...termsCondition,
|
||||
...searchCondition,
|
||||
deletedAt:null
|
||||
},
|
||||
}}
|
||||
cols={4}></PostList>
|
||||
|
|
|
@ -25,6 +25,7 @@ export default function SearchListContainer() {
|
|||
type: searchMode === "both" ? undefined : searchMode,
|
||||
...termsCondition,
|
||||
...searchCondition,
|
||||
deletedAt: null,
|
||||
},
|
||||
}}
|
||||
cols={4}></PostList>
|
||||
|
|
|
@ -39,6 +39,11 @@ export default function MindEditor({ id }: { id?: string }) {
|
|||
const { isAuthenticated, user, hasSomePermissions } = useAuth();
|
||||
const { read } = useVisitor();
|
||||
const queryClient = useQueryClient();
|
||||
useEffect(()=>{
|
||||
console.log("post",post)
|
||||
console.log("user",user)
|
||||
console.log(canEdit)
|
||||
})
|
||||
// const { data: post, isLoading }: { data: PathDto; isLoading: boolean } =
|
||||
// api.post.findFirst.useQuery(
|
||||
// {
|
||||
|
@ -56,11 +61,13 @@ export default function MindEditor({ id }: { id?: string }) {
|
|||
})
|
||||
const canEdit: boolean = useMemo(() => {
|
||||
const isAuth = isAuthenticated && user?.id === post?.author?.id;
|
||||
|
||||
return (
|
||||
isAuthenticated &&
|
||||
(!id || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST))
|
||||
);
|
||||
}, [user]);
|
||||
}, [user,post]);
|
||||
|
||||
|
||||
const navigate = useNavigate();
|
||||
const { create, update } = usePost();
|
||||
|
@ -141,12 +148,14 @@ export default function MindEditor({ id }: { id?: string }) {
|
|||
//挂载实例
|
||||
setInstance(mind);
|
||||
|
||||
}, [canEdit]);
|
||||
}, [canEdit,post]);
|
||||
useEffect(() => {
|
||||
handleIcon()
|
||||
});
|
||||
useEffect(() => {
|
||||
if ((!id || post) && instance) {
|
||||
containerRef.current.style.height = `${Math.floor(window.innerHeight - 271)}px`;
|
||||
containerRef.current.style.width = `100%`;
|
||||
containerRef.current.hidden = false;
|
||||
instance.toCenter();
|
||||
if ((post as any as PathDto)?.meta?.nodeData) {
|
||||
|
@ -154,6 +163,7 @@ export default function MindEditor({ id }: { id?: string }) {
|
|||
}
|
||||
}
|
||||
}, [id, post, instance]);
|
||||
|
||||
//保存 按钮 函数
|
||||
const handleSave = async () => {
|
||||
if (!instance) return;
|
||||
|
@ -175,6 +185,7 @@ export default function MindEditor({ id }: { id?: string }) {
|
|||
id,
|
||||
},
|
||||
data: {
|
||||
//authorId: post.authorId,
|
||||
title: data.nodeData.topic,
|
||||
meta: {
|
||||
...data,
|
||||
|
|
|
@ -62,7 +62,7 @@ export default function PostSelect({
|
|||
where: safeOR([
|
||||
{ ...idCondition },
|
||||
|
||||
{ ...searchCondition, ...(params?.where || {}) },
|
||||
{...(params?.where || {}), ...searchCondition },
|
||||
]),
|
||||
select: { ...postDetailSelect, ...(params?.select || {}) },
|
||||
take: 15,
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue