Commit 0d5b157e authored by 陈帅's avatar 陈帅

fix local error

parent 2dbc8cae
export default [
// user
{
path: '/user',
component: '../layouts/UserLayout',
routes: [
{ path: '/user', redirect: '/user/login' },
{ path: '/user/login', name: 'login', component: './User/Login' },
{ path: '/user/register', name: 'register', component: './User/Register' },
{
path: '/user/register-result',
name: 'register.result',
component: './User/RegisterResult',
},
{
component: '404',
},
],
},
// app
{
path: '/',
component: '../layouts/BasicLayout',
Routes: ['src/pages/Authorized'],
routes: [
// dashboard
{ path: '/', redirect: '/dashboard/analysis', authority: ['admin', 'user'] },
{
path: '/dashboard',
name: 'dashboard',
icon: 'dashboard',
routes: [
{
path: '/dashboard/analysis',
name: 'analysis',
component: './Dashboard/Analysis',
},
{
path: '/dashboard/monitor',
name: 'monitor',
component: './Dashboard/Monitor',
},
{
path: '/dashboard/workplace',
name: 'workplace',
component: './Dashboard/Workplace',
},
],
},
// forms
{
path: '/form',
icon: 'form',
name: 'form',
routes: [
{
path: '/form/basic-form',
name: 'basicform',
component: './Forms/BasicForm',
},
{
path: '/form/step-form',
name: 'stepform',
component: './Forms/StepForm',
hideChildrenInMenu: true,
routes: [
{
path: '/form/step-form',
redirect: '/form/step-form/info',
},
{
path: '/form/step-form/info',
name: 'info',
component: './Forms/StepForm/Step1',
},
{
path: '/form/step-form/confirm',
name: 'confirm',
component: './Forms/StepForm/Step2',
},
{
path: '/form/step-form/result',
name: 'result',
component: './Forms/StepForm/Step3',
},
],
},
{
path: '/form/advanced-form',
name: 'advancedform',
authority: ['admin'],
component: './Forms/AdvancedForm',
},
],
},
// list
{
path: '/list',
icon: 'table',
name: 'list',
routes: [
{
path: '/list/table-list',
name: 'searchtable',
component: './List/TableList',
},
{
path: '/list/basic-list',
name: 'basiclist',
component: './List/BasicList',
},
{
path: '/list/card-list',
name: 'cardlist',
component: './List/CardList',
},
{
path: '/list/search',
name: 'searchlist',
component: './List/List',
routes: [
{
path: '/list/search',
redirect: '/list/search/articles',
},
{
path: '/list/search/articles',
name: 'articles',
component: './List/Articles',
},
{
path: '/list/search/projects',
name: 'projects',
component: './List/Projects',
},
{
path: '/list/search/applications',
name: 'applications',
component: './List/Applications',
},
],
},
],
},
{
path: '/profile',
name: 'profile',
icon: 'profile',
routes: [
// profile
{
path: '/profile/basic',
name: 'basic',
component: './Profile/BasicProfile',
},
{
path: '/profile/basic/:id',
hideInMenu: true,
component: './Profile/BasicProfile',
},
{
path: '/profile/advanced',
name: 'advanced',
authority: ['admin'],
component: './Profile/AdvancedProfile',
},
],
},
{
name: 'result',
icon: 'check-circle-o',
path: '/result',
routes: [
// result
{
path: '/result/success',
name: 'success',
component: './Result/Success',
},
{ path: '/result/fail', name: 'fail', component: './Result/Error' },
],
},
{
name: 'exception',
icon: 'warning',
path: '/exception',
routes: [
// exception
{
path: '/exception/403',
name: 'not-permission',
component: './Exception/403',
},
{
path: '/exception/404',
name: 'not-find',
component: './Exception/404',
},
{
path: '/exception/500',
name: 'server-error',
component: './Exception/500',
},
{
path: '/exception/trigger',
name: 'trigger',
hideInMenu: true,
component: './Exception/TriggerException',
},
],
},
{
name: 'account',
icon: 'user',
path: '/account',
routes: [
{
path: '/account/center',
name: 'center',
component: './Account/Center/Center',
routes: [
{
path: '/account/center',
redirect: '/account/center/articles',
},
{
path: '/account/center/articles',
component: './Account/Center/Articles',
},
{
path: '/account/center/applications',
component: './Account/Center/Applications',
},
{
path: '/account/center/projects',
component: './Account/Center/Projects',
},
],
},
{
path: '/account/settings',
name: 'settings',
component: './Account/Settings/Info',
routes: [
{
path: '/account/settings',
redirect: '/account/settings/base',
},
{
path: '/account/settings/base',
component: './Account/Settings/BaseView',
},
{
path: '/account/settings/security',
component: './Account/Settings/SecurityView',
},
{
path: '/account/settings/binding',
component: './Account/Settings/BindingView',
},
{
path: '/account/settings/notification',
component: './Account/Settings/NotificationView',
},
],
},
],
},
// editor
{
name: 'editor',
icon: 'highlight',
path: '/editor',
routes: [
{
path: '/editor/flow',
name: 'flow',
component: './Editor/GGEditor/Flow',
},
{
path: '/editor/mind',
name: 'mind',
component: './Editor/GGEditor/Mind',
},
{
path: '/editor/koni',
name: 'koni',
component: './Editor/GGEditor/Koni',
},
],
},
{
component: '404',
},
],
},
];
...@@ -61,14 +61,18 @@ ...@@ -61,14 +61,18 @@
"bizcharts-plugin-slider": "^2.1.1-beta.1", "bizcharts-plugin-slider": "^2.1.1-beta.1",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"dva": "^2.4.0", "dva": "^2.4.0",
"hash.js": "^1.1.7",
"lodash": "^4.17.10", "lodash": "^4.17.10",
"lodash-decorators": "^6.0.0", "lodash-decorators": "^6.0.0",
"memoize-one": "^5.0.0", "memoize-one": "^5.0.0",
"moment": "^2.22.2", "moment": "^2.22.2",
"numeral": "^2.0.6", "numeral": "^2.0.6",
"nzh": "^1.0.4",
"omit.js": "^1.0.0", "omit.js": "^1.0.0",
"path-to-regexp": "^2.4.0", "path-to-regexp": "^2.4.0",
"prop-types": "^15.7.2",
"qs": "^6.7.0", "qs": "^6.7.0",
"query-string": "^6.5.0",
"rc-animate": "^2.4.4", "rc-animate": "^2.4.4",
"react": "^16.8.5", "react": "^16.8.5",
"react-container-query": "^0.11.0", "react-container-query": "^0.11.0",
...@@ -78,6 +82,11 @@ ...@@ -78,6 +82,11 @@
"react-fittext": "^1.0.0", "react-fittext": "^1.0.0",
"react-media": "^1.9.2", "react-media": "^1.9.2",
"react-media-hook2": "^1.0.2", "react-media-hook2": "^1.0.2",
"umi": "^2.7.0-beta.2",
"umi-plugin-ga": "^1.1.3",
"umi-plugin-locale": "^2.8.0-beta.1",
"umi-plugin-pro-block": "^1.3.0",
"umi-plugin-react": "^1.8.0-beta.1",
"umi-request": "^1.0.7" "umi-request": "^1.0.7"
}, },
"devDependencies": { "devDependencies": {
...@@ -127,12 +136,7 @@ ...@@ -127,12 +136,7 @@
"tslint": "^5.12.1", "tslint": "^5.12.1",
"tslint-config-prettier": "^1.17.0", "tslint-config-prettier": "^1.17.0",
"tslint-eslint-rules": "^5.4.0", "tslint-eslint-rules": "^5.4.0",
"tslint-react": "^3.6.0", "tslint-react": "^3.6.0"
"umi": "^2.7.0-beta.2",
"umi-plugin-ga": "^1.1.3",
"umi-plugin-pro-block": "^1.3.0",
"umi-plugin-react": "^1.8.0-beta.1",
"umi-request": "^1.0.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"puppeteer": "^1.12.1" "puppeteer": "^1.12.1"
......
export default [
// user
{
path: '/user',
component: '../layouts/UserLayout',
routes: [
{ path: '/user', redirect: '/user/login' },
{ path: '/user/login', name: 'login', component: './User/Login' },
{ path: '/user/register', name: 'register', component: './User/Register' },
{
path: '/user/register-result',
name: 'register.result',
component: './User/RegisterResult',
},
{
component: '404',
},
],
},
// app
{
path: '/',
component: '../layouts/BasicLayout',
Routes: ['src/pages/Authorized'],
routes: [
// dashboard
{ path: '/', redirect: '/dashboard/analysis', authority: ['admin', 'user'] },
{
path: '/dashboard',
name: 'dashboard',
icon: 'dashboard',
routes: [
{
path: '/dashboard/analysis',
name: 'analysis',
component: './Dashboard/Analysis',
},
{
path: '/dashboard/monitor',
name: 'monitor',
component: './Dashboard/Monitor',
},
{
path: '/dashboard/workplace',
name: 'workplace',
component: './Dashboard/Workplace',
},
],
},
// forms
{
path: '/form',
icon: 'form',
name: 'form',
routes: [
{
path: '/form/basic-form',
name: 'basicform',
component: './Forms/BasicForm',
},
{
path: '/form/step-form',
name: 'stepform',
component: './Forms/StepForm',
hideChildrenInMenu: true,
routes: [
{
path: '/form/step-form',
redirect: '/form/step-form/info',
},
{
path: '/form/step-form/info',
name: 'info',
component: './Forms/StepForm/Step1',
},
{
path: '/form/step-form/confirm',
name: 'confirm',
component: './Forms/StepForm/Step2',
},
{
path: '/form/step-form/result',
name: 'result',
component: './Forms/StepForm/Step3',
},
],
},
{
path: '/form/advanced-form',
name: 'advancedform',
authority: ['admin'],
component: './Forms/AdvancedForm',
},
],
},
// list
{
path: '/list',
icon: 'table',
name: 'list',
routes: [
{
path: '/list/table-list',
name: 'searchtable',
component: './List/TableList',
},
{
path: '/list/basic-list',
name: 'basiclist',
component: './List/BasicList',
},
{
path: '/list/card-list',
name: 'cardlist',
component: './List/CardList',
},
{
path: '/list/search',
name: 'searchlist',
component: './List/List',
routes: [
{
path: '/list/search',
redirect: '/list/search/articles',
},
{
path: '/list/search/articles',
name: 'articles',
component: './List/Articles',
},
{
path: '/list/search/projects',
name: 'projects',
component: './List/Projects',
},
{
path: '/list/search/applications',
name: 'applications',
component: './List/Applications',
},
],
},
],
},
{
path: '/profile',
name: 'profile',
icon: 'profile',
routes: [
// profile
{
path: '/profile/basic',
name: 'basic',
component: './Profile/BasicProfile',
},
{
path: '/profile/basic/:id',
hideInMenu: true,
component: './Profile/BasicProfile',
},
{
path: '/profile/advanced',
name: 'advanced',
authority: ['admin'],
component: './Profile/AdvancedProfile',
},
],
},
{
name: 'result',
icon: 'check-circle-o',
path: '/result',
routes: [
// result
{
path: '/result/success',
name: 'success',
component: './Result/Success',
},
{ path: '/result/fail', name: 'fail', component: './Result/Error' },
],
},
{
name: 'exception',
icon: 'warning',
path: '/exception',
routes: [
// exception
{
path: '/exception/403',
name: 'not-permission',
component: './Exception/403',
},
{
path: '/exception/404',
name: 'not-find',
component: './Exception/404',
},
{
path: '/exception/500',
name: 'server-error',
component: './Exception/500',
},
{
path: '/exception/trigger',
name: 'trigger',
hideInMenu: true,
component: './Exception/TriggerException',
},
],
},
{
name: 'account',
icon: 'user',
path: '/account',
routes: [
{
path: '/account/center',
name: 'center',
component: './Account/Center/Center',
routes: [
{
path: '/account/center',
redirect: '/account/center/articles',
},
{
path: '/account/center/articles',
component: './Account/Center/Articles',
},
{
path: '/account/center/applications',
component: './Account/Center/Applications',
},
{
path: '/account/center/projects',
component: './Account/Center/Projects',
},
],
},
{
path: '/account/settings',
name: 'settings',
component: './Account/Settings/Info',
routes: [
{
path: '/account/settings',
redirect: '/account/settings/base',
},
{
path: '/account/settings/base',
component: './Account/Settings/BaseView',
},
{
path: '/account/settings/security',
component: './Account/Settings/SecurityView',
},
{
path: '/account/settings/binding',
component: './Account/Settings/BindingView',
},
{
path: '/account/settings/notification',
component: './Account/Settings/NotificationView',
},
],
},
],
},
// editor
{
name: 'editor',
icon: 'highlight',
path: '/editor',
routes: [
{
path: '/editor/flow',
name: 'flow',
component: './Editor/GGEditor/Flow',
},
{
path: '/editor/mind',
name: 'mind',
component: './Editor/GGEditor/Mind',
},
{
path: '/editor/koni',
name: 'koni',
component: './Editor/GGEditor/Koni',
},
],
},
{
component: '404',
},
],
},
];
...@@ -120,6 +120,7 @@ const installRouters = findAllInstallRouter(router); ...@@ -120,6 +120,7 @@ const installRouters = findAllInstallRouter(router);
let i = 0; let i = 0;
const firstUpperCase = pathString => { const firstUpperCase = pathString => {
return pathString return pathString
.replace('.', '')
.split(/\/|\-/) .split(/\/|\-/)
.map(s => s.toLowerCase().replace(/( |^)[a-z]/g, L => L.toUpperCase())) .map(s => s.toLowerCase().replace(/( |^)[a-z]/g, L => L.toUpperCase()))
.filter(s => s) .filter(s => s)
...@@ -132,12 +133,13 @@ const installBlock = () => { ...@@ -132,12 +133,13 @@ const installBlock = () => {
return; return;
} }
console.log('install ' + item.name + ' to: ' + item.component); console.log('install ' + item.name + ' to: ' + item.component);
const cmd = `umi block add https://github.com/ant-design/pro-blocks/tree/master/${firstUpperCase( const cmd = `umi block add https://github.com/ant-design/pro-blocks/tree/master/${firstUpperCase(
item.path, item.path,
)} --npm-client=cnpm --path=${item.path}`; )} --npm-client=cnpm --path=${item.path}`;
console.log(cmd);
exec(cmd, { encoding: 'utf8' }, (error, statusbar) => { exec(cmd, { encoding: 'utf8' }, (error, statusbar) => {
if (error) console.log(error); if (error) console.log(error);
console.log(statusbar);
i += 1; i += 1;
installBlock(); installBlock();
}); });
......
...@@ -64,27 +64,27 @@ module.exports = [ ...@@ -64,27 +64,27 @@ module.exports = [
name: 'stepform', name: 'stepform',
component: './Forms/StepForm', component: './Forms/StepForm',
hideChildrenInMenu: true, hideChildrenInMenu: true,
routes: [ // routes: [
{ // {
path: '/form/step-form', // path: '/form/step-form',
redirect: '/form/step-form/info', // redirect: '/form/step-form/info',
}, // },
{ // {
path: '/form/step-form/info', // path: '/form/step-form/info',
name: 'info', // name: 'info',
component: './Forms/StepForm/Step1', // component: './Forms/StepForm/Step1',
}, // },
{ // {
path: '/form/step-form/confirm', // path: '/form/step-form/confirm',
name: 'confirm', // name: 'confirm',
component: './Forms/StepForm/Step2', // component: './Forms/StepForm/Step2',
}, // },
{ // {
path: '/form/step-form/result', // path: '/form/step-form/result',
name: 'result', // name: 'result',
component: './Forms/StepForm/Step3', // component: './Forms/StepForm/Step3',
}, // },
], // ],
}, },
{ {
path: '/form/advanced-form', path: '/form/advanced-form',
...@@ -117,7 +117,7 @@ module.exports = [ ...@@ -117,7 +117,7 @@ module.exports = [
}, },
{ {
path: '/list/search', path: '/list/search',
name: 'searchlist', name: 'search-list',
component: './List/List', component: './List/List',
routes: [ routes: [
{ {
...@@ -219,51 +219,51 @@ module.exports = [ ...@@ -219,51 +219,51 @@ module.exports = [
path: '/account/center', path: '/account/center',
name: 'center', name: 'center',
component: './Account/Center/Center', component: './Account/Center/Center',
routes: [ // routes: [
{ // {
path: '/account/center', // path: '/account/center',
redirect: '/account/center/articles', // redirect: '/account/center/articles',
}, // },
{ // {
path: '/account/center/articles', // path: '/account/center/articles',
component: './Account/Center/Articles', // component: './Account/Center/Articles',
}, // },
{ // {
path: '/account/center/applications', // path: '/account/center/applications',
component: './Account/Center/Applications', // component: './Account/Center/Applications',
}, // },
{ // {
path: '/account/center/projects', // path: '/account/center/projects',
component: './Account/Center/Projects', // component: './Account/Center/Projects',
}, // },
], // ],
}, },
{ {
path: '/account/settings', path: '/account/settings',
name: 'settings', name: 'settings',
component: './Account/Settings/Info', component: './Account/Settings/Info',
routes: [ // routes: [
{ // {
path: '/account/settings', // path: '/account/settings',
redirect: '/account/settings/base', // redirect: '/account/settings/base',
}, // },
{ // {
path: '/account/settings/base', // path: '/account/settings/base',
component: './Account/Settings/BaseView', // component: './Account/Settings/BaseView',
}, // },
{ // {
path: '/account/settings/security', // path: '/account/settings/security',
component: './Account/Settings/SecurityView', // component: './Account/Settings/SecurityView',
}, // },
{ // {
path: '/account/settings/binding', // path: '/account/settings/binding',
component: './Account/Settings/BindingView', // component: './Account/Settings/BindingView',
}, // },
{ // {
path: '/account/settings/notification', // path: '/account/settings/notification',
component: './Account/Settings/NotificationView', // component: './Account/Settings/NotificationView',
}, // },
], // ],
}, },
], ],
}, },
......
...@@ -26,11 +26,14 @@ export type BasicLayoutContext = { [K in 'location']: BasicLayoutProps[K] } & { ...@@ -26,11 +26,14 @@ export type BasicLayoutContext = { [K in 'location']: BasicLayoutProps[K] } & {
/** /**
* default menuLocal * default menuLocal
*/ */
const filterMenuData = (menuList: MenuDataItem[], locale: boolean) => { const filterMenuData = (menuList: MenuDataItem[], locale: boolean): MenuDataItem[] => {
return menuList.map(item => { return menuList.map(item => {
const localItem = { const localItem = {
...item, ...item,
name: item.locale && locale ? formatMessage({ id: item.locale }) : item.name, name:
item.locale && locale
? formatMessage({ id: item.locale, defaultMessage: item.name })
: item.name,
children: item.children ? filterMenuData(item.children, locale) : [], children: item.children ? filterMenuData(item.children, locale) : [],
}; };
......
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
'menu.form.step-form.result': 'Step Form(finished)', 'menu.form.step-form.result': 'Step Form(finished)',
'menu.form.advanced-form': 'Advanced Form', 'menu.form.advanced-form': 'Advanced Form',
'menu.list': 'List', 'menu.list': 'List',
'menu.list.search-table': 'Search Table', 'menu.list.table-list': 'Search Table',
'menu.list.basic-list': 'Basic List', 'menu.list.basic-list': 'Basic List',
'menu.list.card-list': 'Card List', 'menu.list.card-list': 'Card List',
'menu.list.search-list': 'Search List', 'menu.list.search-list': 'Search List',
......
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
'menu.form.step-form.result': 'Formulário Assistido(finalizado)', 'menu.form.step-form.result': 'Formulário Assistido(finalizado)',
'menu.form.advanced-form': 'Formulário Avançado', 'menu.form.advanced-form': 'Formulário Avançado',
'menu.list': 'Lista', 'menu.list': 'Lista',
'menu.list.search-table': 'Tabela de Busca', 'menu.list.table-list': 'Tabela de Busca',
'menu.list.basic-list': 'Lista Básica', 'menu.list.basic-list': 'Lista Básica',
'menu.list.card-list': 'Lista de Card', 'menu.list.card-list': 'Lista de Card',
'menu.list.search-list': 'Lista de Busca', 'menu.list.search-list': 'Lista de Busca',
......
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
'menu.form.step-form.result': '分步表单(完成)', 'menu.form.step-form.result': '分步表单(完成)',
'menu.form.advanced-form': '高级表单', 'menu.form.advanced-form': '高级表单',
'menu.list': '列表页', 'menu.list': '列表页',
'menu.list.search-table': '查询表格', 'menu.list.table-list': '查询表格',
'menu.list.basic-list': '标准列表', 'menu.list.basic-list': '标准列表',
'menu.list.card-list': '卡片列表', 'menu.list.card-list': '卡片列表',
'menu.list.search-list': '搜索列表', 'menu.list.search-list': '搜索列表',
......
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
'menu.form.step-form.result': '分步表單(完成)', 'menu.form.step-form.result': '分步表單(完成)',
'menu.form.advanced-form': '高級表單', 'menu.form.advanced-form': '高級表單',
'menu.list': '列表頁', 'menu.list': '列表頁',
'menu.list.search-table': '查詢表格', 'menu.list.table-list': '查詢表格',
'menu.list.basic-list': '標淮列表', 'menu.list.basic-list': '標淮列表',
'menu.list.card-list': '卡片列表', 'menu.list.card-list': '卡片列表',
'menu.list.search-list': '搜索列表', 'menu.list.search-list': '搜索列表',
......
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