Commit c0d3cd9b authored by XieZhiXiong's avatar XieZhiXiong

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

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