Compare commits

..

2 Commits

Author SHA1 Message Date
yu.kuai 2bdb56ef4c feat: 前台支持展示更新人/创建人 2025-11-04 19:03:22 +08:00
yu.kuai 9fe5b50a66 feat: 文档显示人员操作记录 2025-11-04 19:03:22 +08:00
8 changed files with 32 additions and 86 deletions

View File

@ -385,14 +385,14 @@ const ThemeWrapper = ({ children }: { children: React.ReactNode }) => {
const { appPreviewData } = useAppSelector(state => state.config); const { appPreviewData } = useAppSelector(state => state.config);
const theme = useMemo(() => { const theme = useMemo(() => {
const themeName =
appPreviewData?.settings?.web_app_landing_theme?.name || 'blue';
return createTheme( return createTheme(
// @ts-expect-error themeOptions is not typed // @ts-expect-error themeOptions is not typed
{ {
...themeOptions[0], ...themeOptions[0],
palette: palette:
THEME_TO_PALETTE[themeName]?.palette || THEME_TO_PALETTE.blue.palette, THEME_TO_PALETTE[
appPreviewData?.settings?.web_app_landing_theme?.name || 'blue'
].palette,
}, },
...themeOptions.slice(1), ...themeOptions.slice(1),
); );

View File

@ -269,9 +269,7 @@ const ComponentBar = ({
<Stack sx={{ pr: '20px', marginTop: '15px' }}> <Stack sx={{ pr: '20px', marginTop: '15px' }}>
<Select <Select
value={ value={
THEME_TO_PALETTE[ appPreviewData.settings?.web_app_landing_theme?.name || 'blue'
appPreviewData.settings?.web_app_landing_theme?.name || 'blue'
]?.value || 'blue'
} }
renderValue={value => { renderValue={value => {
return THEME_TO_PALETTE[value]?.label; return THEME_TO_PALETTE[value]?.label;

View File

@ -40,8 +40,6 @@ const History = () => {
); );
const [characterCount, setCharacterCount] = useState(0); const [characterCount, setCharacterCount] = useState(0);
const [isMarkdown, setIsMarkdown] = useState(false);
const editorRef = useTiptap({ const editorRef = useTiptap({
content: '', content: '',
editable: false, editable: false,
@ -51,26 +49,10 @@ const History = () => {
}, },
}); });
const editorMdRef = useTiptap({
content: '',
contentType: 'markdown',
editable: false,
immediatelyRender: true,
onUpdate: ({ editor }) => {
setCharacterCount((editor.storage as any).characterCount.characters());
},
});
const getDetail = (v: DomainNodeReleaseListItem) => { const getDetail = (v: DomainNodeReleaseListItem) => {
getApiProV1NodeReleaseDetail({ id: v.id!, kb_id: kb_id! }).then(res => { getApiProV1NodeReleaseDetail({ id: v.id!, kb_id: kb_id! }).then(res => {
setCurNode(res); setCurNode(res);
if (res.meta?.content_type === 'md') { editorRef.setContent(res.content || '');
setIsMarkdown(true);
editorMdRef.setContent(res.content || '');
} else {
setIsMarkdown(false);
editorRef.setContent(res.content || '');
}
window.scrollTo({ top: 0, behavior: 'smooth' }); window.scrollTo({ top: 0, behavior: 'smooth' });
}); });
}; };
@ -225,7 +207,7 @@ const History = () => {
gap={0.5} gap={0.5}
sx={{ cursor: 'pointer' }} sx={{ cursor: 'pointer' }}
> >
<Icon type='icon-tianjiawendang' sx={{ fontSize: 9 }} /> <Icon type='icon-tianjiawendang' />
{curNode.editor_account} {curNode.editor_account}
</Stack> </Stack>
</Tooltip> </Tooltip>
@ -267,6 +249,13 @@ const History = () => {
</Box> </Box>
</Box> </Box>
)} )}
{/* <EditorThemeProvider
colors={{ light }}
mode='light'
theme={{
components: componentStyleOverrides,
}}
> */}
<Box <Box
sx={{ sx={{
'.tiptap': { '.tiptap': {
@ -278,12 +267,9 @@ const History = () => {
}, },
}} }}
> >
{isMarkdown ? ( <Editor editor={editorRef.editor} />
<Editor editor={editorMdRef.editor} />
) : (
<Editor editor={editorRef.editor} />
)}
</Box> </Box>
{/* </EditorThemeProvider> */}
</Box> </Box>
)} )}
</Box> </Box>

View File

@ -19,9 +19,7 @@ const HomePage = () => {
cssVariables: { cssVariables: {
cssVarPrefix: 'welcome', cssVarPrefix: 'welcome',
}, },
palette: palette: THEME_TO_PALETTE[themeMode].palette,
THEME_TO_PALETTE[themeMode]?.palette ||
THEME_TO_PALETTE['blue'].palette,
typography: { typography: {
fontFamily: 'var(--font-gilory), PingFang SC, sans-serif', fontFamily: 'var(--font-gilory), PingFang SC, sans-serif',
}, },

View File

@ -46,11 +46,11 @@ export const THEME_LIST = [
value: 'darkDeepForest', value: 'darkDeepForest',
palette: darkDeepForestPalette, palette: darkDeepForestPalette,
}, },
// { {
// label: '深邃黑', label: '深邃黑',
// value: 'white', value: 'white',
// palette: whitePalette, palette: whitePalette,
// }, },
{ {
label: '电光蓝', label: '电光蓝',
value: 'electricBlue', value: 'electricBlue',

View File

@ -18,10 +18,9 @@ interface BlockGridProps {
} }
const StyledBlockGridItem = styled(Stack)(({ theme }) => ({ const StyledBlockGridItem = styled(Stack)(({ theme }) => ({
aspectRatio: '1 / 1', aspectRatio: '1 / 1',
position: 'relative',
border: `1px solid ${alpha(theme.palette.text.primary, 0.15)}`, border: `1px solid ${alpha(theme.palette.text.primary, 0.15)}`,
borderRadius: '10px', borderRadius: '10px',
padding: theme.spacing(1), padding: theme.spacing(2),
boxShadow: `0px 5px 20px 0px ${alpha(theme.palette.text.primary, 0.06)}`, boxShadow: `0px 5px 20px 0px ${alpha(theme.palette.text.primary, 0.06)}`,
transition: 'all 0.2s ease', transition: 'all 0.2s ease',
'&:hover': { '&:hover': {
@ -45,22 +44,14 @@ export const StyledBlockGridItemImg = styled('img')(({ theme }) => ({
})); }));
const StyledBlockGridItemTitle = styled('div')(({ theme }) => ({ const StyledBlockGridItemTitle = styled('div')(({ theme }) => ({
position: 'absolute',
bottom: '24px',
left: '50%',
maxWidth: 'calc(100% - 24px)',
transform: 'translateX(-50%)',
padding: theme.spacing(0.5, 1),
overflow: 'hidden', overflow: 'hidden',
textOverflow: 'ellipsis', textOverflow: 'ellipsis',
flexShrink: 0, flexShrink: 0,
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
fontSize: 14, fontSize: 16,
textAlign: 'center', textAlign: 'center',
fontWeight: 700, fontWeight: 700,
color: theme.palette.background.default, color: theme.palette.text.primary,
backgroundColor: alpha(theme.palette.text.primary, 0.5),
borderRadius: '6px',
})); }));
// 单个卡片组件,带动画效果 // 单个卡片组件,带动画效果

View File

@ -68,7 +68,7 @@ const StyledSwiperSlideDesc = styled('div')(({ theme }) => ({
fontSize: 14, fontSize: 14,
fontWeight: 400, fontWeight: 400,
color: theme.palette.background.default, color: theme.palette.background.default,
borderRadius: '6px', borderRadius: '12px',
overflow: 'hidden', overflow: 'hidden',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
zIndex: 0, zIndex: 0,
@ -113,7 +113,7 @@ const StyledTabs = styled(Tabs)(({ theme }) => ({
const StyledTab = styled(Tab)(({ theme }) => ({ const StyledTab = styled(Tab)(({ theme }) => ({
minHeight: 'auto', minHeight: 'auto',
padding: theme.spacing(1, 2), padding: theme.spacing(1, 2),
borderRadius: '6px', borderRadius: '10px',
backgroundColor: theme.palette.background.default, backgroundColor: theme.palette.background.default,
color: theme.palette.text.secondary, color: theme.palette.text.secondary,
fontSize: 14, fontSize: 14,

View File

@ -18,8 +18,8 @@ interface ImgTextProps {
const StyledImgTextItem = styled(Stack)(({ theme }) => ({})); const StyledImgTextItem = styled(Stack)(({ theme }) => ({}));
export const StyledImgTextItemImg = styled('img')(({ theme }) => ({ export const StyledImgTextItemImg = styled('img')(({ theme }) => ({
maxWidth: '100%', maxWidth: 350,
maxHeight: '100%', maxHeight: 350,
width: '100%', width: '100%',
height: '100%', height: '100%',
objectFit: 'cover', objectFit: 'cover',
@ -28,7 +28,7 @@ export const StyledImgTextItemImg = styled('img')(({ theme }) => ({
})); }));
const StyledImgTextItemTitle = styled('h3')(({ theme }) => ({ const StyledImgTextItemTitle = styled('h3')(({ theme }) => ({
fontSize: 24, fontSize: 20,
fontWeight: 700, fontWeight: 700,
color: theme.palette.text.primary, color: theme.palette.text.primary,
})); }));
@ -73,7 +73,7 @@ const ImgText: React.FC<ImgTextProps> = React.memo(
<StyledTopicBox> <StyledTopicBox>
<StyledTopicTitle ref={titleRef}>{title}</StyledTopicTitle> <StyledTopicTitle ref={titleRef}>{title}</StyledTopicTitle>
<StyledImgTextItem <StyledImgTextItem
gap={mobile ? 4 : { xs: 4, sm: 6, md: 16 }} gap={mobile ? 4 : { xs: 4, sm: 6, md: 38 }}
direction={ direction={
mobile mobile
? 'column-reverse' ? 'column-reverse'
@ -96,36 +96,9 @@ const ImgText: React.FC<ImgTextProps> = React.memo(
gap={1} gap={1}
sx={{ width: '100%' }} sx={{ width: '100%' }}
ref={cardRightRef as React.Ref<HTMLDivElement>} ref={cardRightRef as React.Ref<HTMLDivElement>}
alignItems={
mobile
? 'flex-start'
: direction === 'row'
? 'flex-start'
: 'flex-end'
}
> >
<StyledImgTextItemTitle <StyledImgTextItemTitle>{item.name}</StyledImgTextItemTitle>
sx={{ <StyledImgTextItemSummary>{item.desc}</StyledImgTextItemSummary>
textAlign: mobile
? 'left'
: direction === 'row'
? 'left'
: 'right',
}}
>
{item.name}
</StyledImgTextItemTitle>
<StyledImgTextItemSummary
sx={{
textAlign: mobile
? 'left'
: direction === 'row'
? 'left'
: 'right',
}}
>
{item.desc}
</StyledImgTextItemSummary>
</Stack> </Stack>
</StyledImgTextItem> </StyledImgTextItem>
</StyledTopicBox> </StyledTopicBox>