Commit 2f3e2847 2f3e284747f07cdad531f8585bb001874b30500d by tailor

origin

1 parent 3073e49c
Showing 150 changed files with 4738 additions and 0 deletions
1 # http://editorconfig.org
2 root = true
3
4 [*]
5 indent_style = space
6 indent_size = 2
7 end_of_line = lf
8 charset = utf-8
9 trim_trailing_whitespace = true
10 insert_final_newline = true
11
12 [*.md]
13 trim_trailing_whitespace = false
14
15 [Makefile]
16 indent_style = tab
1 /lambda/
2 /scripts
3 /config
4 .history
...\ No newline at end of file ...\ No newline at end of file
1 module.exports = {
2 extends: [require.resolve('@umijs/fabric/dist/eslint')],
3 globals: {
4 ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true,
5 page: true,
6 },
7 };
1 ---
2 name: '报告Bug 🐛'
3 about: 报告 Ant Design Pro 的 bug
4 title: '🐛[BUG]'
5 labels: '🐛bug'
6 assignees: ''
7 ---
8
9 ### 🐛 bug 描述
10
11 <!--
12 详细地描述 bug,让大家都能理解
13 -->
14
15 ### 📷 复现步骤
16
17 <!--
18 清晰描述复现步骤,让别人也能看到问题
19 -->
20
21 ### 🏞 期望结果
22
23 <!--
24 描述你原本期望看到的结果
25 -->
26
27 ### 💻 复现代码
28
29 <!--
30 提供可复现的代码,仓库,或线上示例
31 -->
32
33 ### © 版本信息
34
35 - Ant Design Pro 版本: [e.g. 4.0.0]
36 - umi 版本
37 - 浏览器环境
38 - 开发环境 [e.g. mac OS]
39
40 ### 🚑 其他信息
41
42 <!--
43 如截图等其他信息可以贴在这里
44 -->
1 ---
2 name: '功能需求 ✨'
3 about: 对 Ant Design Pro 的需求或建议
4 title: '👑 [需求]'
5 labels: '👑Feature Request'
6 assignees: ''
7 ---
8
9 ### 🥰 需求描述
10
11 <!--
12 详细地描述需求,让大家都能理解
13 -->
14
15 ### 🧐 解决方案
16
17 <!--
18 如果你有解决方案,在这里清晰地阐述
19 -->
20
21 ### 🚑 其他信息
22
23 <!--
24 如截图等其他信息可以贴在这里
25 -->
1 ---
2 name: '疑问或需要帮助 ❓'
3 about: 对 Ant Design Pro 使用的疑问或需要帮助
4 title: '🧐[问题]'
5 labels: '🧐question'
6 assignees: ''
7 ---
8
9 ### 🧐 问题描述
10
11 <!--
12 详细地描述问题,让大家都能理解
13 -->
14
15 ### 💻 示例代码
16
17 <!--
18 如果你有解决方案,在这里清晰地阐述
19 -->
20
21 ### 🚑 其他信息
22
23 <!--
24 如截图等其他信息可以贴在这里
25 -->
1 on:
2 issue_comment:
3 types: [created]
4 name: Automatic Rebase
5 jobs:
6 rebase:
7 name: Rebase
8 runs-on: ubuntu-latest
9 steps:
10 - uses: actions/checkout@master
11 - name: Automatic Rebase
12 uses: cirrus-actions/rebase@master
13 env:
14 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
3 # dependencies
4 **/node_modules
5 # roadhog-api-doc ignore
6 /src/utils/request-temp.js
7 _roadhog-api-doc
8
9 # production
10 /dist
11 /.vscode
12
13 # misc
14 .DS_Store
15 npm-debug.log*
16 yarn-error.log
17
18 /coverage
19 .idea
20 yarn.lock
21 package-lock.json
22 *bak
23 .vscode
24
25 # visual studio code
26 .history
27 *.log
28 functions/*
29 .temp/**
30
31 # umi
32 .umi
33 .umi-production
34
35 # screenshot
36 screenshot
37 .firebase
38 .eslintcache
39
40 build
1 **/*.svg
2 package.json
3 .umi
4 .umi-production
5 /dist
6 .dockerignore
7 .DS_Store
8 .eslintignore
9 *.png
10 *.toml
11 docker
12 .editorconfig
13 Dockerfile*
14 .gitignore
15 .prettierignore
16 LICENSE
17 .eslintcache
18 *.lock
19 yarn-error.log
20 .history
...\ No newline at end of file ...\ No newline at end of file
1 const fabric = require('@umijs/fabric');
2
3 module.exports = {
4 ...fabric.prettier,
5 };
1 const fabric = require('@umijs/fabric');
2
3 module.exports = {
4 ...fabric.stylelint,
5 };
1 import { IConfig, IPlugin } from 'umi-types';
2 import defaultSettings from './defaultSettings'; // https://umijs.org/config/
3
4 import slash from 'slash2';
5 import webpackPlugin from './plugin.config';
6 const { pwa, primaryColor } = defaultSettings; // preview.pro.ant.design only do not use in your production ;
7 // preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
8
9 const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env;
10 const isAntDesignProPreview = ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site';
11 const plugins: IPlugin[] = [
12 [
13 'umi-plugin-react',
14 {
15 antd: true,
16 dva: {
17 hmr: true,
18 },
19 locale: {
20 // default false
21 enable: true,
22 // default zh-CN
23 default: 'zh-CN',
24 // default true, when it is true, will use `navigator.language` overwrite default
25 baseNavigator: true,
26 },
27 // dynamicImport: {
28 // loadingComponent: './components/PageLoading/index',
29 // webpackChunkName: true,
30 // level: 3,
31 // },
32 pwa: pwa
33 ? {
34 workboxPluginMode: 'InjectManifest',
35 workboxOptions: {
36 importWorkboxFrom: 'local',
37 },
38 }
39 : false, // default close dll, because issue https://github.com/ant-design/ant-design-pro/issues/4665
40 // dll features https://webpack.js.org/plugins/dll-plugin/
41 // dll: {
42 // include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
43 // exclude: ['@babel/runtime', 'netlify-lambda'],
44 // },
45 },
46 ],
47 [
48 'umi-plugin-pro-block',
49 {
50 moveMock: false,
51 moveService: false,
52 modifyRequest: true,
53 autoAddMenu: true,
54 },
55 ],
56 ]; // 针对 preview.pro.ant.design 的 GA 统计代码
57
58 if (isAntDesignProPreview) {
59 plugins.push([
60 'umi-plugin-ga',
61 {
62 code: 'UA-72788897-6',
63 },
64 ]);
65 }
66
67 export default {
68 plugins,
69 block: {
70 // 国内用户可以使用码云
71 // defaultGitUrl: 'https://gitee.com/ant-design/pro-blocks',
72 defaultGitUrl: 'https://github.com/ant-design/pro-blocks',
73 },
74 hash: true,
75 targets: {
76 ie: 11,
77 },
78 devtool: isAntDesignProPreview ? 'source-map' : false,
79 // umi routes: https://umijs.org/zh/guide/router.html
80 routes: [
81 {
82 path: '/user',
83 component: '../layouts/UserLayout',
84 routes: [
85 {
86 name: 'login',
87 path: '/user/login',
88 component: './user/login',
89 },
90 ],
91 },
92 {
93 path: '/',
94 component: '../layouts/SecurityLayout',
95 routes: [
96 {
97 path: '/',
98 component: '../layouts/BasicLayout',
99 authority: ['admin', 'user'],
100 routes: [
101 {
102 path: '/',
103 redirect: '/welcome',
104 },
105 {
106 path: '/welcome',
107 name: 'welcome',
108 icon: 'smile',
109 component: './Welcome',
110 },
111 {
112 name: 'ajax',
113 icon: 'smile',
114 path: '/ajax',
115 component: './ajax',
116 },
117 {
118 name: 'reports',
119 icon: 'smile',
120 path: '/reports',
121 component: './reports',
122 routes: [{
123 path: '/reports/blocks',
124 hideInMenu:true,
125 name: 'blocks',
126 component: './reports/blocks',
127 }]
128 },
129 {
130 path: '/employees',
131 name: 'employees',
132 icon: 'smile',
133 component: './employees',
134 },
135 {
136 path: '/machine',
137 name: 'machine',
138 icon: 'smile',
139 component: './Machine',
140 },
141 {
142 path: '/material',
143 name: 'material',
144 icon: 'smile',
145 component: './Material',
146 },
147 {
148 path: '/admin',
149 name: 'admin',
150 icon: 'crown',
151 component: './Admin',
152 authority: ['admin'],
153 },
154 {
155 component: './404',
156 },
157 ],
158 },
159 {
160 component: './404',
161 },
162 ],
163 },
164 {
165 component: './404',
166 },
167 ],
168 // Theme for antd: https://ant.design/docs/react/customize-theme-cn
169 theme: {
170 'primary-color': primaryColor,
171 },
172 define: {
173 ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION:
174 ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '', // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
175 },
176 ignoreMomentLocale: true,
177 lessLoaderOptions: {
178 javascriptEnabled: true,
179 },
180 disableRedirectHoist: true,
181 cssLoaderOptions: {
182 modules: true,
183 getLocalIdent: (
184 context: {
185 resourcePath: string;
186 },
187 _: string,
188 localName: string
189 ) => {
190 if (
191 context.resourcePath.includes('node_modules') ||
192 context.resourcePath.includes('ant.design.pro.less') ||
193 context.resourcePath.includes('global.less')
194 ) {
195 return localName;
196 }
197
198 const match = context.resourcePath.match(/src(.*)/);
199
200 if (match && match[1]) {
201 const antdProPath = match[1].replace('.less', '');
202 const arr = slash(antdProPath)
203 .split('/')
204 .map((a: string) => a.replace(/([A-Z])/g, '-$1'))
205 .map((a: string) => a.toLowerCase());
206 return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-');
207 }
208
209 return localName;
210 },
211 },
212 manifest: {
213 basePath: '/',
214 },
215 chainWebpack: webpackPlugin,
216 /*
217 proxy: {
218 '/server/api/': {
219 target: 'https://preview.pro.ant.design/',
220 changeOrigin: true,
221 pathRewrite: { '^/server': '' },
222 },
223 },
224 */
225 } as IConfig;
1 import { MenuTheme } from 'antd/es/menu/MenuContext';
2
3 export type ContentWidth = 'Fluid' | 'Fixed';
4
5 export interface DefaultSettings {
6 /**
7 * theme for nav menu
8 */
9 navTheme: MenuTheme;
10 /**
11 * primary color of ant design
12 */
13 primaryColor: string;
14 /**
15 * nav menu position: `sidemenu` or `topmenu`
16 */
17 layout: 'sidemenu' | 'topmenu';
18 /**
19 * layout of content: `Fluid` or `Fixed`, only works when layout is topmenu
20 */
21 contentWidth: ContentWidth;
22 /**
23 * sticky header
24 */
25 fixedHeader: boolean;
26 /**
27 * auto hide header
28 */
29 autoHideHeader: boolean;
30 /**
31 * sticky siderbar
32 */
33 fixSiderbar: boolean;
34 menu: { locale: boolean };
35 title: string;
36 pwa: boolean;
37 // Your custom iconfont Symbol script Url
38 // eg://at.alicdn.com/t/font_1039637_btcrd5co4w.js
39 // 注意:如果需要图标多色,Iconfont 图标项目里要进行批量去色处理
40 // Usage: https://github.com/ant-design/ant-design-pro/pull/3517
41 iconfontUrl: string;
42 colorWeak: boolean;
43 }
44
45 export default {
46 navTheme: 'dark',
47 primaryColor: '#1890FF',
48 layout: 'sidemenu',
49 contentWidth: 'Fluid',
50 fixedHeader: false,
51 autoHideHeader: false,
52 fixSiderbar: false,
53 colorWeak: false,
54 menu: {
55 locale: true,
56 },
57 title: 'LIMSChain 平台',
58 pwa: false,
59 iconfontUrl: '',
60 } as DefaultSettings;
1 // Change theme plugin
2 // eslint-disable-next-line eslint-comments/abdeils - enable - pair;
3 /* eslint-disable import/no-extraneous-dependencies */
4 import ThemeColorReplacer from 'webpack-theme-color-replacer';
5 import generate from '@ant-design/colors/lib/generate';
6 import path from 'path';
7
8 function getModulePackageName(module: { context: string }) {
9 if (!module.context) return null;
10
11 const nodeModulesPath = path.join(__dirname, '../node_modules/');
12 if (module.context.substring(0, nodeModulesPath.length) !== nodeModulesPath) {
13 return null;
14 }
15
16 const moduleRelativePath = module.context.substring(nodeModulesPath.length);
17 const [moduleDirName] = moduleRelativePath.split(path.sep);
18 let packageName: string | null = moduleDirName;
19 // handle tree shaking
20 if (packageName && packageName.match('^_')) {
21 // eslint-disable-next-line prefer-destructuring
22 packageName = packageName.match(/^_(@?[^@]+)/)![1];
23 }
24 return packageName;
25 }
26
27 export default (config: any) => {
28 // preview.pro.ant.design only do not use in your production;
29 if (
30 process.env.ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site' ||
31 process.env.NODE_ENV !== 'production'
32 ) {
33 config.plugin('webpack-theme-color-replacer').use(ThemeColorReplacer, [
34 {
35 fileName: 'css/theme-colors-[contenthash:8].css',
36 matchColors: getAntdSerials('#1890ff'), // 主色系列
37 // 改变样式选择器,解决样式覆盖问题
38 changeSelector(selector: string): string {
39 switch (selector) {
40 case '.ant-calendar-today .ant-calendar-date':
41 return ':not(.ant-calendar-selected-date)' + selector;
42 case '.ant-btn:focus,.ant-btn:hover':
43 return '.ant-btn:focus:not(.ant-btn-primary),.ant-btn:hover:not(.ant-btn-primary)';
44 case '.ant-btn.active,.ant-btn:active':
45 return '.ant-btn.active:not(.ant-btn-primary),.ant-btn:active:not(.ant-btn-primary)';
46 default:
47 return selector;
48 }
49 },
50 // isJsUgly: true,
51 },
52 ]);
53 }
54
55 // optimize chunks
56 config.optimization
57 // share the same chunks across different modules
58 .runtimeChunk(false)
59 .splitChunks({
60 chunks: 'async',
61 name: 'vendors',
62 maxInitialRequests: Infinity,
63 minSize: 0,
64 cacheGroups: {
65 vendors: {
66 test: (module: { context: string }) => {
67 const packageName = getModulePackageName(module) || '';
68 if (packageName) {
69 return [
70 'bizcharts',
71 'gg-editor',
72 'g6',
73 '@antv',
74 'gg-editor-core',
75 'bizcharts-plugin-slider',
76 ].includes(packageName);
77 }
78 return false;
79 },
80 name(module: { context: string }) {
81 const packageName = getModulePackageName(module);
82 if (packageName) {
83 if (['bizcharts', '@antv_data-set'].indexOf(packageName) >= 0) {
84 return 'viz'; // visualization package
85 }
86 }
87 return 'misc';
88 },
89 },
90 },
91 });
92 };
93
94 const getAntdSerials = (color: string) => {
95 const lightNum = 9;
96 const devide10 = 10;
97 // 淡化(即less的tint)
98 const lightens = new Array(lightNum).fill(undefined).map((_, i: number) => {
99 return ThemeColorReplacer.varyColor.lighten(color, i / devide10);
100 });
101 const colorPalettes = generate(color);
102 const rgb = ThemeColorReplacer.varyColor.toNum3(color.replace('#', '')).join(',');
103 return lightens.concat(colorPalettes).concat(rgb);
104 };
1 // ps https://github.com/GoogleChrome/puppeteer/issues/3120
2 module.exports = {
3 launch: {
4 args: [
5 '--disable-gpu',
6 '--disable-dev-shm-usage',
7 '--no-first-run',
8 '--no-zygote',
9 '--no-sandbox',
10 ],
11 },
12 };
1 module.exports = {
2 testURL: 'http://localhost:8000',
3 preset: 'jest-puppeteer',
4 globals: {
5 ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: false,
6 localStorage: null,
7 },
8 };
1 {
2 "compilerOptions": {
3 "emitDecoratorMetadata": true,
4 "experimentalDecorators": true,
5 "baseUrl": ".",
6 "paths": {
7 "@/*": ["./src/*"]
8 }
9 }
10 }
1 import { Request, Response } from 'express';
2
3 const getNotices = (req: Request, res: Response) => {
4 res.json([
5 {
6 id: '000000001',
7 avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
8 title: '你收到了 14 份新周报',
9 datetime: '2017-08-09',
10 type: 'notification',
11 },
12 {
13 id: '000000002',
14 avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png',
15 title: '你推荐的 曲妮妮 已通过第三轮面试',
16 datetime: '2017-08-08',
17 type: 'notification',
18 },
19 {
20 id: '000000003',
21 avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png',
22 title: '这种模板可以区分多种通知类型',
23 datetime: '2017-08-07',
24 read: true,
25 type: 'notification',
26 },
27 {
28 id: '000000004',
29 avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png',
30 title: '左侧图标用于区分不同的类型',
31 datetime: '2017-08-07',
32 type: 'notification',
33 },
34 {
35 id: '000000005',
36 avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
37 title: '内容不要超过两行字,超出时自动截断',
38 datetime: '2017-08-07',
39 type: 'notification',
40 },
41 {
42 id: '000000006',
43 avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
44 title: '曲丽丽 评论了你',
45 description: '描述信息描述信息描述信息',
46 datetime: '2017-08-07',
47 type: 'message',
48 clickClose: true,
49 },
50 {
51 id: '000000007',
52 avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
53 title: '朱偏右 回复了你',
54 description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
55 datetime: '2017-08-07',
56 type: 'message',
57 clickClose: true,
58 },
59 {
60 id: '000000008',
61 avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
62 title: '标题',
63 description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
64 datetime: '2017-08-07',
65 type: 'message',
66 clickClose: true,
67 },
68 {
69 id: '000000009',
70 title: '任务名称',
71 description: '任务需要在 2017-01-12 20:00 前启动',
72 extra: '未开始',
73 status: 'todo',
74 type: 'event',
75 },
76 {
77 id: '000000010',
78 title: '第三方紧急代码变更',
79 description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
80 extra: '马上到期',
81 status: 'urgent',
82 type: 'event',
83 },
84 {
85 id: '000000011',
86 title: '信息安全考试',
87 description: '指派竹尔于 2017-01-09 前完成更新并发布',
88 extra: '已耗时 8 天',
89 status: 'doing',
90 type: 'event',
91 },
92 {
93 id: '000000012',
94 title: 'ABCD 版本发布',
95 description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
96 extra: '进行中',
97 status: 'processing',
98 type: 'event',
99 },
100 ]);
101 };
102
103 export default {
104 'GET /api/notices': getNotices,
105 };
1 export default {
2 '/api/auth_routes': {
3 '/form/advanced-form': { authority: ['admin', 'user'] },
4 },
5 };
1 import { Request, Response } from 'express';
2
3 function getFakeCaptcha(req: Request, res: Response) {
4 return res.json('captcha-xxx');
5 }
6 // 代码中会兼容本地 service mock 以及部署站点的静态数据
7 export default {
8 // 支持值为 Object 和 Array
9 'GET /api/currentUser': {
10 name: 'Serati Ma',
11 avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
12 userid: '00000001',
13 email: 'antdesign@alipay.com',
14 signature: '海纳百川,有容乃大',
15 title: '交互专家',
16 group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED',
17 tags: [
18 {
19 key: '0',
20 label: '很有想法的',
21 },
22 {
23 key: '1',
24 label: '专注设计',
25 },
26 {
27 key: '2',
28 label: '辣~',
29 },
30 {
31 key: '3',
32 label: '大长腿',
33 },
34 {
35 key: '4',
36 label: '川妹子',
37 },
38 {
39 key: '5',
40 label: '海纳百川',
41 },
42 ],
43 notifyCount: 12,
44 unreadCount: 11,
45 country: 'China',
46 geographic: {
47 province: {
48 label: '浙江省',
49 key: '330000',
50 },
51 city: {
52 label: '杭州市',
53 key: '330100',
54 },
55 },
56 address: '西湖区工专路 77 号',
57 phone: '0752-268888888',
58 },
59 // GET POST 可省略
60 'GET /api/users': [
61 {
62 key: '1',
63 name: 'John Brown',
64 age: 32,
65 address: 'New York No. 1 Lake Park',
66 },
67 {
68 key: '2',
69 name: 'Jim Green',
70 age: 42,
71 address: 'London No. 1 Lake Park',
72 },
73 {
74 key: '3',
75 name: 'Joe Black',
76 age: 32,
77 address: 'Sidney No. 1 Lake Park',
78 },
79 ],
80 'POST /api/login/account': (req: Request, res: Response) => {
81 const { password, userName, type } = req.body;
82 if (password === 'ant.design' && userName === 'admin') {
83 res.send({
84 status: 'ok',
85 type,
86 currentAuthority: 'admin',
87 });
88 return;
89 }
90 if (password === 'ant.design' && userName === 'user') {
91 res.send({
92 status: 'ok',
93 type,
94 currentAuthority: 'user',
95 });
96 return;
97 }
98 res.send({
99 status: 'error',
100 type,
101 currentAuthority: 'guest',
102 });
103 },
104 'POST /api/register': (req: Request, res: Response) => {
105 res.send({ status: 'ok', currentAuthority: 'user' });
106 },
107 'GET /api/500': (req: Request, res: Response) => {
108 res.status(500).send({
109 timestamp: 1513932555104,
110 status: 500,
111 error: 'error',
112 message: 'error',
113 path: '/base/category/list',
114 });
115 },
116 'GET /api/404': (req: Request, res: Response) => {
117 res.status(404).send({
118 timestamp: 1513932643431,
119 status: 404,
120 error: 'Not Found',
121 message: 'No message available',
122 path: '/base/category/list/2121212',
123 });
124 },
125 'GET /api/403': (req: Request, res: Response) => {
126 res.status(403).send({
127 timestamp: 1513932555104,
128 status: 403,
129 error: 'Unauthorized',
130 message: 'Unauthorized',
131 path: '/base/category/list',
132 });
133 },
134 'GET /api/401': (req: Request, res: Response) => {
135 res.status(401).send({
136 timestamp: 1513932555104,
137 status: 401,
138 error: 'Unauthorized',
139 message: 'Unauthorized',
140 path: '/base/category/list',
141 });
142 },
143
144 'GET /api/login/captcha': getFakeCaptcha,
145 };
1 {
2 "name": "ant-design-pro",
3 "version": "1.0.0",
4 "private": true,
5 "description": "An out-of-box UI solution for enterprise applications",
6 "proxy": "https://randomuser.me/api",
7 "scripts": {
8 "analyze": "cross-env ANALYZE=1 umi build",
9 "build": "umi build",
10 "deploy": "npm run site && npm run gh-pages",
11 "fetch:blocks": "pro fetch-blocks && npm run prettier",
12 "format-imports": "cross-env import-sort --write '**/*.{js,jsx,ts,tsx}'",
13 "gh-pages": "cp CNAME ./dist/ && gh-pages -d dist",
14 "i18n-remove": "pro i18n-remove --locale=zh-CN --write",
15 "lint": "npm run lint:js && npm run lint:style && npm run lint:prettier",
16 "lint-staged": "lint-staged",
17 "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
18 "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src && npm run lint:style",
19 "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
20 "lint:prettier": "check-prettier lint",
21 "lint:style": "stylelint --fix \"src/**/*.less\" --syntax less",
22 "prettier": "prettier -c --write \"**/*\"",
23 "start": "umi dev",
24 "start:no-mock": "cross-env MOCK=none umi dev",
25 "start:no-ui": "cross-env UMI_UI=none umi dev",
26 "test": "umi test",
27 "test:all": "node ./tests/run-tests.js",
28 "test:component": "umi test ./src/components",
29 "ui": "umi ui"
30 },
31 "husky": {
32 "hooks": {
33 "pre-commit": "npm run lint-staged"
34 }
35 },
36 "lint-staged": {
37 "**/*.less": "stylelint --syntax less",
38 "**/*.{js,jsx,tsx,ts,less,md,json}": [
39 "prettier --write",
40 "git add"
41 ],
42 "**/*.{js,jsx}": "npm run lint-staged:js",
43 "**/*.{js,ts,tsx}": "npm run lint-staged:js"
44 },
45 "browserslist": [
46 "> 1%",
47 "last 2 versions",
48 "not ie <= 10"
49 ],
50 "dependencies": {
51 "@ant-design/colors": "^3.1.0",
52 "@ant-design/pro-layout": "^4.5.16",
53 "@antv/data-set": "^0.10.2",
54 "antd": "^3.23.6",
55 "classnames": "^2.2.6",
56 "dva": "^2.4.1",
57 "echarts": "^4.5.0",
58 "echarts-for-react": "^2.0.15-beta.1",
59 "lodash": "^4.17.11",
60 "moment": "^2.24.0",
61 "omit.js": "^1.0.2",
62 "path-to-regexp": "2.4.0",
63 "qs": "^6.9.0",
64 "react": "^16.8.6",
65 "react-copy-to-clipboard": "^5.0.1",
66 "react-dom": "^16.8.6",
67 "react-helmet": "^5.2.1",
68 "redux": "^4.0.1",
69 "slash2": "^2.0.0",
70 "umi": "^2.9.6",
71 "umi-plugin-pro-block": "^1.3.4",
72 "umi-plugin-react": "^1.10.1",
73 "umi-request": "^1.2.7",
74 "webpack-theme-color-replacer": "^1.2.15"
75 },
76 "devDependencies": {
77 "@ant-design/pro-cli": "^1.0.13",
78 "@types/classnames": "^2.2.7",
79 "@types/express": "^4.17.0",
80 "@types/history": "^4.7.2",
81 "@types/jest": "^24.0.13",
82 "@types/lodash": "^4.14.144",
83 "@types/qs": "^6.5.3",
84 "@types/react": "^16.8.19",
85 "@types/react-dom": "^16.8.4",
86 "@types/react-helmet": "^5.0.13",
87 "@umijs/fabric": "^1.2.0",
88 "chalk": "^3.0.0",
89 "check-prettier": "^1.0.3",
90 "cross-env": "^6.0.0",
91 "cross-port-killer": "^1.1.1",
92 "enzyme": "^3.9.0",
93 "eslint": "5.16.0",
94 "express": "^4.17.1",
95 "gh-pages": "^2.0.1",
96 "husky": "^3.0.0",
97 "import-sort-cli": "^6.0.0",
98 "import-sort-parser-babylon": "^6.0.0",
99 "import-sort-parser-typescript": "^6.0.0",
100 "import-sort-style-module": "^6.0.0",
101 "jest-puppeteer": "^4.2.0",
102 "lint-staged": "^9.0.0",
103 "mockjs": "^1.0.1-beta3",
104 "node-fetch": "^2.6.0",
105 "prettier": "^1.17.1",
106 "pro-download": "1.0.1",
107 "stylelint": "^12.0.0",
108 "umi-plugin-ga": "^1.1.3",
109 "umi-plugin-pro": "^1.0.2",
110 "umi-types": "^0.5.0"
111 },
112 "optionalDependencies": {
113 "puppeteer": "^1.17.0"
114 },
115 "engines": {
116 "node": ">=10.0.0"
117 },
118 "checkFiles": [
119 "src/**/*.js*",
120 "src/**/*.ts*",
121 "src/**/*.less",
122 "config/**/*.js*",
123 "scripts/**/*.js"
124 ]
125 }
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <svg width="200px" height="200px" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3 <!-- Generator: Sketch 47.1 (45422) - http://www.bohemiancoding.com/sketch -->
4 <title>Group 28 Copy 5</title>
5 <desc>Created with Sketch.</desc>
6 <defs>
7 <linearGradient x1="62.1023273%" y1="0%" x2="108.19718%" y2="37.8635764%" id="linearGradient-1">
8 <stop stop-color="#4285EB" offset="0%"></stop>
9 <stop stop-color="#2EC7FF" offset="100%"></stop>
10 </linearGradient>
11 <linearGradient x1="69.644116%" y1="0%" x2="54.0428975%" y2="108.456714%" id="linearGradient-2">
12 <stop stop-color="#29CDFF" offset="0%"></stop>
13 <stop stop-color="#148EFF" offset="37.8600687%"></stop>
14 <stop stop-color="#0A60FF" offset="100%"></stop>
15 </linearGradient>
16 <linearGradient x1="69.6908165%" y1="-12.9743587%" x2="16.7228981%" y2="117.391248%" id="linearGradient-3">
17 <stop stop-color="#FA816E" offset="0%"></stop>
18 <stop stop-color="#F74A5C" offset="41.472606%"></stop>
19 <stop stop-color="#F51D2C" offset="100%"></stop>
20 </linearGradient>
21 <linearGradient x1="68.1279872%" y1="-35.6905737%" x2="30.4400914%" y2="114.942679%" id="linearGradient-4">
22 <stop stop-color="#FA8E7D" offset="0%"></stop>
23 <stop stop-color="#F74A5C" offset="51.2635191%"></stop>
24 <stop stop-color="#F51D2C" offset="100%"></stop>
25 </linearGradient>
26 </defs>
27 <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
28 <g id="logo" transform="translate(-20.000000, -20.000000)">
29 <g id="Group-28-Copy-5" transform="translate(20.000000, 20.000000)">
30 <g id="Group-27-Copy-3">
31 <g id="Group-25" fill-rule="nonzero">
32 <g id="2">
33 <path d="M91.5880863,4.17652823 L4.17996544,91.5127728 C-0.519240605,96.2081146 -0.519240605,103.791885 4.17996544,108.487227 L91.5880863,195.823472 C96.2872923,200.518814 103.877304,200.518814 108.57651,195.823472 L145.225487,159.204632 C149.433969,154.999611 149.433969,148.181924 145.225487,143.976903 C141.017005,139.771881 134.193707,139.771881 129.985225,143.976903 L102.20193,171.737352 C101.032305,172.906015 99.2571609,172.906015 98.0875359,171.737352 L28.285908,101.993122 C27.1162831,100.824459 27.1162831,99.050775 28.285908,97.8821118 L98.0875359,28.1378823 C99.2571609,26.9692191 101.032305,26.9692191 102.20193,28.1378823 L129.985225,55.8983314 C134.193707,60.1033528 141.017005,60.1033528 145.225487,55.8983314 C149.433969,51.69331 149.433969,44.8756232 145.225487,40.6706018 L108.58055,4.05574592 C103.862049,-0.537986846 96.2692618,-0.500797906 91.5880863,4.17652823 Z" id="Shape" fill="url(#linearGradient-1)"></path>
34 <path d="M91.5880863,4.17652823 L4.17996544,91.5127728 C-0.519240605,96.2081146 -0.519240605,103.791885 4.17996544,108.487227 L91.5880863,195.823472 C96.2872923,200.518814 103.877304,200.518814 108.57651,195.823472 L145.225487,159.204632 C149.433969,154.999611 149.433969,148.181924 145.225487,143.976903 C141.017005,139.771881 134.193707,139.771881 129.985225,143.976903 L102.20193,171.737352 C101.032305,172.906015 99.2571609,172.906015 98.0875359,171.737352 L28.285908,101.993122 C27.1162831,100.824459 27.1162831,99.050775 28.285908,97.8821118 L98.0875359,28.1378823 C100.999864,25.6271836 105.751642,20.541824 112.729652,19.3524487 C117.915585,18.4685261 123.585219,20.4140239 129.738554,25.1889424 C125.624663,21.0784292 118.571995,14.0340304 108.58055,4.05574592 C103.862049,-0.537986846 96.2692618,-0.500797906 91.5880863,4.17652823 Z" id="Shape" fill="url(#linearGradient-2)"></path>
35 </g>
36 <path d="M153.685633,135.854579 C157.894115,140.0596 164.717412,140.0596 168.925894,135.854579 L195.959977,108.842726 C200.659183,104.147384 200.659183,96.5636133 195.960527,91.8688194 L168.690777,64.7181159 C164.472332,60.5180858 157.646868,60.5241425 153.435895,64.7316526 C149.227413,68.936674 149.227413,75.7543607 153.435895,79.9593821 L171.854035,98.3623765 C173.02366,99.5310396 173.02366,101.304724 171.854035,102.473387 L153.685633,120.626849 C149.47715,124.83187 149.47715,131.649557 153.685633,135.854579 Z" id="Shape" fill="url(#linearGradient-3)"></path>
37 </g>
38 <ellipse id="Combined-Shape" fill="url(#linearGradient-4)" cx="100.519339" cy="100.436681" rx="23.6001926" ry="23.580786"></ellipse>
39 </g>
40 </g>
41 </g>
42 </g>
43 </svg>
...\ No newline at end of file ...\ No newline at end of file
1 import React from 'react';
2 import { Result } from 'antd';
3 import check, { IAuthorityType } from './CheckPermissions';
4
5 import AuthorizedRoute from './AuthorizedRoute';
6 import Secured from './Secured';
7
8 interface AuthorizedProps {
9 authority: IAuthorityType;
10 noMatch?: React.ReactNode;
11 }
12
13 type IAuthorizedType = React.FunctionComponent<AuthorizedProps> & {
14 Secured: typeof Secured;
15 check: typeof check;
16 AuthorizedRoute: typeof AuthorizedRoute;
17 };
18
19 const Authorized: React.FunctionComponent<AuthorizedProps> = ({
20 children,
21 authority,
22 noMatch = (
23 <Result
24 status="403"
25 title="403"
26 subTitle="Sorry, you are not authorized to access this page."
27 />
28 ),
29 }) => {
30 const childrenRender: React.ReactNode = typeof children === 'undefined' ? null : children;
31 const dom = check(authority, childrenRender, noMatch);
32 return <>{dom}</>;
33 };
34
35 export default Authorized as IAuthorizedType;
1 import { Redirect, Route } from 'umi';
2
3 import React from 'react';
4 import Authorized from './Authorized';
5 import { IAuthorityType } from './CheckPermissions';
6
7 interface AuthorizedRoutePops {
8 currentAuthority: string;
9 component: React.ComponentClass<any, any>;
10 render: (props: any) => React.ReactNode;
11 redirectPath: string;
12 authority: IAuthorityType;
13 }
14
15 const AuthorizedRoute: React.SFC<AuthorizedRoutePops> = ({
16 component: Component,
17 render,
18 authority,
19 redirectPath,
20 ...rest
21 }) => (
22 <Authorized
23 authority={authority}
24 noMatch={<Route {...rest} render={() => <Redirect to={{ pathname: redirectPath }} />} />}
25 >
26 <Route
27 {...rest}
28 render={(props: any) => (Component ? <Component {...props} /> : render(props))}
29 />
30 </Authorized>
31 );
32
33 export default AuthorizedRoute;
1 import React from 'react';
2 import { CURRENT } from './renderAuthorize';
3 // eslint-disable-next-line import/no-cycle
4 import PromiseRender from './PromiseRender';
5
6 export type IAuthorityType =
7 | undefined
8 | string
9 | string[]
10 | Promise<boolean>
11 | ((currentAuthority: string | string[]) => IAuthorityType);
12
13 /**
14 * 通用权限检查方法
15 * Common check permissions method
16 * @param { 权限判定 | Permission judgment } authority
17 * @param { 你的权限 | Your permission description } currentAuthority
18 * @param { 通过的组件 | Passing components } target
19 * @param { 未通过的组件 | no pass components } Exception
20 */
21 const checkPermissions = <T, K>(
22 authority: IAuthorityType,
23 currentAuthority: string | string[],
24 target: T,
25 Exception: K,
26 ): T | K | React.ReactNode => {
27 // 没有判定权限.默认查看所有
28 // Retirement authority, return target;
29 if (!authority) {
30 return target;
31 }
32 // 数组处理
33 if (Array.isArray(authority)) {
34 if (Array.isArray(currentAuthority)) {
35 if (currentAuthority.some(item => authority.includes(item))) {
36 return target;
37 }
38 } else if (authority.includes(currentAuthority)) {
39 return target;
40 }
41 return Exception;
42 }
43 // string 处理
44 if (typeof authority === 'string') {
45 if (Array.isArray(currentAuthority)) {
46 if (currentAuthority.some(item => authority === item)) {
47 return target;
48 }
49 } else if (authority === currentAuthority) {
50 return target;
51 }
52 return Exception;
53 }
54 // Promise 处理
55 if (authority instanceof Promise) {
56 return <PromiseRender<T, K> ok={target} error={Exception} promise={authority} />;
57 }
58 // Function 处理
59 if (typeof authority === 'function') {
60 try {
61 const bool = authority(currentAuthority);
62 // 函数执行后返回值是 Promise
63 if (bool instanceof Promise) {
64 return <PromiseRender<T, K> ok={target} error={Exception} promise={bool} />;
65 }
66 if (bool) {
67 return target;
68 }
69 return Exception;
70 } catch (error) {
71 throw error;
72 }
73 }
74 throw new Error('unsupported parameters');
75 };
76
77 export { checkPermissions };
78
79 function check<T, K>(authority: IAuthorityType, target: T, Exception: K): T | K | React.ReactNode {
80 return checkPermissions<T, K>(authority, CURRENT, target, Exception);
81 }
82
83 export default check;
1 import React from 'react';
2 import { Spin } from 'antd';
3 import isEqual from 'lodash/isEqual';
4 import { isComponentClass } from './Secured';
5 // eslint-disable-next-line import/no-cycle
6
7 interface PromiseRenderProps<T, K> {
8 ok: T;
9 error: K;
10 promise: Promise<boolean>;
11 }
12
13 interface PromiseRenderState {
14 component: React.ComponentClass | React.FunctionComponent;
15 }
16
17 export default class PromiseRender<T, K> extends React.Component<
18 PromiseRenderProps<T, K>,
19 PromiseRenderState
20 > {
21 state: PromiseRenderState = {
22 component: () => null,
23 };
24
25 componentDidMount() {
26 this.setRenderComponent(this.props);
27 }
28
29 shouldComponentUpdate = (nextProps: PromiseRenderProps<T, K>, nextState: PromiseRenderState) => {
30 const { component } = this.state;
31 if (!isEqual(nextProps, this.props)) {
32 this.setRenderComponent(nextProps);
33 }
34 if (nextState.component !== component) return true;
35 return false;
36 };
37
38 // set render Component : ok or error
39 setRenderComponent(props: PromiseRenderProps<T, K>) {
40 const ok = this.checkIsInstantiation(props.ok);
41 const error = this.checkIsInstantiation(props.error);
42 props.promise
43 .then(() => {
44 this.setState({
45 component: ok,
46 });
47 return true;
48 })
49 .catch(() => {
50 this.setState({
51 component: error,
52 });
53 });
54 }
55
56 // Determine whether the incoming component has been instantiated
57 // AuthorizedRoute is already instantiated
58 // Authorized render is already instantiated, children is no instantiated
59 // Secured is not instantiated
60 checkIsInstantiation = (
61 target: React.ReactNode | React.ComponentClass,
62 ): React.FunctionComponent => {
63 if (isComponentClass(target)) {
64 const Target = target as React.ComponentClass;
65 return (props: any) => <Target {...props} />;
66 }
67 if (React.isValidElement(target)) {
68 return (props: any) => React.cloneElement(target, props);
69 }
70 return () => target as React.ReactNode & null;
71 };
72
73 render() {
74 const { component: Component } = this.state;
75 const { ok, error, promise, ...rest } = this.props;
76
77 return Component ? (
78 <Component {...rest} />
79 ) : (
80 <div
81 style={{
82 width: '100%',
83 height: '100%',
84 margin: 'auto',
85 paddingTop: 50,
86 textAlign: 'center',
87 }}
88 >
89 <Spin size="large" />
90 </div>
91 );
92 }
93 }
1 import React from 'react';
2 import CheckPermissions from './CheckPermissions';
3
4 /**
5 * 默认不能访问任何页面
6 * default is "NULL"
7 */
8 const Exception403 = () => 403;
9
10 export const isComponentClass = (component: React.ComponentClass | React.ReactNode): boolean => {
11 if (!component) return false;
12 const proto = Object.getPrototypeOf(component);
13 if (proto === React.Component || proto === Function.prototype) return true;
14 return isComponentClass(proto);
15 };
16
17 // Determine whether the incoming component has been instantiated
18 // AuthorizedRoute is already instantiated
19 // Authorized render is already instantiated, children is no instantiated
20 // Secured is not instantiated
21 const checkIsInstantiation = (target: React.ComponentClass | React.ReactNode) => {
22 if (isComponentClass(target)) {
23 const Target = target as React.ComponentClass;
24 return (props: any) => <Target {...props} />;
25 }
26 if (React.isValidElement(target)) {
27 return (props: any) => React.cloneElement(target, props);
28 }
29 return () => target;
30 };
31
32 /**
33 * 用于判断是否拥有权限访问此 view 权限
34 * authority 支持传入 string, () => boolean | Promise
35 * e.g. 'user' 只有 user 用户能访问
36 * e.g. 'user,admin' user 和 admin 都能访问
37 * e.g. ()=>boolean 返回true能访问,返回false不能访问
38 * e.g. Promise then 能访问 catch不能访问
39 * e.g. authority support incoming string, () => boolean | Promise
40 * e.g. 'user' only user user can access
41 * e.g. 'user, admin' user and admin can access
42 * e.g. () => boolean true to be able to visit, return false can not be accessed
43 * e.g. Promise then can not access the visit to catch
44 * @param {string | function | Promise} authority
45 * @param {ReactNode} error 非必需参数
46 */
47 const authorize = (authority: string, error?: React.ReactNode) => {
48 /**
49 * conversion into a class
50 * 防止传入字符串时找不到staticContext造成报错
51 * String parameters can cause staticContext not found error
52 */
53 let classError: boolean | React.FunctionComponent = false;
54 if (error) {
55 classError = (() => error) as React.FunctionComponent;
56 }
57 if (!authority) {
58 throw new Error('authority is required');
59 }
60 return function decideAuthority(target: React.ComponentClass | React.ReactNode) {
61 const component = CheckPermissions(authority, target, classError || Exception403);
62 return checkIsInstantiation(component);
63 };
64 };
65
66 export default authorize;
1 import Authorized from './Authorized';
2 import Secured from './Secured';
3 import check from './CheckPermissions';
4 import renderAuthorize from './renderAuthorize';
5
6 Authorized.Secured = Secured;
7 Authorized.check = check;
8
9 const RenderAuthorize = renderAuthorize(Authorized);
10
11 export default RenderAuthorize;
1 /* eslint-disable eslint-comments/disable-enable-pair */
2 /* eslint-disable import/no-mutable-exports */
3 let CURRENT: string | string[] = 'NULL';
4
5 type CurrentAuthorityType = string | string[] | (() => typeof CURRENT);
6 /**
7 * use authority or getAuthority
8 * @param {string|()=>String} currentAuthority
9 */
10 const renderAuthorize = <T>(Authorized: T): ((currentAuthority: CurrentAuthorityType) => T) => (
11 currentAuthority: CurrentAuthorityType,
12 ): T => {
13 if (currentAuthority) {
14 if (typeof currentAuthority === 'function') {
15 CURRENT = currentAuthority();
16 }
17 if (
18 Object.prototype.toString.call(currentAuthority) === '[object String]' ||
19 Array.isArray(currentAuthority)
20 ) {
21 CURRENT = currentAuthority as string[];
22 }
23 } else {
24 CURRENT = 'NULL';
25 }
26 return Authorized;
27 };
28
29 export { CURRENT };
30 export default <T>(Authorized: T) => renderAuthorize<T>(Authorized);
1 .copy-block {
2 position: fixed;
3 right: 80px;
4 bottom: 40px;
5 z-index: 99;
6 display: flex;
7 flex-direction: column;
8 align-items: center;
9 justify-content: center;
10 width: 40px;
11 height: 40px;
12 font-size: 20px;
13 background: #fff;
14 border-radius: 40px;
15 box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14),
16 0 1px 10px 0 rgba(0, 0, 0, 0.12);
17 cursor: pointer;
18 }
19
20 .copy-block-view {
21 position: relative;
22 .copy-block-code {
23 display: inline-block;
24 margin: 0 0.2em;
25 padding: 0.2em 0.4em 0.1em;
26 font-size: 85%;
27 border-radius: 3px;
28 }
29 }
1 import { Icon, Popover, Typography } from 'antd';
2 import React, { useRef } from 'react';
3
4 import { FormattedMessage } from 'umi-plugin-react/locale';
5 import { connect } from 'dva';
6 import { isAntDesignPro } from '@/utils/utils';
7 import styles from './index.less';
8
9 const firstUpperCase = (pathString: string): string =>
10 pathString
11 .replace('.', '')
12 .split(/\/|-/)
13 .map((s): string => s.toLowerCase().replace(/( |^)[a-z]/g, L => L.toUpperCase()))
14 .filter((s): boolean => !!s)
15 .join('');
16
17 // when click block copy, send block url to ga
18 const onBlockCopy = (label: string) => {
19 if (!isAntDesignPro()) {
20 return;
21 }
22
23 const ga = window && window.ga;
24 if (ga) {
25 ga('send', 'event', {
26 eventCategory: 'block',
27 eventAction: 'copy',
28 eventLabel: label,
29 });
30 }
31 };
32
33 const BlockCodeView: React.SFC<{
34 url: string;
35 }> = ({ url }) => {
36 const blockUrl = `npx umi block add ${firstUpperCase(url)} --path=${url}`;
37 return (
38 <div className={styles['copy-block-view']}>
39 <Typography.Paragraph
40 copyable={{
41 text: blockUrl,
42 onCopy: () => onBlockCopy(url),
43 }}
44 style={{
45 display: 'flex',
46 }}
47 >
48 <pre>
49 <code className={styles['copy-block-code']}>{blockUrl}</code>
50 </pre>
51 </Typography.Paragraph>
52 </div>
53 );
54 };
55
56 interface RoutingType {
57 location: {
58 pathname: string;
59 };
60 }
61
62 export default connect(({ routing }: { routing: RoutingType }) => ({
63 location: routing.location,
64 }))(({ location }: RoutingType) => {
65 const url = location.pathname;
66 const divDom = useRef<HTMLDivElement>(null);
67 return (
68 <Popover
69 title={<FormattedMessage id="app.preview.down.block" defaultMessage="下载此页面到本地项目" />}
70 placement="topLeft"
71 content={<BlockCodeView url={url} />}
72 trigger="click"
73 getPopupContainer={dom => (divDom.current ? divDom.current : dom)}
74 >
75 <div className={styles['copy-block']} ref={divDom}>
76 <Icon type="download" />
77 </div>
78 </Popover>
79 );
80 });
1 import React, { Component } from 'react';
2 // import ReactEcharts from '../../../src/index';
3 import ReactEcharts from "echarts-for-react";
4
5 require('echarts/map/js/china.js');
6
7 export default class CountryMap extends Component {
8 constructor(props: any) {
9 super(props);
10 this.state = this.getInitialState();
11 }
12 timeTicket: any = null;
13 state: any;
14 getInitialState = () => ({option: this.getOption()});
15
16 componentDidMount() {
17 if (this.timeTicket) {
18 clearInterval(this.timeTicket);
19 }
20 this.timeTicket = setInterval(() => {
21 const option = this.state.option;
22 const r = new Date().getSeconds();
23 option.title.text = '国抽任务' + r;
24 option.series[0].name = '省抽任务' + r;
25 option.legend.data[0] = '其他任务' + r;
26 this.setState({ option: option });
27 }, 1000);
28 };
29 componentWillUnmount() {
30 if (this.timeTicket) {
31 clearInterval(this.timeTicket);
32 }
33 };
34 randomData() {
35 return Math.round(Math.random()*1000);
36 };
37 getOption = () => {
38 return {
39 title: {
40 text: '检测任务',
41 subtext: '全国检测任务分布图',
42 left: 'center'
43 },
44 tooltip: {
45 trigger: 'item'
46 },
47 legend: {
48 orient: 'vertical',
49 left: 'left',
50 data:['国抽任务','省抽任务','其他任务']
51 },
52 visualMap: {
53 min: 0,
54 max: 2500,
55 left: 'left',
56 top: 'bottom',
57 text: ['高','低'], // 文本,默认为数值文本
58 calculable: true
59 },
60 toolbox: {
61 show: true,
62 orient: 'vertical',
63 left: 'right',
64 top: 'center',
65 feature: {
66 dataView: {readOnly: false},
67 restore: {},
68 saveAsImage: {}
69 }
70 },
71 series: [
72 {
73 name: '国抽任务',
74 type: 'map',
75 mapType: 'china',
76 roam: false,
77 label: {
78 normal: {
79 show: true
80 },
81 emphasis: {
82 show: true
83 }
84 },
85 data:[
86 {name: '青岛', value: this.randomData()},
87 {name: '莱西', value: this.randomData()},
88 {name: '日照', value: this.randomData()},
89 {name: '烟台', value: this.randomData()},
90 {name: '即墨', value: this.randomData()},
91 {name: '莱州', value: this.randomData()},
92 {name: '蓬莱', value: this.randomData()},
93 {name: '寿光', value: this.randomData()},
94 {name: '潍坊', value: this.randomData()},
95 {name: '枣庄', value: this.randomData()},
96 {name: '淄博', value: this.randomData()},
97 {name: '济南', value: this.randomData()},
98 {name: '临沂', value: this.randomData()},
99 {name: '泰安', value: this.randomData()},
100 {name: '聊城', value: this.randomData()},
101 {name: '德州', value: this.randomData()},
102 {name: '济宁', value: this.randomData()},
103 {name: '莱芜', value: this.randomData()},
104 {name: '菏泽', value: this.randomData()},
105 {name: '北京',value: this.randomData() },
106 {name: '天津',value: this.randomData() },
107 {name: '上海',value: this.randomData() },
108 {name: '重庆',value: this.randomData() },
109 {name: '河北',value: this.randomData() },
110 {name: '河南',value: this.randomData() },
111 {name: '云南',value: this.randomData() },
112 {name: '辽宁',value: this.randomData() },
113 {name: '黑龙江',value: this.randomData() },
114 {name: '湖南',value: this.randomData() },
115 {name: '安徽',value: this.randomData() },
116 {name: '山东',value: this.randomData() },
117 {name: '新疆',value: this.randomData() },
118 {name: '江苏',value: this.randomData() },
119 {name: '浙江',value: this.randomData() },
120 {name: '江西',value: this.randomData() },
121 {name: '湖北',value: this.randomData() },
122 {name: '广西',value: this.randomData() },
123 {name: '甘肃',value: this.randomData() },
124 {name: '山西',value: this.randomData() },
125 {name: '内蒙古',value: this.randomData() },
126 {name: '陕西',value: this.randomData() },
127 {name: '吉林',value: this.randomData() },
128 {name: '福建',value: this.randomData() },
129 {name: '贵州',value: this.randomData() },
130 {name: '广东',value: this.randomData() },
131 {name: '青海',value: this.randomData() },
132 {name: '西藏',value: this.randomData() },
133 {name: '四川',value: this.randomData() },
134 {name: '宁夏',value: this.randomData() },
135 {name: '海南',value: this.randomData() },
136 {name: '台湾',value: this.randomData() },
137 {name: '香港',value: this.randomData() },
138 {name: '澳门',value: this.randomData() }
139 ]
140 },
141 {
142 name: '省抽任务',
143 type: 'map',
144 mapType: 'china',
145 label: {
146 normal: {
147 show: true
148 },
149 emphasis: {
150 show: true
151 }
152 },
153 data:[
154 {name: '北京',value: this.randomData() },
155 {name: '天津',value: this.randomData() },
156 {name: '上海',value: this.randomData() },
157 {name: '重庆',value: this.randomData() },
158 {name: '河北',value: this.randomData() },
159 {name: '安徽',value: this.randomData() },
160 {name: '新疆',value: this.randomData() },
161 {name: '浙江',value: this.randomData() },
162 {name: '江西',value: this.randomData() },
163 {name: '山西',value: this.randomData() },
164 {name: '内蒙古',value: this.randomData() },
165 {name: '吉林',value: this.randomData() },
166 {name: '福建',value: this.randomData() },
167 {name: '广东',value: this.randomData() },
168 {name: '西藏',value: this.randomData() },
169 {name: '四川',value: this.randomData() },
170 {name: '宁夏',value: this.randomData() },
171 {name: '香港',value: this.randomData() },
172 {name: '澳门',value: this.randomData() }
173 ]
174 },
175 {
176 name: '其他任务',
177 type: 'map',
178 mapType: 'china',
179 label: {
180 normal: {
181 show: true
182 },
183 emphasis: {
184 show: true
185 }
186 },
187 data:[
188 {name: '北京',value: this.randomData() },
189 {name: '天津',value: this.randomData() },
190 {name: '上海',value: this.randomData() },
191 {name: '广东',value: this.randomData() },
192 {name: '台湾',value: this.randomData() },
193 {name: '香港',value: this.randomData() },
194 {name: '澳门',value: this.randomData() }
195 ]
196 }
197 ]
198 };
199 };
200 render() {
201 return (
202 <div className='examples'>
203 <div className='parent'>
204 <label> 全国检测任务分布信息 <strong>区域分布</strong>: </label>
205 <ReactEcharts
206 option={this.state.option}
207 style={{height: '500px', width: '100%'}}
208 className='react_for_echarts' />
209 </div>
210 </div>
211 );
212 };
213 }
...\ No newline at end of file ...\ No newline at end of file
1 import React from 'react';
2
3 import ReactEcharts from "echarts-for-react";
4 // const echarts = require('echarts/lib/echarts');
5 require('echarts/map/js/china.js');
6
7 export default class ProvinceMap extends React.Component {
8 constructor(props: any) {
9 super(props);
10 this.state = this.getInitialState();
11 }
12 timeTicket: any = null;
13 state: any;
14 getInitialState = () => ({option: this.getOption()});
15 componentDidMount() {
16 if (this.timeTicket) {
17 clearInterval(this.timeTicket);
18 }
19 this.timeTicket = setInterval(() => {
20 const option = this.state.option;
21 const r = new Date().getSeconds();
22 option.title.text = 'iphone销量' + r;
23 option.series[0].name = 'iphone销量' + r;
24 // option.legend.data[0] = 'iphone销量' + r;
25 this.setState({ option: option });
26 }, 1000);
27 };
28 componentWillUnmount() {
29 if (this.timeTicket) {
30 clearInterval(this.timeTicket);
31 }
32 };
33 randomData() {
34 return Math.round(Math.random()*1000);
35 };
36 data: any[] = [
37 {name: '青岛', value: 18},
38 {name: '莱西', value: 21},
39 {name: '日照', value: 21},
40 {name: '烟台', value: 28},
41 {name: '即墨', value: 30},
42 {name: '莱州', value: 32},
43 {name: '蓬莱', value: 37},
44 {name: '寿光', value: 40},
45 {name: '潍坊', value: 65},
46 {name: '枣庄', value: 84},
47 {name: '淄博', value: 85},
48 {name: '济南', value: 92},
49 {name: '临沂', value: 103},
50 {name: '泰安', value: 112},
51 {name: '聊城', value: 116},
52 {name: '德州', value: 120},
53 {name: '济宁', value: 120},
54 {name: '莱芜', value: 148},
55 {name: '菏泽', value: 194}
56 ];
57
58 geoCoordMap: any = {
59 '青岛':[120.33,36.07],
60 '莱西':[120.53,36.86],
61 '日照':[119.46,35.42],
62 '威海':[122.1,37.5],
63 '烟台':[121.39,37.52],
64 '即墨':[120.45,36.38],
65 '莱州':[119.942327,37.177017],
66 '蓬莱':[120.75,37.8],
67 '寿光':[118.73,36.86],
68 '潍坊':[119.1,36.62],
69 '枣庄':[117.57,34.86],
70 '淄博':[118.05,36.78],
71 '济南':[117,36.65],
72 '临沂':[118.35,35.05],
73 '泰安':[117.13,36.18],
74 '聊城':[115.97,36.45],
75 '德州':[116.29,37.45],
76 '济宁':[116.59,35.38],
77 '莱芜':[117.67,36.19],
78 '菏泽':[115.480656,35.23375]
79 };
80
81 convertData = (data: any) => {
82 var res = [];
83 for (var i = 0; i < data.length; i++) {
84 var geoCoord = this.geoCoordMap[data[i].name];
85 if (geoCoord) {
86 res.push({
87 name: data[i].name,
88 value: geoCoord.concat(data[i].value)
89 });
90 }
91 }
92 return res;
93 };
94 // renderItem = (params: any, api: any) => {
95 // var coords = [
96 // [116.7,39.53],
97 // [103.73,36.03],
98 // [112.91,27.87],
99 // [120.65,28.01],
100 // [119.57,39.95]
101 // ];
102 // var points = [];
103 // for (var i = 0; i < coords.length; i++) {
104 // points.push(api.coord(coords[i]));
105 // }
106 // var color = api.visual('color');
107
108 // return {
109 // type: 'polygon',
110 // shape: {
111 // points: echarts.graphic.clipPointsByRect(points, {
112 // x: params.coordSys.x,
113 // y: params.coordSys.y,
114 // width: params.coordSys.width,
115 // height: params.coordSys.height
116 // })
117 // },
118 // style: api.style({
119 // fill: color,
120 // stroke: echarts.color.lift(color)
121 // })
122 // };
123 // }
124 getOption = () => {
125 return {
126 backgroundColor: 'transparent',
127 title: {
128 text: '全国主要城市空气质量',
129 subtext: 'data from PM25.in',
130 sublink: 'http://www.pm25.in',
131 left: 'center',
132 textStyle: {
133 color: '#fff'
134 }
135 },
136 tooltip : {
137 trigger: 'item'
138 },
139 bmap: {
140 center: [104.114129, 37.550339],
141 zoom: 5,
142 roam: true,
143 mapStyle: {
144 styleJson: [
145 {
146 "featureType": "water",
147 "elementType": "all",
148 "stylers": {
149 "color": "#044161"
150 }
151 },
152 {
153 "featureType": "land",
154 "elementType": "all",
155 "stylers": {
156 "color": "#004981"
157 }
158 },
159 {
160 "featureType": "boundary",
161 "elementType": "geometry",
162 "stylers": {
163 "color": "#064f85"
164 }
165 },
166 {
167 "featureType": "railway",
168 "elementType": "all",
169 "stylers": {
170 "visibility": "off"
171 }
172 },
173 {
174 "featureType": "highway",
175 "elementType": "geometry",
176 "stylers": {
177 "color": "#004981"
178 }
179 },
180 {
181 "featureType": "highway",
182 "elementType": "geometry.fill",
183 "stylers": {
184 "color": "#005b96",
185 "lightness": 1
186 }
187 },
188 {
189 "featureType": "highway",
190 "elementType": "labels",
191 "stylers": {
192 "visibility": "off"
193 }
194 },
195 {
196 "featureType": "arterial",
197 "elementType": "geometry",
198 "stylers": {
199 "color": "#004981"
200 }
201 },
202 {
203 "featureType": "arterial",
204 "elementType": "geometry.fill",
205 "stylers": {
206 "color": "#00508b"
207 }
208 },
209 {
210 "featureType": "poi",
211 "elementType": "all",
212 "stylers": {
213 "visibility": "off"
214 }
215 },
216 {
217 "featureType": "green",
218 "elementType": "all",
219 "stylers": {
220 "color": "#056197",
221 "visibility": "off"
222 }
223 },
224 {
225 "featureType": "subway",
226 "elementType": "all",
227 "stylers": {
228 "visibility": "off"
229 }
230 },
231 {
232 "featureType": "manmade",
233 "elementType": "all",
234 "stylers": {
235 "visibility": "off"
236 }
237 },
238 {
239 "featureType": "local",
240 "elementType": "all",
241 "stylers": {
242 "visibility": "off"
243 }
244 },
245 {
246 "featureType": "arterial",
247 "elementType": "labels",
248 "stylers": {
249 "visibility": "off"
250 }
251 },
252 {
253 "featureType": "boundary",
254 "elementType": "geometry.fill",
255 "stylers": {
256 "color": "#029fd4"
257 }
258 },
259 {
260 "featureType": "building",
261 "elementType": "all",
262 "stylers": {
263 "color": "#1a5787"
264 }
265 },
266 {
267 "featureType": "label",
268 "elementType": "all",
269 "stylers": {
270 "visibility": "off"
271 }
272 }
273 ]
274 }
275 },
276 series : [
277 {
278 name: 'pm2.5',
279 type: 'scatter',
280 coordinateSystem: 'bmap',
281 data: this.convertData(this.data),
282 symbolSize: function (val: any) {
283 return val[2] / 10;
284 },
285 label: {
286 normal: {
287 formatter: '{b}',
288 position: 'right',
289 show: false
290 },
291 emphasis: {
292 show: true
293 }
294 },
295 itemStyle: {
296 normal: {
297 color: '#ddb926'
298 }
299 }
300 },
301 {
302 name: 'Top 5',
303 type: 'effectScatter',
304 coordinateSystem: 'bmap',
305 data: this.convertData(this.data.sort(function (a, b) {
306 return b.value - a.value;
307 }).slice(0, 6)),
308 symbolSize: function (val: any) {
309 return val[2] / 10;
310 },
311 showEffectOn: 'emphasis',
312 rippleEffect: {
313 brushType: 'stroke'
314 },
315 hoverAnimation: true,
316 label: {
317 normal: {
318 formatter: '{b}',
319 position: 'right',
320 show: true
321 }
322 },
323 itemStyle: {
324 normal: {
325 color: '#f4e925',
326 shadowBlur: 10,
327 shadowColor: '#333'
328 }
329 },
330 zlevel: 1
331 }
332 ]
333 };
334 }
335
336 onChartReadyCallback = (e: any) => {
337 console.log(e);
338 }
339 onEvent1 = (e: any) => {
340 console.log(e);
341 }
342 onEvent2 = (e: any) => {
343 console.log(e);
344 }
345
346 render() {
347
348 return (
349 <ReactEcharts
350 style={{height: '500px', width: '100%'}}
351 className='react_for_echarts'
352 option={this.state.option}
353 notMerge={true}
354 lazyUpdate={true}
355 theme={"dark"}
356 onChartReady={this.onChartReadyCallback}
357 onEvents={{click: this.onEvent1, focus: this.onEvent2}}
358 opts={{}} />
359 );
360 }
361 }
...\ No newline at end of file ...\ No newline at end of file
1 import { Avatar, Icon, Menu, Spin } from 'antd';
2 import { ClickParam } from 'antd/es/menu';
3 import { FormattedMessage } from 'umi-plugin-react/locale';
4 import React from 'react';
5 import { connect } from 'dva';
6 import router from 'umi/router';
7
8 import { ConnectProps, ConnectState } from '@/models/connect';
9 import { CurrentUser } from '@/models/user';
10 import HeaderDropdown from '../HeaderDropdown';
11 import styles from './index.less';
12
13 export interface GlobalHeaderRightProps extends ConnectProps {
14 currentUser?: CurrentUser;
15 menu?: boolean;
16 }
17
18 class AvatarDropdown extends React.Component<GlobalHeaderRightProps> {
19 onMenuClick = (event: ClickParam) => {
20 const { key } = event;
21
22 if (key === 'logout') {
23 const { dispatch } = this.props;
24 if (dispatch) {
25 dispatch({
26 type: 'login/logout',
27 });
28 }
29
30 return;
31 }
32 router.push(`/account/${key}`);
33 };
34
35 render(): React.ReactNode {
36 const { currentUser = { avatar: '', name: '' }, menu } = this.props;
37
38 const menuHeaderDropdown = (
39 <Menu className={styles.menu} selectedKeys={[]} onClick={this.onMenuClick}>
40 {menu && (
41 <Menu.Item key="center">
42 <Icon type="user" />
43 <FormattedMessage id="menu.account.center" defaultMessage="account center" />
44 </Menu.Item>
45 )}
46 {menu && (
47 <Menu.Item key="settings">
48 <Icon type="setting" />
49 <FormattedMessage id="menu.account.settings" defaultMessage="account settings" />
50 </Menu.Item>
51 )}
52 {menu && <Menu.Divider />}
53
54 <Menu.Item key="logout">
55 <Icon type="logout" />
56 <FormattedMessage id="menu.account.logout" defaultMessage="logout" />
57 </Menu.Item>
58 </Menu>
59 );
60
61 return currentUser && currentUser.name ? (
62 <HeaderDropdown overlay={menuHeaderDropdown}>
63 <span className={`${styles.action} ${styles.account}`}>
64 <Avatar size="small" className={styles.avatar} src={currentUser.avatar} alt="avatar" />
65 <span className={styles.name}>{currentUser.name}</span>
66 </span>
67 </HeaderDropdown>
68 ) : (
69 <Spin size="small" style={{ marginLeft: 8, marginRight: 8 }} />
70 );
71 }
72 }
73 export default connect(({ user }: ConnectState) => ({
74 currentUser: user.currentUser,
75 }))(AvatarDropdown);
1 import React, { Component } from 'react';
2 import { Tag, message } from 'antd';
3 import { connect } from 'dva';
4 import { formatMessage } from 'umi-plugin-react/locale';
5 import groupBy from 'lodash/groupBy';
6 import moment from 'moment';
7
8 import { NoticeItem } from '@/models/global';
9 import NoticeIcon from '../NoticeIcon';
10 import { CurrentUser } from '@/models/user';
11 import { ConnectProps, ConnectState } from '@/models/connect';
12 import styles from './index.less';
13
14 export interface GlobalHeaderRightProps extends ConnectProps {
15 notices?: NoticeItem[];
16 currentUser?: CurrentUser;
17 fetchingNotices?: boolean;
18 onNoticeVisibleChange?: (visible: boolean) => void;
19 onNoticeClear?: (tabName?: string) => void;
20 }
21
22 class GlobalHeaderRight extends Component<GlobalHeaderRightProps> {
23 componentDidMount() {
24 const { dispatch } = this.props;
25 if (dispatch) {
26 dispatch({
27 type: 'global/fetchNotices',
28 });
29 }
30 }
31
32 changeReadState = (clickedItem: NoticeItem): void => {
33 const { id } = clickedItem;
34 const { dispatch } = this.props;
35 if (dispatch) {
36 dispatch({
37 type: 'global/changeNoticeReadState',
38 payload: id,
39 });
40 }
41 };
42
43 handleNoticeClear = (title: string, key: string) => {
44 const { dispatch } = this.props;
45 message.success(`${formatMessage({ id: 'component.noticeIcon.cleared' })} ${title}`);
46 if (dispatch) {
47 dispatch({
48 type: 'global/clearNotices',
49 payload: key,
50 });
51 }
52 };
53
54 getNoticeData = (): { [key: string]: NoticeItem[] } => {
55 const { notices = [] } = this.props;
56 if (notices.length === 0) {
57 return {};
58 }
59 const newNotices = notices.map(notice => {
60 const newNotice = { ...notice };
61 if (newNotice.datetime) {
62 newNotice.datetime = moment(notice.datetime as string).fromNow();
63 }
64 if (newNotice.id) {
65 newNotice.key = newNotice.id;
66 }
67 if (newNotice.extra && newNotice.status) {
68 const color = {
69 todo: '',
70 processing: 'blue',
71 urgent: 'red',
72 doing: 'gold',
73 }[newNotice.status];
74 newNotice.extra = (
75 <Tag color={color} style={{ marginRight: 0 }}>
76 {newNotice.extra}
77 </Tag>
78 );
79 }
80 return newNotice;
81 });
82 return groupBy(newNotices, 'type');
83 };
84
85 getUnreadData = (noticeData: { [key: string]: NoticeItem[] }) => {
86 const unreadMsg: { [key: string]: number } = {};
87 Object.keys(noticeData).forEach(key => {
88 const value = noticeData[key];
89 if (!unreadMsg[key]) {
90 unreadMsg[key] = 0;
91 }
92 if (Array.isArray(value)) {
93 unreadMsg[key] = value.filter(item => !item.read).length;
94 }
95 });
96 return unreadMsg;
97 };
98
99 render() {
100 const { currentUser, fetchingNotices, onNoticeVisibleChange } = this.props;
101 const noticeData = this.getNoticeData();
102 const unreadMsg = this.getUnreadData(noticeData);
103
104 return (
105 <NoticeIcon
106 className={styles.action}
107 count={currentUser && currentUser.unreadCount}
108 onItemClick={item => {
109 this.changeReadState(item as NoticeItem);
110 }}
111 loading={fetchingNotices}
112 clearText={formatMessage({ id: 'component.noticeIcon.clear' })}
113 viewMoreText={formatMessage({ id: 'component.noticeIcon.view-more' })}
114 onClear={this.handleNoticeClear}
115 onPopupVisibleChange={onNoticeVisibleChange}
116 onViewMore={() => message.info('Click on view more')}
117 clearClose
118 >
119 <NoticeIcon.Tab
120 tabKey="notification"
121 count={unreadMsg.notification}
122 list={noticeData.notification}
123 title={formatMessage({ id: 'component.globalHeader.notification' })}
124 emptyText={formatMessage({ id: 'component.globalHeader.notification.empty' })}
125 showViewMore
126 />
127 <NoticeIcon.Tab
128 tabKey="message"
129 count={unreadMsg.message}
130 list={noticeData.message}
131 title={formatMessage({ id: 'component.globalHeader.message' })}
132 emptyText={formatMessage({ id: 'component.globalHeader.message.empty' })}
133 showViewMore
134 />
135 <NoticeIcon.Tab
136 tabKey="event"
137 title={formatMessage({ id: 'component.globalHeader.event' })}
138 emptyText={formatMessage({ id: 'component.globalHeader.event.empty' })}
139 count={unreadMsg.event}
140 list={noticeData.event}
141 showViewMore
142 />
143 </NoticeIcon>
144 );
145 }
146 }
147
148 export default connect(({ user, global, loading }: ConnectState) => ({
149 currentUser: user.currentUser,
150 collapsed: global.collapsed,
151 fetchingMoreNotices: loading.effects['global/fetchMoreNotices'],
152 fetchingNotices: loading.effects['global/fetchNotices'],
153 notices: global.notices,
154 }))(GlobalHeaderRight);
1 import { Icon, Tooltip } from 'antd';
2 import React from 'react';
3 import { connect } from 'dva';
4 import { formatMessage } from 'umi-plugin-react/locale';
5 import { ConnectProps, ConnectState } from '@/models/connect';
6
7 import Avatar from './AvatarDropdown';
8 import HeaderSearch from '../HeaderSearch';
9 import SelectLang from '../SelectLang';
10 import styles from './index.less';
11
12 export type SiderTheme = 'light' | 'dark';
13 export interface GlobalHeaderRightProps extends ConnectProps {
14 theme?: SiderTheme;
15 layout: 'sidemenu' | 'topmenu';
16 }
17
18 const GlobalHeaderRight: React.SFC<GlobalHeaderRightProps> = props => {
19 const { theme, layout } = props;
20 let className = styles.right;
21
22 if (theme === 'dark' && layout === 'topmenu') {
23 className = `${styles.right} ${styles.dark}`;
24 }
25
26 return (
27 <div className={className}>
28 <HeaderSearch
29 className={`${styles.action} ${styles.search}`}
30 placeholder={formatMessage({
31 id: 'component.globalHeader.search',
32 })}
33 defaultValue="umi ui"
34 dataSource={[
35 formatMessage({
36 id: 'component.globalHeader.search.example1',
37 }),
38 formatMessage({
39 id: 'component.globalHeader.search.example2',
40 }),
41 formatMessage({
42 id: 'component.globalHeader.search.example3',
43 }),
44 ]}
45 onSearch={value => {
46 console.log('input', value);
47 }}
48 onPressEnter={value => {
49 console.log('enter', value);
50 }}
51 />
52 <Tooltip
53 title={formatMessage({
54 id: 'component.globalHeader.help',
55 })}
56 >
57 <a
58 target="_blank"
59 href="https://pro.ant.design/docs/getting-started"
60 rel="noopener noreferrer"
61 className={styles.action}
62 >
63 <Icon type="question-circle-o" />
64 </a>
65 </Tooltip>
66 <Avatar />
67 <SelectLang className={styles.action} />
68 </div>
69 );
70 };
71
72 export default connect(({ settings }: ConnectState) => ({
73 theme: settings.navTheme,
74 layout: settings.layout,
75 }))(GlobalHeaderRight);
1 @import '~antd/es/style/themes/default.less';
2
3 @pro-header-hover-bg: rgba(0, 0, 0, 0.025);
4
5 .menu {
6 :global(.anticon) {
7 margin-right: 8px;
8 }
9 :global(.ant-dropdown-menu-item) {
10 min-width: 160px;
11 }
12 }
13
14 .right {
15 float: right;
16 height: 100%;
17 margin-left: auto;
18 overflow: hidden;
19 .action {
20 display: inline-block;
21 height: 100%;
22 padding: 0 12px;
23 cursor: pointer;
24 transition: all 0.3s;
25 > i {
26 color: @text-color;
27 vertical-align: middle;
28 }
29 &:hover {
30 background: @pro-header-hover-bg;
31 }
32 &:global(.opened) {
33 background: @pro-header-hover-bg;
34 }
35 }
36 .search {
37 padding: 0 12px;
38 &:hover {
39 background: transparent;
40 }
41 }
42 .account {
43 .avatar {
44 margin: ~'calc((@{layout-header-height} - 24px) / 2)' 0;
45 margin-right: 8px;
46 color: @primary-color;
47 vertical-align: top;
48 background: rgba(255, 255, 255, 0.85);
49 }
50 }
51 }
52
53 .dark {
54 height: @layout-header-height;
55 .action {
56 color: rgba(255, 255, 255, 0.85);
57 > i {
58 color: rgba(255, 255, 255, 0.85);
59 }
60 &:hover,
61 &:global(.opened) {
62 background: @primary-color;
63 }
64 }
65 }
66
67 :global(.ant-pro-global-header) {
68 .dark {
69 .action {
70 color: @text-color;
71 > i {
72 color: @text-color;
73 }
74 &:hover {
75 color: rgba(255, 255, 255, 0.85);
76 > i {
77 color: rgba(255, 255, 255, 0.85);
78 }
79 }
80 }
81 }
82 }
83
84 @media only screen and (max-width: @screen-md) {
85 :global(.ant-divider-vertical) {
86 vertical-align: unset;
87 }
88 .name {
89 display: none;
90 }
91 .right {
92 position: absolute;
93 top: 0;
94 right: 12px;
95 .account {
96 .avatar {
97 margin-right: 0;
98 }
99 }
100 }
101 }
1 @import '~antd/es/style/themes/default.less';
2
3 .container > * {
4 background-color: #fff;
5 border-radius: 4px;
6 box-shadow: @shadow-1-down;
7 }
8
9 @media screen and (max-width: @screen-xs) {
10 .container {
11 width: 100% !important;
12 }
13 .container > * {
14 border-radius: 0 !important;
15 }
16 }
1 import { DropDownProps } from 'antd/es/dropdown';
2 import { Dropdown } from 'antd';
3 import React from 'react';
4 import classNames from 'classnames';
5 import styles from './index.less';
6
7 declare type OverlayFunc = () => React.ReactNode;
8
9 export interface HeaderDropdownProps extends DropDownProps {
10 overlayClassName?: string;
11 overlay: React.ReactNode | OverlayFunc;
12 placement?: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight' | 'bottomCenter';
13 }
14
15 const HeaderDropdown: React.FC<HeaderDropdownProps> = ({ overlayClassName: cls, ...restProps }) => (
16 <Dropdown overlayClassName={classNames(styles.container, cls)} {...restProps} />
17 );
18
19 export default HeaderDropdown;
1 @import '~antd/es/style/themes/default.less';
2
3 .headerSearch {
4 :global(.anticon-search) {
5 font-size: 16px;
6 cursor: pointer;
7 }
8 .input {
9 width: 0;
10 background: transparent;
11 border-radius: 0;
12 transition: width 0.3s, margin-left 0.3s;
13 :global(.ant-select-selection) {
14 background: transparent;
15 }
16 input {
17 padding-right: 0;
18 padding-left: 0;
19 border: 0;
20 box-shadow: none !important;
21 }
22 &,
23 &:hover,
24 &:focus {
25 border-bottom: 1px solid @border-color-base;
26 }
27 &.show {
28 width: 210px;
29 margin-left: 8px;
30 }
31 }
32 }
1 import { AutoComplete, Icon, Input } from 'antd';
2 import { AutoCompleteProps, DataSourceItemType } from 'antd/es/auto-complete';
3 import React, { Component } from 'react';
4
5 import classNames from 'classnames';
6 import debounce from 'lodash/debounce';
7 import styles from './index.less';
8
9 export interface HeaderSearchProps {
10 onPressEnter: (value: string) => void;
11 onSearch: (value: string) => void;
12 onChange: (value: string) => void;
13 onVisibleChange: (b: boolean) => void;
14 className: string;
15 placeholder: string;
16 defaultActiveFirstOption: boolean;
17 dataSource: DataSourceItemType[];
18 defaultOpen: boolean;
19 open?: boolean;
20 defaultValue?: string;
21 }
22
23 interface HeaderSearchState {
24 value?: string;
25 searchMode: boolean;
26 }
27
28 export default class HeaderSearch extends Component<HeaderSearchProps, HeaderSearchState> {
29 static defaultProps = {
30 defaultActiveFirstOption: false,
31 onPressEnter: () => {},
32 onSearch: () => {},
33 onChange: () => {},
34 className: '',
35 placeholder: '',
36 dataSource: [],
37 defaultOpen: false,
38 onVisibleChange: () => {},
39 };
40
41 static getDerivedStateFromProps(props: HeaderSearchProps) {
42 if ('open' in props) {
43 return {
44 searchMode: props.open,
45 };
46 }
47 return null;
48 }
49
50 private inputRef: Input | null = null;
51
52 constructor(props: HeaderSearchProps) {
53 super(props);
54 this.state = {
55 searchMode: props.defaultOpen,
56 value: props.defaultValue,
57 };
58 this.debouncePressEnter = debounce(this.debouncePressEnter, 500, {
59 leading: true,
60 trailing: false,
61 });
62 }
63
64 onKeyDown = (e: React.KeyboardEvent) => {
65 if (e.key === 'Enter') {
66 this.debouncePressEnter();
67 }
68 };
69
70 onChange: AutoCompleteProps['onChange'] = value => {
71 if (typeof value === 'string') {
72 const { onSearch, onChange } = this.props;
73 this.setState({ value });
74 if (onSearch) {
75 onSearch(value);
76 }
77 if (onChange) {
78 onChange(value);
79 }
80 }
81 };
82
83 enterSearchMode = () => {
84 const { onVisibleChange } = this.props;
85 onVisibleChange(true);
86 this.setState({ searchMode: true }, () => {
87 const { searchMode } = this.state;
88 if (searchMode && this.inputRef) {
89 this.inputRef.focus();
90 }
91 });
92 };
93
94 leaveSearchMode = () => {
95 this.setState({
96 searchMode: false,
97 });
98 };
99
100 debouncePressEnter = () => {
101 const { onPressEnter } = this.props;
102 const { value } = this.state;
103 onPressEnter(value || '');
104 };
105
106 render() {
107 const { className, defaultValue, placeholder, open, ...restProps } = this.props;
108 const { searchMode, value } = this.state;
109 delete restProps.defaultOpen; // for rc-select not affected
110 const inputClass = classNames(styles.input, {
111 [styles.show]: searchMode,
112 });
113
114 return (
115 <span
116 className={classNames(className, styles.headerSearch)}
117 onClick={this.enterSearchMode}
118 onTransitionEnd={({ propertyName }) => {
119 if (propertyName === 'width' && !searchMode) {
120 const { onVisibleChange } = this.props;
121 onVisibleChange(searchMode);
122 }
123 }}
124 >
125 <Icon type="search" key="Icon" />
126 <AutoComplete
127 key="AutoComplete"
128 {...restProps}
129 className={inputClass}
130 value={value}
131 onChange={this.onChange}
132 >
133 <Input
134 ref={node => {
135 this.inputRef = node;
136 }}
137 defaultValue={defaultValue}
138 aria-label={placeholder}
139 placeholder={placeholder}
140 onKeyDown={this.onKeyDown}
141 onBlur={this.leaveSearchMode}
142 />
143 </AutoComplete>
144 </span>
145 );
146 }
147 }
1 @import '~antd/es/style/themes/default.less';
2
3 .list {
4 max-height: 400px;
5 overflow: auto;
6 &::-webkit-scrollbar {
7 display: none;
8 }
9 .item {
10 padding-right: 24px;
11 padding-left: 24px;
12 overflow: hidden;
13 cursor: pointer;
14 transition: all 0.3s;
15
16 .meta {
17 width: 100%;
18 }
19
20 .avatar {
21 margin-top: 4px;
22 background: #fff;
23 }
24 .iconElement {
25 font-size: 32px;
26 }
27
28 &.read {
29 opacity: 0.4;
30 }
31 &:last-child {
32 border-bottom: 0;
33 }
34 &:hover {
35 background: @primary-1;
36 }
37 .title {
38 margin-bottom: 8px;
39 font-weight: normal;
40 }
41 .description {
42 font-size: 12px;
43 line-height: @line-height-base;
44 }
45 .datetime {
46 margin-top: 4px;
47 font-size: 12px;
48 line-height: @line-height-base;
49 }
50 .extra {
51 float: right;
52 margin-top: -1.5px;
53 margin-right: 0;
54 color: @text-color-secondary;
55 font-weight: normal;
56 }
57 }
58 .loadMore {
59 padding: 8px 0;
60 color: @primary-6;
61 text-align: center;
62 cursor: pointer;
63 &.loadedAll {
64 color: rgba(0, 0, 0, 0.25);
65 cursor: unset;
66 }
67 }
68 }
69
70 .notFound {
71 padding: 73px 0 88px;
72 color: @text-color-secondary;
73 text-align: center;
74 img {
75 display: inline-block;
76 height: 76px;
77 margin-bottom: 16px;
78 }
79 }
80
81 .bottomBar {
82 height: 46px;
83 color: @text-color;
84 line-height: 46px;
85 text-align: center;
86 border-top: 1px solid @border-color-split;
87 border-radius: 0 0 @border-radius-base @border-radius-base;
88 transition: all 0.3s;
89 div {
90 display: inline-block;
91 width: 50%;
92 cursor: pointer;
93 transition: all 0.3s;
94 user-select: none;
95 &:hover {
96 color: @heading-color;
97 }
98 &:only-child {
99 width: 100%;
100 }
101 &:not(:only-child):last-child {
102 border-left: 1px solid @border-color-split;
103 }
104 }
105 }
1 import { Avatar, List } from 'antd';
2
3 import React from 'react';
4 import classNames from 'classnames';
5 import { NoticeIconData } from './index';
6 import styles from './NoticeList.less';
7
8 export interface NoticeIconTabProps {
9 count?: number;
10 name?: string;
11 showClear?: boolean;
12 showViewMore?: boolean;
13 style?: React.CSSProperties;
14 title: string;
15 tabKey: string;
16 data?: NoticeIconData[];
17 onClick?: (item: NoticeIconData) => void;
18 onClear?: () => void;
19 emptyText?: string;
20 clearText?: string;
21 viewMoreText?: string;
22 list: NoticeIconData[];
23 onViewMore?: (e: any) => void;
24 }
25 const NoticeList: React.SFC<NoticeIconTabProps> = ({
26 data = [],
27 onClick,
28 onClear,
29 title,
30 onViewMore,
31 emptyText,
32 showClear = true,
33 clearText,
34 viewMoreText,
35 showViewMore = false,
36 }) => {
37 if (data.length === 0) {
38 return (
39 <div className={styles.notFound}>
40 <img
41 src="https://gw.alipayobjects.com/zos/rmsportal/sAuJeJzSKbUmHfBQRzmZ.svg"
42 alt="not found"
43 />
44 <div>{emptyText}</div>
45 </div>
46 );
47 }
48 return (
49 <div>
50 <List<NoticeIconData>
51 className={styles.list}
52 dataSource={data}
53 renderItem={(item, i) => {
54 const itemCls = classNames(styles.item, {
55 [styles.read]: item.read,
56 });
57 // eslint-disable-next-line no-nested-ternary
58 const leftIcon = item.avatar ? (
59 typeof item.avatar === 'string' ? (
60 <Avatar className={styles.avatar} src={item.avatar} />
61 ) : (
62 <span className={styles.iconElement}>{item.avatar}</span>
63 )
64 ) : null;
65
66 return (
67 <List.Item
68 className={itemCls}
69 key={item.key || i}
70 onClick={() => onClick && onClick(item)}
71 >
72 <List.Item.Meta
73 className={styles.meta}
74 avatar={leftIcon}
75 title={
76 <div className={styles.title}>
77 {item.title}
78 <div className={styles.extra}>{item.extra}</div>
79 </div>
80 }
81 description={
82 <div>
83 <div className={styles.description}>{item.description}</div>
84 <div className={styles.datetime}>{item.datetime}</div>
85 </div>
86 }
87 />
88 </List.Item>
89 );
90 }}
91 />
92 <div className={styles.bottomBar}>
93 {showClear ? (
94 <div onClick={onClear}>
95 {clearText} {title}
96 </div>
97 ) : null}
98 {showViewMore ? (
99 <div
100 onClick={e => {
101 if (onViewMore) {
102 onViewMore(e);
103 }
104 }}
105 >
106 {viewMoreText}
107 </div>
108 ) : null}
109 </div>
110 </div>
111 );
112 };
113
114 export default NoticeList;
1 @import '~antd/es/style/themes/default.less';
2
3 .popover {
4 position: relative;
5 width: 336px;
6 }
7
8 .noticeButton {
9 display: inline-block;
10 cursor: pointer;
11 transition: all 0.3s;
12 }
13 .icon {
14 padding: 4px;
15 vertical-align: middle;
16 }
17
18 .badge {
19 font-size: 16px;
20 }
21
22 .tabs {
23 :global {
24 .ant-tabs-nav-scroll {
25 text-align: center;
26 }
27 .ant-tabs-bar {
28 margin-bottom: 0;
29 }
30 }
31 }
1 import { Badge, Icon, Spin, Tabs } from 'antd';
2 import React, { Component } from 'react';
3 import classNames from 'classnames';
4 import NoticeList, { NoticeIconTabProps } from './NoticeList';
5
6 import HeaderDropdown from '../HeaderDropdown';
7 import styles from './index.less';
8
9 const { TabPane } = Tabs;
10
11 export interface NoticeIconData {
12 avatar?: string | React.ReactNode;
13 title?: React.ReactNode;
14 description?: React.ReactNode;
15 datetime?: React.ReactNode;
16 extra?: React.ReactNode;
17 style?: React.CSSProperties;
18 key?: string | number;
19 read?: boolean;
20 }
21
22 export interface NoticeIconProps {
23 count?: number;
24 bell?: React.ReactNode;
25 className?: string;
26 loading?: boolean;
27 onClear?: (tabName: string, tabKey: string) => void;
28 onItemClick?: (item: NoticeIconData, tabProps: NoticeIconTabProps) => void;
29 onViewMore?: (tabProps: NoticeIconTabProps, e: MouseEvent) => void;
30 onTabChange?: (tabTile: string) => void;
31 style?: React.CSSProperties;
32 onPopupVisibleChange?: (visible: boolean) => void;
33 popupVisible?: boolean;
34 clearText?: string;
35 viewMoreText?: string;
36 clearClose?: boolean;
37 children: React.ReactElement<NoticeIconTabProps>[];
38 }
39
40 export default class NoticeIcon extends Component<NoticeIconProps> {
41 public static Tab: typeof NoticeList = NoticeList;
42
43 static defaultProps = {
44 onItemClick: (): void => {},
45 onPopupVisibleChange: (): void => {},
46 onTabChange: (): void => {},
47 onClear: (): void => {},
48 onViewMore: (): void => {},
49 loading: false,
50 clearClose: false,
51 emptyImage: 'https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg',
52 };
53
54 state = {
55 visible: false,
56 };
57
58 onItemClick = (item: NoticeIconData, tabProps: NoticeIconTabProps): void => {
59 const { onItemClick } = this.props;
60 if (onItemClick) {
61 onItemClick(item, tabProps);
62 }
63 };
64
65 onClear = (name: string, key: string): void => {
66 const { onClear } = this.props;
67 if (onClear) {
68 onClear(name, key);
69 }
70 };
71
72 onTabChange = (tabType: string): void => {
73 const { onTabChange } = this.props;
74 if (onTabChange) {
75 onTabChange(tabType);
76 }
77 };
78
79 onViewMore = (tabProps: NoticeIconTabProps, event: MouseEvent): void => {
80 const { onViewMore } = this.props;
81 if (onViewMore) {
82 onViewMore(tabProps, event);
83 }
84 };
85
86 getNotificationBox(): React.ReactNode {
87 const { children, loading, clearText, viewMoreText } = this.props;
88 if (!children) {
89 return null;
90 }
91 const panes = React.Children.map(
92 children,
93 (child: React.ReactElement<NoticeIconTabProps>): React.ReactNode => {
94 if (!child) {
95 return null;
96 }
97 const { list, title, count, tabKey, showClear, showViewMore } = child.props;
98 const len = list && list.length ? list.length : 0;
99 const msgCount = count || count === 0 ? count : len;
100 const tabTitle: string = msgCount > 0 ? `${title} (${msgCount})` : title;
101 return (
102 <TabPane tab={tabTitle} key={title}>
103 <NoticeList
104 clearText={clearText}
105 viewMoreText={viewMoreText}
106 data={list}
107 onClear={(): void => this.onClear(title, tabKey)}
108 onClick={(item): void => this.onItemClick(item, child.props)}
109 onViewMore={(event): void => this.onViewMore(child.props, event)}
110 showClear={showClear}
111 showViewMore={showViewMore}
112 title={title}
113 {...child.props}
114 />
115 </TabPane>
116 );
117 },
118 );
119 return (
120 <>
121 <Spin spinning={loading} delay={300}>
122 <Tabs className={styles.tabs} onChange={this.onTabChange}>
123 {panes}
124 </Tabs>
125 </Spin>
126 </>
127 );
128 }
129
130 handleVisibleChange = (visible: boolean): void => {
131 const { onPopupVisibleChange } = this.props;
132 this.setState({ visible });
133 if (onPopupVisibleChange) {
134 onPopupVisibleChange(visible);
135 }
136 };
137
138 render(): React.ReactNode {
139 const { className, count, popupVisible, bell } = this.props;
140 const { visible } = this.state;
141 const noticeButtonClass = classNames(className, styles.noticeButton);
142 const notificationBox = this.getNotificationBox();
143 const NoticeBellIcon = bell || <Icon type="bell" className={styles.icon} />;
144 const trigger = (
145 <span className={classNames(noticeButtonClass, { opened: visible })}>
146 <Badge count={count} style={{ boxShadow: 'none' }} className={styles.badge}>
147 {NoticeBellIcon}
148 </Badge>
149 </span>
150 );
151 if (!notificationBox) {
152 return trigger;
153 }
154 const popoverProps: {
155 visible?: boolean;
156 } = {};
157 if ('popupVisible' in this.props) {
158 popoverProps.visible = popupVisible;
159 }
160
161 return (
162 <HeaderDropdown
163 placement="bottomRight"
164 overlay={notificationBox}
165 overlayClassName={styles.popover}
166 trigger={['click']}
167 visible={visible}
168 onVisibleChange={this.handleVisibleChange}
169 {...popoverProps}
170 >
171 {trigger}
172 </HeaderDropdown>
173 );
174 }
175 }
1 import React from 'react';
2 import { Spin } from 'antd';
3
4 // loading components from code split
5 // https://umijs.org/plugin/umi-plugin-react.html#dynamicimport
6 const PageLoading: React.FC = () => (
7 <div style={{ paddingTop: 100, textAlign: 'center' }}>
8 <Spin size="large" />
9 </div>
10 );
11 export default PageLoading;
1 @import '~antd/es/style/themes/default.less';
2
3 .menu {
4 :global(.anticon) {
5 margin-right: 8px;
6 }
7 :global(.ant-dropdown-menu-item) {
8 min-width: 160px;
9 }
10 }
11
12 .dropDown {
13 line-height: @layout-header-height;
14 vertical-align: top;
15 cursor: pointer;
16 > i {
17 font-size: 16px !important;
18 transform: none !important;
19 svg {
20 position: relative;
21 top: -1px;
22 }
23 }
24 }
1 import { Icon, Menu } from 'antd';
2 import { formatMessage, getLocale, setLocale } from 'umi-plugin-react/locale';
3
4 import { ClickParam } from 'antd/es/menu';
5 import React from 'react';
6 import classNames from 'classnames';
7 import HeaderDropdown from '../HeaderDropdown';
8 import styles from './index.less';
9
10 interface SelectLangProps {
11 className?: string;
12 }
13 const SelectLang: React.FC<SelectLangProps> = props => {
14 const { className } = props;
15 const selectedLang = getLocale();
16 const changeLang = ({ key }: ClickParam): void => setLocale(key);
17 const locales = ['zh-CN', 'zh-TW', 'en-US', 'pt-BR'];
18 const languageLabels = {
19 'zh-CN': '简体中文',
20 'zh-TW': '繁体中文',
21 'en-US': 'English',
22 'pt-BR': 'Português',
23 };
24 const languageIcons = {
25 'zh-CN': '🇨🇳',
26 'zh-TW': '🇭🇰',
27 'en-US': '🇺🇸',
28 'pt-BR': '🇧🇷',
29 };
30 const langMenu = (
31 <Menu className={styles.menu} selectedKeys={[selectedLang]} onClick={changeLang}>
32 {locales.map(locale => (
33 <Menu.Item key={locale}>
34 <span role="img" aria-label={languageLabels[locale]}>
35 {languageIcons[locale]}
36 </span>{' '}
37 {languageLabels[locale]}
38 </Menu.Item>
39 ))}
40 </Menu>
41 );
42 return (
43 <HeaderDropdown overlay={langMenu} placement="bottomRight">
44 <span className={classNames(styles.dropDown, className)}>
45 <Icon type="global" title={formatMessage({ id: 'navBar.lang' })} />
46 </span>
47 </HeaderDropdown>
48 );
49 };
50
51 export default SelectLang;
1 // eslint-disable-next-line eslint-comments/disable-enable-pair
2 /* eslint-disable import/no-extraneous-dependencies */
3 import client from 'webpack-theme-color-replacer/client';
4 import generate from '@ant-design/colors/lib/generate';
5
6 export default {
7 getAntdSerials(color: string): string[] {
8 const lightCount = 9;
9 const divide = 10;
10 // 淡化(即less的tint)
11 let lightens = new Array(lightCount).fill(0);
12 lightens = lightens.map((_, i) => client.varyColor.lighten(color, i / divide));
13 const colorPalettes = generate(color);
14 const rgb = client.varyColor.toNum3(color.replace('#', '')).join(',');
15 return lightens.concat(colorPalettes).concat(rgb);
16 },
17 changeColor(color?: string): Promise<void> {
18 if (!color) {
19 return Promise.resolve();
20 }
21 const options = {
22 // new colors array, one-to-one corresponde with `matchColors`
23 newColors: this.getAntdSerials(color),
24 changeUrl(cssUrl: string): string {
25 // while router is not `hash` mode, it needs absolute path
26 return `/${cssUrl}`;
27 },
28 };
29 return client.changer.changeColor(options, Promise);
30 },
31 };
1 @import '~antd/es/style/themes/default.less';
2
3 .standardTable {
4 :global {
5 .ant-table-pagination {
6 margin-top: 24px;
7 }
8 }
9
10 .tableAlert {
11 margin-bottom: 16px;
12 }
13 }
1 import { Alert, Table } from 'antd';
2 import { ColumnProps, TableRowSelection, TableProps } from 'antd/es/table';
3 import React, { Component, Fragment } from 'react';
4
5 import { TableListItem } from '../../data.d';
6 import styles from './index.less';
7
8 type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
9
10 export interface StandardTableProps<T> extends Omit<TableProps<T>, 'columns'> {
11 columns: StandardTableColumnProps[];
12 data: {
13 list: TableListItem[];
14 pagination: StandardTableProps<TableListItem>['pagination'];
15 };
16 selectedRows: TableListItem[];
17 onSelectRow: (rows: any) => void;
18 }
19
20 export interface StandardTableColumnProps extends ColumnProps<TableListItem> {
21 needTotal?: boolean;
22 total?: number;
23 }
24
25 function initTotalList(columns: StandardTableColumnProps[]) {
26 if (!columns) {
27 return [];
28 }
29 const totalList: StandardTableColumnProps[] = [];
30 columns.forEach(column => {
31 if (column.needTotal) {
32 totalList.push({ ...column, total: 0 });
33 }
34 });
35 return totalList;
36 }
37
38 interface StandardTableState {
39 selectedRowKeys: string[];
40 needTotalList: StandardTableColumnProps[];
41 }
42
43 class StandardTable extends Component<StandardTableProps<TableListItem>, StandardTableState> {
44 static getDerivedStateFromProps(nextProps: StandardTableProps<TableListItem>) {
45 // clean state
46 if (nextProps.selectedRows.length === 0) {
47 const needTotalList = initTotalList(nextProps.columns);
48 return {
49 selectedRowKeys: [],
50 needTotalList,
51 };
52 }
53 return null;
54 }
55
56 constructor(props: StandardTableProps<TableListItem>) {
57 super(props);
58 const { columns } = props;
59 const needTotalList = initTotalList(columns);
60
61 this.state = {
62 selectedRowKeys: [],
63 needTotalList,
64 };
65 }
66
67 handleRowSelectChange: TableRowSelection<TableListItem>['onChange'] = (
68 selectedRowKeys,
69 selectedRows: TableListItem[],
70 ) => {
71 const currySelectedRowKeys = selectedRowKeys as string[];
72 let { needTotalList } = this.state;
73 needTotalList = needTotalList.map(item => ({
74 ...item,
75 total: selectedRows.reduce((sum, val) => sum + parseFloat(val[item.dataIndex || 0]), 0),
76 }));
77 const { onSelectRow } = this.props;
78 if (onSelectRow) {
79 onSelectRow(selectedRows);
80 }
81
82 this.setState({ selectedRowKeys: currySelectedRowKeys, needTotalList });
83 };
84
85 handleTableChange: TableProps<TableListItem>['onChange'] = (
86 pagination,
87 filters,
88 sorter,
89 ...rest
90 ) => {
91 const { onChange } = this.props;
92 if (onChange) {
93 onChange(pagination, filters, sorter, ...rest);
94 }
95 };
96
97 cleanSelectedKeys = () => {
98 if (this.handleRowSelectChange) {
99 this.handleRowSelectChange([], []);
100 }
101 };
102
103 render() {
104 const { selectedRowKeys, needTotalList } = this.state;
105 const { data, rowKey, ...rest } = this.props;
106 const { list = [], pagination = false } = data || {};
107
108 const paginationProps = pagination
109 ? {
110 showSizeChanger: true,
111 showQuickJumper: true,
112 ...pagination,
113 }
114 : false;
115
116 const rowSelection: TableRowSelection<TableListItem> = {
117 selectedRowKeys,
118 onChange: this.handleRowSelectChange,
119 getCheckboxProps: (record: TableListItem) => ({
120 disabled: record.disabled,
121 }),
122 };
123
124 return (
125 <div className={styles.standardTable}>
126 <div className={styles.tableAlert}>
127 <Alert
128 message={
129 <Fragment>
130 已选择 <a style={{ fontWeight: 600 }}>{selectedRowKeys.length}</a> 项&nbsp;&nbsp;
131 {needTotalList.map((item, index) => (
132 <span style={{ marginLeft: 8 }} key={item.dataIndex}>
133 {item.title}
134 总计&nbsp;
135 <span style={{ fontWeight: 600 }}>
136 {item.render
137 ? item.render(item.total, item as TableListItem, index)
138 : item.total}
139 </span>
140 </span>
141 ))}
142 <a onClick={this.cleanSelectedKeys} style={{ marginLeft: 24 }}>
143 清空
144 </a>
145 </Fragment>
146 }
147 type="info"
148 showIcon
149 />
150 </div>
151 <Table
152 rowKey={rowKey || 'key'}
153 rowSelection={rowSelection}
154 dataSource={list}
155 pagination={paginationProps}
156 onChange={this.handleTableChange}
157 {...rest}
158 />
159 </div>
160 );
161 }
162 }
163
164 export default StandardTable;
1 const { uniq } = require('lodash');
2 const RouterConfig = require('../../config/config').default.routes;
3
4 const BASE_URL = `http://localhost:${process.env.PORT || 8000}`;
5
6 function formatter(routes, parentPath = '') {
7 const fixedParentPath = parentPath.replace(/\/{1,}/g, '/');
8 let result = [];
9 routes.forEach(item => {
10 if (item.path) {
11 result.push(`${fixedParentPath}/${item.path}`.replace(/\/{1,}/g, '/'));
12 }
13 if (item.routes) {
14 result = result.concat(
15 formatter(item.routes, item.path ? `${fixedParentPath}/${item.path}` : parentPath),
16 );
17 }
18 });
19 return uniq(result.filter(item => !!item));
20 }
21
22 describe('Ant Design Pro E2E test', () => {
23 const testPage = path => async () => {
24 await page.goto(`${BASE_URL}${path}`);
25 await page.waitForSelector('footer', {
26 timeout: 2000,
27 });
28 const haveFooter = await page.evaluate(
29 () => document.getElementsByTagName('footer').length > 0,
30 );
31 expect(haveFooter).toBeTruthy();
32 };
33
34 const routers = formatter(RouterConfig);
35 console.log('routers', routers);
36 routers.forEach(route => {
37 it(`test pages ${route}`, testPage(route));
38 });
39 });
1 const BASE_URL = `http://localhost:${process.env.PORT || 8000}`;
2
3 describe('Homepage', () => {
4 it('topmenu should have footer', async () => {
5 const params = '/form/basic-form?navTheme=light&layout=topmenu';
6 await page.goto(`${BASE_URL}${params}`);
7 await page.waitForSelector('footer', {
8 timeout: 2000,
9 });
10 const haveFooter = await page.evaluate(
11 () => document.getElementsByTagName('footer').length > 0,
12 );
13 expect(haveFooter).toBeTruthy();
14 });
15 });
1 @import '~antd/es/style/themes/default.less';
2
3 html,
4 body,
5 #root {
6 height: 100%;
7 }
8
9 .colorWeak {
10 filter: invert(80%);
11 }
12
13 .ant-layout {
14 min-height: 100vh;
15 }
16
17 canvas {
18 display: block;
19 }
20
21 body {
22 text-rendering: optimizeLegibility;
23 -webkit-font-smoothing: antialiased;
24 -moz-osx-font-smoothing: grayscale;
25 }
26
27 ul,
28 ol {
29 list-style: none;
30 }
31
32 @media (max-width: @screen-xs) {
33 .ant-table {
34 width: 100%;
35 overflow-x: auto;
36 &-thead > tr,
37 &-tbody > tr {
38 > th,
39 > td {
40 white-space: pre;
41 > span {
42 display: block;
43 }
44 }
45 }
46 }
47 }
48
49 .ant-layout-header {
50 height: 32px;
51 line-height: 32px;
52 }
53 .ant-pro-global-header {
54 height: 32px;
55 }
56 .ant-pro-global-header-trigger {
57 height: 32px;
58 padding: calc((32px - 26px) / 2) 24px;
59 }
60 .antd-pro-components-global-header-index-right .antd-pro-components-global-header-index-account .antd-pro-components-global-header-index-avatar {
61 margin: calc((32px - 24px) / 2) 0;
62 }
63
64 .ant-pro-basicLayout-content.ant-pro-basicLayout-has-header {
65 padding-top: 32px;
66 }
67 .ant-page-header.has-breadcrumb {
68 padding-top: 5px;
69 }
70 .ant-page-header {
71 padding: 0 24px;
72 }
73 .ant-breadcrumb + .ant-page-header-heading {
74 margin-top: 0;
75 }
76 .antd-pro-components-select-lang-index-dropDown {
77 line-height: 32px;
78 }
79
80 .ant-page-header-heading-title {
81 font-size: 16px;
82 }
83 .ant-layout-footer {
84 padding: 24px 5px;
85 background: #fff;
86 }
87
88 .ant-pro-global-footer {
89 margin: 10px 0;
90 }
91
92 .ant-pro-global-footer-links {
93 margin-bottom: 5px;
94 }
...\ No newline at end of file ...\ No newline at end of file
1 import { Button, message, notification } from 'antd';
2
3 import React from 'react';
4 import { formatMessage } from 'umi-plugin-react/locale';
5 import defaultSettings from '../config/defaultSettings';
6
7 const { pwa } = defaultSettings;
8 // if pwa is true
9 if (pwa) {
10 // Notify user if offline now
11 window.addEventListener('sw.offline', () => {
12 message.warning(formatMessage({ id: 'app.pwa.offline' }));
13 });
14
15 // Pop up a prompt on the page asking the user if they want to use the latest version
16 window.addEventListener('sw.updated', (event: Event) => {
17 const e = event as CustomEvent;
18 const reloadSW = async () => {
19 // Check if there is sw whose state is waiting in ServiceWorkerRegistration
20 // https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration
21 const worker = e.detail && e.detail.waiting;
22 if (!worker) {
23 return true;
24 }
25 // Send skip-waiting event to waiting SW with MessageChannel
26 await new Promise((resolve, reject) => {
27 const channel = new MessageChannel();
28 channel.port1.onmessage = msgEvent => {
29 if (msgEvent.data.error) {
30 reject(msgEvent.data.error);
31 } else {
32 resolve(msgEvent.data);
33 }
34 };
35 worker.postMessage({ type: 'skip-waiting' }, [channel.port2]);
36 });
37 // Refresh current page to use the updated HTML and other assets after SW has skiped waiting
38 window.location.reload(true);
39 return true;
40 };
41 const key = `open${Date.now()}`;
42 const btn = (
43 <Button
44 type="primary"
45 onClick={() => {
46 notification.close(key);
47 reloadSW();
48 }}
49 >
50 {formatMessage({ id: 'app.pwa.serviceworker.updated.ok' })}
51 </Button>
52 );
53 notification.open({
54 message: formatMessage({ id: 'app.pwa.serviceworker.updated' }),
55 description: formatMessage({ id: 'app.pwa.serviceworker.updated.hint' }),
56 btn,
57 key,
58 onClose: async () => {},
59 });
60 });
61 } else if ('serviceWorker' in navigator) {
62 // unregister service worker
63 const { serviceWorker } = navigator;
64 if (serviceWorker.getRegistrations) {
65 serviceWorker.getRegistrations().then(sws => {
66 sws.forEach(sw => {
67 sw.unregister();
68 });
69 });
70 }
71 serviceWorker.getRegistration().then(sw => {
72 if (sw) sw.unregister();
73 });
74
75 // remove all caches
76 if (window.caches && window.caches.keys) {
77 caches.keys().then(keys => {
78 keys.forEach(key => {
79 caches.delete(key);
80 });
81 });
82 }
83 }
1 /**
2 * Ant Design Pro v4 use `@ant-design/pro-layout` to handle Layout.
3 * You can view component api by:
4 * https://github.com/ant-design/ant-design-pro-layout
5 */
6
7 import ProLayout, {
8 MenuDataItem,
9 BasicLayoutProps as ProLayoutProps,
10 Settings,
11 DefaultFooter,
12 } from '@ant-design/pro-layout';
13 import React, { useEffect } from 'react';
14 import Link from 'umi/link';
15 import { Dispatch } from 'redux';
16 import { connect } from 'dva';
17 import { Icon, Result, Button } from 'antd';
18 import { formatMessage } from 'umi-plugin-react/locale';
19
20 import Authorized from '@/utils/Authorized';
21 import RightContent from '@/components/GlobalHeader/RightContent';
22 import { ConnectState } from '@/models/connect';
23 import { isAntDesignPro, getAuthorityFromRouter } from '@/utils/utils';
24 import logo from '../assets/logo.svg';
25
26 const noMatch = (
27 <Result
28 status="403"
29 title="403"
30 subTitle="Sorry, you are not authorized to access this page."
31 extra={
32 <Button type="primary">
33 <Link to="/user/login">Go Login</Link>
34 </Button>
35 }
36 />
37 );
38
39 export interface BasicLayoutProps extends ProLayoutProps {
40 breadcrumbNameMap: {
41 [path: string]: MenuDataItem;
42 };
43 route: ProLayoutProps['route'] & {
44 authority: string[];
45 };
46 settings: Settings;
47 dispatch: Dispatch;
48 }
49 export type BasicLayoutContext = { [K in 'location']: BasicLayoutProps[K] } & {
50 breadcrumbNameMap: {
51 [path: string]: MenuDataItem;
52 };
53 };
54
55 /**
56 * use Authorized check all menu item
57 */
58 const menuDataRender = (menuList: MenuDataItem[]): MenuDataItem[] =>
59 menuList.map(item => {
60 const localItem = {
61 ...item,
62 children: item.children ? menuDataRender(item.children) : [],
63 };
64 return Authorized.check(item.authority, localItem, null) as MenuDataItem;
65 });
66
67 const defaultFooterDom = (
68 <DefaultFooter
69 styles="margin: 0 0 24px 0; padding: 0 5px"
70 copyright="2017 - 2019 利姆斯(北京)区块链技术有限公司 京ICP备18046899号-1 京网信备1101091997877663001X号"
71 links={[
72 {
73 key: 'LIMSChain',
74 title: 'LIMSChain 基于区块链的检验检测监管平台 v1.0',
75 href: 'http://limschain.com',
76 blankTarget: true,
77 }
78 ]}
79 />
80 );
81
82 const footerRender: BasicLayoutProps['footerRender'] = () => {
83 if (!isAntDesignPro()) {
84 return defaultFooterDom;
85 }
86 return (
87 <>
88 {defaultFooterDom}
89 </>
90 );
91 };
92
93 const BasicLayout: React.FC<BasicLayoutProps> = props => {
94 const { dispatch, children, settings, location = { pathname: '/' } } = props;
95 /**
96 * constructor
97 */
98
99 useEffect(() => {
100 if (dispatch) {
101 dispatch({
102 type: 'user/fetchCurrent',
103 });
104 dispatch({
105 type: 'settings/getSetting',
106 });
107 }
108 }, []);
109 /**
110 * init variables
111 */
112 const handleMenuCollapse = (payload: boolean): void => {
113 if (dispatch) {
114 dispatch({
115 type: 'global/changeLayoutCollapsed',
116 payload,
117 });
118 }
119 };
120 // get children authority
121 const authorized = getAuthorityFromRouter(props.route.routes, location.pathname || '/') || {
122 authority: undefined,
123 };
124
125 return (
126 <ProLayout
127 logo={logo}
128 menuHeaderRender={(logoDom, titleDom) => (
129 <Link to="/">
130 {logoDom}
131 {titleDom}
132 </Link>
133 )}
134 onCollapse={handleMenuCollapse}
135 menuItemRender={(menuItemProps, defaultDom) => {
136 if (menuItemProps.isUrl || menuItemProps.children) {
137 return defaultDom;
138 }
139 return <Link to={menuItemProps.path}>{defaultDom}</Link>;
140 }}
141 breadcrumbRender={(routers = []) => [
142 {
143 path: '/',
144 breadcrumbName: formatMessage({
145 id: 'menu.home',
146 defaultMessage: 'Home',
147 }),
148 },
149 ...routers,
150 ]}
151 itemRender={(route, params, routes, paths) => {
152 const first = routes.indexOf(route) === 0;
153 return first ? (
154 <Link to={paths.join('/')}>{route.breadcrumbName}</Link>
155 ) : (
156 <span>{route.breadcrumbName}</span>
157 );
158 }}
159 footerRender={footerRender}
160 menuDataRender={menuDataRender}
161 formatMessage={formatMessage}
162 rightContentRender={rightProps => <RightContent {...rightProps} />}
163 {...props}
164 {...settings}
165 >
166 <Authorized authority={authorized!.authority} noMatch={noMatch}>
167 {children}
168 </Authorized>
169 </ProLayout>
170 );
171 };
172
173 export default connect(({ global, settings }: ConnectState) => ({
174 collapsed: global.collapsed,
175 settings,
176 }))(BasicLayout);
1 import React from 'react';
2
3 const Layout: React.FC = ({ children }) => <div>{children}</div>;
4
5 export default Layout;
1 import React from 'react';
2 import { connect } from 'dva';
3 import { Redirect } from 'umi';
4 import { stringify } from 'querystring';
5 import { ConnectState, ConnectProps } from '@/models/connect';
6 import { CurrentUser } from '@/models/user';
7 import PageLoading from '@/components/PageLoading';
8
9 interface SecurityLayoutProps extends ConnectProps {
10 loading: boolean;
11 currentUser: CurrentUser;
12 }
13
14 interface SecurityLayoutState {
15 isReady: boolean;
16 }
17
18 class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayoutState> {
19 state: SecurityLayoutState = {
20 isReady: false,
21 };
22
23 componentDidMount() {
24 this.setState({
25 isReady: true,
26 });
27 const { dispatch } = this.props;
28 if (dispatch) {
29 dispatch({
30 type: 'user/fetchCurrent',
31 });
32 }
33 }
34
35 render() {
36 const { isReady } = this.state;
37 const { children, loading, currentUser } = this.props;
38 // You can replace it to your authentication rule (such as check token exists)
39 // 你可以把它替换成你自己的登录认证规则(比如判断 token 是否存在)
40 const isLogin = currentUser && currentUser.userid;
41 const queryString = stringify({
42 redirect: window.location.href,
43 });
44
45 if ((!isLogin && loading) || !isReady) {
46 return <PageLoading />;
47 }
48 if (!isLogin) {
49 return <Redirect to={`/user/login?${queryString}`}></Redirect>;
50 }
51 return children;
52 }
53 }
54
55 export default connect(({ user, loading }: ConnectState) => ({
56 currentUser: user.currentUser,
57 loading: loading.models.user,
58 }))(SecurityLayout);
1 @import '~antd/es/style/themes/default.less';
2
3 .container {
4 display: flex;
5 flex-direction: column;
6 height: 100vh;
7 overflow: auto;
8 background: @layout-body-background;
9 }
10
11 .lang {
12 width: 100%;
13 height: 40px;
14 line-height: 44px;
15 text-align: right;
16 :global(.ant-dropdown-trigger) {
17 margin-right: 24px;
18 }
19 }
20
21 .content {
22 flex: 1;
23 padding: 32px 0;
24 }
25
26 @media (min-width: @screen-md-min) {
27 .container {
28 background-image: url('https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg');
29 background-repeat: no-repeat;
30 background-position: center 110px;
31 background-size: 100%;
32 }
33
34 .content {
35 padding: 32px 0 24px;
36 }
37 }
38
39 .top {
40 text-align: center;
41 }
42
43 .header {
44 height: 44px;
45 line-height: 44px;
46 a {
47 text-decoration: none;
48 }
49 }
50
51 .logo {
52 height: 44px;
53 margin-right: 16px;
54 vertical-align: top;
55 }
56
57 .title {
58 position: relative;
59 top: 2px;
60 color: @heading-color;
61 font-weight: 600;
62 font-size: 33px;
63 font-family: Avenir, 'Helvetica Neue', Arial, Helvetica, sans-serif;
64 }
65
66 .desc {
67 margin-top: 12px;
68 margin-bottom: 40px;
69 color: @text-color-secondary;
70 font-size: @font-size-base;
71 }
1 import { DefaultFooter, MenuDataItem, getMenuData, getPageTitle } from '@ant-design/pro-layout';
2 import { Helmet } from 'react-helmet';
3 import Link from 'umi/link';
4 import React from 'react';
5 import { connect } from 'dva';
6 import { formatMessage } from 'umi-plugin-react/locale';
7
8 import SelectLang from '@/components/SelectLang';
9 import { ConnectProps, ConnectState } from '@/models/connect';
10 import logo from '../assets/logo.svg';
11 import styles from './UserLayout.less';
12
13 export interface UserLayoutProps extends ConnectProps {
14 breadcrumbNameMap: { [path: string]: MenuDataItem };
15 }
16
17 const UserLayout: React.SFC<UserLayoutProps> = props => {
18 const {
19 route = {
20 routes: [],
21 },
22 } = props;
23 const { routes = [] } = route;
24 const {
25 children,
26 location = {
27 pathname: '',
28 },
29 } = props;
30 const { breadcrumb } = getMenuData(routes);
31 const title = getPageTitle({
32 pathname: location.pathname,
33 breadcrumb,
34 formatMessage,
35 ...props,
36 });
37 return (
38 <>
39 <Helmet>
40 <title>{title}</title>
41 <meta name="description" content={title} />
42 </Helmet>
43
44 <div className={styles.container}>
45 <div className={styles.lang}>
46 <SelectLang />
47 </div>
48 <div className={styles.content}>
49 <div className={styles.top}>
50 <div className={styles.header}>
51 <Link to="/">
52 <img alt="logo" className={styles.logo} src={logo} />
53 <span className={styles.title}>Ant Design</span>
54 </Link>
55 </div>
56 <div className={styles.desc}>Ant Design 是西湖区最具影响力的 Web 设计规范</div>
57 </div>
58 {children}
59 </div>
60 <DefaultFooter />
61 </div>
62 </>
63 );
64 };
65
66 export default connect(({ settings }: ConnectState) => ({
67 ...settings,
68 }))(UserLayout);
1 import component from './en-US/component';
2 import globalHeader from './en-US/globalHeader';
3 import menu from './en-US/menu';
4 import pwa from './en-US/pwa';
5 import settingDrawer from './en-US/settingDrawer';
6 import settings from './en-US/settings';
7
8 export default {
9 'navBar.lang': 'Languages',
10 'layout.user.link.help': 'Help',
11 'layout.user.link.privacy': 'Privacy',
12 'layout.user.link.terms': 'Terms',
13 'app.preview.down.block': 'Download this page to your local project',
14 'app.welcome.link.fetch-blocks': 'Get all block',
15 'app.welcome.link.block-list': 'Quickly build standard, pages based on `block` development',
16 ...globalHeader,
17 ...menu,
18 ...settingDrawer,
19 ...settings,
20 ...pwa,
21 ...component,
22 };
1 export default {
2 'component.tagSelect.expand': 'Expand',
3 'component.tagSelect.collapse': 'Collapse',
4 'component.tagSelect.all': 'All',
5 };
1 export default {
2 'component.globalHeader.search': 'Search',
3 'component.globalHeader.search.example1': 'Search example 1',
4 'component.globalHeader.search.example2': 'Search example 2',
5 'component.globalHeader.search.example3': 'Search example 3',
6 'component.globalHeader.help': 'Help',
7 'component.globalHeader.notification': 'Notification',
8 'component.globalHeader.notification.empty': 'You have viewed all notifications.',
9 'component.globalHeader.message': 'Message',
10 'component.globalHeader.message.empty': 'You have viewed all messsages.',
11 'component.globalHeader.event': 'Event',
12 'component.globalHeader.event.empty': 'You have viewed all events.',
13 'component.noticeIcon.clear': 'Clear',
14 'component.noticeIcon.cleared': 'Cleared',
15 'component.noticeIcon.empty': 'No notifications',
16 'component.noticeIcon.view-more': 'View more',
17 };
1 export default {
2 'menu.welcome': 'Welcome',
3 'menu.more-blocks': 'More Blocks',
4 'menu.home': 'Home',
5 'menu.admin': 'admin',
6 'menu.login': 'Login',
7 'menu.register': 'Register',
8 'menu.register.result': 'Register Result',
9 'menu.dashboard': 'Dashboard',
10 'menu.dashboard.analysis': 'Analysis',
11 'menu.dashboard.monitor': 'Monitor',
12 'menu.dashboard.workplace': 'Workplace',
13 'menu.exception.403': '403',
14 'menu.exception.404': '404',
15 'menu.exception.500': '500',
16 'menu.form': 'Form',
17 'menu.form.basic-form': 'Basic Form',
18 'menu.form.step-form': 'Step Form',
19 'menu.form.step-form.info': 'Step Form(write transfer information)',
20 'menu.form.step-form.confirm': 'Step Form(confirm transfer information)',
21 'menu.form.step-form.result': 'Step Form(finished)',
22 'menu.form.advanced-form': 'Advanced Form',
23 'menu.list': 'List',
24 'menu.list.table-list': 'Search Table',
25 'menu.list.basic-list': 'Basic List',
26 'menu.list.card-list': 'Card List',
27 'menu.list.search-list': 'Search List',
28 'menu.list.search-list.articles': 'Search List(articles)',
29 'menu.list.search-list.projects': 'Search List(projects)',
30 'menu.list.search-list.applications': 'Search List(applications)',
31 'menu.profile': 'Profile',
32 'menu.profile.basic': 'Basic Profile',
33 'menu.profile.advanced': 'Advanced Profile',
34 'menu.result': 'Result',
35 'menu.result.success': 'Success',
36 'menu.result.fail': 'Fail',
37 'menu.exception': 'Exception',
38 'menu.exception.not-permission': '403',
39 'menu.exception.not-find': '404',
40 'menu.exception.server-error': '500',
41 'menu.exception.trigger': 'Trigger',
42 'menu.account': 'Account',
43 'menu.account.center': 'Account Center',
44 'menu.account.settings': 'Account Settings',
45 'menu.account.trigger': 'Trigger Error',
46 'menu.account.logout': 'Logout',
47 'menu.editor': 'Graphic Editor',
48 'menu.editor.flow': 'Flow Editor',
49 'menu.editor.mind': 'Mind Editor',
50 'menu.editor.koni': 'Koni Editor',
51 };
1 export default {
2 'app.pwa.offline': 'You are offline now',
3 'app.pwa.serviceworker.updated': 'New content is available',
4 'app.pwa.serviceworker.updated.hint': 'Please press the "Refresh" button to reload current page',
5 'app.pwa.serviceworker.updated.ok': 'Refresh',
6 };
1 export default {
2 'app.setting.pagestyle': 'Page style setting',
3 'app.setting.pagestyle.dark': 'Dark style',
4 'app.setting.pagestyle.light': 'Light style',
5 'app.setting.content-width': 'Content Width',
6 'app.setting.content-width.fixed': 'Fixed',
7 'app.setting.content-width.fluid': 'Fluid',
8 'app.setting.themecolor': 'Theme Color',
9 'app.setting.themecolor.dust': 'Dust Red',
10 'app.setting.themecolor.volcano': 'Volcano',
11 'app.setting.themecolor.sunset': 'Sunset Orange',
12 'app.setting.themecolor.cyan': 'Cyan',
13 'app.setting.themecolor.green': 'Polar Green',
14 'app.setting.themecolor.daybreak': 'Daybreak Blue (default)',
15 'app.setting.themecolor.geekblue': 'Geek Glue',
16 'app.setting.themecolor.purple': 'Golden Purple',
17 'app.setting.navigationmode': 'Navigation Mode',
18 'app.setting.sidemenu': 'Side Menu Layout',
19 'app.setting.topmenu': 'Top Menu Layout',
20 'app.setting.fixedheader': 'Fixed Header',
21 'app.setting.fixedsidebar': 'Fixed Sidebar',
22 'app.setting.fixedsidebar.hint': 'Works on Side Menu Layout',
23 'app.setting.hideheader': 'Hidden Header when scrolling',
24 'app.setting.hideheader.hint': 'Works when Hidden Header is enabled',
25 'app.setting.othersettings': 'Other Settings',
26 'app.setting.weakmode': 'Weak Mode',
27 'app.setting.copy': 'Copy Setting',
28 'app.setting.copyinfo': 'copy success,please replace defaultSettings in src/models/setting.js',
29 'app.setting.production.hint':
30 'Setting panel shows in development environment only, please manually modify',
31 };
1 export default {
2 'app.settings.menuMap.basic': 'Basic Settings',
3 'app.settings.menuMap.security': 'Security Settings',
4 'app.settings.menuMap.binding': 'Account Binding',
5 'app.settings.menuMap.notification': 'New Message Notification',
6 'app.settings.basic.avatar': 'Avatar',
7 'app.settings.basic.change-avatar': 'Change avatar',
8 'app.settings.basic.email': 'Email',
9 'app.settings.basic.email-message': 'Please input your email!',
10 'app.settings.basic.nickname': 'Nickname',
11 'app.settings.basic.nickname-message': 'Please input your Nickname!',
12 'app.settings.basic.profile': 'Personal profile',
13 'app.settings.basic.profile-message': 'Please input your personal profile!',
14 'app.settings.basic.profile-placeholder': 'Brief introduction to yourself',
15 'app.settings.basic.country': 'Country/Region',
16 'app.settings.basic.country-message': 'Please input your country!',
17 'app.settings.basic.geographic': 'Province or city',
18 'app.settings.basic.geographic-message': 'Please input your geographic info!',
19 'app.settings.basic.address': 'Street Address',
20 'app.settings.basic.address-message': 'Please input your address!',
21 'app.settings.basic.phone': 'Phone Number',
22 'app.settings.basic.phone-message': 'Please input your phone!',
23 'app.settings.basic.update': 'Update Information',
24 'app.settings.security.strong': 'Strong',
25 'app.settings.security.medium': 'Medium',
26 'app.settings.security.weak': 'Weak',
27 'app.settings.security.password': 'Account Password',
28 'app.settings.security.password-description': 'Current password strength',
29 'app.settings.security.phone': 'Security Phone',
30 'app.settings.security.phone-description': 'Bound phone',
31 'app.settings.security.question': 'Security Question',
32 'app.settings.security.question-description':
33 'The security question is not set, and the security policy can effectively protect the account security',
34 'app.settings.security.email': 'Backup Email',
35 'app.settings.security.email-description': 'Bound Email',
36 'app.settings.security.mfa': 'MFA Device',
37 'app.settings.security.mfa-description':
38 'Unbound MFA device, after binding, can be confirmed twice',
39 'app.settings.security.modify': 'Modify',
40 'app.settings.security.set': 'Set',
41 'app.settings.security.bind': 'Bind',
42 'app.settings.binding.taobao': 'Binding Taobao',
43 'app.settings.binding.taobao-description': 'Currently unbound Taobao account',
44 'app.settings.binding.alipay': 'Binding Alipay',
45 'app.settings.binding.alipay-description': 'Currently unbound Alipay account',
46 'app.settings.binding.dingding': 'Binding DingTalk',
47 'app.settings.binding.dingding-description': 'Currently unbound DingTalk account',
48 'app.settings.binding.bind': 'Bind',
49 'app.settings.notification.password': 'Account Password',
50 'app.settings.notification.password-description':
51 'Messages from other users will be notified in the form of a station letter',
52 'app.settings.notification.messages': 'System Messages',
53 'app.settings.notification.messages-description':
54 'System messages will be notified in the form of a station letter',
55 'app.settings.notification.todo': 'To-do Notification',
56 'app.settings.notification.todo-description':
57 'The to-do list will be notified in the form of a letter from the station',
58 'app.settings.open': 'Open',
59 'app.settings.close': 'Close',
60 };
1 import component from './pt-BR/component';
2 import globalHeader from './pt-BR/globalHeader';
3 import menu from './pt-BR/menu';
4 import pwa from './pt-BR/pwa';
5 import settingDrawer from './pt-BR/settingDrawer';
6 import settings from './pt-BR/settings';
7
8 export default {
9 'navBar.lang': 'Idiomas',
10 'layout.user.link.help': 'ajuda',
11 'layout.user.link.privacy': 'política de privacidade',
12 'layout.user.link.terms': 'termos de serviços',
13 'app.preview.down.block': 'Download this page to your local project',
14 ...globalHeader,
15 ...menu,
16 ...settingDrawer,
17 ...settings,
18 ...pwa,
19 ...component,
20 };
1 export default {
2 'component.tagSelect.expand': 'Expandir',
3 'component.tagSelect.collapse': 'Diminuir',
4 'component.tagSelect.all': 'Todas',
5 };
1 export default {
2 'component.globalHeader.search': 'Busca',
3 'component.globalHeader.search.example1': 'Exemplo de busca 1',
4 'component.globalHeader.search.example2': 'Exemplo de busca 2',
5 'component.globalHeader.search.example3': 'Exemplo de busca 3',
6 'component.globalHeader.help': 'Ajuda',
7 'component.globalHeader.notification': 'Notificação',
8 'component.globalHeader.notification.empty': 'Você visualizou todas as notificações.',
9 'component.globalHeader.message': 'Mensagem',
10 'component.globalHeader.message.empty': 'Você visualizou todas as mensagens.',
11 'component.globalHeader.event': 'Evento',
12 'component.globalHeader.event.empty': 'Você visualizou todos os eventos.',
13 'component.noticeIcon.clear': 'Limpar',
14 'component.noticeIcon.cleared': 'Limpo',
15 'component.noticeIcon.empty': 'Sem notificações',
16 'component.noticeIcon.loaded': 'Carregado',
17 'component.noticeIcon.view-more': 'Veja mais',
18 };
1 export default {
2 'menu.welcome': 'Welcome',
3 'menu.more-blocks': 'More Blocks',
4 'menu.home': 'Início',
5 'menu.login': 'Login',
6 'menu.admin': 'admin',
7 'menu.register': 'Registro',
8 'menu.register.result': 'Resultado de registro',
9 'menu.dashboard': 'Dashboard',
10 'menu.dashboard.analysis': 'Análise',
11 'menu.dashboard.monitor': 'Monitor',
12 'menu.dashboard.workplace': 'Ambiente de Trabalho',
13 'menu.exception.403': '403',
14 'menu.exception.404': '404',
15 'menu.exception.500': '500',
16 'menu.form': 'Formulário',
17 'menu.form.basic-form': 'Formulário Básico',
18 'menu.form.step-form': 'Formulário Assistido',
19 'menu.form.step-form.info': 'Formulário Assistido(gravar informações de transferência)',
20 'menu.form.step-form.confirm': 'Formulário Assistido(confirmar informações de transferência)',
21 'menu.form.step-form.result': 'Formulário Assistido(finalizado)',
22 'menu.form.advanced-form': 'Formulário Avançado',
23 'menu.list': 'Lista',
24 'menu.list.table-list': 'Tabela de Busca',
25 'menu.list.basic-list': 'Lista Básica',
26 'menu.list.card-list': 'Lista de Card',
27 'menu.list.search-list': 'Lista de Busca',
28 'menu.list.search-list.articles': 'Lista de Busca(artigos)',
29 'menu.list.search-list.projects': 'Lista de Busca(projetos)',
30 'menu.list.search-list.applications': 'Lista de Busca(aplicações)',
31 'menu.profile': 'Perfil',
32 'menu.profile.basic': 'Perfil Básico',
33 'menu.profile.advanced': 'Perfil Avançado',
34 'menu.result': 'Resultado',
35 'menu.result.success': 'Sucesso',
36 'menu.result.fail': 'Falha',
37 'menu.exception': 'Exceção',
38 'menu.exception.not-permission': '403',
39 'menu.exception.not-find': '404',
40 'menu.exception.server-error': '500',
41 'menu.exception.trigger': 'Disparar',
42 'menu.account': 'Conta',
43 'menu.account.center': 'Central da Conta',
44 'menu.account.settings': 'Configurar Conta',
45 'menu.account.trigger': 'Disparar Erro',
46 'menu.account.logout': 'Sair',
47 'menu.editor': 'Graphic Editor',
48 'menu.editor.flow': 'Flow Editor',
49 'menu.editor.mind': 'Mind Editor',
50 'menu.editor.koni': 'Koni Editor',
51 };
1 export default {
2 'app.pwa.offline': 'Você está offline agora',
3 'app.pwa.serviceworker.updated': 'Novo conteúdo está disponível',
4 'app.pwa.serviceworker.updated.hint':
5 'Por favor, pressione o botão "Atualizar" para recarregar a página atual',
6 'app.pwa.serviceworker.updated.ok': 'Atualizar',
7 };
1 export default {
2 'app.setting.pagestyle': 'Configuração de estilo da página',
3 'app.setting.pagestyle.dark': 'Dark style',
4 'app.setting.pagestyle.light': 'Light style',
5 'app.setting.content-width': 'Largura do conteúdo',
6 'app.setting.content-width.fixed': 'Fixo',
7 'app.setting.content-width.fluid': 'Fluido',
8 'app.setting.themecolor': 'Cor do Tema',
9 'app.setting.themecolor.dust': 'Dust Red',
10 'app.setting.themecolor.volcano': 'Volcano',
11 'app.setting.themecolor.sunset': 'Sunset Orange',
12 'app.setting.themecolor.cyan': 'Cyan',
13 'app.setting.themecolor.green': 'Polar Green',
14 'app.setting.themecolor.daybreak': 'Daybreak Blue (default)',
15 'app.setting.themecolor.geekblue': 'Geek Glue',
16 'app.setting.themecolor.purple': 'Golden Purple',
17 'app.setting.navigationmode': 'Modo de Navegação',
18 'app.setting.sidemenu': 'Layout do Menu Lateral',
19 'app.setting.topmenu': 'Layout do Menu Superior',
20 'app.setting.fixedheader': 'Cabeçalho fixo',
21 'app.setting.fixedsidebar': 'Barra lateral fixa',
22 'app.setting.fixedsidebar.hint': 'Funciona no layout do menu lateral',
23 'app.setting.hideheader': 'Esconder o cabeçalho quando rolar',
24 'app.setting.hideheader.hint': 'Funciona quando o esconder cabeçalho está abilitado',
25 'app.setting.othersettings': 'Outras configurações',
26 'app.setting.weakmode': 'Weak Mode',
27 'app.setting.copy': 'Copiar Configuração',
28 'app.setting.copyinfo':
29 'copiado com sucesso,por favor trocar o defaultSettings em src/models/setting.js',
30 'app.setting.production.hint':
31 'O painel de configuração apenas é exibido no ambiente de desenvolvimento, por favor modifique manualmente o',
32 };
1 export default {
2 'app.settings.menuMap.basic': 'Configurações Básicas',
3 'app.settings.menuMap.security': 'Configurações de Segurança',
4 'app.settings.menuMap.binding': 'Vinculação de Conta',
5 'app.settings.menuMap.notification': 'Mensagens de Notificação',
6 'app.settings.basic.avatar': 'Avatar',
7 'app.settings.basic.change-avatar': 'Alterar avatar',
8 'app.settings.basic.email': 'Email',
9 'app.settings.basic.email-message': 'Por favor insira seu email!',
10 'app.settings.basic.nickname': 'Nome de usuário',
11 'app.settings.basic.nickname-message': 'Por favor insira seu nome de usuário!',
12 'app.settings.basic.profile': 'Perfil pessoal',
13 'app.settings.basic.profile-message': 'Por favor insira seu perfil pessoal!',
14 'app.settings.basic.profile-placeholder': 'Breve introdução sua',
15 'app.settings.basic.country': 'País/Região',
16 'app.settings.basic.country-message': 'Por favor insira país!',
17 'app.settings.basic.geographic': 'Província, estado ou cidade',
18 'app.settings.basic.geographic-message': 'Por favor insira suas informações geográficas!',
19 'app.settings.basic.address': 'Endereço',
20 'app.settings.basic.address-message': 'Por favor insira seu endereço!',
21 'app.settings.basic.phone': 'Número de telefone',
22 'app.settings.basic.phone-message': 'Por favor insira seu número de telefone!',
23 'app.settings.basic.update': 'Atualizar Informações',
24 'app.settings.security.strong': 'Forte',
25 'app.settings.security.medium': 'Média',
26 'app.settings.security.weak': 'Fraca',
27 'app.settings.security.password': 'Senha da Conta',
28 'app.settings.security.password-description': 'Força da senha',
29 'app.settings.security.phone': 'Telefone de Seguraça',
30 'app.settings.security.phone-description': 'Telefone vinculado',
31 'app.settings.security.question': 'Pergunta de Segurança',
32 'app.settings.security.question-description':
33 'A pergunta de segurança não está definida e a política de segurança pode proteger efetivamente a segurança da conta',
34 'app.settings.security.email': 'Email de Backup',
35 'app.settings.security.email-description': 'Email vinculado',
36 'app.settings.security.mfa': 'Dispositivo MFA',
37 'app.settings.security.mfa-description':
38 'O dispositivo MFA não vinculado, após a vinculação, pode ser confirmado duas vezes',
39 'app.settings.security.modify': 'Modificar',
40 'app.settings.security.set': 'Atribuir',
41 'app.settings.security.bind': 'Vincular',
42 'app.settings.binding.taobao': 'Vincular Taobao',
43 'app.settings.binding.taobao-description': 'Atualmente não vinculado à conta Taobao',
44 'app.settings.binding.alipay': 'Vincular Alipay',
45 'app.settings.binding.alipay-description': 'Atualmente não vinculado à conta Alipay',
46 'app.settings.binding.dingding': 'Vincular DingTalk',
47 'app.settings.binding.dingding-description': 'Atualmente não vinculado à conta DingTalk',
48 'app.settings.binding.bind': 'Vincular',
49 'app.settings.notification.password': 'Senha da Conta',
50 'app.settings.notification.password-description':
51 'Mensagens de outros usuários serão notificadas na forma de uma estação de letra',
52 'app.settings.notification.messages': 'Mensagens de Sistema',
53 'app.settings.notification.messages-description':
54 'Mensagens de sistema serão notificadas na forma de uma estação de letra',
55 'app.settings.notification.todo': 'Notificação de To-do',
56 'app.settings.notification.todo-description':
57 'A lista de to-do será notificada na forma de uma estação de letra',
58 'app.settings.open': 'Aberto',
59 'app.settings.close': 'Fechado',
60 };
1 import component from './zh-CN/component';
2 import globalHeader from './zh-CN/globalHeader';
3 import menu from './zh-CN/menu';
4 import pwa from './zh-CN/pwa';
5 import settingDrawer from './zh-CN/settingDrawer';
6 import settings from './zh-CN/settings';
7
8 export default {
9 'navBar.lang': '语言',
10 'layout.user.link.help': '帮助',
11 'layout.user.link.privacy': '隐私',
12 'layout.user.link.terms': '条款',
13 'app.preview.down.block': '下载此页面到本地项目',
14 'app.welcome.link.fetch-blocks': '获取全部区块',
15 'app.welcome.link.block-list': '基于 block 开发,快速构建标准页面',
16 ...globalHeader,
17 ...menu,
18 ...settingDrawer,
19 ...settings,
20 ...pwa,
21 ...component,
22 };
1 export default {
2 'component.tagSelect.expand': '展开',
3 'component.tagSelect.collapse': '收起',
4 'component.tagSelect.all': '全部',
5 };
1 export default {
2 'component.globalHeader.search': '站内搜索',
3 'component.globalHeader.search.example1': '搜索提示一',
4 'component.globalHeader.search.example2': '搜索提示二',
5 'component.globalHeader.search.example3': '搜索提示三',
6 'component.globalHeader.help': '使用文档',
7 'component.globalHeader.notification': '通知',
8 'component.globalHeader.notification.empty': '你已查看所有通知',
9 'component.globalHeader.message': '消息',
10 'component.globalHeader.message.empty': '您已读完所有消息',
11 'component.globalHeader.event': '待办',
12 'component.globalHeader.event.empty': '你已完成所有待办',
13 'component.noticeIcon.clear': '清空',
14 'component.noticeIcon.cleared': '清空了',
15 'component.noticeIcon.empty': '暂无数据',
16 'component.noticeIcon.view-more': '查看更多',
17 };
1 export default {
2 'menu.welcome': '全景',
3 'menu.reports': '报告追溯',
4 'menu.operation': '过程追溯',
5 'menu.employees': '人员',
6 'menu.machine': '设备',
7 'menu.material': '材料',
8 'menu.items': '能力',
9 'menu.more-blocks': '更多区块',
10 'menu.home': '首页',
11 'menu.admin': '管理页',
12 'menu.login': '登录',
13 'menu.register': '注册',
14 'menu.register.result': '注册结果',
15 'menu.dashboard': 'Dashboard',
16 'menu.dashboard.analysis': '分析页',
17 'menu.dashboard.monitor': '监控页',
18 'menu.dashboard.workplace': '工作台',
19 'menu.exception.403': '403',
20 'menu.exception.404': '404',
21 'menu.exception.500': '500',
22 'menu.form': '表单页',
23 'menu.form.basic-form': '基础表单',
24 'menu.form.step-form': '分步表单',
25 'menu.form.step-form.info': '分步表单(填写转账信息)',
26 'menu.form.step-form.confirm': '分步表单(确认转账信息)',
27 'menu.form.step-form.result': '分步表单(完成)',
28 'menu.form.advanced-form': '高级表单',
29 'menu.list': '列表页',
30 'menu.list.table-list': '查询表格',
31 'menu.list.basic-list': '标准列表',
32 'menu.list.card-list': '卡片列表',
33 'menu.list.search-list': '搜索列表',
34 'menu.list.search-list.articles': '搜索列表(文章)',
35 'menu.list.search-list.projects': '搜索列表(项目)',
36 'menu.list.search-list.applications': '搜索列表(应用)',
37 'menu.profile': '详情页',
38 'menu.profile.basic': '基础详情页',
39 'menu.profile.advanced': '高级详情页',
40 'menu.result': '结果页',
41 'menu.result.success': '成功页',
42 'menu.result.fail': '失败页',
43 'menu.exception': '异常页',
44 'menu.exception.not-permission': '403',
45 'menu.exception.not-find': '404',
46 'menu.exception.server-error': '500',
47 'menu.exception.trigger': '触发错误',
48 'menu.account': '个人页',
49 'menu.account.center': '个人中心',
50 'menu.account.settings': '个人设置',
51 'menu.account.trigger': '触发报错',
52 'menu.account.logout': '退出登录',
53 'menu.editor': '图形编辑器',
54 'menu.editor.flow': '流程编辑器',
55 'menu.editor.mind': '脑图编辑器',
56 'menu.editor.koni': '拓扑编辑器',
57 };
1 export default {
2 'app.pwa.offline': '当前处于离线状态',
3 'app.pwa.serviceworker.updated': '有新内容',
4 'app.pwa.serviceworker.updated.hint': '请点击“刷新”按钮或者手动刷新页面',
5 'app.pwa.serviceworker.updated.ok': '刷新',
6 };
1 export default {
2 'app.setting.pagestyle': '整体风格设置',
3 'app.setting.pagestyle.dark': '暗色菜单风格',
4 'app.setting.pagestyle.light': '亮色菜单风格',
5 'app.setting.content-width': '内容区域宽度',
6 'app.setting.content-width.fixed': '定宽',
7 'app.setting.content-width.fluid': '流式',
8 'app.setting.themecolor': '主题色',
9 'app.setting.themecolor.dust': '薄暮',
10 'app.setting.themecolor.volcano': '火山',
11 'app.setting.themecolor.sunset': '日暮',
12 'app.setting.themecolor.cyan': '明青',
13 'app.setting.themecolor.green': '极光绿',
14 'app.setting.themecolor.daybreak': '拂晓蓝(默认)',
15 'app.setting.themecolor.geekblue': '极客蓝',
16 'app.setting.themecolor.purple': '酱紫',
17 'app.setting.navigationmode': '导航模式',
18 'app.setting.sidemenu': '侧边菜单布局',
19 'app.setting.topmenu': '顶部菜单布局',
20 'app.setting.fixedheader': '固定 Header',
21 'app.setting.fixedsidebar': '固定侧边菜单',
22 'app.setting.fixedsidebar.hint': '侧边菜单布局时可配置',
23 'app.setting.hideheader': '下滑时隐藏 Header',
24 'app.setting.hideheader.hint': '固定 Header 时可配置',
25 'app.setting.othersettings': '其他设置',
26 'app.setting.weakmode': '色弱模式',
27 'app.setting.copy': '拷贝设置',
28 'app.setting.copyinfo': '拷贝成功,请到 src/defaultSettings.js 中替换默认配置',
29 'app.setting.production.hint':
30 '配置栏只在开发环境用于预览,生产环境不会展现,请拷贝后手动修改配置文件',
31 };
1 export default {
2 'app.settings.menuMap.basic': '基本设置',
3 'app.settings.menuMap.security': '安全设置',
4 'app.settings.menuMap.binding': '账号绑定',
5 'app.settings.menuMap.notification': '新消息通知',
6 'app.settings.basic.avatar': '头像',
7 'app.settings.basic.change-avatar': '更换头像',
8 'app.settings.basic.email': '邮箱',
9 'app.settings.basic.email-message': '请输入您的邮箱!',
10 'app.settings.basic.nickname': '昵称',
11 'app.settings.basic.nickname-message': '请输入您的昵称!',
12 'app.settings.basic.profile': '个人简介',
13 'app.settings.basic.profile-message': '请输入个人简介!',
14 'app.settings.basic.profile-placeholder': '个人简介',
15 'app.settings.basic.country': '国家/地区',
16 'app.settings.basic.country-message': '请输入您的国家或地区!',
17 'app.settings.basic.geographic': '所在省市',
18 'app.settings.basic.geographic-message': '请输入您的所在省市!',
19 'app.settings.basic.address': '街道地址',
20 'app.settings.basic.address-message': '请输入您的街道地址!',
21 'app.settings.basic.phone': '联系电话',
22 'app.settings.basic.phone-message': '请输入您的联系电话!',
23 'app.settings.basic.update': '更新基本信息',
24 'app.settings.security.strong': '强',
25 'app.settings.security.medium': '中',
26 'app.settings.security.weak': '弱',
27 'app.settings.security.password': '账户密码',
28 'app.settings.security.password-description': '当前密码强度',
29 'app.settings.security.phone': '密保手机',
30 'app.settings.security.phone-description': '已绑定手机',
31 'app.settings.security.question': '密保问题',
32 'app.settings.security.question-description': '未设置密保问题,密保问题可有效保护账户安全',
33 'app.settings.security.email': '备用邮箱',
34 'app.settings.security.email-description': '已绑定邮箱',
35 'app.settings.security.mfa': 'MFA 设备',
36 'app.settings.security.mfa-description': '未绑定 MFA 设备,绑定后,可以进行二次确认',
37 'app.settings.security.modify': '修改',
38 'app.settings.security.set': '设置',
39 'app.settings.security.bind': '绑定',
40 'app.settings.binding.taobao': '绑定淘宝',
41 'app.settings.binding.taobao-description': '当前未绑定淘宝账号',
42 'app.settings.binding.alipay': '绑定支付宝',
43 'app.settings.binding.alipay-description': '当前未绑定支付宝账号',
44 'app.settings.binding.dingding': '绑定钉钉',
45 'app.settings.binding.dingding-description': '当前未绑定钉钉账号',
46 'app.settings.binding.bind': '绑定',
47 'app.settings.notification.password': '账户密码',
48 'app.settings.notification.password-description': '其他用户的消息将以站内信的形式通知',
49 'app.settings.notification.messages': '系统消息',
50 'app.settings.notification.messages-description': '系统消息将以站内信的形式通知',
51 'app.settings.notification.todo': '待办任务',
52 'app.settings.notification.todo-description': '待办任务将以站内信的形式通知',
53 'app.settings.open': '开',
54 'app.settings.close': '关',
55 };
1 import component from './zh-TW/component';
2 import globalHeader from './zh-TW/globalHeader';
3 import menu from './zh-TW/menu';
4 import pwa from './zh-TW/pwa';
5 import settingDrawer from './zh-TW/settingDrawer';
6 import settings from './zh-TW/settings';
7
8 export default {
9 'navBar.lang': '語言',
10 'layout.user.link.help': '幫助',
11 'layout.user.link.privacy': '隱私',
12 'layout.user.link.terms': '條款',
13 'app.preview.down.block': '下載此頁面到本地項目',
14 ...globalHeader,
15 ...menu,
16 ...settingDrawer,
17 ...settings,
18 ...pwa,
19 ...component,
20 };
1 export default {
2 'component.tagSelect.expand': '展開',
3 'component.tagSelect.collapse': '收起',
4 'component.tagSelect.all': '全部',
5 };
1 export default {
2 'component.globalHeader.search': '站內搜索',
3 'component.globalHeader.search.example1': '搜索提示壹',
4 'component.globalHeader.search.example2': '搜索提示二',
5 'component.globalHeader.search.example3': '搜索提示三',
6 'component.globalHeader.help': '使用手冊',
7 'component.globalHeader.notification': '通知',
8 'component.globalHeader.notification.empty': '妳已查看所有通知',
9 'component.globalHeader.message': '消息',
10 'component.globalHeader.message.empty': '您已讀完所有消息',
11 'component.globalHeader.event': '待辦',
12 'component.globalHeader.event.empty': '妳已完成所有待辦',
13 'component.noticeIcon.clear': '清空',
14 'component.noticeIcon.cleared': '清空了',
15 'component.noticeIcon.empty': '暫無資料',
16 'component.noticeIcon.view-more': '查看更多',
17 };
1 export default {
2 'menu.welcome': '歡迎',
3 'menu.more-blocks': '更多區塊',
4
5 'menu.home': '首頁',
6 'menu.login': '登錄',
7 'menu.admin': '权限',
8 'menu.exception.403': '403',
9 'menu.exception.404': '404',
10 'menu.exception.500': '500',
11 'menu.register': '註冊',
12 'menu.register.result': '註冊結果',
13 'menu.dashboard': 'Dashboard',
14 'menu.dashboard.analysis': '分析頁',
15 'menu.dashboard.monitor': '監控頁',
16 'menu.dashboard.workplace': '工作臺',
17 'menu.form': '表單頁',
18 'menu.form.basic-form': '基礎表單',
19 'menu.form.step-form': '分步表單',
20 'menu.form.step-form.info': '分步表單(填寫轉賬信息)',
21 'menu.form.step-form.confirm': '分步表單(確認轉賬信息)',
22 'menu.form.step-form.result': '分步表單(完成)',
23 'menu.form.advanced-form': '高級表單',
24 'menu.list': '列表頁',
25 'menu.list.table-list': '查詢表格',
26 'menu.list.basic-list': '標淮列表',
27 'menu.list.card-list': '卡片列表',
28 'menu.list.search-list': '搜索列表',
29 'menu.list.search-list.articles': '搜索列表(文章)',
30 'menu.list.search-list.projects': '搜索列表(項目)',
31 'menu.list.search-list.applications': '搜索列表(應用)',
32 'menu.profile': '詳情頁',
33 'menu.profile.basic': '基礎詳情頁',
34 'menu.profile.advanced': '高級詳情頁',
35 'menu.result': '結果頁',
36 'menu.result.success': '成功頁',
37 'menu.result.fail': '失敗頁',
38 'menu.account': '個人頁',
39 'menu.account.center': '個人中心',
40 'menu.account.settings': '個人設置',
41 'menu.account.trigger': '觸發報錯',
42 'menu.account.logout': '退出登錄',
43 'menu.exception': '异常页',
44 'menu.exception.not-permission': '403',
45 'menu.exception.not-find': '404',
46 'menu.exception.server-error': '500',
47 'menu.exception.trigger': '触发错误',
48 'menu.editor': '圖形編輯器',
49 'menu.editor.flow': '流程編輯器',
50 'menu.editor.mind': '腦圖編輯器',
51 'menu.editor.koni': '拓撲編輯器',
52 };
1 export default {
2 'app.pwa.offline': '當前處於離線狀態',
3 'app.pwa.serviceworker.updated': '有新內容',
4 'app.pwa.serviceworker.updated.hint': '請點擊“刷新”按鈕或者手動刷新頁面',
5 'app.pwa.serviceworker.updated.ok': '刷新',
6 };
1 export default {
2 'app.setting.pagestyle': '整體風格設置',
3 'app.setting.pagestyle.dark': '暗色菜單風格',
4 'app.setting.pagestyle.light': '亮色菜單風格',
5 'app.setting.content-width': '內容區域寬度',
6 'app.setting.content-width.fixed': '定寬',
7 'app.setting.content-width.fluid': '流式',
8 'app.setting.themecolor': '主題色',
9 'app.setting.themecolor.dust': '薄暮',
10 'app.setting.themecolor.volcano': '火山',
11 'app.setting.themecolor.sunset': '日暮',
12 'app.setting.themecolor.cyan': '明青',
13 'app.setting.themecolor.green': '極光綠',
14 'app.setting.themecolor.daybreak': '拂曉藍(默認)',
15 'app.setting.themecolor.geekblue': '極客藍',
16 'app.setting.themecolor.purple': '醬紫',
17 'app.setting.navigationmode': '導航模式',
18 'app.setting.sidemenu': '側邊菜單布局',
19 'app.setting.topmenu': '頂部菜單布局',
20 'app.setting.fixedheader': '固定 Header',
21 'app.setting.fixedsidebar': '固定側邊菜單',
22 'app.setting.fixedsidebar.hint': '側邊菜單布局時可配置',
23 'app.setting.hideheader': '下滑時隱藏 Header',
24 'app.setting.hideheader.hint': '固定 Header 時可配置',
25 'app.setting.othersettings': '其他設置',
26 'app.setting.weakmode': '色弱模式',
27 'app.setting.copy': '拷貝設置',
28 'app.setting.copyinfo': '拷貝成功,請到 src/defaultSettings.js 中替換默認配置',
29 'app.setting.production.hint':
30 '配置欄只在開發環境用於預覽,生產環境不會展現,請拷貝後手動修改配置文件',
31 };