feat: 模卡更新

This commit is contained in:
chashaobao
2025-11-03 22:18:39 +08:00
parent fde2027588
commit 5e3e6903cb
31 changed files with 479 additions and 193 deletions

View File

@ -124,7 +124,6 @@ function JobFragment(props: IProps) {
const handleSelectEmployType = useCallback(
(value?: EmployType) => {
console.log('哈哈哈', value);
setShowEmployTypeSelect(false);
onClickEmployType(value!);
},

View File

@ -23,9 +23,7 @@ function ProfileBasicFragment(props: IProps, ref) {
const [name, setName] = useState(profile.name || '');
const [gender, setGender] = useState<GenderType>(profile.gender || GenderType.WOMEN);
const [age, setAge] = useState(profile.age || '');
const [height, setHeight] = useState(profile.height || '');
const [weight, setWeight] = useState(profile.weight || '');
const [shoeSize, setShoeSize] = useState(profile.shoeSize || '');
const [workedSecCategoryStr, setWorkedSecCategoryStr] = useState(profile.workedSecCategoryStr || '');
const handleInputName = useCallback((e: BaseEventOrig<InputProps.inputEventDetail>) => {
const value = e.detail.value || '';
@ -40,41 +38,21 @@ function ProfileBasicFragment(props: IProps, ref) {
setAge(string2Number(value));
}, []);
const handleInputHeight = useCallback((e: BaseEventOrig<InputProps.inputEventDetail>) => {
const value = e.detail.value || '';
if (Number.isNaN(Number(value))) {
return;
}
setHeight(string2Number(value));
}, []);
const handleInputWeight = useCallback((e: BaseEventOrig<InputProps.inputEventDetail>) => {
const value = e.detail.value || '';
if (Number.isNaN(Number(value))) {
return;
}
setWeight(string2Number(value));
}, []);
const handleInputShoeSize = useCallback((e: BaseEventOrig<InputProps.inputEventDetail>) => {
const value = e.detail.value || '';
if (Number.isNaN(Number(value))) {
return;
}
setShoeSize(string2Number(value));
}, []);
const handleGenderChange = useCallback((value: GenderType) => {
log('handleGenderChange', value);
setGender(value);
}, []);
const handleInputWorkedSecCategoryStr = useCallback((e: BaseEventOrig<InputProps.inputEventDetail>) => {
const value = e.detail.value || '';
setWorkedSecCategoryStr(value);
}, []);
useImperativeHandle(
ref,
() => ({
getData: () => ({ name, gender, age, height, weight, shoeSize }),
getData: () => ({ name, gender, age, workedSecCategoryStr }),
}),
[name, gender, age, height, weight, shoeSize]
[name, gender, age, workedSecCategoryStr]
);
return (
@ -82,29 +60,17 @@ function ProfileBasicFragment(props: IProps, ref) {
<BlFormItem title="称呼">
<BlFormInput value={name} onInput={handleInputName} />
</BlFormItem>
<BlFormItem title="年龄">
<BlFormInput value={String(age)} type="number" maxlength={3} onInput={handleInputAge} rightText="岁" />
</BlFormItem>
<BlFormItem title="性别">
<BlFormRadioGroup direction="horizontal" value={gender} onChange={handleGenderChange}>
<BlFormRadio name={GenderType.WOMEN} text="女" value={gender} />
<BlFormRadio name={GenderType.MEN} text="男" value={gender} />
</BlFormRadioGroup>
</BlFormItem>
<BlFormItem title="年龄">
<BlFormInput value={String(age)} type="number" maxlength={3} onInput={handleInputAge} rightText="岁" />
</BlFormItem>
<BlFormItem title="身高">
<BlFormInput value={String(height)} type="number" maxlength={3} onInput={handleInputHeight} rightText="CM" />
</BlFormItem>
<BlFormItem title="体重">
<BlFormInput value={String(weight)} type="number" maxlength={3} onInput={handleInputWeight} rightText="KG" />
</BlFormItem>
<BlFormItem title="鞋码" optional>
<BlFormInput
value={String(shoeSize)}
type="number"
maxlength={2}
onInput={handleInputShoeSize}
rightText="码"
/>
<BlFormItem title="直播过的品类" optional>
<BlFormInput value={workedSecCategoryStr} maxlength={140} onInput={handleInputWorkedSecCategoryStr} />
</BlFormItem>
</div>
);

View File

@ -48,10 +48,9 @@ function ProfileExperienceFragment(props: IProps, ref) {
const [workedYear, setWorkedYear] = useState(profile.workedYear);
const [workedAccounts, setWorkedAccounts] = useState(profile.workedAccounts || '');
const [newAccountExperience, setNewAccountExperience] = useState(profile.newAccountExperience);
const [workedSecCategoryStr, setWorkedSecCategoryStr] = useState(profile.workedSecCategoryStr || '');
// const [style, setStyle] = useState(calcInitStyle(profile.style));
const [maxGmv, setMaxGmv] = useState(calcInitMaxGmv(profile?.maxGmv || 0));
const [maxOnline, setMaxOnline] = useState(profile.maxOnline || '');
// const [maxOnline, setMaxOnline] = useState(profile.maxOnline || '');
const handleSelectWorkYear = useCallback((newYear: WorkedYears) => {
setWorkedYear(newYear);
@ -67,11 +66,6 @@ function ProfileExperienceFragment(props: IProps, ref) {
setNewAccountExperience(value);
}, []);
const handleInputWorkedSecCategoryStr = useCallback((e: BaseEventOrig<InputProps.inputEventDetail>) => {
const value = e.detail.value || '';
setWorkedSecCategoryStr(value);
}, []);
// const handleStyleChange = useCallback((value: StyleType[]) => {
// log('handleStyleChange', value);
// setStyle(value);
@ -84,14 +78,14 @@ function ProfileExperienceFragment(props: IProps, ref) {
}
setMaxGmv(string2Number(value));
}, []);
const handleInputMaxOnline = useCallback((e: BaseEventOrig<InputProps.inputEventDetail>) => {
const value = e.detail.value || '';
if (Number.isNaN(Number(value))) {
return;
}
setMaxOnline(string2Number(value));
}, []);
//
// const handleInputMaxOnline = useCallback((e: BaseEventOrig<InputProps.inputEventDetail>) => {
// const value = e.detail.value || '';
// if (Number.isNaN(Number(value))) {
// return;
// }
// setMaxOnline(string2Number(value));
// }, []);
useImperativeHandle(
ref,
@ -100,22 +94,21 @@ function ProfileExperienceFragment(props: IProps, ref) {
workedYear,
workedAccounts,
newAccountExperience,
workedSecCategoryStr,
// style: getStyleString(style.sort()),
maxOnline: maxOnline === '' ? undefined : maxOnline,
// maxOnline: maxOnline === '' ? undefined : maxOnline,
maxGmv: maxGmv === '' ? undefined : getMaxGmv(Number(maxGmv)),
}),
}),
[workedYear, workedAccounts, newAccountExperience, workedSecCategoryStr, maxGmv, maxOnline]
[workedYear, workedAccounts, newAccountExperience, maxGmv]
);
return (
<div className={PREFIX}>
<BlFormItem title="直播经验">
<BlFormItem title="直播经验" optional>
<BlFormSelect title="直播经验" value={workedYear} options={WORK_YEAR_OPTIONS} onSelect={handleSelectWorkYear} />
</BlFormItem>
<BlFormItem title="直播过的品类" optional>
<BlFormInput value={workedSecCategoryStr} maxlength={140} onInput={handleInputWorkedSecCategoryStr} />
<BlFormItem title="直播过的账号" optional>
<BlFormInput value={workedAccounts} maxlength={140} onInput={handleInputWorkedAccounts} />
</BlFormItem>
<BlFormItem title="自然流起号经验" optional>
<BlFormRadioGroup
@ -127,9 +120,6 @@ function ProfileExperienceFragment(props: IProps, ref) {
<BlFormRadio name text="有" value={newAccountExperience} />
</BlFormRadioGroup>
</BlFormItem>
<BlFormItem title="直播过的账号" optional>
<BlFormInput value={workedAccounts} maxlength={140} onInput={handleInputWorkedAccounts} />
</BlFormItem>
{/* <ProfileEditItem title="直播风格" optional>
<ProfileCheckboxGroup value={style} onChange={handleStyleChange}>
<ProfileCheckbox value={style} name={StyleType.Broadcasting} text="平播" />
@ -140,9 +130,9 @@ function ProfileExperienceFragment(props: IProps, ref) {
<BlFormItem title="最高GMV" optional>
<BlFormInput value={String(maxGmv)} type="number" maxlength={10} onInput={handleInputMaxGmv} rightText="W" />
</BlFormItem>
<BlFormItem title="最高在线人数" optional>
<BlFormInput value={String(maxOnline)} type="number" onInput={handleInputMaxOnline} rightText="人" />
</BlFormItem>
{/*<BlFormItem title="最高在线人数" optional>*/}
{/* <BlFormInput value={String(maxOnline)} type="number" onInput={handleInputMaxOnline} rightText="人" />*/}
{/*</BlFormItem>*/}
</div>
);
}

View File

@ -45,4 +45,8 @@
}
}
}
.transparent {
background: transparent;
padding: 0;
}
}

View File

@ -3,12 +3,21 @@ import Taro from '@tarojs/taro';
import { forwardRef, useCallback, useEffect, useImperativeHandle, useState } from 'react';
import { BlCheckbox, BlCheckboxGroup } from '@/components/bl-checkbox';
import BlFormItem from '@/components/bl-form-item';
import { BlFormRadio, BlFormRadioGroup } from '@/components/bl-form-radio';
import BlFormSelect from '@/components/bl-form-select';
import { EventName, OpenSource, PageUrl } from '@/constants/app';
import { CITY_CODE_TO_NAME_MAP } from '@/constants/city';
import { EmployType, EMPLOY_TYPE_TITLE_MAP, FULL_PRICE_OPTIONS, PART_PRICE_OPTIONS } from '@/constants/job';
import {
EmployType,
EMPLOY_TYPE_TITLE_MAP,
FULL_PRICE_OPTIONS,
PART_PRICE_OPTIONS,
ALL_JOB_TYPES,
JobType,
JOB_TYPE_TITLE_MAP,
} from '@/constants/job';
import { SalaryRange } from '@/types/job';
import { MaterialProfile } from '@/types/material';
import { logWithPrefix } from '@/utils/common';
@ -60,6 +69,12 @@ const getSalaryPrice = (fullSalary?: SalaryRange, partSalary?: SalaryRange) => {
return price;
};
const getWorkedCategoryString = (workedCategory: JobType[]) => workedCategory.join(',');
const getWorkedCategory = (workedCategory?: string): JobType[] => {
return workedCategory ? (workedCategory.split(',') as JobType[]).filter(v => ALL_JOB_TYPES.includes(v)) : [];
};
function ProfileIntentionFragment(props: IProps, ref) {
const { profile } = props;
const [cityCodes, setCityCodes] = useState(calcInitCityCodes(profile.cityCodes || ''));
@ -67,6 +82,7 @@ function ProfileIntentionFragment(props: IProps, ref) {
const [fullSalary, setFullSalary] = useState(calcSalarySelect(profile, true));
const [partSalary, setPartSalary] = useState(calcSalarySelect(profile, false));
const [acceptWorkForSit, setAcceptWorkForSit] = useState(profile.acceptWorkForSit);
const [workedCategory, setWorkedCategory] = useState<JobType[]>(getWorkedCategory(profile.workedCategory));
const handleDeleteCity = useCallback(
(deleteCode: string) => {
@ -85,7 +101,7 @@ function ProfileIntentionFragment(props: IProps, ref) {
data => {
log('handleSelectCity', data);
realtimeLogger.info('handleSelectCity', data);
const { openSource, cityCode: code } = data;
const { cityCode: code } = data;
// if (openSource !== OpenSource.AddIndentCity) {
// return;
// }
@ -118,6 +134,11 @@ function ProfileIntentionFragment(props: IProps, ref) {
setAcceptWorkForSit(value);
}, []);
const handleWorkedCategoryChange = useCallback((value: JobType[]) => {
log('handleWorkedCategoryChange', value);
setWorkedCategory(value);
}, []);
useEffect(() => {
Taro.eventCenter.on(EventName.SELECT_CITY, handleSelectCity);
return () => {
@ -132,10 +153,11 @@ function ProfileIntentionFragment(props: IProps, ref) {
cityCodes: getCityCodeString(cityCodes),
employType,
acceptWorkForSit,
workedCategory: getWorkedCategoryString(workedCategory),
...getSalaryPrice(fullSalary, partSalary),
}),
}),
[cityCodes, employType, fullSalary, partSalary, acceptWorkForSit]
[cityCodes, employType, fullSalary, partSalary, acceptWorkForSit, workedCategory]
);
return (
@ -174,7 +196,7 @@ function ProfileIntentionFragment(props: IProps, ref) {
</BlFormRadioGroup>
</BlFormItem>
{isFullTimePriceRequired(employType) && (
<BlFormItem title="期望全职薪资">
<BlFormItem title="期望全职薪资" subTitle="重要">
<BlFormSelect
title="期望全职薪资"
value={fullSalary}
@ -184,7 +206,7 @@ function ProfileIntentionFragment(props: IProps, ref) {
</BlFormItem>
)}
{isPartTimePriceRequired(employType) && (
<BlFormItem title="期望兼职薪资">
<BlFormItem title="期望兼职薪资" subTitle="重要">
<BlFormSelect
title="期望兼职薪资"
value={partSalary}
@ -193,12 +215,19 @@ function ProfileIntentionFragment(props: IProps, ref) {
/>
</BlFormItem>
)}
<BlFormItem title="是否接受坐班">
<BlFormItem title="是否接受坐班" optional>
<BlFormRadioGroup direction="horizontal" value={acceptWorkForSit} onChange={handleAcceptSittingChange}>
<BlFormRadio name text="接受" value={acceptWorkForSit} />
<BlFormRadio name={false} text="不接受" value={acceptWorkForSit} />
</BlFormRadioGroup>
</BlFormItem>
<BlFormItem title="意向类目" subTitle="多选" dynamicHeight contentClassName="transparent">
<BlCheckboxGroup value={workedCategory} onChange={handleWorkedCategoryChange}>
{ALL_JOB_TYPES.filter(type => type !== JobType.All).map(type => {
return <BlCheckbox text={JOB_TYPE_TITLE_MAP[type]} key={type} name={type} />;
})}
</BlCheckboxGroup>
</BlFormItem>
</div>
);
}

View File

@ -0,0 +1,15 @@
@import '@/styles/common.less';
@import '@/styles/variables.less';
.fragment-profile-others {
width: 100%;
&__title {
font-weight: 400;
font-size: 32px;
line-height: 40px;
margin-bottom: 24px;
}
}

View File

@ -0,0 +1,94 @@
import { BaseEventOrig, InputProps } from '@tarojs/components';
import { forwardRef, useCallback, useImperativeHandle, useState } from 'react';
import BlFormInput from '@/components/bl-form-input';
import BlFormItem from '@/components/bl-form-item';
import BlFormSelect from '@/components/bl-form-select';
import { EDUCATION_TYPE_OPTIONS, EducationType } from '@/constants/material';
import { MaterialProfile } from '@/types/material';
import { logWithPrefix, string2Number } from '@/utils/common';
import './index.less';
interface IProps {
profile: Partial<MaterialProfile>;
}
const PREFIX = 'fragment-profile-others';
const log = logWithPrefix(PREFIX);
function ProfileOthersFragment(props: IProps, ref) {
const { profile } = props;
const [educationType, setEducationType] = useState(profile.educationType || '');
const [height, setHeight] = useState(profile.height || '');
const [weight, setWeight] = useState(profile.weight || '');
const [shoeSize, setShoeSize] = useState(profile.shoeSize || '');
const handleInputHeight = useCallback((e: BaseEventOrig<InputProps.inputEventDetail>) => {
const value = e.detail.value || '';
if (Number.isNaN(Number(value))) {
return;
}
setHeight(string2Number(value));
}, []);
const handleInputWeight = useCallback((e: BaseEventOrig<InputProps.inputEventDetail>) => {
const value = e.detail.value || '';
if (Number.isNaN(Number(value))) {
return;
}
setWeight(string2Number(value));
}, []);
const handleInputShoeSize = useCallback((e: BaseEventOrig<InputProps.inputEventDetail>) => {
const value = e.detail.value || '';
if (Number.isNaN(Number(value))) {
return;
}
setShoeSize(string2Number(value));
}, []);
const handleSelectEducationType = useCallback((type: EducationType) => {
setEducationType(type);
}, []);
useImperativeHandle(
ref,
() => ({
getData: () => ({ height, weight, shoeSize, educationType }),
}),
[height, weight, shoeSize, educationType]
);
return (
<div className={PREFIX}>
<div className={`${PREFIX}__title`}>穿</div>
<BlFormItem title="身高" optional>
<BlFormInput value={String(height)} type="number" maxlength={3} onInput={handleInputHeight} rightText="CM" />
</BlFormItem>
<BlFormItem title="体重" optional>
<BlFormInput value={String(weight)} type="number" maxlength={3} onInput={handleInputWeight} rightText="KG" />
</BlFormItem>
<BlFormItem title="鞋码" optional>
<BlFormInput
value={String(shoeSize)}
type="number"
maxlength={2}
onInput={handleInputShoeSize}
rightText="码"
/>
</BlFormItem>
<BlFormItem title="学历" optional>
<BlFormSelect
title="学历"
value={educationType}
options={EDUCATION_TYPE_OPTIONS}
onSelect={handleSelectEducationType}
/>
</BlFormItem>
</div>
);
}
export default forwardRef(ProfileOthersFragment);

View File

@ -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) => (