diff --git a/apps/admin/src/views/compo/image-upload.tsx b/apps/admin/src/views/compo/image-upload.tsx index 86f1b97e..a5302f05 100644 --- a/apps/admin/src/views/compo/image-upload.tsx +++ b/apps/admin/src/views/compo/image-upload.tsx @@ -1,7 +1,5 @@ import { CloudUploadOutlined, PlusOutlined } from '@ant-design/icons'; -import { - Button, Card, Col, Modal, Row, Upload, -} from 'antd'; +import { Button, Card, Col, Modal, Row, Upload } from 'antd'; import React, { useState } from 'react'; import { PageWrapper } from '@/components/Page'; @@ -48,12 +46,13 @@ const ImageUpload: React.FC = () => { setPreviewTitle(file.name || file.url!.substring(file.url!.lastIndexOf('/') + 1)); }; - const getBase64 = (file: RcFile): Promise => new Promise((resolve, reject) => { - const reader = new FileReader(); - reader.readAsDataURL(file); - reader.onload = () => resolve(reader.result as string); - reader.onerror = (error) => reject(error); - }); + const getBase64 = (file: RcFile): Promise => + new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => resolve(reader.result as string); + reader.onerror = (error) => reject(error); + }); const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => setListImgs(newFileList); @@ -73,11 +72,13 @@ const ImageUpload: React.FC = () => { accept='.jpg, .jpeg, .gif, .png, .bmp' multiple > -

+

-

将图片拖到此处, 或点击上传

-

只能上传jpg、jpeg、gif、png、bmp文件, 且不超过500kb

+

+ 将图片拖到此处, 或点击上传 +

+

只能上传jpg、jpeg、gif、png、bmp文件, 且不超过500kb

@@ -94,7 +95,7 @@ const ImageUpload: React.FC = () => { 点击上传 -

只能上传jpg、jpeg、gif、png、bmp文件, 且不超过500kb

+

只能上传jpg、jpeg、gif、png、bmp文件, 且不超过500kb

@@ -115,12 +116,7 @@ const ImageUpload: React.FC = () => { - + diff --git a/apps/admin/src/views/user/addUser/index.tsx b/apps/admin/src/views/user/addUser/index.tsx index fb5858f0..597ba17a 100644 --- a/apps/admin/src/views/user/addUser/index.tsx +++ b/apps/admin/src/views/user/addUser/index.tsx @@ -1,17 +1,63 @@ -import { Card, Col, Flex, Row, Upload } from 'antd'; +import { Card, Col, Flex, Row, Tag, Upload } from 'antd'; +import { GButton, GForm } from 'gbeata'; +import { useNavigate } from 'react-router-dom'; import { SvgIcon, Translatex } from 'ui'; import useStyles from './style'; +import type { FormValues } from 'gbeata/lib/types/FormValues'; import type { FC } from 'react'; interface PAddUser { onAdd?: (user: any) => void; } -const AddUser: FC = ({ onAdd = () => {} }) => { +const AddUser: FC = () => { + const navigate = useNavigate(); const { Dragger } = Upload; const { styles } = useStyles(); + const fields = [ + { + title: '全名', + key: 'input', + required: true, + defaultValue: 'Gbeata', + }, + { + title: '密码', + type: 'password', + key: 'password', + defaultValue: 'gbeata', + }, + { + title: '城市', + type: 'select', + key: 'select', + defaultValue: 1, + options: [ + { label: 选项A, value: 1 }, + { label: '选项2', value: 2 }, + ], + }, + { + title: '电话号码', + key: 'number', + required: true, + defaultValue: 15305999999, + }, + { + title: '地址', + type: 'textarea', + key: 'textarea', + defaultValue: '广东省深圳市南山区科技园', + span: 24, + }, + ]; + + const onFinish = (form: FormValues) => { + console.log(form); + navigate('/user/user-list'); + }; return ( @@ -31,13 +77,23 @@ const AddUser: FC = ({ onAdd = () => {} }) => {

- 将图片拖到此处, 或点击上传 + 将图片拖到此处, 或点击上传

只能上传jpg、jpeg、gif、png、bmp文件, 且不超过500kb

- 2 + + + + + + 创建用户 + + + + +
); diff --git a/apps/admin/src/views/user/addUser/style.ts b/apps/admin/src/views/user/addUser/style.ts index 6b6f0732..d13af7cd 100644 --- a/apps/admin/src/views/user/addUser/style.ts +++ b/apps/admin/src/views/user/addUser/style.ts @@ -45,6 +45,9 @@ const useStyles = createStyles(({ token }) => ({ borderRadius: token.borderRadiusLG, }, }, + 'btn-submit': { + width: '100%', + }, })); export default useStyles; diff --git a/apps/admin/src/views/user/list/index.tsx b/apps/admin/src/views/user/list/index.tsx index 7d4ca534..956d50e4 100644 --- a/apps/admin/src/views/user/list/index.tsx +++ b/apps/admin/src/views/user/list/index.tsx @@ -2,6 +2,7 @@ import { PlusOutlined } from '@ant-design/icons'; import { useRequest } from 'ahooks'; import { Button, Col, Flex, Row } from 'antd'; import { useEffect, useState } from 'react'; +import { useNavigate } from 'react-router-dom'; import UserCard from '@/components/UserCard'; @@ -23,6 +24,7 @@ interface PUSerList { const UserList: FC = () => { const { styles, theme, cx } = useStyles(); + const navigate = useNavigate(); const [tableTableData, setTableTableData] = useState([]); const { data: user, loading } = useRequest(getUsersList); @@ -33,7 +35,12 @@ const UserList: FC = () => { return ( - diff --git a/packages/gbeata/package.json b/packages/gbeata/package.json index 9948c205..bde3a6b3 100644 --- a/packages/gbeata/package.json +++ b/packages/gbeata/package.json @@ -15,7 +15,7 @@ "license": "MIT", "main": "lib/index.js", "module": "es/index.js", - "types": "dist/index.d.ts", + "types": "dist/esm/index.d.ts", "typings": "lib/index.d.ts", "files": [ "dist",