address测试frontpage的改动
This commit is contained in:
parent
c2385e2cd9
commit
7774aea40e
|
|
@ -76,5 +76,5 @@
|
|||
"test": "ts-node ./test/test.ts",
|
||||
"prepare": "rimraf node_modules/react & rimraf node_modules/react-dom & rimraf node_modules/react-router"
|
||||
},
|
||||
"main": "lib/index"
|
||||
"main": "src/index"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ const checkers: Checker<EntityDict, 'address', RuntimeContext<EntityDict>> [] =
|
|||
data.forEach(
|
||||
ele => {
|
||||
const a: Exclude<keyof EntityDict['address']['OpSchema'], 'aa'> = 'name';
|
||||
checkAttributesNotNull('address', ele, ['name', 'detail', 'phone', 'areaId']);
|
||||
checkAttributesNotNull('address', ele, ['name', 'detail', 'phone'/* , 'areaId' */]);
|
||||
if (!isMobile(ele.phone)) {
|
||||
throw new OakInputIllegalException('address', ['phone'], '手机号非法');
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@ const checkers: Checker<EntityDict, 'address', RuntimeContext<EntityDict>> [] =
|
|||
);
|
||||
}
|
||||
else {
|
||||
checkAttributesNotNull('address', data, ['name', 'detail', 'phone', 'areaId']);
|
||||
checkAttributesNotNull('address', data, ['name', 'detail', 'phone'/* , 'areaId' */]);
|
||||
if (!isMobile(data.phone)) {
|
||||
throw new OakInputIllegalException('address', ['phone'], '手机号非法');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ export default OakComponent({
|
|||
isList: true,
|
||||
formData: async ({ data }) => ({
|
||||
addresses: data.map((address) => ({
|
||||
id: address?.id,
|
||||
name: address?.name!,
|
||||
phone: address?.phone!,
|
||||
districtName: address?.area?.name!,
|
||||
|
|
@ -38,5 +39,11 @@ export default OakComponent({
|
|||
url: '/address/upsert',
|
||||
});
|
||||
},
|
||||
gotoUpsert(oakId: string) {
|
||||
this.navigateTo({
|
||||
url: '/address/upsert',
|
||||
oakId,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
@ -9,7 +9,7 @@ export default function render(this: any) {
|
|||
return (
|
||||
<List>
|
||||
{addresses.map((address: Record<string, any>) => (
|
||||
<List.Item key={address.id}>
|
||||
<List.Item key={address.id} onClick={() => this.gotoUpsert(address.id)}>
|
||||
<List.Item.Meta
|
||||
title={address.name}
|
||||
description={address.areaText + address.detail}
|
||||
|
|
|
|||
|
|
@ -47,9 +47,7 @@ export default OakComponent({
|
|||
},
|
||||
async confirm() {
|
||||
await this.execute();
|
||||
if (this.props.oakFrom === 'address:list') {
|
||||
this.navigateBack();
|
||||
}
|
||||
this.navigateBack();
|
||||
},
|
||||
reset() {
|
||||
this.cleanOperation();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { Button, Input, Form } from 'antd';
|
|||
import { RightOutlined } from '@ant-design/icons';
|
||||
import Style from './web.module.less';
|
||||
|
||||
export default function render(this: any) {
|
||||
export default function Render(this: any) {
|
||||
const PickArea = (
|
||||
<Button
|
||||
type="text"
|
||||
|
|
@ -11,8 +11,20 @@ export default function render(this: any) {
|
|||
onClick={() => this.callAreaPicker()}
|
||||
/>
|
||||
);
|
||||
console.log(this.state.name);
|
||||
return (
|
||||
<div className={Style.container}>
|
||||
<Input
|
||||
placeholder="姓名2"
|
||||
onChange={(e) => this.setUpdateData('name', e.target.value)}
|
||||
value={this.state.name}
|
||||
data-attr="name"
|
||||
status={
|
||||
this.state.oakFocused?.attr === 'name'
|
||||
? 'error'
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
<Form colon={false} layout="vertical">
|
||||
<Form.Item
|
||||
label={this.t('address:attr.name')}
|
||||
|
|
|
|||
Loading…
Reference in New Issue