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

@ -21,25 +21,28 @@ import { navigateBack } from '@/utils/route';
import Toast from '@/utils/toast';
import './index.less';
import ProfileOthersFragment from '@/fragments/profile/others';
const PREFIX = 'page-material-create-profile';
const log = logWithPrefix(PREFIX);
const REQUIRE_KEYS = {
[ProfileGroupType.Basic]: ['name', 'gender', 'age', 'height', 'weight'],
[ProfileGroupType.Basic]: ['name', 'gender', 'age'],
[ProfileGroupType.Intention]: [
'cityCodes',
'employType',
'acceptWorkForSit',
'fullTimeMinPrice',
'fullTimeMaxPrice',
'partyTimeMinPrice',
'partyTimeMaxPrice',
],
[ProfileGroupType.Experience]: ['workedYear'],
[ProfileGroupType.Experience]: [],
[ProfileGroupType.Advantages]: [],
[ProfileGroupType.Others]: [],
};
const COULD_SKIP = [ProfileGroupType.Experience, ProfileGroupType.Others];
const CONDITIONAL_REQUIRED_KEYS = {
[ProfileGroupType.Intention]: [
['fullTimeMinPrice', data => isFullTimePriceRequired(data.employType)],
@ -52,11 +55,13 @@ const CONDITIONAL_REQUIRED_KEYS = {
const getNextStepGroupType = (curType: ProfileGroupType) => {
switch (curType) {
case ProfileGroupType.Basic:
return ProfileGroupType.Advantages;
case ProfileGroupType.Intention:
return ProfileGroupType.Experience;
case ProfileGroupType.Experience:
case ProfileGroupType.Intention:
return ProfileGroupType.Basic;
case ProfileGroupType.Experience:
return ProfileGroupType.Others;
case ProfileGroupType.Others:
return ProfileGroupType.Advantages;
default:
return null;
}
@ -88,7 +93,16 @@ export default function MaterialCreateProfile() {
? ProfileExperienceFragment
: groupType === ProfileGroupType.Advantages
? ProfileAdvantagesFragment
: Fragment;
: groupType === ProfileGroupType.Others
? ProfileOthersFragment
: Fragment;
const handleSkip = useCallback(() => {
const nextType = getNextStepGroupType(groupType);
if (nextType) {
setGroupType(nextType);
}
}, [groupType]);
const handleSubmit = useCallback(async () => {
try {
@ -123,14 +137,23 @@ export default function MaterialCreateProfile() {
Taro.setNavigationBarTitle({ title });
}, [groupType]);
const couldSkip = COULD_SKIP.includes(groupType);
return (
<div className={PREFIX}>
<ProfileFragment ref={ref} profile={{ cityCodes: location.cityCode || '' }} />
<SafeBottomPadding />
<div className={`${PREFIX}__footer`}>
<Button className={`${PREFIX}__submit-btn`} onClick={handleSubmit}>
<Button className={`${PREFIX}__submit-btn ${couldSkip ? 'up' : ''}`} onClick={handleSubmit}>
{groupType === ProfileGroupType.Advantages ? '完成' : '下一步'}
</Button>
{couldSkip && (
<div className={`${PREFIX}__skip-btn-wrapper`}>
<div className={`${PREFIX}__skip-btn`} onClick={handleSkip}>
</div>
</div>
)}
<SafeBottomPadding />
</div>
</div>