Commit da792376 authored by XieZhiXiong's avatar XieZhiXiong

对接完已有接口

parent 2bffb388
...@@ -82,6 +82,9 @@ export const STATUS_ENUM = [ ...@@ -82,6 +82,9 @@ export const STATUS_ENUM = [
} }
] ]
// 1是阿里云oss服务器, 2是本地文件服务器
export const UPLOAD_TYPE = isDev ? 2 : 1
// 会员规则类型 // 会员规则类型
export const VIP_RULE_TRANSACTION = 1; // 交易 export const VIP_RULE_TRANSACTION = 1; // 交易
export const VIP_RULE_LOGIN = 2; // 登录 export const VIP_RULE_LOGIN = 2; // 登录
......
...@@ -172,9 +172,11 @@ const addEquity: React.FC<[]> = () => { ...@@ -172,9 +172,11 @@ const addEquity: React.FC<[]> = () => {
setSubmitLoading(true); setSubmitLoading(true);
try { try {
const res = await Promise.all(promises); const resArr = await Promise.all(promises);
message.success('保存成功'); if (resArr.every(item => item && item.code === 1000)) {
getMemberLevelInfo(); message.success('保存成功');
getMemberLevelInfo();
}
} catch (errInfo) { } catch (errInfo) {
} }
......
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { UPLOAD_TYPE } from '@/constants';
import { PATTERN_MAPS } from '@/constants/regExp';
export const importSchema: ISchema = { export const importSchema: ISchema = {
type: 'object', type: 'object',
...@@ -154,44 +156,59 @@ export const auditModalSchema: ISchema = { ...@@ -154,44 +156,59 @@ export const auditModalSchema: ISchema = {
}, },
}; };
const FIELD_TYPE_MAP = {
'string': 'string',
'long': 'string',
'upload': 'customUpload',
};
const getXComponentProps = (type, item) => {
const MAP = {
'string': {
placeholder: item.fieldRemark,
},
'upload': {
listType: 'card',
action: '/api/file/file/upload',
data: { fileType: UPLOAD_TYPE },
fileList: [],
onChange: file => console.log(file),
},
};
return MAP[type];
};
const getCompnentValue = (elements: any) => { const getCompnentValue = (elements: any) => {
let components = {}; const components = {};
for (let item of elements) { for (let item of elements) {
let xComponentProps =
item.fieldType === 'string' // 先判断是否存在 type,防止不存在的 type 报错
? { const realType = FIELD_TYPE_MAP[item.fieldType];
placeholder: item.fieldRemark, if (realType) {
} components[item.fieldName] = {
: { type: FIELD_TYPE_MAP[item.fieldType],
listType: 'card', required: item.fieldEmpty === 0,
action: '/api/file/file/upload', title: item.fieldCNName,
data: { fileType: 2 }, 'x-component-props': getXComponentProps(realType, item),
fileList: [], };
onChange: file => console.log(file), }
};
components[item.fieldName] = {
type: item.fieldType,
required: item.fieldEmpty === 0,
title: item.fieldCNName,
'x-component-props': xComponentProps,
};
} }
return components; return components;
}; };
export const initDetailSchema = (props: any) => { export const initDetailSchema = (props: any) => {
let tabSchema = { let tabSchema: ISchema = {
properties: { properties: {
'tab-1': { 'tab-1': {
type: 'object', type: 'object',
'x-component': 'tabpane', 'x-component': 'TabPane',
'x-component-props': { 'x-component-props': {
tab: '基本信息', tab: '基本信息',
}, },
properties: { properties: {
MEGA_LAYOUT1: { MEGA_LAYOUT1: {
type: 'object', type: 'object',
'x-component': 'mega-layout', 'x-component': 'Mega-Layout',
'x-component-props': { 'x-component-props': {
labelCol: 4, labelCol: 4,
wrapperCol: 8, wrapperCol: 8,
...@@ -213,10 +230,13 @@ export const initDetailSchema = (props: any) => { ...@@ -213,10 +230,13 @@ export const initDetailSchema = (props: any) => {
title: '会员角色', title: '会员角色',
enum: [], enum: [],
'x-component-props': { 'x-component-props': {
placeholder: '请选择', placeholder: '请选择',
},
'x-props': {
hasFeedback: true,
}, },
}, },
level: { levelId: {
type: 'string', type: 'string',
required: true, required: true,
title: '会员等级', title: '会员等级',
...@@ -224,69 +244,73 @@ export const initDetailSchema = (props: any) => { ...@@ -224,69 +244,73 @@ export const initDetailSchema = (props: any) => {
'x-component-props': { 'x-component-props': {
placeholder: '请选择', placeholder: '请选择',
}, },
'x-props': {
hasFeedback: true,
},
}, },
MEGA_LAYOUT1_1: { MEGA_LAYOUT1_1: {
type: 'object', type: 'object',
'x-component': 'mega-layout', 'x-component': 'Mega-Layout',
'x-component-props': { 'x-component-props': {
label: '注册手机', label: '注册手机',
wrapperCol: 24, required: true,
required: true, inline: true,
}, },
properties: { properties: {
MEGA_LAYOUT1_1_1: { countryCodeId: {
type: 'object', type: 'string',
'x-component': 'mega-layout', enum: [],
'x-component-props': { 'x-component-props': {
grid: true, placeholder: '请选择',
full: true, },
}, required: true,
properties: { },
telCode: { phone: {
type: 'string', type: 'string',
enum: [], required: true,
'x-component-props': { 'x-component-props': {
placeholder: '请选择', placeholder: '请输入你的手机号码',
}, maxLength: 11,
required: true, },
}, 'x-rules': [
tel: { {
type: 'string', pattern: PATTERN_MAPS.phone,
'x-mega-props': { span: 2 }, message: '请输入正确格式的手机号',
'x-component-props': {
placeholder: '请输入你的手机号码',
maxLength: 11,
},
required: true,
}, },
}, ],
}, },
}, },
}, },
memberEmail: { email: {
type: 'string', type: 'string',
title: '邮箱', title: '邮箱',
'x-component-props': {}, 'x-component-props': {},
'x-rules': [
{
pattern: PATTERN_MAPS.email,
message: '请输入正确格式的邮箱',
},
],
}, },
}, },
}, },
}, },
}, },
}, },
}; };
if (Object.keys(props).length > 0) { if (Array.isArray(props)) {
for (let [index, item] of props.groups.entries()) { for (let [index, item] of props.entries()) {
tabSchema.properties[`tab-${index + 2}`] = { tabSchema.properties![`tab-${index + 2}`] = {
type: 'object', type: 'object',
'x-component': 'tabpane', 'x-component': 'TabPane',
'x-component-props': { 'x-component-props': {
tab: item.groupName, tab: item.groupName,
}, },
properties: { properties: {
[`MEGA_LAYOUT${index + 2}`]: { [`MEGA_LAYOUT${index + 2}`]: {
type: 'object', type: 'object',
'x-component': 'mega-layout', 'x-component': 'Mega-Layout',
'x-component-props': { 'x-component-props': {
labelCol: 4, labelCol: 4,
wrapperCol: 8, wrapperCol: 8,
...@@ -299,13 +323,15 @@ export const initDetailSchema = (props: any) => { ...@@ -299,13 +323,15 @@ export const initDetailSchema = (props: any) => {
} }
} }
let detailSchema = { let detailSchema: ISchema = {
type: 'object', type: 'object',
properties: { properties: {
REPOSIT_TABS: { tabs: {
type: 'object', type: 'object',
'x-component': 'tab', 'x-component': 'Tab',
'x-component-props': {}, 'x-component-props': {
type: 'card',
},
...tabSchema, ...tabSchema,
}, },
}, },
......
...@@ -237,12 +237,14 @@ const AuditPr1: React.FC<QueryProps> = props => { ...@@ -237,12 +237,14 @@ const AuditPr1: React.FC<QueryProps> = props => {
}), }),
]; ];
Promise.all(promises).then(res => { Promise.all(promises).then(resArr => {
if (resArr.every(item => item && item.code === 1000)) {
setTimeout(() => {
history.goBack();
}, 800);
setModalVisible(false);
}
setConfirmLoading(false); setConfirmLoading(false);
setTimeout(() => {
history.goBack();
}, 800);
setModalVisible(false);
}).catch(() => { }).catch(() => {
setConfirmLoading(false); setConfirmLoading(false);
}); });
......
...@@ -237,12 +237,14 @@ const AuditPr2: React.FC<QueryProps> = props => { ...@@ -237,12 +237,14 @@ const AuditPr2: React.FC<QueryProps> = props => {
}), }),
]; ];
Promise.all(promises).then(res => { Promise.all(promises).then(resArr => {
if (resArr.every(item => item && item.code === 1000)) {
setTimeout(() => {
history.goBack();
}, 800);
setModalVisible(false);
}
setConfirmLoading(false); setConfirmLoading(false);
setTimeout(() => {
history.goBack();
}, 800);
setModalVisible(false);
}).catch(() => { }).catch(() => {
setConfirmLoading(false); setConfirmLoading(false);
}); });
......
...@@ -237,12 +237,14 @@ const AuditPrComfirm: React.FC<QueryProps> = props => { ...@@ -237,12 +237,14 @@ const AuditPrComfirm: React.FC<QueryProps> = props => {
}), }),
]; ];
Promise.all(promises).then(res => { Promise.all(promises).then(resArr => {
if (resArr.every(item => item && item.code === 1000)) {
setTimeout(() => {
history.goBack();
}, 800);
setModalVisible(false);
}
setConfirmLoading(false); setConfirmLoading(false);
setTimeout(() => {
history.goBack();
}, 800);
setModalVisible(false);
}).catch(() => { }).catch(() => {
setConfirmLoading(false); setConfirmLoading(false);
}); });
......
...@@ -237,12 +237,14 @@ const AuditPrSubmit: React.FC<QueryProps> = props => { ...@@ -237,12 +237,14 @@ const AuditPrSubmit: React.FC<QueryProps> = props => {
}), }),
]; ];
Promise.all(promises).then(res => { Promise.all(promises).then(resArr => {
if (resArr.every(item => item && item.code === 1000)) {
setTimeout(() => {
history.goBack();
}, 800);
setModalVisible(false);
}
setConfirmLoading(false); setConfirmLoading(false);
setTimeout(() => {
history.goBack();
}, 800);
setModalVisible(false);
}).catch(() => { }).catch(() => {
setConfirmLoading(false); setConfirmLoading(false);
}); });
......
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