Commit 9b17346a authored by 前端-许佳敏's avatar 前端-许佳敏

优化按钮loading

parent fb9a0460
......@@ -65,6 +65,7 @@ const actions = createFormActions()
const UserRegistry = () => {
const [current, setCurrent] = useState(0)
const [subStep, setSubStep] = useState(false)
const [submitLoading, setSubmitLoading] = useState(false)
const stepList = [
{ title: '填写信息', key: 'message', name: 'message' },
{ title: '完善资料', key: 'over', name: 'over' },
......@@ -151,6 +152,7 @@ const UserRegistry = () => {
const { values } = data
formCache = Object.assign({},formCache, filterUndef(values))
const { businessTypeId, typeId } = values
setSubmitLoading(true)
PublicApi.getMemberMenuRegisterDetail({
businessTypeId,
memberTypeId: typeId
......@@ -163,6 +165,8 @@ const UserRegistry = () => {
}
}).catch(() => {
}).finally(() => {
setSubmitLoading(false)
})
})
}
......@@ -175,6 +179,7 @@ const UserRegistry = () => {
// 写死传入的区号
formCache.countryCode = '+86'
const params = omit(formCache, ['isRead', 'confirmPassword'])
setSubmitLoading(true)
PublicApi.postMemberRegister(params).then(({code}) => {
if (code === 1000) {
actions.dispatch('onFormStepNext', {})
......@@ -184,6 +189,8 @@ const UserRegistry = () => {
}).catch(() => {
// 调用接口后 失败需清空缓存的数据
formCache = {}
}).finally(() => {
setSubmitLoading(false)
})
})
}
......@@ -221,11 +228,11 @@ const UserRegistry = () => {
}
{
current === 1 && !subStep &&
<Button type='primary' className={'continueButton'} onClick={nextStepAction}>下一步:继续完善</Button>
<Button type='primary' className={'continueButton'} onClick={nextStepAction} loading={submitLoading}>下一步:继续完善</Button>
}
{
current === 1 && subStep &&
<Button type='primary' className={'continueButton'} onClick={submitForm}>提交注册资料</Button>
<Button type='primary' className={'continueButton'} onClick={submitForm} loading={submitLoading}>提交注册资料</Button>
}
</div>
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment