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

@ -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>
);