Skip to content

Commit 4140226

Browse files
committed
feat: add backto top
1 parent edd7891 commit 4140226

File tree

6 files changed

+41
-6
lines changed

6 files changed

+41
-6
lines changed

src/component/Markdown/index.less

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
.editor {
2-
border: none;
3-
1+
.markdown {
42
:global {
53
.editor-container {
64
> .sec-html {
@@ -11,3 +9,11 @@
119
}
1210
}
1311
}
12+
13+
.markdown_render {
14+
border: none;
15+
}
16+
17+
.markdown_editor {
18+
min-height: 180px;
19+
}

src/component/Markdown/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ const Markdown: React.FC<Props> = (props) => {
1111
const { value, type, onChange } = props;
1212

1313
let view;
14+
let classname = styles.markdown;
1415

1516
if (type === 'render') {
1617
view = {
1718
menu: false,
1819
md: false,
1920
html: true,
2021
};
22+
23+
classname += ` ${styles.markdown_render}`;
2124
}
2225

2326
if (type === 'editor') {
@@ -26,11 +29,13 @@ const Markdown: React.FC<Props> = (props) => {
2629
md: true,
2730
html: false,
2831
};
32+
33+
classname += ` ${styles.markdown_editor}`;
2934
}
3035

3136
return (
3237
<MdEditor
33-
className={styles.editor}
38+
className={classname}
3439
readOnly={type === 'render'}
3540
view={view}
3641
value={value}

src/constants/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export const TABS_MAP = {
1717
name: '招聘',
1818
color: '#5BD8A6',
1919
},
20+
dev: {
21+
name: '客户端测试',
22+
color: '#5BD8A6',
23+
},
2024
};
2125

2226
export type TabType = keyof typeof TABS_MAP;

src/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const layoutConfig = ({
5252
navTheme: 'light',
5353
layout: 'top',
5454
headerHeight: 64,
55-
fixedHeader: false,
55+
fixedHeader: true,
5656
contentWidth: 'Fluid',
5757

5858
logo,

src/layout/index.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import ProCard from '@ant-design/pro-card';
33

44
import { IRoute, Link } from 'umi';
55
import { PageContainer } from '@ant-design/pro-layout';
6+
import { Affix, Button } from 'antd';
7+
68
import UserInfo from './component/UserInfo';
79

810
const getCurrentRoute = (route: IRoute, path: string): IRoute | undefined => {
@@ -76,6 +78,22 @@ const Layout: React.FC<React.PropsWithChildren<Props>> = (props) => {
7678
<UserInfo />
7779
</ProCard>
7880
</ProCard>
81+
<Affix
82+
offsetBottom={200}
83+
style={{
84+
position: 'fixed',
85+
bottom: '50px',
86+
right: '24px',
87+
}}
88+
>
89+
<Button
90+
onClick={() => {
91+
window.scrollTo(0, 0);
92+
}}
93+
>
94+
回到顶部
95+
</Button>
96+
</Affix>
7997
</PageContainer>
8098
);
8199
};

src/service/topic.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export const queryTopicList = async (params: {
1818
},
1919
};
2020

21-
return request(`${BASE_URL}/api/v1/topics`, options);
21+
const res = await request(`${BASE_URL}/api/v1/topics`, options);
22+
res.data = res.data.filter((item: any) => item?.author?.loginname);
23+
return res;
2224
};
2325

2426
export const queryTopicDetail = async (params: {

0 commit comments

Comments
 (0)