Browse Source

feat: add umi-uni18n (#4814)

* add umi-uni18n

fix ts error

* style: change script name

* change package name

* remove fetch-blocks
pull/4865/head
陈帅 7 years ago
committed by GitHub
parent
commit
122edaf5d5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      mock/notices.ts
  2. 13
      mock/user.ts
  3. 7
      package.json

5
mock/notices.ts

@ -1,4 +1,6 @@
const getNotices = (req, res) => import { Request, Response } from 'express';
const getNotices = (req: Request, res: Response) => {
res.json([ res.json([
{ {
id: '000000001', id: '000000001',
@ -96,6 +98,7 @@ const getNotices = (req, res) =>
type: 'event', type: 'event',
}, },
]); ]);
};
export default { export default {
'GET /api/notices': getNotices, 'GET /api/notices': getNotices,

13
mock/user.ts

@ -1,3 +1,4 @@
import { Request, Response } from 'express';
// 代码中会兼容本地 service mock 以及部署站点的静态数据 // 代码中会兼容本地 service mock 以及部署站点的静态数据
export default { export default {
// 支持值为 Object 和 Array // 支持值为 Object 和 Array
@ -72,7 +73,7 @@ export default {
address: 'Sidney No. 1 Lake Park', address: 'Sidney No. 1 Lake Park',
}, },
], ],
'POST /api/login/account': (req, res) => { 'POST /api/login/account': (req: Request, res: Response) => {
const { password, userName, type } = req.body; const { password, userName, type } = req.body;
if (password === 'ant.design' && userName === 'admin') { if (password === 'ant.design' && userName === 'admin') {
res.send({ res.send({
@ -96,10 +97,10 @@ export default {
currentAuthority: 'guest', currentAuthority: 'guest',
}); });
}, },
'POST /api/register': (req, res) => { 'POST /api/register': (req: Request, res: Response) => {
res.send({ status: 'ok', currentAuthority: 'user' }); res.send({ status: 'ok', currentAuthority: 'user' });
}, },
'GET /api/500': (req, res) => { 'GET /api/500': (req: Request, res: Response) => {
res.status(500).send({ res.status(500).send({
timestamp: 1513932555104, timestamp: 1513932555104,
status: 500, status: 500,
@ -108,7 +109,7 @@ export default {
path: '/base/category/list', path: '/base/category/list',
}); });
}, },
'GET /api/404': (req, res) => { 'GET /api/404': (req: Request, res: Response) => {
res.status(404).send({ res.status(404).send({
timestamp: 1513932643431, timestamp: 1513932643431,
status: 404, status: 404,
@ -117,7 +118,7 @@ export default {
path: '/base/category/list/2121212', path: '/base/category/list/2121212',
}); });
}, },
'GET /api/403': (req, res) => { 'GET /api/403': (req: Request, res: Response) => {
res.status(403).send({ res.status(403).send({
timestamp: 1513932555104, timestamp: 1513932555104,
status: 403, status: 403,
@ -126,7 +127,7 @@ export default {
path: '/base/category/list', path: '/base/category/list',
}); });
}, },
'GET /api/401': (req, res) => { 'GET /api/401': (req: Request, res: Response) => {
res.status(401).send({ res.status(401).send({
timestamp: 1513932555104, timestamp: 1513932555104,
status: 401, status: 401,

7
package.json

@ -14,11 +14,12 @@
"docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up", "docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up",
"docker:push": "npm run docker-hub:build && npm run docker:tag && docker push antdesign/ant-design-pro", "docker:push": "npm run docker-hub:build && npm run docker:tag && docker push antdesign/ant-design-pro",
"docker:tag": "docker tag ant-design-pro antdesign/ant-design-pro", "docker:tag": "docker tag ant-design-pro antdesign/ant-design-pro",
"fetch:blocks": "fetch-blocks", "fetch:blocks": "pro fetch-blocks",
"format-imports": "import-sort --write '**/*.{js,jsx,ts,tsx}'", "format-imports": "import-sort --write '**/*.{js,jsx,ts,tsx}'",
"functions:build": "netlify-lambda build ./lambda", "functions:build": "netlify-lambda build ./lambda",
"functions:run": "cross-env NODE_ENV=dev netlify-lambda serve ./lambda", "functions:run": "cross-env NODE_ENV=dev netlify-lambda serve ./lambda",
"gh-pages": "cp CNAME ./dist/ && gh-pages -d dist", "gh-pages": "cp CNAME ./dist/ && gh-pages -d dist",
"i18n-remove": "pro i18n-remove --locale=zh-CN --write",
"lint": "npm run lint:js && npm run lint:style && npm run lint:prettier", "lint": "npm run lint:js && npm run lint:style && npm run lint:prettier",
"lint-staged": "lint-staged", "lint-staged": "lint-staged",
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ", "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
@ -82,7 +83,9 @@
}, },
"devDependencies": { "devDependencies": {
"@ant-design/colors": "^3.1.0", "@ant-design/colors": "^3.1.0",
"@ant-design/pro-cli": "^1.0.0",
"@types/classnames": "^2.2.7", "@types/classnames": "^2.2.7",
"@types/express": "^4.17.0",
"@types/history": "^4.7.2", "@types/history": "^4.7.2",
"@types/jest": "^24.0.13", "@types/jest": "^24.0.13",
"@types/lodash": "^4.14.133", "@types/lodash": "^4.14.133",
@ -98,7 +101,6 @@
"enzyme": "^3.9.0", "enzyme": "^3.9.0",
"eslint": "^5.16.0", "eslint": "^5.16.0",
"express": "^4.17.1", "express": "^4.17.1",
"fetch-blocks": "^1.0.0",
"gh-pages": "^2.0.1", "gh-pages": "^2.0.1",
"husky": "^3.0.0", "husky": "^3.0.0",
"import-sort-cli": "^6.0.0", "import-sort-cli": "^6.0.0",
@ -162,3 +164,4 @@
] ]
} }
} }

Loading…
Cancel
Save