From 2466d80b566d910ffc64b45e81a7e47cb675fbe8 Mon Sep 17 00:00:00 2001 From: zhoux Date: Thu, 21 Dec 2023 17:33:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9Espin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/ShowInfo.tsx | 161 ++++++++++++++++++++++------------------- 1 file changed, 88 insertions(+), 73 deletions(-) diff --git a/src/pages/ShowInfo.tsx b/src/pages/ShowInfo.tsx index 719c284..f971860 100644 --- a/src/pages/ShowInfo.tsx +++ b/src/pages/ShowInfo.tsx @@ -1,4 +1,5 @@ import { + PageContainer, ProCard, ProForm, ProFormDependency, @@ -6,97 +7,111 @@ import { ProFormText, ProFormUploadDragger, } from '@ant-design/pro-components'; -import { Form, Image } from 'antd'; -import React, { useState } from 'react'; +import { Button, Form, Image, Spin, SpinProps } from 'antd'; +import React, { useEffect, useState } from 'react'; // @ts-ignore import cookie from 'react-cookies'; -import axios from 'axios'; +import { API } from 'types'; const ShowInfoDemo: React.FC = () => { const [form] = Form.useForm(); const [imageUrl, setImageUrl] = useState(''); - // useEffect(()=>{ + // 是否需要加载中 + const [isLoading, setIsLoading] = useState(false); - // }, []) const initialValues = { cardCode: '200100199508081010', gender: '男', }; + + return (
- -
- { - const reader = new FileReader(); - reader.onload = (e) => { - setImageUrl(e.target?.result as string); - }; + + + + +
+ { + setIsLoading(true) + const reader = new FileReader(); + reader.onload = (e) => { + setImageUrl(e.target?.result as string); + }; - reader.readAsDataURL(file); + reader.readAsDataURL(file); - // 返回 false 可以阻止上传 - // 返回 Promise 可以异步操作 - return true; - }, - maxCount: 1, - name: 'file', - // beforeUpload: beforeUploadFile, - headers: { - 'X-CSRFToken': cookie.load('csrftoken'), - }, - }} - > - - + // 返回 false 可以阻止上传 + // 返回 Promise 可以异步操作 + return true; + }, + + maxCount: 1, + name: 'file', + // beforeUpload: beforeUploadFile, + headers: { + 'X-CSRFToken': cookie.load('csrftoken'), + }, + }} + > + + - {/* + {/* */} -
+
- {/* 展示信息 */} -
- - [ - // TODO 使用接口数据与 initialValues 值对应 - { label: '证件号码', value: 'cardCode' }, - { label: '性别', value: 'gender' }, - ]} - name="name1" - label="展示数据" - /> - - {({ name1 }) => { - if (name1) { - console.log(name1, 'ProFormDependency_name1'); - return ( - - ); - } - return <>; - }} - - -
-
+ {/* 展示信息 */} +
+ + [ + // TODO 使用接口数据与 initialValues 值对应 + { label: '证件号码', value: 'cardCode' }, + { label: '性别', value: 'gender' }, + ]} + name="name1" + label="展示数据" + /> + + {({ name1 }) => { + if (name1) { + console.log(name1, 'ProFormDependency_name1'); + return ( + + ); + } + return <>; + }} + + +
+ +
); };