feat: first commit
This commit is contained in:
30
src/components/message-chat/material/index.less
Normal file
30
src/components/message-chat/material/index.less
Normal file
@ -0,0 +1,30 @@
|
||||
@import '@/styles/common.less';
|
||||
@import '@/styles/variables.less';
|
||||
|
||||
.material-message {
|
||||
width: calc(100% - 64px);
|
||||
.flex-column();
|
||||
align-items: flex-start;
|
||||
margin: 40px 32px 0;
|
||||
padding: 20px 24px;
|
||||
background: #FFFFFF;
|
||||
border-radius: 20px;
|
||||
box-sizing: border-box;
|
||||
|
||||
&__name {
|
||||
font-size: 28px;
|
||||
line-height: 40px;
|
||||
font-weight: 500;
|
||||
color: @blColor;
|
||||
}
|
||||
|
||||
&__basic,
|
||||
&__categories {
|
||||
font-size: 24px;
|
||||
line-height: 36px;
|
||||
font-weight: 400;
|
||||
color: @blColorG2;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
}
|
||||
41
src/components/message-chat/material/index.tsx
Normal file
41
src/components/message-chat/material/index.tsx
Normal file
@ -0,0 +1,41 @@
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import { IBaseMessageProps } from '@/components/message-chat/base';
|
||||
import { PageUrl } from '@/constants/app';
|
||||
import { MaterialViewSource } from '@/constants/material';
|
||||
import { IMaterialMessage } from '@/types/message';
|
||||
import { getScrollItemId, safeJsonParse } from '@/utils/common';
|
||||
import { getBasicInfo } from '@/utils/material';
|
||||
import { navigateTo } from '@/utils/route';
|
||||
|
||||
import './index.less';
|
||||
|
||||
interface IProps extends IBaseMessageProps {}
|
||||
|
||||
const PREFIX = 'material-message';
|
||||
|
||||
function MaterialMessage(props: IProps) {
|
||||
const { id, message } = props;
|
||||
const data = safeJsonParse<IMaterialMessage>(message.actionObject, null);
|
||||
|
||||
const handleClick = useCallback(() => {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
navigateTo(PageUrl.MaterialView, { resumeId: data.id, source: MaterialViewSource.Chat });
|
||||
}, [data]);
|
||||
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={PREFIX} id={getScrollItemId(id)} onClick={handleClick}>
|
||||
<div className={`${PREFIX}__name`}>{data.name}</div>
|
||||
<div className={`${PREFIX}__basic`}>{getBasicInfo(data)}</div>
|
||||
<div className={`${PREFIX}__categories`}>{`播过 ${data.workedSecCategoryStr}`}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default MaterialMessage;
|
||||
Reference in New Issue
Block a user