手机号授权页面,直接判断是否是新的有问题,改成成上层传下去

This commit is contained in:
wangwenchen 2024-01-30 15:57:26 +08:00
parent 6b97c47eca
commit 917eaec869
7 changed files with 13 additions and 6 deletions

View File

@ -11,6 +11,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'mobile', fa
passwordRequire: boolean; passwordRequire: boolean;
allowUpdateName?: boolean; allowUpdateName?: boolean;
allowUpdateNickname?: boolean; allowUpdateNickname?: boolean;
isNew: boolean;
}, { }, {
onMobileChange: (value: string) => Promise<void>; onMobileChange: (value: string) => Promise<void>;
onConfirm: () => Promise<void>; onConfirm: () => Promise<void>;

View File

@ -3,7 +3,7 @@ import { Form, Input, Button } from 'antd-mobile';
import Style from './web.module.less'; import Style from './web.module.less';
import OnUser from '../onUser/index'; import OnUser from '../onUser/index';
export default function Render(props) { export default function Render(props) {
const { mobileValue, mobileValueReady, relations, entity, entityId, userId, oakFullpath, oakExecutable, oakDirty, passwordRequire, allowUpdateName, allowUpdateNickname, } = props.data; const { mobileValue, mobileValueReady, relations, entity, entityId, userId, oakFullpath, oakExecutable, oakDirty, passwordRequire, allowUpdateName, allowUpdateNickname,isNew } = props.data;
const { onConfirm, onMobileChange, onReset, t } = props.methods; const { onConfirm, onMobileChange, onReset, t } = props.methods;
return (<Form footer={<div className={Style.btnContainer}> return (<Form footer={<div className={Style.btnContainer}>
<Button color="primary" style={{ flex: 2 }} onClick={() => { <Button color="primary" style={{ flex: 2 }} onClick={() => {
@ -35,6 +35,6 @@ export default function Render(props) {
}} placeholder={t('inputMobile')} type="tel" clearable/> }} placeholder={t('inputMobile')} type="tel" clearable/>
</> </>
</Form.Item> </Form.Item>
{mobileValueReady && (<OnUser oakAutoUnmount={true} oakPath={`${oakFullpath}.user`} entity={entity} entityId={entityId} relations={relations} passwordRequire={passwordRequire} allowUpdateName={allowUpdateName} allowUpdateNickname={allowUpdateNickname}/>)} {mobileValueReady && (<OnUser oakAutoUnmount={true} oakPath={`${oakFullpath}.user`} entity={entity} entityId={entityId} relations={relations} passwordRequire={passwordRequire} allowUpdateName={allowUpdateName} allowUpdateNickname={allowUpdateNickname} isNew={isNew} />)}
</Form>); </Form>);
} }

View File

@ -29,7 +29,7 @@ export default function Render(props) {
}} placeholder="请输入手机号码" type="tel"/> }} placeholder="请输入手机号码" type="tel"/>
</Form.Item> </Form.Item>
</Form> </Form>
{mobileValueReady && (<OnUser oakAutoUnmount={true} oakPath={`${oakFullpath}.user`} entity={entity} entityId={entityId} relations={relations} setPasswordConfirm={setPasswordConfirm} passwordRequire={passwordRequire} allowUpdateName={allowUpdateName} allowUpdateNickname={allowUpdateNickname}/>)} {mobileValueReady && (<OnUser oakAutoUnmount={true} oakPath={`${oakFullpath}.user`} entity={entity} entityId={entityId} relations={relations} setPasswordConfirm={setPasswordConfirm} passwordRequire={passwordRequire} allowUpdateName={allowUpdateName} allowUpdateNickname={allowUpdateNickname} isNew={isNew} />)}
<Form colon labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}> <Form colon labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}>
<Form.Item wrapperCol={{ offset: 4 }}> <Form.Item wrapperCol={{ offset: 4 }}>
<Space> <Space>

View File

@ -63,7 +63,7 @@ export default OakComponent({
password, password,
name, name,
nickname, nickname,
isNew: $$createAt$$ === 1, // isNew: $$createAt$$ === 1,
}; };
}, },
properties: { properties: {
@ -75,5 +75,6 @@ export default OakComponent({
passwordRequire: false, passwordRequire: false,
allowUpdateName: false, allowUpdateName: false,
allowUpdateNickname: false, allowUpdateNickname: false,
isNew: false,
}, },
}); });

View File

@ -91,6 +91,7 @@ export default function Render(
passwordRequire={passwordRequire} passwordRequire={passwordRequire}
allowUpdateName={allowUpdateName} allowUpdateName={allowUpdateName}
allowUpdateNickname={allowUpdateNickname} allowUpdateNickname={allowUpdateNickname}
isNew={isNew}
/> />
)} )}
<Form colon labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}> <Form colon labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}>

View File

@ -20,6 +20,7 @@ export default function Render(
passwordRequire: boolean; passwordRequire: boolean;
allowUpdateName?: boolean; allowUpdateName?: boolean;
allowUpdateNickname?: boolean; allowUpdateNickname?: boolean;
isNew: boolean;
}, },
{ {
onMobileChange: (value: string) => Promise<void>; onMobileChange: (value: string) => Promise<void>;
@ -41,6 +42,7 @@ export default function Render(
passwordRequire, passwordRequire,
allowUpdateName, allowUpdateName,
allowUpdateNickname, allowUpdateNickname,
isNew,
} = props.data; } = props.data;
const { onConfirm, onMobileChange, onReset, t } = props.methods; const { onConfirm, onMobileChange, onReset, t } = props.methods;
return ( return (
@ -104,6 +106,7 @@ export default function Render(
passwordRequire={passwordRequire} passwordRequire={passwordRequire}
allowUpdateName={allowUpdateName} allowUpdateName={allowUpdateName}
allowUpdateNickname={allowUpdateNickname} allowUpdateNickname={allowUpdateNickname}
isNew={isNew}
/> />
)} )}
</Form> </Form>

View File

@ -68,7 +68,7 @@ export default OakComponent({
password, password,
name, name,
nickname, nickname,
isNew: $$createAt$$ === 1, // isNew: $$createAt$$ === 1,
}; };
}, },
properties: { properties: {
@ -76,9 +76,10 @@ export default OakComponent({
entityId: '', entityId: '',
relations: [] as EntityDict['relation']['OpSchema'][], relations: [] as EntityDict['relation']['OpSchema'][],
mobile: '', mobile: '',
setPasswordConfirm: (value: boolean) => {}, setPasswordConfirm: (value: boolean) => { },
passwordRequire: false, passwordRequire: false,
allowUpdateName: false, allowUpdateName: false,
allowUpdateNickname: false, allowUpdateNickname: false,
isNew: false,
}, },
}); });