This commit is contained in:
梁朝伟 2022-07-12 14:18:33 +08:00
parent 4820fcf355
commit ba1969e4d9
11 changed files with 332 additions and 6 deletions

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,11 @@
/** index.wxss **/
.image {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
border: 1rpx solid #eee;
border-radius: 4rpx;
}

View File

@ -0,0 +1,51 @@
// index.ts
import { composeFileUrl } from "../../../../src/utils/extraFile";
export default OakComponent({
path: 'user:manage',
entity: 'user',
isList: true,
formData: async ({ data: user }) => {
const {
id,
nickname,
userState,
name,
mobile$user,
extraFile$entity,
} = user || {};
const mobile = mobile$user && mobile$user[0]?.mobile;
const avatar =
extraFile$entity &&
extraFile$entity[0] &&
composeFileUrl(extraFile$entity[0]);
return {
user,
nickname,
name,
mobile,
avatar,
userState,
};
},
properties: {
oakFullpath: String,
oakParent: String,
oakPath: String,
oakId: String,
},
data: {
stateColor: {
shadow: 'orange',
normal: 'green',
disabled: 'red'
}
},
methods: {
async onCellClicked(event: any) {
// resolveInput拿的是target原来代码拿的是currentTarget
this.pub(this.props.event, this.state.user);
},
},
});

View File

@ -0,0 +1,37 @@
import React, { Component } from 'react';
import { Card, Avatar, Tag, Space } from 'antd';
import {
PictureFilled,
} from '@ant-design/icons';
const { Meta } = Card;
export default function render() {
const { t } = this.props;
const { iState, name, mobile, nickname, avatar, stateColor, userState } = this.state;
return (
<div className="cell" onClick={(e) => this.onCellClicked(e)}>
{avatar ? (
<img className="avatar" src="{{item.avatar}}" />
) : (
<div className="img-view">
<PictureFilled />
</div>
)}
<div className="user-info">
<div className="row">
<div className="nickname">{nickname || '未设置'}</div>
<Tag color={stateColor[userState]}>
{userState}
</Tag>
</div>
<div className="name">
{name || '未设置'}</div>
<div className="mobile">
{mobile || '未设置'}
</div>
</div>
</div>
);
}

View File

View File

@ -1,9 +1,66 @@
import React, { Component } from 'react';
import { Button, Checkbox, Form, Input } from 'antd';
export default function render() {
return (
<div>
react
<Form
name="basic"
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}
initialValues={{ remember: true }}
autoComplete="off"
>
<Form.Item
label="姓名"
required
>
<Input
onChange={this.setValue}
oak:value="name"
/>
</Form.Item>
<Form.Item
label="手机号"
required
>
<Input
onChange={this.setValue}
oak:value="phone"
/>
</Form.Item>
<Form.Item
label="所在地区"
required
>
<Input
placeholder="所在地区"
onChange={this.setValue}
oak:value="areaText"
/>
</Form.Item>
<Form.Item
label="详细地址"
rules={[{ required: true, message: '请输入详细地址' }]}
>
<Input.TextArea showCount maxLength={100} oak:value="detail" />
</Form.Item>
</Form>
<Button
block
size="middle"
type="primary"
onClick={(event) => {
this.confirm();
}}
>
</Button>
</div>
);
}

View File

@ -1,9 +1,53 @@
import React, { Component } from 'react';
import * as React from 'react';
import { Input, Tooltip, Button } from 'antd';
const { Search } = Input;
import UserCell from '../../../components/user/cell';
export default function render() {
return (
<div>
react
<Search
placeholder="请输入"
value={this.state.searchValue || ''}
enterButton="搜索"
size="middle"
loading={this.state.oakLoading}
onChange={this.searchChange}
allowClear
onSearch={(value, event) => {
// value清空
if (value) {
this.searchConfirm();
} else {
this.searchCancel();
}
}}
/>
{this.state.userData?.map((ele, index) => {
return (
<UserCell
key={index}
oak:path={index.toString()}
oakId={ele.id}
/>
);
})}
<Tooltip title="创建">
<Button
className="add-btn"
type="primary"
shape="circle"
size="large"
onClick={(event) => {
this.goNewUser();
}}
>
+
</Button>
</Tooltip>
</div>
);
}
}

View File

@ -11,6 +11,11 @@
box-sizing: border-box;
.safe-area-inset-bottom();
}
.web-mobile-container {
display: flex;
flex-direction: column;
padding: @size-spacing-base;
}
.btn-view {
display: flex;
justify-content: center;

View File

@ -1,9 +1,95 @@
import React, { Component } from 'react';
import { Button, Checkbox, Form, Input, DatePicker, Radio } from 'antd';
import moment from 'moment';
export default function render() {
const onChange = (data, dataString) => {
this.setUpdateData('birth', data);
}
const { gender, GenderOptions, IDCardTypeOptions, birth } = this.state;
return (
<div>
react
<div className="web-mobile-container">
<Form
name="basic"
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}
initialValues={{ remember: true }}
autoComplete="off"
>
<Form.Item
label="昵称"
required
>
<Input
onChange={this.setValue}
oak:value="nickname"
/>
</Form.Item>
<Form.Item
label="姓名"
required
>
<Input
onChange={this.setValue}
oak:value="name"
/>
</Form.Item>
<Form.Item
label="出生日期"
required
>
<DatePicker onChange={onChange} value={moment(birth)} />
</Form.Item>
<Form.Item
label="性别"
required
>
<Radio.Group
options={GenderOptions}
onChange={this.setValue}
buttonStyle="solid"
optionType="button"
oak:value="gender"
/>
</Form.Item>
<Form.Item
label="证件类别"
required
>
<Radio.Group
options={IDCardTypeOptions}
onChange={this.setValue}
oak:value="idCardType"
optionType="button"
buttonStyle="solid"
/>
</Form.Item>
<Form.Item
label="证件号"
required
>
<Input
type="number"
onChange={this.setValue}
oak:value="idNumber"
/>
</Form.Item>
</Form>
<Button
block
size="middle"
type="primary"
onClick={(event) => {
this.confirm();
}}
>
</Button>
</div>
);
}

30
lib/aspects/aspectDict.d.ts vendored Normal file
View File

@ -0,0 +1,30 @@
import { EntityDict } from "general-app-domain";
import { WechatMpEnv } from "general-app-domain/Token/Schema";
import { QiniuUploadInfo } from "oak-frontend-base/src/types/Upload";
import { GeneralRuntimeContext } from "../RuntimeContext";
declare type GeneralAspectDict<ED extends EntityDict, Cxt extends GeneralRuntimeContext<ED>> = {
loginByPassword: (params: {
password: string;
mobile: string;
}, context: Cxt) => Promise<string>;
loginMp: (params: {
code: string;
}, context: Cxt) => Promise<string>;
loginWechatMp: ({ code, env }: {
code: string;
env: WechatMpEnv;
}, context: Cxt) => Promise<string>;
syncUserInfoWechatMp: ({ nickname, avatarUrl, encryptedData, iv, signature }: {
nickname: string;
avatarUrl: string;
encryptedData: string;
iv: string;
signature: string;
}, context: Cxt) => Promise<void>;
getUploadInfo: (params: {
origin: string;
fileName: string;
}, context: Cxt) => Promise<QiniuUploadInfo>;
};
export declare type AspectDict<ED extends EntityDict, Cxt extends GeneralRuntimeContext<ED>> = GeneralAspectDict<ED, Cxt>;
export {};

View File

@ -3,8 +3,11 @@
"version": "1.0.0",
"description": "oak框架中公共业务逻辑的实现",
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@fingerprintjs/fingerprintjs": "^3.3.3",
"antd": "^4.21.5",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"oak-common-aspect": "file:../oak-common-aspect",
"oak-domain": "file:../oak-domain",
"oak-external-sdk": "file:../oak-external-sdk",