Commit c0d3cd9b authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复 资质证明 未展示的问题

parent d76b76d7
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-05-26 16:52:48
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-30 10:22:49
* @LastEditTime: 2021-07-03 14:50:48
* @Description: 申请会员
*/
import React, { useState, useEffect, useRef } from 'react';
......@@ -21,6 +21,7 @@ import ReutrnEle from '@/components/ReturnEle';
import NiceForm from '@/components/NiceForm';
import MellowCard from '@/components/MellowCard';
import { PublicApi } from '@/services/api';
import { normalizeFiledata, FileData } from '@/utils';
import schema, { GroupItem } from './schema';
import { useBusinessEffects } from '../../components/QualitiesUploadFormItem/effects';
import ComingAgreement from './components/ComingAgreement';
......@@ -66,6 +67,16 @@ type ValueType = {
},
}
interface MemberInfo {
step4: {
qualities: {
file: FileData[],
expireDay: string,
permanent: number[],
}[],
},
}
let countDownLen = 10;
const formActions = createFormActions();
......@@ -86,6 +97,7 @@ const MemberQueryApplyMember: React.FC = () => {
const [loading, setLoading] = useState(false);
const [agreement, setAgreement] = useState('');
const [agreementLoading, setAgreementLoading] = useState(false);
const [memberInfo, setMemberInfo] = useState<MemberInfo>();
const stepRef = useRef(!validateId ? 0 : 1);
......@@ -131,7 +143,17 @@ const MemberQueryApplyMember: React.FC = () => {
validateId: `${validateId}`,
});
if (res.code === 1000) {
const qualities = res.data.qualities || [];
setDepositInfo(res.data.groups);
setMemberInfo({
step4: {
qualities: qualities.map((item) => ({
file: item.url ? [normalizeFiledata(item.url)] : [],
expireDay: item.expireDay,
permanent: item.permanent === 1 ? [item.permanent] : [],
}))
},
});
}
setLoading(false);
};
......@@ -172,6 +194,16 @@ const MemberQueryApplyMember: React.FC = () => {
content: '正在保存,请稍候...',
duration: 0,
});
const commonPayload = {
qualities: qualities.map((item) => ({
expireDay: item.expireDay || '',
permanent: item.permanent && item.permanent[0] || 0,
url: item.file && item.file[0] ? item.file[0].url : '',
name: item.file && item.file[0] ? item.file[0].name : '',
})),
};
if (!validateId) {
if ((!upperMemberId || !upperRoleId)) {
return;
......@@ -180,12 +212,7 @@ const MemberQueryApplyMember: React.FC = () => {
upperMemberId,
upperRoleId,
depositDetails: step3,
qualities: qualities.map((item) => ({
expireDay: item.expireDay || '',
permanent: item.permanent && item.permanent[0] || 0,
url: item.file && item.file[0] ? item.file[0].url : '',
name: item.file && item.file[0] ? item.file[0].name : '',
})),
...commonPayload,
}).then(res => {
if (res.code !== 1000) {
return;
......@@ -200,12 +227,7 @@ const MemberQueryApplyMember: React.FC = () => {
PublicApi.postMemberAbilityInfoDepositDetailUpdate({
validateId,
detail: step3,
qualities: qualities.map((item) => ({
expireDay: item.expireDay || '',
permanent: item.permanent && item.permanent[0] || 0,
url: item.file && item.file[0] ? item.file[0].url : '',
name: item.file && item.file[0] ? item.file[0].name : '',
})),
...commonPayload,
}).then(res => {
if (res.code !== 1000) {
return;
......@@ -320,7 +342,7 @@ const MemberQueryApplyMember: React.FC = () => {
previewPlaceholder=" "
onSubmit={handleSubmit}
actions={formActions}
initialValues={{}}
initialValues={memberInfo}
components={{
Checkbox,
CheckboxGroup: Checkbox.Group,
......
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