能够发送 /user/kyc1 请求给后台了

This commit is contained in:
luk.lu
2019-10-12 11:14:04 +08:00
parent 95da22e0bf
commit a23a80ed19
5 changed files with 23 additions and 18 deletions

View File

@@ -180,7 +180,7 @@ export default {
'identity.idphoto': 'ID Photo', 'identity.idphoto': 'ID Photo',
'identity.idtypes': {idcard:'id card', passport:'passport'}, 'identity.idtypes': {idcard:'id card', passport:'passport'},
'identity.chooseIdtype': 'Type of id cards', 'identity.chooseIdtype': 'Type of id cards',
'identity.real1btn': 'Submit', 'identity.kyc1btn': 'Submit',
'identity.real2btn': 'Go to 2nd level of KYC', 'identity.real2btn': 'Go to 2nd level of KYC',
'system.title': 'Settings', 'system.title': 'Settings',

View File

@@ -180,7 +180,7 @@ export default {
'identity.idphoto': '证件照片', 'identity.idphoto': '证件照片',
'identity.idtypes': {idcard:'身份证', passport:'护照'}, 'identity.idtypes': {idcard:'身份证', passport:'护照'},
'identity.chooseIdtype': '选择证件类型', 'identity.chooseIdtype': '选择证件类型',
'identity.real1btn': '提交', 'identity.kyc1btn': '提交',
'identity.real2btn': '进入二级实名认证', 'identity.real2btn': '进入二级实名认证',
'system.title': '我的设置', 'system.title': '我的设置',

View File

@@ -96,13 +96,13 @@ const IdentityPage: React.FC<DispatchProp & UserModelState & IdentityModelState>
type="primary" type="primary"
size="large" size="large"
loading={kyc1Submitting} loading={kyc1Submitting}
onClick={() => dispatch({ type: 'identity/real1submit' })} onClick={() => dispatch({ type: 'identity/kyc1submit' })}
>{formatMessage({ id: 'identity.real1btn' })}</Button> >{formatMessage({ id: 'identity.kyc1btn' })}</Button>
</div>} </div>}
</div> </div>
); );
}; };
export default connect( export default connect(
({ user, account }: any) => ({ ...user, ...account }), ({ user, identity }: any) => ({ ...user, ...identity }),
)(IdentityPage); )(IdentityPage);

View File

@@ -1,5 +1,5 @@
import { Model } from 'dva'; import { Model } from 'dva';
import { changeName } from './service'; import { kyc1 } from './service';
import { message } from 'antd'; import { message } from 'antd';
export interface IdentityModelState { export interface IdentityModelState {
@@ -20,23 +20,26 @@ const model: Model = {
} as IdentityModelState, } as IdentityModelState,
effects: { effects: {
*changeName(_, { put, all, call, select }) { *kyc1submit(_, { put, all, call, select }) {
const { nameInput } = yield select((state: any) => state.account); // console.info('kyc1 submitting............')
if (!nameInput) return; // const { idcode } = yield select((state:any) => state.identity)
// if (!idcode) return
yield put({ type: 'onUpdateState', nameSubmitting: true }); yield put({ type: 'onUpdateState', kyc1Submitting: true })
try { try {
yield call(changeName, nameInput); yield call(kyc1, {idcode:'模拟的idcode字符串', realname:'是谁呢'})
yield all([
/* yield all([
put({ type: 'onUpdateState', nameInput: '', nameEditable: false }), put({ type: 'onUpdateState', nameInput: '', nameEditable: false }),
put({ type: 'user/updateUser', payload: { nickname: nameInput } }), put({ type: 'user/updateUser', payload: { nickname: nameInput } }),
]); ]);
*/
} catch (e) { } catch (e) {
message.error(e.message); message.error(e.message)
} finally { } finally {
yield put({ type: 'onUpdateState', nameSubmitting: false }); yield put({ type: 'onUpdateState', kyc1Submitting: false})
}
} }
},
}, },
reducers: { reducers: {

View File

@@ -1,7 +1,9 @@
import http from '@/utils/http'; import http from '@/utils/http';
export async function changeName(nickname: string) { export async function kyc1(kyc1info: object) {
const { ok, msg } = await http.post('/user/chnickname', { nickname }); // console.info('进入了 service.ts 调用 kyc1......')
const { ok, msg } = await http.post('/user/kyc1', kyc1info);
if (ok) { if (ok) {
return true; return true;
} }