feat: 模卡更新
This commit is contained in:
@ -8,16 +8,22 @@ import DevDiv from '@/components/dev-div';
|
||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||
import { OpenSource, PageUrl } from '@/constants/app';
|
||||
import { CITY_CODE_TO_NAME_MAP } from '@/constants/city';
|
||||
import { FULL_PRICE_OPTIONS, PART_PRICE_OPTIONS } from '@/constants/job';
|
||||
import { ProfileGroupType, ProfileTitleMap, WORK_YEAR_OPTIONS } from '@/constants/material';
|
||||
import { FULL_PRICE_OPTIONS, JOB_TYPE_TITLE_MAP, JobType, PART_PRICE_OPTIONS } from '@/constants/job';
|
||||
import {
|
||||
EDUCATION_TYPE_LABELS,
|
||||
GenderType,
|
||||
ProfileGroupType,
|
||||
ProfileTitleMap,
|
||||
WORK_YEAR_OPTIONS,
|
||||
} from '@/constants/material';
|
||||
import { MaterialProfile } from '@/types/material';
|
||||
import { logWithPrefix, isDesktop } from '@/utils/common';
|
||||
import { getBasicInfo, sortVideos } from '@/utils/material';
|
||||
import { isDesktop, logWithPrefix } from '@/utils/common';
|
||||
import { sortVideos } from '@/utils/material';
|
||||
import { navigateTo } from '@/utils/route';
|
||||
|
||||
import './index.less';
|
||||
import onChangeEventDetail = SwiperProps.onChangeEventDetail;
|
||||
import { JoinGroupHint } from '@/components/join-group-hint';
|
||||
import onChangeEventDetail = SwiperProps.onChangeEventDetail;
|
||||
|
||||
interface IProps {
|
||||
editable: boolean;
|
||||
@ -30,7 +36,7 @@ const log = logWithPrefix(PREFIX);
|
||||
const DEFAULT_TEXT = '未填写';
|
||||
|
||||
const getIndentCity = (codeString: string = '') => {
|
||||
const codes = (codeString||'').split('、');
|
||||
const codes = (codeString || '').split('、');
|
||||
const cityNames: string[] = [];
|
||||
codes.forEach(code => {
|
||||
const cityName = CITY_CODE_TO_NAME_MAP.get(code);
|
||||
@ -63,7 +69,14 @@ const getWorkYear = (year: number) => {
|
||||
const y = Math.min(year, 3);
|
||||
return WORK_YEAR_OPTIONS.find(option => option.value === y)?.label || `${y}年`;
|
||||
};
|
||||
|
||||
const getWorkedCategory = (workedCategory?: string): string => {
|
||||
return workedCategory
|
||||
? (workedCategory.split(',') as JobType[])
|
||||
.map(v => (v !== JobType.All ? JOB_TYPE_TITLE_MAP[v] : null))
|
||||
.filter(Boolean)
|
||||
.join('、')
|
||||
: '';
|
||||
};
|
||||
const getDataGroup = (profile: MaterialProfile | null) => {
|
||||
if (!profile) {
|
||||
return [];
|
||||
@ -77,6 +90,7 @@ const getDataGroup = (profile: MaterialProfile | null) => {
|
||||
{ title: '兼职薪资', value: getIndentPrice(profile.partyTimeMinPrice, profile.partyTimeMaxPrice, false) || '' },
|
||||
{ title: '意向城市', value: getIndentCity(profile.cityCodes) || DEFAULT_TEXT },
|
||||
{ title: '是否接受坐班', value: profile.acceptWorkForSit ? '是' : '否' },
|
||||
{ title: '意向品类', value: getWorkedCategory(profile.workedCategory) || DEFAULT_TEXT, fullLine: true },
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -86,9 +100,18 @@ const getDataGroup = (profile: MaterialProfile | null) => {
|
||||
{ title: '直播年限', value: getWorkYear(profile.workedYear) || DEFAULT_TEXT },
|
||||
{ title: '直播过的账号', value: profile.workedAccounts || DEFAULT_TEXT },
|
||||
{ title: '自然流起号经验', value: Boolean(profile.newAccountExperience) ? '有' : '无' },
|
||||
{ title: '直播过的品类', value: profile.workedSecCategoryStr || DEFAULT_TEXT },
|
||||
// { title: '直播过的品类', value: profile.workedSecCategoryStr || DEFAULT_TEXT },
|
||||
{ title: '最高GMV', value: profile.maxGmv ? `${profile.maxGmv / 10000}万` : DEFAULT_TEXT },
|
||||
{ title: '最高在线人数', value: profile.maxOnline || DEFAULT_TEXT },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: ProfileTitleMap[ProfileGroupType.Others],
|
||||
type: ProfileGroupType.Others,
|
||||
items: [
|
||||
{ title: '身高', value: profile.height ? `${profile.height}cm` : DEFAULT_TEXT },
|
||||
{ title: '体重', value: profile.weight ? `${profile.weight}kg` : DEFAULT_TEXT },
|
||||
{ title: '鞋码', value: profile.shoeSize ? `${profile.shoeSize}码` : DEFAULT_TEXT },
|
||||
{ title: '学历', value: EDUCATION_TYPE_LABELS[profile.educationType] || DEFAULT_TEXT },
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -99,6 +122,16 @@ const getDataGroup = (profile: MaterialProfile | null) => {
|
||||
];
|
||||
};
|
||||
|
||||
export const getBasicInfo = (profile: Pick<MaterialProfile, 'age' | 'gender'>) => {
|
||||
const result: string[] = [];
|
||||
if (typeof profile.age !== 'undefined' && profile.age !== null) {
|
||||
result.push(`${profile.age}岁`);
|
||||
}
|
||||
result.push(profile.gender === GenderType.MEN ? '男' : '女');
|
||||
|
||||
return result.join('·');
|
||||
};
|
||||
|
||||
export default function ProfileViewFragment(props: IProps) {
|
||||
const { profile, editable, onDev } = props;
|
||||
const [coverIndex, setCoverIndex] = useState(0);
|
||||
@ -221,7 +254,9 @@ export default function ProfileViewFragment(props: IProps) {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className={`${PREFIX}__basic-info__content`}>{getBasicInfo(profile)}</div>
|
||||
<div className={`${PREFIX}__basic-info__content`}>
|
||||
<div>{getBasicInfo(profile)}</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__divider`} />
|
||||
</div>
|
||||
{dataGroup.map((data, index: number) => (
|
||||
|
||||
Reference in New Issue
Block a user