upload
This commit is contained in:
@@ -17,6 +17,7 @@ import { IdentityModelState } from './model';
|
||||
|
||||
import kycIdCover from '@/assets/kycIdCover.svg';
|
||||
import kycIdBack from '@/assets/kycIdBack.svg'
|
||||
import http from '@/utils/http';
|
||||
|
||||
const idtypes = [
|
||||
{key:'idcard', value:'身份证'},
|
||||
@@ -40,6 +41,8 @@ const IdentityPage: React.FC<DispatchProp & UserModelState & IdentityModelState>
|
||||
const picBack = React.createRef();
|
||||
const [idtypesVisible, setIdtypesVisible] = useState(false);
|
||||
const [nationVisible, setNationVisible] = useState(false);
|
||||
const [realname, setRealname] = useState();
|
||||
const [idNo, setIdNo] = useState();
|
||||
|
||||
const onPicCover = (key: any) => {
|
||||
console.log(key);
|
||||
@@ -79,7 +82,7 @@ const IdentityPage: React.FC<DispatchProp & UserModelState & IdentityModelState>
|
||||
title={formatMessage({ id: 'identity.chooseIdtype' })}
|
||||
/>
|
||||
);
|
||||
const submitHandler = () => {
|
||||
const submitHandler = async () => {
|
||||
const formData = new FormData();
|
||||
const pic1 = picCover.current.files[0];
|
||||
const pic2 = picBack.current.files[0];
|
||||
@@ -87,10 +90,10 @@ const IdentityPage: React.FC<DispatchProp & UserModelState & IdentityModelState>
|
||||
// const p2 = new FileReader(pic2);
|
||||
formData.append('pic1', pic1);
|
||||
formData.append('pic2', pic2);
|
||||
/**
|
||||
可以在这里直接
|
||||
axios.post(url, formData)
|
||||
*/
|
||||
formData.append('realname', realname);
|
||||
formData.append('idNo', idNo);
|
||||
const data = await http.post('/user/verify', formData);
|
||||
console.log(data);
|
||||
}
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
@@ -102,8 +105,8 @@ const IdentityPage: React.FC<DispatchProp & UserModelState & IdentityModelState>
|
||||
<input className={styles.myinput}
|
||||
placeholder={formatMessage({ id: 'identity.idcode' })}
|
||||
name="idcode"
|
||||
value={user.idcode}
|
||||
onChange={e => dispatch({ type: 'identity/onUpdateState', idcode: e.target.value })}
|
||||
value={idNo}
|
||||
onChange={e => setIdNo(e.target.value)}
|
||||
/>
|
||||
<div style={{'display': 'flex', 'position': 'relative'}}>
|
||||
<div className={styles.uploadBox}>
|
||||
@@ -122,8 +125,8 @@ const IdentityPage: React.FC<DispatchProp & UserModelState & IdentityModelState>
|
||||
<input className={styles.myinput}
|
||||
placeholder={formatMessage({ id: 'identity.realname' })}
|
||||
name="realname"
|
||||
value={user.realname}
|
||||
onChange={e => dispatch({ type: 'identity/onUpdateState', realname: e.target.value })}
|
||||
value={realname}
|
||||
onChange={e => setRealname(e.target.value)}
|
||||
/>
|
||||
{/* <AccountItem
|
||||
className="group"
|
||||
|
||||
Reference in New Issue
Block a user