能够发送 /user/kyc1 请求给后台了
This commit is contained in:
@@ -180,7 +180,7 @@ export default {
|
||||
'identity.idphoto': 'ID Photo',
|
||||
'identity.idtypes': {idcard:'id card', passport:'passport'},
|
||||
'identity.chooseIdtype': 'Type of id cards',
|
||||
'identity.real1btn': 'Submit',
|
||||
'identity.kyc1btn': 'Submit',
|
||||
'identity.real2btn': 'Go to 2nd level of KYC',
|
||||
|
||||
'system.title': 'Settings',
|
||||
|
||||
@@ -180,7 +180,7 @@ export default {
|
||||
'identity.idphoto': '证件照片',
|
||||
'identity.idtypes': {idcard:'身份证', passport:'护照'},
|
||||
'identity.chooseIdtype': '选择证件类型',
|
||||
'identity.real1btn': '提交',
|
||||
'identity.kyc1btn': '提交',
|
||||
'identity.real2btn': '进入二级实名认证',
|
||||
|
||||
'system.title': '我的设置',
|
||||
|
||||
@@ -96,13 +96,13 @@ const IdentityPage: React.FC<DispatchProp & UserModelState & IdentityModelState>
|
||||
type="primary"
|
||||
size="large"
|
||||
loading={kyc1Submitting}
|
||||
onClick={() => dispatch({ type: 'identity/real1submit' })}
|
||||
>{formatMessage({ id: 'identity.real1btn' })}</Button>
|
||||
onClick={() => dispatch({ type: 'identity/kyc1submit' })}
|
||||
>{formatMessage({ id: 'identity.kyc1btn' })}</Button>
|
||||
</div>}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default connect(
|
||||
({ user, account }: any) => ({ ...user, ...account }),
|
||||
({ user, identity }: any) => ({ ...user, ...identity }),
|
||||
)(IdentityPage);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Model } from 'dva';
|
||||
import { changeName } from './service';
|
||||
import { kyc1 } from './service';
|
||||
import { message } from 'antd';
|
||||
|
||||
export interface IdentityModelState {
|
||||
@@ -20,23 +20,26 @@ const model: Model = {
|
||||
} as IdentityModelState,
|
||||
|
||||
effects: {
|
||||
*changeName(_, { put, all, call, select }) {
|
||||
const { nameInput } = yield select((state: any) => state.account);
|
||||
if (!nameInput) return;
|
||||
|
||||
yield put({ type: 'onUpdateState', nameSubmitting: true });
|
||||
*kyc1submit(_, { put, all, call, select }) {
|
||||
// console.info('kyc1 submitting............')
|
||||
// const { idcode } = yield select((state:any) => state.identity)
|
||||
// if (!idcode) return
|
||||
yield put({ type: 'onUpdateState', kyc1Submitting: true })
|
||||
try {
|
||||
yield call(changeName, nameInput);
|
||||
yield all([
|
||||
yield call(kyc1, {idcode:'模拟的idcode字符串', realname:'是谁呢'})
|
||||
|
||||
/* yield all([
|
||||
put({ type: 'onUpdateState', nameInput: '', nameEditable: false }),
|
||||
put({ type: 'user/updateUser', payload: { nickname: nameInput } }),
|
||||
]);
|
||||
*/
|
||||
|
||||
} catch (e) {
|
||||
message.error(e.message);
|
||||
message.error(e.message)
|
||||
} finally {
|
||||
yield put({ type: 'onUpdateState', nameSubmitting: false });
|
||||
yield put({ type: 'onUpdateState', kyc1Submitting: false})
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
reducers: {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import http from '@/utils/http';
|
||||
|
||||
export async function changeName(nickname: string) {
|
||||
const { ok, msg } = await http.post('/user/chnickname', { nickname });
|
||||
export async function kyc1(kyc1info: object) {
|
||||
// console.info('进入了 service.ts 调用 kyc1......')
|
||||
|
||||
const { ok, msg } = await http.post('/user/kyc1', kyc1info);
|
||||
if (ok) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user