Commit 1a8bf461 authored by 邓晓峰's avatar 邓晓峰

fix: 修复openapi

parent e3a58a52
Pipeline #23702 skipped with stages
// @ts-ignore // @ts-ignore
//import { Request, Response } from 'express'; // import { Request, Response } from 'express';
module.exports = {}; module.exports = {};
// @ts-ignore // @ts-ignore
//import { Request, Response } from 'express'; // import { Request, Response } from 'express';
module.exports = { module.exports = {
'GET /api/rule': (req, res) => { 'GET /api/rule': (req, res) => {
res res.status(200).send({
.status(200) data: [
.send({ {
data: [ key: 77,
{ disabled: true,
key: 77, href: 'https://umijs.org/',
disabled: true, avatar:
href: 'https://umijs.org/', 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png', name: '杜明',
name: '杜明', owner: 'Johnson',
owner: 'Johnson', desc: '展金习设许此备还育住第即但没新何进。',
desc: '展金习设许此备还育住第即但没新何进。', callNo: 75,
callNo: 75, status: 69,
status: 69, updatedAt: 'z*GGqY',
updatedAt: 'z*GGqY', createdAt: 'OgCEx15',
createdAt: 'OgCEx15', progress: 81,
progress: 81, },
}, {
{ key: 72,
key: 72, disabled: true,
disabled: true, href: 'https://ant.design',
href: 'https://ant.design', avatar: 'https://avatars0.githubusercontent.com/u/507615?s=40&v=4',
avatar: 'https://avatars0.githubusercontent.com/u/507615?s=40&v=4', name: '龙伟',
name: '龙伟', owner: 'Moore',
owner: 'Moore', desc: '近区置世意史风品容等量引律养级马理。',
desc: '近区置世意史风品容等量引律养级马理。', callNo: 72,
callNo: 72, status: 63,
status: 63, updatedAt: 'o%NS',
updatedAt: 'o%NS', createdAt: 'HJo',
createdAt: 'HJo', progress: 89,
progress: 89, },
}, {
{ key: 98,
key: 98, disabled: true,
disabled: true, href: 'https://procomponents.ant.design/',
href: 'https://procomponents.ant.design/', avatar:
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
name: '韩军', name: '韩军',
owner: 'Hall', owner: 'Hall',
desc: '二应据称感号单常强持社少便快极西流能。', desc: '二应据称感号单常强持社少便快极西流能。',
callNo: 82, callNo: 82,
status: 71, status: 71,
updatedAt: '2jgCyz', updatedAt: '2jgCyz',
createdAt: '&d$kEH', createdAt: '&d$kEH',
progress: 70, progress: 70,
}, },
{ {
key: 94, key: 94,
disabled: false, disabled: false,
href: 'https://preview.pro.ant.design/dashboard/analysis', href: 'https://preview.pro.ant.design/dashboard/analysis',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png', avatar:
name: '刘平', 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png',
owner: 'Lopez', name: '刘平',
desc: '大管别消证物拉主今解过格科家角。', owner: 'Lopez',
callNo: 71, desc: '大管别消证物拉主今解过格科家角。',
status: 97, callNo: 71,
updatedAt: 'u5Y', status: 97,
createdAt: '4xJ5O', updatedAt: 'u5Y',
progress: 78, createdAt: '4xJ5O',
}, progress: 78,
{ },
key: 74, {
disabled: true, key: 74,
href: 'https://ant.design', disabled: true,
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg', href: 'https://ant.design',
name: '苏娟', avatar:
owner: 'Miller', 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg',
desc: '需八相严平写今的快验二历林。', name: '苏娟',
callNo: 76, owner: 'Miller',
status: 89, desc: '需八相严平写今的快验二历林。',
updatedAt: 'Roob', callNo: 76,
createdAt: 'hikM9o', status: 89,
progress: 92, updatedAt: 'Roob',
}, createdAt: 'hikM9o',
{ progress: 92,
key: 92, },
disabled: false, {
href: 'https://preview.pro.ant.design/dashboard/analysis', key: 92,
avatar: 'https://avatars0.githubusercontent.com/u/507615?s=40&v=4', disabled: false,
name: '赖霞', href: 'https://preview.pro.ant.design/dashboard/analysis',
owner: 'Taylor', avatar: 'https://avatars0.githubusercontent.com/u/507615?s=40&v=4',
desc: '采众用我类拉标技政般酸往得。', name: '赖霞',
callNo: 79, owner: 'Taylor',
status: 78, desc: '采众用我类拉标技政般酸往得。',
updatedAt: 'Af9Y%', callNo: 79,
createdAt: 'n*M4H', status: 78,
progress: 66, updatedAt: 'Af9Y%',
}, createdAt: 'n*M4H',
{ progress: 66,
key: 99, },
disabled: false, {
href: '', key: 99,
avatar: disabled: false,
'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png', href: '',
name: '何杰', avatar:
owner: 'Young', 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
desc: '段除然到社包示上来化文将机思。', name: '何杰',
callNo: 67, owner: 'Young',
status: 99, desc: '段除然到社包示上来化文将机思。',
updatedAt: 'v!T9b', callNo: 67,
createdAt: '3NS@', status: 99,
progress: 69, updatedAt: 'v!T9b',
}, createdAt: '3NS@',
{ progress: 69,
key: 88, },
disabled: false, {
href: 'https://procomponents.ant.design/', key: 88,
avatar: 'https://avatars0.githubusercontent.com/u/507615?s=40&v=4', disabled: false,
name: '冯娟', href: 'https://procomponents.ant.design/',
owner: 'Johnson', avatar: 'https://avatars0.githubusercontent.com/u/507615?s=40&v=4',
desc: '公与起拉记龙应二家种定科。', name: '冯娟',
callNo: 68, owner: 'Johnson',
status: 96, desc: '公与起拉记龙应二家种定科。',
updatedAt: 'hV6*R6', callNo: 68,
createdAt: 'FrTdqU', status: 96,
progress: 71, updatedAt: 'hV6*R6',
}, createdAt: 'FrTdqU',
{ progress: 71,
key: 66, },
disabled: false, {
href: 'https://github.com/umijs/dumi', key: 66,
avatar: 'https://avatars1.githubusercontent.com/u/8186664?s=40&v=4', disabled: false,
name: '杜刚', href: 'https://github.com/umijs/dumi',
owner: 'Lewis', avatar: 'https://avatars1.githubusercontent.com/u/8186664?s=40&v=4',
desc: '收花领养克听关消克般时电自必需论。', name: '杜刚',
callNo: 72, owner: 'Lewis',
status: 98, desc: '收花领养克听关消克般时电自必需论。',
updatedAt: 's*t', callNo: 72,
createdAt: 'uby3w', status: 98,
progress: 68, updatedAt: 's*t',
}, createdAt: 'uby3w',
{ progress: 68,
key: 71, },
disabled: true, {
href: 'https://procomponents.ant.design/', key: 71,
avatar: 'https://avatars0.githubusercontent.com/u/507615?s=40&v=4', disabled: true,
name: '戴芳', href: 'https://procomponents.ant.design/',
owner: 'Jackson', avatar: 'https://avatars0.githubusercontent.com/u/507615?s=40&v=4',
desc: '也天下京完指际保手上劳响什部多。', name: '戴芳',
callNo: 85, owner: 'Jackson',
status: 64, desc: '也天下京完指际保手上劳响什部多。',
updatedAt: 'YIzwv', callNo: 85,
createdAt: 'x[Z', status: 64,
progress: 86, updatedAt: 'YIzwv',
}, createdAt: 'x[Z',
{ progress: 86,
key: 63, },
disabled: true, {
href: 'https://procomponents.ant.design/', key: 63,
avatar: 'https://avatars1.githubusercontent.com/u/8186664?s=40&v=4', disabled: true,
name: '赖艳', href: 'https://procomponents.ant.design/',
owner: 'Brown', avatar: 'https://avatars1.githubusercontent.com/u/8186664?s=40&v=4',
desc: '之示气上你力表清力队气消全划山路。', name: '赖艳',
callNo: 72, owner: 'Brown',
status: 66, desc: '之示气上你力表清力队气消全划山路。',
updatedAt: '(6U0', callNo: 72,
createdAt: 'WVSoNJ', status: 66,
progress: 84, updatedAt: '(6U0',
}, createdAt: 'WVSoNJ',
], progress: 84,
total: 99, },
success: true, ],
}); total: 99,
success: true,
});
}, },
'POST /api/rule': (req, res) => { 'POST /api/rule': (req, res) => {
res res.status(200).send({
.status(200) key: 71,
.send({ disabled: true,
key: 71, href: 'https://ant.design',
disabled: true, avatar:
href: 'https://ant.design', 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', name: '段勇',
name: '段勇', owner: 'Thomas',
owner: 'Thomas', desc: '院题质数下布进或会府速体快型前快。',
desc: '院题质数下布进或会府速体快型前快。', callNo: 91,
callNo: 91, status: 88,
status: 88, updatedAt: 'T$frcd',
updatedAt: 'T$frcd', createdAt: '#]MhT%',
createdAt: '#]MhT%', progress: 79,
progress: 79, });
});
}, },
'PUT /api/rule': (req, res) => { 'PUT /api/rule': (req, res) => {
res res.status(200).send({
.status(200) key: 94,
.send({ disabled: true,
key: 94, href: 'https://umijs.org/',
disabled: true, avatar: 'https://avatars0.githubusercontent.com/u/507615?s=40&v=4',
href: 'https://umijs.org/', name: '常桂英',
avatar: 'https://avatars0.githubusercontent.com/u/507615?s=40&v=4', owner: 'Perez',
name: '常桂英', desc: '布华意王去消候研格作指称。',
owner: 'Perez', callNo: 61,
desc: '布华意王去消候研格作指称。', status: 97,
callNo: 61, updatedAt: 'ZX0wE7',
status: 97, createdAt: 'mg%',
updatedAt: 'ZX0wE7', progress: 93,
createdAt: 'mg%', });
progress: 93,
});
}, },
'DELETE /api/rule': (req, res) => { 'DELETE /api/rule': (req, res) => {
res.status(200).send({}); res.status(200).send({});
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -98,9 +98,9 @@ ...@@ -98,9 +98,9 @@
"@ant-design/pro-utils": "^1.10.4", "@ant-design/pro-utils": "^1.10.4",
"@babel/polyfill": "7.4.3", "@babel/polyfill": "7.4.3",
"@babel/runtime": "^7.10.5", "@babel/runtime": "^7.10.5",
"@wisdom-utils/components": "0.0.9", "@wisdom-utils/components": "0.0.14",
"@wisdom-utils/runtime": "0.0.15", "@wisdom-utils/runtime": "0.0.15",
"@wisdom-utils/utils": "0.0.44", "@wisdom-utils/utils": "0.0.46",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"antd": "^4.11.2", "antd": "^4.11.2",
"compression": "1.7.4", "compression": "1.7.4",
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"kit_global_config": "^1.0.24", "kit_global_config": "^1.0.24",
"kit_logger": "^1.0.2", "kit_logger": "^1.0.2",
"kit_utils": "^1.3.10", "kit_utils": "^1.3.11",
"lodash": "4.17.11", "lodash": "4.17.11",
"minimist": "1.2.0", "minimist": "1.2.0",
"mqtt-client": "^1.0.11", "mqtt-client": "^1.0.11",
......
...@@ -60,6 +60,7 @@ const generateService = async ({ requestLibPath, schemaPath, mockFolder, ...rest ...@@ -60,6 +60,7 @@ const generateService = async ({ requestLibPath, schemaPath, mockFolder, ...rest
const requestImportStatement = getImportStatement(requestLibPath); const requestImportStatement = getImportStatement(requestLibPath);
const serviceGenerator = new serviceGenerators.ServiceGenerator({ const serviceGenerator = new serviceGenerators.ServiceGenerator({
namespace: 'API', namespace: 'API',
basePath: openAPI.servers[0].url,
requestImportStatement, requestImportStatement,
...rest, ...rest,
}, openAPI); }, openAPI);
...@@ -77,4 +78,4 @@ const generateService = async ({ requestLibPath, schemaPath, mockFolder, ...rest ...@@ -77,4 +78,4 @@ const generateService = async ({ requestLibPath, schemaPath, mockFolder, ...rest
module.exports = { module.exports = {
generateService, generateService,
getSchema getSchema
} }
\ No newline at end of file
const chalk = require('chalk'); const chalk = require('chalk');
const Log = (...rest) => console.log(`${chalk.blue('[openAPI]')}: ${rest.join('\n')}`); const Log = (...rest) =>
module.exports = Log; console.log(`${chalk.blue('[openAPI]')}: ${rest.join('\n')}`);
\ No newline at end of file module.exports = Log;
const mockjs = require("mockjs"); const mockjs = require('mockjs');
const fs = require("fs"); const fs = require('fs');
const util = require("./util"); const path = require('path');
const path = require("path"); const util = require('./util');
const openAPIParserMock = require("./openAPIParserMock/index"); const openAPIParserMock = require('./openAPIParserMock/index');
const log = require("./log"); const log = require('./log');
mockjs.Random.extend({ mockjs.Random.extend({
country() { country() {
const data = [ const data = [
'阿根廷', '阿根廷',
'澳大利亚', '澳大利亚',
'巴西', '巴西',
'加拿大', '加拿大',
'中国', '中国',
'法国', '法国',
'德国', '德国',
'印度', '印度',
'印度尼西亚', '印度尼西亚',
'意大利', '意大利',
'日本', '日本',
'韩国', '韩国',
'墨西哥', '墨西哥',
'俄罗斯', '俄罗斯',
'沙特阿拉伯', '沙特阿拉伯',
'南非', '南非',
'土耳其', '土耳其',
'英国', '英国',
'美国', '美国',
]; ];
const id = (Math.random() * data.length).toFixed(); const id = (Math.random() * data.length).toFixed();
return data[id]; return data[id];
}, },
phone() { phone() {
const phonepreFix = ['111', '112', '114']; // 自己写前缀哈 const phonepreFix = ['111', '112', '114']; // 自己写前缀哈
return this.pick(phonepreFix) + mockjs.mock(/\d{8}/); // Number() return this.pick(phonepreFix) + mockjs.mock(/\d{8}/); // Number()
}, },
status() { status() {
const status = ['success', 'error', 'default', 'processing', 'warning']; const status = ['success', 'error', 'default', 'processing', 'warning'];
return status[(Math.random() * 4).toFixed(0)]; return status[(Math.random() * 4).toFixed(0)];
}, },
authority() { authority() {
const status = ['admin', 'user', 'guest']; const status = ['admin', 'user', 'guest'];
return status[(Math.random() * status.length).toFixed(0)]; return status[(Math.random() * status.length).toFixed(0)];
}, },
avatar() { avatar() {
const avatar = [ const avatar = [
'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg', 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg',
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png', 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png', 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png', 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png',
'https://avatars0.githubusercontent.com/u/507615?s=40&v=4', 'https://avatars0.githubusercontent.com/u/507615?s=40&v=4',
'https://avatars1.githubusercontent.com/u/8186664?s=40&v=4', 'https://avatars1.githubusercontent.com/u/8186664?s=40&v=4',
]; ];
const id = (Math.random() * avatar.length).toFixed(); const id = (Math.random() * avatar.length).toFixed();
return avatar[id]; return avatar[id];
}, },
group() { group() {
const data = ['体验技术部', '创新科技组', '前端 6 组', '区块链平台部', '服务技术部']; const data = [
const id = (Math.random() * data.length).toFixed(); '体验技术部',
return data[id]; '创新科技组',
}, '前端 6 组',
label() { '区块链平台部',
const label = [ '服务技术部',
'很有想法的', ];
'小清新', const id = (Math.random() * data.length).toFixed();
'傻白甜', return data[id];
'阳光少年', },
'大咖', label() {
'健身达人', const label = [
'程序员', '很有想法的',
'算法工程师', '小清新',
'川妹子', '傻白甜',
'名望程序员', '阳光少年',
'大长腿', '大咖',
'海纳百川', '健身达人',
'专注设计', '程序员',
'爱好广泛', '算法工程师',
'IT 互联网', '川妹子',
]; '名望程序员',
const id = (Math.random() * label.length).toFixed(); '大长腿',
return label[id]; '海纳百川',
}, '专注设计',
href() { '爱好广泛',
const href = [ 'IT 互联网',
'https://preview.pro.ant.design/dashboard/analysis', ];
'https://ant.design', const id = (Math.random() * label.length).toFixed();
'https://procomponents.ant.design/', return label[id];
'https://umijs.org/', },
'https://github.com/umijs/dumi', href() {
]; const href = [
const id = (Math.random() * href.length).toFixed(); 'https://preview.pro.ant.design/dashboard/analysis',
return href[id]; 'https://ant.design',
}, 'https://procomponents.ant.design/',
'https://umijs.org/',
'https://github.com/umijs/dumi',
];
const id = (Math.random() * href.length).toFixed();
return href[id];
},
}); });
const genMockData = (example) => { const genMockData = example => {
if (!example) { if (!example) {
return {}; return {};
} }
if (typeof example === 'string') { if (typeof example === 'string') {
return mockjs.mock(example); return mockjs.mock(example);
} }
if (Array.isArray(example)) { if (Array.isArray(example)) {
return mockjs.mock(example); return mockjs.mock(example);
} }
return Object.keys(example) return Object.keys(example)
.map((name) => { .map(name => ({
return { [name]: mockjs.mock(example[name]),
[name]: mockjs.mock(example[name]), }))
}; .reduce(
}) (pre, next) => ({
.reduce((pre, next) => { ...pre,
return { ...next,
...pre, }),
...next, {},
}; );
}, {});
}; };
const genByTemp = ({ method, path, status, data, }) => { // eslint-disable-next-line no-shadow
if (!['get', 'put', 'post', 'delete', 'patch'].includes(method.toLocaleLowerCase())) { const genByTemp = ({ method, path, status, data }) => {
return ''; if (
} !['get', 'put', 'post', 'delete', 'patch'].includes(
return `'${method.toUpperCase()} ${path}': (req, res) => { method.toLocaleLowerCase(),
)
) {
return '';
}
return `'${method.toUpperCase()} ${path}': (req, res) => {
res.status(${status}).send(${data}); res.status(${status}).send(${data});
}`; }`;
}; };
const genMockFiles = (mockFunction) => { const genMockFiles = mockFunction =>
return util.prettierFile(` util.prettierFile(`
// @ts-ignore // @ts-ignore
//import { Request, Response } from 'express'; //import { Request, Response } from 'express';
module.exports = { module.exports = {
${mockFunction.join('\n,')} ${mockFunction.join('\n,')}
}`)[0]; }`)[0];
};
const mockGenerator = async ({ openAPI, mockFolder }) => { const mockGenerator = async ({ openAPI, mockFolder }) => {
const openAPParse = new openAPIParserMock(openAPI); // eslint-disable-next-line new-cap
const docs = openAPParse.parser(); const openAPParse = new openAPIParserMock(openAPI);
const pathList = Object.keys(docs.paths); const docs = openAPParse.parser();
const { paths } = docs; const pathList = Object.keys(docs.paths);
const mockActionsObj = {}; const { paths } = docs;
pathList.forEach((path) => { const mockActionsObj = {};
const pathConfig = paths[path]; // eslint-disable-next-line no-shadow
Object.keys(pathConfig).forEach((method) => { pathList.forEach(path => {
const methodConfig = pathConfig[method]; const pathConfig = paths[path];
if (methodConfig) { Object.keys(pathConfig).forEach(method => {
const conte = methodConfig && methodConfig.tags && methodConfig.tags.join('/') || const methodConfig = pathConfig[method];
path.replace('/', '').split('/')[1] || if (methodConfig) {
methodConfig.operationId; const conte =
const data = genMockData(methodConfig && methodConfig.responses && methodConfig.responses['200'] && methodConfig.responses['200'].example); (methodConfig && methodConfig.tags && methodConfig.tags.join('/')) ||
if (!mockActionsObj[conte]) { path.replace('/', '').split('/')[1] ||
mockActionsObj[conte] = []; methodConfig.operationId;
} const data = genMockData(
const tempFile = genByTemp({ methodConfig &&
method, methodConfig.responses &&
path, methodConfig.responses['200'] &&
status: '200', methodConfig.responses['200'].example,
data: JSON.stringify(data), );
}); if (!mockActionsObj[conte]) {
if (tempFile) { mockActionsObj[conte] = [];
mockActionsObj[conte].push(tempFile);
}
}
});
});
Object.keys(mockActionsObj).forEach((file) => {
if (!file || file === 'undefined') {
return;
} }
fs.writeFileSync(path.join(mockFolder, `${file}.mock.js`), genMockFiles(mockActionsObj[file]), { const tempFile = genByTemp({
encoding: 'utf8', method,
path,
status: '200',
data: JSON.stringify(data),
}); });
if (tempFile) {
mockActionsObj[conte].push(tempFile);
}
}
}); });
log('✅ 生成 mock 文件成功'); });
Object.keys(mockActionsObj).forEach(file => {
if (!file || file === 'undefined') {
return;
}
fs.writeFileSync(
path.join(mockFolder, `${file}.mock.js`),
genMockFiles(mockActionsObj[file]),
{
encoding: 'utf8',
},
);
});
log('✅ 生成 mock 文件成功');
}; };
module.exports = { module.exports = {
mockGenerator mockGenerator,
}; };
\ No newline at end of file
...@@ -3,175 +3,192 @@ const utils = require('./utils'); ...@@ -3,175 +3,192 @@ const utils = require('./utils');
const primitives = require('./preimitives'); const primitives = require('./preimitives');
const getDateByName = (name, parentsKey) => { const getDateByName = (name, parentsKey) => {
if (!name || name.length < 1) { if (!name || name.length < 1) {
return 'string'; return 'string';
} }
if (Array.isArray(name)) { if (Array.isArray(name)) {
return getDateByName([...name].pop(), name); return getDateByName([...name].pop(), name);
} }
if (['nickname', 'name'].includes(name)) { if (['nickname', 'name'].includes(name)) {
return 'cname'; return 'cname';
} }
if (['owner', 'firstName', 'lastName', 'username'].includes(name)) { if (['owner', 'firstName', 'lastName', 'username'].includes(name)) {
return 'name'; return 'name';
} }
if (['avatar'].includes(name)) { if (['avatar'].includes(name)) {
return 'avatar'; return 'avatar';
} }
if (['group'].includes(name)) { if (['group'].includes(name)) {
return 'group'; return 'group';
} }
if (name.toLocaleLowerCase().endsWith('id')) { if (name.toLocaleLowerCase().endsWith('id')) {
return 'uuid'; return 'uuid';
} }
if (name.toLocaleLowerCase().endsWith('type') || if (
name.toLocaleLowerCase().endsWith('key') || name.toLocaleLowerCase().endsWith('type') ||
['key'].includes(name)) { name.toLocaleLowerCase().endsWith('key') ||
return 'id'; ['key'].includes(name)
} ) {
if (name.toLocaleLowerCase().endsWith('label') || ['label'].includes(name)) { return 'id';
const newParents = [...parentsKey]; }
newParents.pop(); if (name.toLocaleLowerCase().endsWith('label') || ['label'].includes(name)) {
const newType = getDateByName(newParents); const newParents = [...parentsKey];
if (newType !== 'string' && newType !== 'csentence') { newParents.pop();
return newType; const newType = getDateByName(newParents);
} if (newType !== 'string' && newType !== 'csentence') {
return 'label'; return newType;
} }
if (['email'].includes(name)) { return 'label';
return 'email'; }
} if (['email'].includes(name)) {
if (['password'].includes(name)) { return 'email';
return 'string(16)'; }
} if (['password'].includes(name)) {
if (['phone'].includes(name)) { return 'string(16)';
return 'phone'; }
} if (['phone'].includes(name)) {
if (['province'].includes(name)) { return 'phone';
return 'province'; }
} if (['province'].includes(name)) {
if (['city'].includes(name)) { return 'province';
return 'city'; }
} if (['city'].includes(name)) {
if (['addr', 'address'].includes(name)) { return 'city';
return 'county'; }
} if (['addr', 'address'].includes(name)) {
if (['country'].includes(name)) { return 'county';
return 'country'; }
} if (['country'].includes(name)) {
if (['url', 'imageUrl', 'href'].includes(name) || return 'country';
name.toLocaleLowerCase().endsWith('url') || }
name.toLocaleLowerCase().endsWith('urls') || if (
name.toLocaleLowerCase().endsWith('image') || ['url', 'imageUrl', 'href'].includes(name) ||
name.toLocaleLowerCase().endsWith('link')) { name.toLocaleLowerCase().endsWith('url') ||
return 'href'; name.toLocaleLowerCase().endsWith('urls') ||
} name.toLocaleLowerCase().endsWith('image') ||
if (name.toLocaleLowerCase().endsWith('errorcode')) { name.toLocaleLowerCase().endsWith('link')
return 'errorCode'; ) {
} return 'href';
if (['type', 'status'].includes(name) || }
name.toLocaleLowerCase().endsWith('status') || if (name.toLocaleLowerCase().endsWith('errorcode')) {
name.toLocaleLowerCase().endsWith('type')) { return 'errorCode';
return 'status'; }
} if (
if (name.toLocaleLowerCase().endsWith('authority')) { ['type', 'status'].includes(name) ||
return 'authority'; name.toLocaleLowerCase().endsWith('status') ||
} name.toLocaleLowerCase().endsWith('type')
return 'csentence'; ) {
} return 'status';
}
if (name.toLocaleLowerCase().endsWith('authority')) {
return 'authority';
}
return 'csentence';
};
function primitive(schemaParams, propsName) { function primitive(schemaParams, propsName) {
const schema = utils.objectify(schemaParams);
const schema = utils.objectify(schemaParams); const { type, format } = schema;
console.log("schemaParams", propsName) const value =
const { type, format } = schema; primitives[`${type}_${format || getDateByName(propsName)}`] ||
const value = primitives[`${type}_${format || getDateByName(propsName)}`] || primitives[type]; primitives[type];
if (typeof schema.example === 'undefined') { if (typeof schema.example === 'undefined') {
return value || `Unknown Type: ${schema.type}`; return value || `Unknown Type: ${schema.type}`;
} }
return schema.example; return schema.example;
} }
class OpenAPIGeneratorMockJs { class OpenAPIGeneratorMockJs {
constructor(openAPI) { constructor(openAPI) {
this.sampleFromSchema = (schema, propsName) => { this.sampleFromSchema = (schema, propsName) => {
const localSchema = schema.$ref const localSchema = schema.$ref
? utils.get(this.openAPI, schema.$ref.replace('#/', '').split('/')) ? utils.get(this.openAPI, schema.$ref.replace('#/', '').split('/'))
: utils.objectify(schema); : utils.objectify(schema);
let { type } = localSchema; let { type } = localSchema;
const { properties, additionalProperties, items } = localSchema; const { properties, additionalProperties, items } = localSchema;
if (!type) { if (!type) {
if (properties) { if (properties) {
type = 'object'; type = 'object';
} } else if (items) {
else if (items) { type = 'array';
type = 'array'; } else {
} return null;
else { }
return null; }
} if (type === 'object') {
} const props = utils.objectify(properties);
if (type === 'object') { const obj = {};
const props = utils.objectify(properties); // eslint-disable-next-line guard-for-in
const obj = {}; for (const name in props) {
for (const name in props) { obj[name] = this.sampleFromSchema(props[name], [
obj[name] = this.sampleFromSchema(props[name], [...(propsName || []), name]); ...(propsName || []),
} name,
if (additionalProperties === true) { ]);
obj.additionalProp1 = {}; }
return obj; if (additionalProperties === true) {
} obj.additionalProp1 = {};
if (additionalProperties) { return obj;
const additionalProps = utils.objectify(additionalProperties); }
const additionalPropVal = this.sampleFromSchema(additionalProps, propsName); if (additionalProperties) {
for (let i = 1; i < 4; i += 1) { const additionalProps = utils.objectify(additionalProperties);
obj[`additionalProp${i}`] = additionalPropVal; const additionalPropVal = this.sampleFromSchema(
} additionalProps,
} propsName,
return obj; );
} for (let i = 1; i < 4; i += 1) {
if (type === 'array') { obj[`additionalProp${i}`] = additionalPropVal;
const item = this.sampleFromSchema(items, propsName); }
return new Array(parseInt((Math.random() * 20).toFixed(0), 10)).fill(item); }
} return obj;
if (localSchema.enum) { }
if (localSchema.default) if (type === 'array') {
return localSchema.default; const item = this.sampleFromSchema(items, propsName);
return utils.normalizeArray(localSchema.enum)[0]; return new Array(parseInt((Math.random() * 20).toFixed(0), 10)).fill(
} item,
if (type === 'file') { );
return null; }
} if (localSchema.enum) {
return primitive(localSchema, propsName); if (localSchema.default) return localSchema.default;
}; return utils.normalizeArray(localSchema.enum)[0];
this.parser = () => { }
const openAPI = { if (type === 'file') {
...this.openAPI, return null;
}; }
for (const path in openAPI.paths) { return primitive(localSchema, propsName);
for (const method in openAPI.paths[path]) { };
const api = openAPI.paths[path][method]; this.parser = () => {
for (const code in api.responses) { // eslint-disable-next-line no-shadow
const response = api.responses[code]; const openAPI = {
const schema = response.content && ...this.openAPI,
response.content['application/json'] && };
utils.inferSchema(response.content['application/json']); // eslint-disable-next-line guard-for-in
if (schema) { for (const path in openAPI.paths) {
response.example = schema ? this.sampleFromSchema(schema) : null; // eslint-disable-next-line guard-for-in
} for (const method in openAPI.paths[path]) {
} const api = openAPI.paths[path][method];
if (!api.parameters) // eslint-disable-next-line guard-for-in
continue; for (const code in api.responses) {
for (const parameter of api.parameters) { const response = api.responses[code];
const schema = utils.inferSchema(parameter); const schema =
parameter.example = schema ? this.sampleFromSchema(schema) : null; response.content &&
} response.content['application/json'] &&
} utils.inferSchema(response.content['application/json']);
if (schema) {
response.example = schema ? this.sampleFromSchema(schema) : null;
} }
return openAPI; }
}; // eslint-disable-next-line no-continue
this.openAPI = openAPI; if (!api.parameters) continue;
this.sampleFromSchema = memoizee(this.sampleFromSchema); for (const parameter of api.parameters) {
} const schema = utils.inferSchema(parameter);
parameter.example = schema ? this.sampleFromSchema(schema) : null;
}
}
}
return openAPI;
};
this.openAPI = openAPI;
this.sampleFromSchema = memoizee(this.sampleFromSchema);
}
} }
module.exports = OpenAPIGeneratorMockJs; module.exports = OpenAPIGeneratorMockJs;
\ No newline at end of file
module.exports = { module.exports = {
string: '@string', string: '@string',
string_email: '@email', string_email: '@email',
string_phone: '@phone', string_phone: '@phone',
string_username: '@cname', string_username: '@cname',
string_url: '@url', string_url: '@url',
string_uuid: '@guid', string_uuid: '@guid',
string_id: '@increment', string_id: '@increment',
string_status: '@status', string_status: '@status',
string_authority: '@authority', string_authority: '@authority',
string_label: '@label', string_label: '@label',
string_group: '@group', string_group: '@group',
string_csentence: '@csentence', string_csentence: '@csentence',
string_cname: '@cname', string_cname: '@cname',
string_name: '@last', string_name: '@last',
string_errorCode: '@increment', string_errorCode: '@increment',
string_country: '@country', string_country: '@country',
string_county: '@county(true)', string_county: '@county(true)',
string_province: '@province', string_province: '@province',
string_city: '@city', string_city: '@city',
string_avatar: '@avatar', string_avatar: '@avatar',
string_href: '@href', string_href: '@href',
'string_string(16)': 'string(16)', 'string_string(16)': 'string(16)',
'string_date-time': '@datetime', 'string_date-time': '@datetime',
string_date: '@date', string_date: '@date',
number: '@integer(60, 100)', number: '@integer(60, 100)',
number_float: '@float(60, 100, 3, 5)', number_float: '@float(60, 100, 3, 5)',
integer: '@integer(60, 100)', integer: '@integer(60, 100)',
boolean: '@boolean', boolean: '@boolean',
} };
\ No newline at end of file
function isObject(obj) { function isObject(obj) {
return !!obj && typeof obj === 'object'; return !!obj && typeof obj === 'object';
} }
function objectify(thing) { function objectify(thing) {
if (!isObject(thing)) if (!isObject(thing)) return {};
return {}; return thing;
return thing;
} }
function get(entity, path) { function get(entity, path) {
let current = entity; let current = entity;
for (let i = 0; i < path.length; i += 1) { for (let i = 0; i < path.length; i += 1) {
if (current === null || current === undefined) { if (current === null || current === undefined) {
return undefined; return undefined;
}
current = current[path[i]];
} }
return current; current = current[path[i]];
}
return current;
} }
function normalizeArray(arr) { function normalizeArray(arr) {
if (Array.isArray(arr)) if (Array.isArray(arr)) return arr;
return arr; return [arr];
return [arr];
} }
function isFunc(thing) { function isFunc(thing) {
return typeof thing === 'function'; return typeof thing === 'function';
} }
function inferSchema(thing) { function inferSchema(thing) {
if (thing.schema) { if (thing.schema) {
return thing.schema; return thing.schema;
} }
if (thing.properties) { if (thing.properties) {
return { return {
...thing, ...thing,
type: 'object', type: 'object',
}; };
} }
return thing; return thing;
} }
module.exports = { module.exports = {
isObject, isObject,
objectify, objectify,
get, get,
normalizeArray, normalizeArray,
isFunc, isFunc,
inferSchema inferSchema,
} };
\ No newline at end of file
...@@ -21,9 +21,9 @@ function createMiddleware(config) { ...@@ -21,9 +21,9 @@ function createMiddleware(config) {
if (serversFolder && !existsSync(serversFolder)) { if (serversFolder && !existsSync(serversFolder)) {
mkdirSync(serversFolder); mkdirSync(serversFolder);
} }
// pageConfig.name.split('/').pop(),
await generateService({ await generateService({
projectName: '', projectName: '',
//pageConfig.name.split('/').pop(),
...openAPIConfig, ...openAPIConfig,
serversPath: serversFolder, serversPath: serversFolder,
mockFolder, mockFolder,
......
/* eslint-disable */
const fs = require('fs'); const fs = require('fs');
const glob = require('glob'); const glob = require('glob');
const rimraf = require('rimraf'); const rimraf = require('rimraf');
const nunjucks = require("nunjucks"); const nunjucks = require('nunjucks');
const path = require('path'); const path = require('path');
const lodash = require('lodash'); const lodash = require('lodash');
const reservedWords = require('reserved-words'); const reservedWords = require('reserved-words');
...@@ -159,7 +160,7 @@ class ServiceGenerator { ...@@ -159,7 +160,7 @@ class ServiceGenerator {
}; };
this.openAPIData = openAPIData; this.openAPIData = openAPIData;
const { info } = openAPIData; const { info } = openAPIData;
const basePath = ''; const basePath = config.basePath || '';
this.version = info.version; this.version = info.version;
Object.keys(openAPIData.paths || {}).forEach((p) => { Object.keys(openAPIData.paths || {}).forEach((p) => {
const pathItem = openAPIData.paths[p]; const pathItem = openAPIData.paths[p];
...@@ -182,7 +183,7 @@ class ServiceGenerator { ...@@ -182,7 +183,7 @@ class ServiceGenerator {
}); });
} }
genFile() { genFile() {
const basePath = this.config.serversPath || './src/service'; const basePath = this.config.serversPath || './src/api/generateAPI';
try { try {
const finalPath = path.join(basePath, this.config.projectName); const finalPath = path.join(basePath, this.config.projectName);
this.finalPath = finalPath; this.finalPath = finalPath;
...@@ -229,7 +230,7 @@ class ServiceGenerator { ...@@ -229,7 +230,7 @@ class ServiceGenerator {
list: this.classNameList, list: this.classNameList,
disableTypeCheck: false, disableTypeCheck: false,
}); });
// 打印日志 // 打印日志
log(`✅ 成功生成 service 文件`); log(`✅ 成功生成 service 文件`);
} }
...@@ -239,7 +240,7 @@ class ServiceGenerator { ...@@ -239,7 +240,7 @@ class ServiceGenerator {
// functionName tag 级别防重 // functionName tag 级别防重
const tmpFunctionRD = {}; const tmpFunctionRD = {};
const genParams = this.apiData[tag] const genParams = this.apiData[tag]
.filter((api) => .filter((api) =>
// 暂不支持变量 // 暂不支持变量
!api.path.includes('${')) !api.path.includes('${'))
.map((api) => { .map((api) => {
...@@ -325,6 +326,7 @@ class ServiceGenerator { ...@@ -325,6 +326,7 @@ class ServiceGenerator {
// prefix 变量 // prefix 变量
return `$\{${prefix}}${formattedPath}`; return `$\{${prefix}}${formattedPath}`;
}; };
return { return {
...newApi, ...newApi,
functionName, functionName,
...@@ -622,7 +624,7 @@ class ServiceGenerator { ...@@ -622,7 +624,7 @@ class ServiceGenerator {
} }
module.exports = { module.exports = {
getPath, getPath,
getGenInfo, getGenInfo,
ServiceGenerator ServiceGenerator
} };
\ No newline at end of file
...@@ -13,18 +13,11 @@ import 'sanitize.css/sanitize.css'; ...@@ -13,18 +13,11 @@ import 'sanitize.css/sanitize.css';
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { import { Button, message, notification } from 'antd';
Button,
message,
notification,
} from 'antd';
import { ConnectedRouter } from 'connected-react-router/immutable'; import { ConnectedRouter } from 'connected-react-router/immutable';
import Immutable from 'immutable'; import Immutable from 'immutable';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { import { params, Storeage } from 'kit_utils';
params,
Storeage,
} from 'kit_utils';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { useIntl } from '@/locales/localeExports'; import { useIntl } from '@/locales/localeExports';
...@@ -42,15 +35,13 @@ import { actionCreators } from './containers/App/store'; ...@@ -42,15 +35,13 @@ import { actionCreators } from './containers/App/store';
import { LocaleContainer } from './locales/locale'; import { LocaleContainer } from './locales/locale';
import { initMicroApps } from './micro'; import { initMicroApps } from './micro';
import Login from './pages/user/login/login'; import Login from './pages/user/login/login';
import { import { getToken, isString } from './utils/utils';
getToken,
isString,
} from './utils/utils';
const isHttps = document.location.protocol === 'https:'; const isHttps = document.location.protocol === 'https:';
const { pwa } = defaultSettings; const { pwa } = defaultSettings;
// eslint-disable-next-line no-restricted-globals // eslint-disable-next-line no-restricted-globals
const namespace = `__PANDA_STORE__${location.hostname}`; const namespace = `__PANDA_STORE__${location.hostname}`;
debugger
window.createStoreage = new Storeage(namespace); window.createStoreage = new Storeage(namespace);
// eslint-disable-next-line no-underscore-dangle // eslint-disable-next-line no-underscore-dangle
const initialState = Immutable.Map(); const initialState = Immutable.Map();
...@@ -83,6 +74,8 @@ const initLocale = () => { ...@@ -83,6 +74,8 @@ const initLocale = () => {
}; };
const initGlobalConfig = () => { const initGlobalConfig = () => {
// eslint-disable-next-line no-debugger
debugger
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
let config = createStoreage.get('globalConfig') || {}; let config = createStoreage.get('globalConfig') || {};
store.dispatch(actionCreators.updateComplexConfig({})); store.dispatch(actionCreators.updateComplexConfig({}));
...@@ -188,15 +181,7 @@ window.share && ...@@ -188,15 +181,7 @@ window.share &&
window.share.event.on('triggerMicro', () => { window.share.event.on('triggerMicro', () => {
initMicroApps(loader, store); initMicroApps(loader, store);
}); });
window.share &&
window.share.event &&
window.share.event.on('triggerLoginout', () => {
if(Cookies.get('token')) {
store.dispatch(actionCreators.logout());
window.location.reload();
}
initGlobalConfig();
});
if (pwa) { if (pwa) {
// const appPWA = window.i18n.getI18n('app'); // const appPWA = window.i18n.getI18n('app');
......
...@@ -163,10 +163,13 @@ export function updateMicroMounted(data) { ...@@ -163,10 +163,13 @@ export function updateMicroMounted(data) {
} }
export function logout(data) { export function logout(data) {
// eslint-disable-next-line no-undef
createStoreage.remove('PANDA_STORE'); createStoreage.remove('PANDA_STORE');
Cookies.set(window.globalConfig.client, '', { if (window.globalConfig) {
path: '/', Cookies.set(window.globalConfig.client, '', {
}); path: '/',
});
}
Cookies.set('token', '', { Cookies.set('token', '', {
path: '/', path: '/',
...@@ -183,13 +186,13 @@ export function logout(data) { ...@@ -183,13 +186,13 @@ export function logout(data) {
path: '/', path: '/',
}); });
localStorage.removeItem('access_token'); localStorage.removeItem('access_token');
// eslint-disable-next-line no-undef,no-restricted-globals
createStoreage.remove(`__PANDA_STORE__${location.hostname}`); createStoreage.remove(`__PANDA_STORE__${location.hostname}`);
return { return {
type: LOGINOUT, type: LOGINOUT,
data: { data: {
currentMenuIndex: 0, currentMenuIndex: 0,
// config: {}, complexConfig: {},
complexConfig: {} },
} };
} }
}
\ No newline at end of file
...@@ -198,7 +198,7 @@ const appReducer = (state = initialState, action) => { ...@@ -198,7 +198,7 @@ const appReducer = (state = initialState, action) => {
return state.merge({ return state.merge({
complexConfig: action.data.complexConfig, complexConfig: action.data.complexConfig,
currentMenuIndex: action.data.currentMenuIndex, currentMenuIndex: action.data.currentMenuIndex,
}) });
default: default:
return state; return state;
} }
......
...@@ -50,7 +50,7 @@ export const initMicroApps = (loader, store) => { ...@@ -50,7 +50,7 @@ export const initMicroApps = (loader, store) => {
item.activeRule = genActiveRule(`/civbase/${item.PackageName}`); item.activeRule = genActiveRule(`/civbase/${item.PackageName}`);
item.props = JSON.parse(item.DefaultSetting); item.props = JSON.parse(item.DefaultSetting);
return item; return item;
}) }) || micorConfig.prod
: micorConfig.prod; : micorConfig.prod;
registerMicroApps( registerMicroApps(
...@@ -276,4 +276,4 @@ window.app.define('rc-tree', require.context('../node_modules/rc-tree/lib', true ...@@ -276,4 +276,4 @@ window.app.define('rc-tree', require.context('../node_modules/rc-tree/lib', true
window.app.define('rc-tree-select', require.context('../node_modules/rc-tree-select/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js'); window.app.define('rc-tree-select', require.context('../node_modules/rc-tree-select/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('rc-trigger', require.context('../node_modules/rc-trigger/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js'); window.app.define('rc-trigger', require.context('../node_modules/rc-trigger/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('rc-upload', require.context('../node_modules/rc-upload/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js'); window.app.define('rc-upload', require.context('../node_modules/rc-upload/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('rc-virtual-list', require.context('../node_modules/rc-virtual-list/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js'); window.app.define('rc-virtual-list', require.context('../node_modules/rc-virtual-list/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
\ No newline at end of file
...@@ -9,7 +9,9 @@ export default () => { ...@@ -9,7 +9,9 @@ export default () => {
switch(loginTemplate) { switch(loginTemplate) {
case '新春 - 智联.html': case '新春 - 智联.html':
return <NewYear/> return <NewYear/>
default: case 'Dark.html':
return <BaseLogin/> return <BaseLogin/>
default:
return <></>;
} }
}; };
import 'kit_utils/lib/format'; import 'kit_utils/lib/format';
import React, { import React, { forwardRef, useEffect, useRef, useState } from 'react';
forwardRef,
useEffect,
useRef,
useState,
} from 'react';
import { import { Alert, Checkbox, Form, Modal, Popover } from 'antd';
Alert,
Checkbox,
Form,
Modal,
Popover,
} from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import { encode } from 'js-base64'; import { encode } from 'js-base64';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { dom } from 'kit_utils'; import { dom } from 'kit_utils';
import QRCode from 'qrcode.react'; import QRCode from 'qrcode.react';
import { import { Helmet, HelmetProvider } from 'react-helmet-async';
Helmet,
HelmetProvider,
} from 'react-helmet-async';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import { import { LOGIN_DISPLAY, LOGIN_WAY } from '@/constants';
LOGIN_DISPLAY,
LOGIN_WAY,
} from '@/constants';
import { actionCreators } from '@/containers/App/store'; import { actionCreators } from '@/containers/App/store';
import { useIntl } from '@/locales/localeExports'; import { useIntl } from '@/locales/localeExports';
...@@ -556,7 +539,7 @@ const Login = forwardRef((props, _ref) => { ...@@ -556,7 +539,7 @@ const Login = forwardRef((props, _ref) => {
> >
<img <img
role="logo" role="logo"
src={props.global.transformDevAssetsBaseURL(props.global.logo)} src={props.global && props.global.transformDevAssetsBaseURL && props.global.transformDevAssetsBaseURL(props.global.logo)}
/> />
<div <div
className={classNames( className={classNames(
......
...@@ -31,19 +31,33 @@ export const dyRoutes = routes => { ...@@ -31,19 +31,33 @@ export const dyRoutes = routes => {
component: BasicLayout, component: BasicLayout,
routes: dyRoutes, routes: dyRoutes,
}, },
process.env.NODE_ENV === 'development' && { process.env.NODE_ENV === 'development' && {
path: '/openapi', path: '/openapi',
exact: true, exact: true,
component: dynamic({ loader: () => import(/* webpackChunkName: 'civ__plugin-openapi__openapi' */'../components/openapi/openapi'), loading: LoadingComponent}), component: dynamic({
loader: () =>
import(
/* webpackChunkName: 'civ__plugin-openapi__openapi' */ '../components/openapi/openapi'
),
loading: LoadingComponent,
}),
}, },
{ {
path: '/404', path: '/404',
component: dynamic({ loader: () => import(/* webpackChunkName: 'p__404' */'../pages/exception/404'), loading: LoadingComponent}), component: dynamic({
loader: () =>
import(/* webpackChunkName: 'p__404' */ '../pages/exception/404'),
loading: LoadingComponent,
}),
}, },
{ {
path: '/500', path: '/500',
component: dynamic({ loader: () => import(/* webpackChunkName: 'p__500' */'../pages/exception/500'), loading: LoadingComponent}), component: dynamic({
loader: () =>
import(/* webpackChunkName: 'p__500' */ '../pages/exception/500'),
loading: LoadingComponent,
}),
}, },
], ],
}; };
......
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