Sfoglia il codice sorgente

feat: add umi-uni18n (#4814)

* add umi-uni18n

fix ts error

* style: change script name

* change package name

* remove fetch-blocks
陈帅 6 anni fa
parent
commit
122edaf5d5
3 ha cambiato i file con 16 aggiunte e 9 eliminazioni
  1. 4 1
      mock/notices.ts
  2. 7 6
      mock/user.ts
  3. 5 2
      package.json

+ 4 - 1
mock/notices.ts

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

+ 7 - 6
mock/user.ts

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

+ 5 - 2
package.json

@@ -14,11 +14,12 @@
     "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: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}'",
     "functions:build": "netlify-lambda build ./lambda",
     "functions:run": "cross-env NODE_ENV=dev netlify-lambda serve ./lambda",
     "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-staged": "lint-staged",
     "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
@@ -82,7 +83,9 @@
   },
   "devDependencies": {
     "@ant-design/colors": "^3.1.0",
+    "@ant-design/pro-cli": "^1.0.0",
     "@types/classnames": "^2.2.7",
+    "@types/express": "^4.17.0",
     "@types/history": "^4.7.2",
     "@types/jest": "^24.0.13",
     "@types/lodash": "^4.14.133",
@@ -98,7 +101,6 @@
     "enzyme": "^3.9.0",
     "eslint": "^5.16.0",
     "express": "^4.17.1",
-    "fetch-blocks": "^1.0.0",
     "gh-pages": "^2.0.1",
     "husky": "^3.0.0",
     "import-sort-cli": "^6.0.0",
@@ -162,3 +164,4 @@
     ]
   }
 }
+