mirror of https://github.com/fantasticit/think.git
commit
e552399332
|
@ -4,7 +4,7 @@ import { IconUserAdd } from '@douyinfe/semi-icons';
|
||||||
import { Avatar, AvatarGroup, Button, Dropdown, Modal, Popover, Toast, Tooltip, Typography } from '@douyinfe/semi-ui';
|
import { Avatar, AvatarGroup, Button, Dropdown, Modal, Popover, Toast, Tooltip, Typography } from '@douyinfe/semi-ui';
|
||||||
|
|
||||||
import { Members } from 'components/members';
|
import { Members } from 'components/members';
|
||||||
import { useDoumentMembers } from 'data/document';
|
import { useDocumentMembers } from 'data/document';
|
||||||
import { useUser } from 'data/user';
|
import { useUser } from 'data/user';
|
||||||
import { event, JOIN_USER } from 'event';
|
import { event, JOIN_USER } from 'event';
|
||||||
import { IsOnMobile } from 'hooks/use-on-mobile';
|
import { IsOnMobile } from 'hooks/use-on-mobile';
|
||||||
|
@ -41,7 +41,7 @@ export const DocumentCollaboration: React.FC<IProps> = ({ wikiId, documentId, di
|
||||||
<div style={{ padding: '24px 0' }}>
|
<div style={{ padding: '24px 0' }}>
|
||||||
<Members
|
<Members
|
||||||
id={documentId}
|
id={documentId}
|
||||||
hook={useDoumentMembers}
|
hook={useDocumentMembers}
|
||||||
descriptions={[
|
descriptions={[
|
||||||
'权限继承:默认继承知识库成员权限',
|
'权限继承:默认继承知识库成员权限',
|
||||||
'超级管理员:组织超级管理员、知识库超级管理员和文档创建者',
|
'超级管理员:组织超级管理员、知识库超级管理员和文档创建者',
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { IconPlus } from '@douyinfe/semi-icons';
|
||||||
import { Button, Tree as SemiTree, Typography } from '@douyinfe/semi-ui';
|
import { Button, Tree as SemiTree, Typography } from '@douyinfe/semi-ui';
|
||||||
|
|
||||||
import { DocumentActions } from 'components/document/actions';
|
import { DocumentActions } from 'components/document/actions';
|
||||||
import { DocumentCreator as DocumenCreatorForm } from 'components/document/create';
|
import { DocumentCreator as DocumentCreatorForm } from 'components/document/create';
|
||||||
import deepEqual from 'deep-equal';
|
import deepEqual from 'deep-equal';
|
||||||
import { CREATE_DOCUMENT, event, triggerCreateDocument } from 'event';
|
import { CREATE_DOCUMENT, event, triggerCreateDocument } from 'event';
|
||||||
import { useToggle } from 'hooks/use-toggle';
|
import { useToggle } from 'hooks/use-toggle';
|
||||||
|
@ -72,7 +72,12 @@ const AddDocument = () => {
|
||||||
}, [toggleVisible]);
|
}, [toggleVisible]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DocumenCreatorForm wikiId={wikiId} parentDocumentId={documentId} visible={visible} toggleVisible={toggleVisible} />
|
<DocumentCreatorForm
|
||||||
|
wikiId={wikiId}
|
||||||
|
parentDocumentId={documentId}
|
||||||
|
visible={visible}
|
||||||
|
toggleVisible={toggleVisible}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ export const getDocumentMembers = (
|
||||||
* @param documentId
|
* @param documentId
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const useDoumentMembers = (documentId, options?: UseQueryOptions<Array<{ user: IUser; auth: IAuthority }>>) => {
|
export const useDocumentMembers = (documentId, options?: UseQueryOptions<Array<{ user: IUser; auth: IAuthority }>>) => {
|
||||||
const [pageSize] = useState(12);
|
const [pageSize] = useState(12);
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const { data, error, isLoading, refetch } = useQuery(
|
const { data, error, isLoading, refetch } = useQuery(
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useQuery, UseQueryOptions } from 'react-query';
|
||||||
|
|
||||||
import { IDocument, IWiki, StarApiDefinition } from '@think/domains';
|
import { IDocument, IWiki, StarApiDefinition } from '@think/domains';
|
||||||
|
|
||||||
import { event, TOGGLE_STAR_DOUCMENT, TOGGLE_STAR_WIKI, triggerToggleStarDocument, triggerToggleStarWiki } from 'event';
|
import { event, TOGGLE_STAR_DOCUMENT, TOGGLE_STAR_WIKI, triggerToggleStarDocument, triggerToggleStarWiki } from 'event';
|
||||||
import { HttpClient } from 'services/http-client';
|
import { HttpClient } from 'services/http-client';
|
||||||
|
|
||||||
export type IWikiWithIsMember = IWiki & { isMember?: boolean };
|
export type IWikiWithIsMember = IWiki & { isMember?: boolean };
|
||||||
|
@ -122,10 +122,10 @@ export const useStarDocumentsInOrganization = (organizationId) => {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
event.on(TOGGLE_STAR_DOUCMENT, refetch);
|
event.on(TOGGLE_STAR_DOCUMENT, refetch);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
event.off(TOGGLE_STAR_DOUCMENT, refetch);
|
event.off(TOGGLE_STAR_DOCUMENT, refetch);
|
||||||
};
|
};
|
||||||
}, [refetch]);
|
}, [refetch]);
|
||||||
return { data, error, loading: isLoading, refresh: refetch };
|
return { data, error, loading: isLoading, refresh: refetch };
|
||||||
|
@ -218,10 +218,10 @@ export const useStarDocumentsInWiki = (organizationId, wikiId) => {
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
event.on(TOGGLE_STAR_DOUCMENT, refetch);
|
event.on(TOGGLE_STAR_DOCUMENT, refetch);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
event.off(TOGGLE_STAR_DOUCMENT, refetch);
|
event.off(TOGGLE_STAR_DOCUMENT, refetch);
|
||||||
};
|
};
|
||||||
}, [refetch]);
|
}, [refetch]);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ export const REFRESH_ORGANIZATIONS = 'REFRESH_ORGANIZATIONS'; // 刷新组织列
|
||||||
export const REFRESH_TOCS = `REFRESH_TOCS`; // 刷新知识库目录
|
export const REFRESH_TOCS = `REFRESH_TOCS`; // 刷新知识库目录
|
||||||
export const CREATE_DOCUMENT = `CREATE_DOCUMENT`;
|
export const CREATE_DOCUMENT = `CREATE_DOCUMENT`;
|
||||||
export const TOGGLE_STAR_WIKI = `TOGGLE_STAR_WIKI`; // 收藏或取消收藏知识库
|
export const TOGGLE_STAR_WIKI = `TOGGLE_STAR_WIKI`; // 收藏或取消收藏知识库
|
||||||
export const TOGGLE_STAR_DOUCMENT = `TOGGLE_STAR_DOUCMENT`; // 收藏或取消收藏文档
|
export const TOGGLE_STAR_DOCUMENT = `TOGGLE_STAR_DOCUMENT`; // 收藏或取消收藏文档
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新知识库目录
|
* 刷新知识库目录
|
||||||
|
@ -60,7 +60,7 @@ export const triggerToggleStarWiki = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const triggerToggleStarDocument = () => {
|
export const triggerToggleStarDocument = () => {
|
||||||
event.emit(TOGGLE_STAR_DOUCMENT);
|
event.emit(TOGGLE_STAR_DOCUMENT);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const triggerRefreshOrganizations = () => {
|
export const triggerRefreshOrganizations = () => {
|
||||||
|
|
Loading…
Reference in New Issue