Skip to content

Commit

Permalink
🐛 fix(antd-dayjs-webpack-plugin): ant-design/antd-dayjs-webpack-plugi…
Browse files Browse the repository at this point in the history
  • Loading branch information
lifegit committed Nov 12, 2021
1 parent 6443fbc commit 4a78916
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 90 deletions.
79 changes: 39 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"gh-pages": "gh-pages -d dist",
"i18n-remove": "pro i18n-remove --locale=zh-CN --write",
"postinstall": "umi g tmp",
"upgrade": "ncu -u",
"lint": "umi g tmp && npm run lint:js && npm run lint:style && npm run lint:prettier && npm run tsc",
"lint-staged": "lint-staged",
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
Expand Down Expand Up @@ -48,54 +47,54 @@
"not ie <= 10"
],
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@ant-design/pro-descriptions": "^1.9.29",
"@ant-design/pro-form": "^1.46.0",
"@ant-design/pro-table": "^2.56.8",
"@ant-design/pro-layout": "^6.27.2",
"classnames": "^2.3.1",
"dayjs": "^1.10.7",
"@ant-design/icons": "^4.6.4",
"@ant-design/pro-descriptions": "^1.9.11",
"@ant-design/pro-form": "^1.39.0",
"@ant-design/pro-table": "^2.52.0",
"@ant-design/pro-layout": "^6.25.2",
"classnames": "^2.2.6",
"dayjs": "^1.10.6",
"local-storage": "^2.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"react-zmage": "^0.8.5-beta.37",
"umi": "^3.5.20"
"umi": "^3.5.4"
},
"devDependencies": {
"react-dev-inspector": "^1.7.1",
"react-dev-inspector": "^1.6.0",
"antd-dayjs-webpack-plugin": "^1.0.6",
"@ant-design/pro-cli": "^2.1.5",
"@types/express": "^4.17.13",
"@types/history": "^4.7.9",
"@types/jest": "^27.0.2",
"@types/lodash": "^4.14.176",
"@types/react": "^17.0.34",
"@types/react-dom": "^17.0.11",
"@types/react-helmet": "^6.1.4",
"@umijs/fabric": "^2.8.1",
"@umijs/openapi": "^1.3.4",
"@umijs/plugin-blocks": "^2.2.2",
"@umijs/plugin-esbuild": "^1.4.1",
"@umijs/plugin-openapi": "^1.3.2",
"@umijs/preset-ant-design-pro": "^1.3.3",
"@umijs/preset-dumi": "^1.1.31",
"@umijs/preset-react": "^1.8.25",
"@umijs/yorkie": "^2.0.5",
"@ant-design/pro-cli": "^2.0.2",
"@types/express": "^4.17.0",
"@types/history": "^4.7.2",
"@types/jest": "^26.0.0",
"@types/lodash": "^4.14.144",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/react-helmet": "^6.1.0",
"@umijs/fabric": "^2.6.2",
"@umijs/openapi": "^1.2.0",
"@umijs/plugin-blocks": "^2.0.5",
"@umijs/plugin-esbuild": "^1.0.1",
"@umijs/plugin-openapi": "^1.3.0",
"@umijs/preset-ant-design-pro": "^1.2.0",
"@umijs/preset-dumi": "^1.1.7",
"@umijs/preset-react": "^1.8.17",
"@umijs/yorkie": "^2.0.3",
"carlo": "^0.9.46",
"cross-env": "^7.0.3",
"cross-port-killer": "^1.3.0",
"detect-installer": "^1.0.2",
"cross-env": "^7.0.0",
"cross-port-killer": "^1.1.1",
"detect-installer": "^1.0.1",
"enzyme": "^3.11.0",
"eslint": "^8.2.0",
"eslint": "^7.1.0",
"express": "^4.17.1",
"gh-pages": "^3.2.3",
"gh-pages": "^3.0.0",
"jsdom-global": "^3.0.2",
"lint-staged": "^11.2.6",
"mockjs": "^1.1.0",
"prettier": "^2.4.1",
"puppeteer-core": "^11.0.0",
"stylelint": "^14.0.1",
"typescript": "^4.4.4"
"lint-staged": "^10.0.0",
"mockjs": "^1.0.1-beta3",
"prettier": "^2.3.2",
"puppeteer-core": "^8.0.0",
"stylelint": "^13.0.0",
"typescript": "^4.2.2"
},
"engines": {
"node": ">=10.0.0"
Expand Down
36 changes: 19 additions & 17 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ import RightContent from '@/components/RightContent';
import Footer from '@/components/Footer';
import { currentUser as queryCurrentUser } from './services/ant-design-pro/api';
import { BookOutlined, LinkOutlined } from '@ant-design/icons';
import React from "react";
import {notification} from "antd";
import {Token} from "@/utils/account";
import {RequestConfig, UseRequestProvider} from "@@/plugin-request/request";
import React from 'react';
import { notification } from 'antd';
import { Token } from '@/utils/account';
import { RequestConfig, UseRequestProvider } from '@@/plugin-request/request';
import type { RequestOptionsInit, ResponseError } from 'umi-request';
import dayjs from "dayjs";
import 'dayjs/locale/zh-cn'
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
import isMoment from 'dayjs/esm/plugin/isMoment';

dayjs.locale('zh-cn')
dayjs.locale('zh-cn');
// fix: https://github.com/ant-design/antd-dayjs-webpack-plugin/issues/66
dayjs.extend(isMoment as any);

const isDev = process.env.NODE_ENV === 'development';
const loginPath = '/user/login';
Expand All @@ -35,17 +38,17 @@ export async function getInitialState(): Promise<{
if (history.location.pathname === loginPath) {
return {
settings: {},
}
};
}

return Promise.allSettled([
queryCurrentUser().catch(()=> history.push(loginPath) )
]).then((res: any) => {
return {
currentUser: res[0]?.value,
settings: {},
};
})
return Promise.allSettled([queryCurrentUser().catch(() => history.push(loginPath))]).then(
(res: any) => {
return {
currentUser: res[0]?.value,
settings: {},
};
},
);
}

// ProLayout 支持的api https://procomponents.ant.design/components/layout
Expand Down Expand Up @@ -83,7 +86,6 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => {
};
};


const codeMessage = {
200: '服务器成功返回请求的数据。',
201: '新建或修改数据成功。',
Expand Down
57 changes: 28 additions & 29 deletions src/components/Launch/index.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,64 @@
## Launch

支持各种意图,类似android的Action
支持各种意图,类似 android 的 Action

### API

#### LaunchQQ

| 参数 | 说明 | 类型 | 必选 | 默认值 |
|----------|------------------------------------------|-------------|-------|-------|
| qq | QQ | string | true | - |
| 参数 | 说明 | 类型 | 必选 | 默认值 |
| ---- | ---- | ------ | ---- | ------ |
| qq | QQ | string | true | - |

#### LaunchUrl


| 参数 | 说明 | 类型 | 必选 | 默认值 |
|----------|------------------------------------------|-------------|-------|-------|
| url | url | string | true | - |
| open | 是否打开 | bool | false | false |
| copy | 是否复制 | bool | false | false |

| 参数 | 说明 | 类型 | 必选 | 默认值 |
| ---- | -------- | ------ | ----- | ------ |
| url | url | string | true | - |
| open | 是否打开 | bool | false | false |
| copy | 是否复制 | bool | false | false |

#### LaunchImg


| 参数 | 说明 | 类型 | 必选 | 默认值 |
|----------|------------------------------------------|-------------|-------|-------|
| src | 图片列表 | string[] | true | - |
| icon | 图标 | React.ReactNode | false | `<PictureOutlined/>` |
| 参数 | 说明 | 类型 | 必选 | 默认值 |
| ---- | -------- | --------------- | ----- | -------------------- |
| src | 图片列表 | string[] | true | - |
| icon | 图标 | React.ReactNode | false | `<PictureOutlined/>` |

#### LaunchMobile


| 参数 | 说明 | 类型 | 必选 | 默认值 |
|----------|------------------------------------------|-------------|-------|-------|
| mobile | 手机号 | string | true | - |
| icon | 图标 | React.ReactNode | false | `<PhoneOutlined/>` |

| 参数 | 说明 | 类型 | 必选 | 默认值 |
| ------ | ------ | --------------- | ----- | ------------------ |
| mobile | 手机号 | string | true | - |
| icon | 图标 | React.ReactNode | false | `<PhoneOutlined/>` |

### 代码演示

```tsx
import React from 'react';
import {LaunchQQ,LaunchUrl,LaunchImg,LaunchMobile} from './index'
import { LaunchQQ, LaunchUrl, LaunchImg, LaunchMobile } from './index';

export default () =>{

export default () => {
return (
<div>
<div>
<LaunchQQ qq={'597985317'}/>
<LaunchQQ qq={'597985317'} />
</div>
<div>
<LaunchUrl url={"https://baidu.com"} open={true} copy={true} />
<LaunchUrl url={'https://baidu.com'} open={true} copy={true} />
</div>
<div>
<LaunchImg src={['https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png','https://preview.pro.ant.design/favicon.ico']} />
<LaunchImg
src={[
'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
'https://preview.pro.ant.design/favicon.ico',
]}
/>
</div>
<div>
<LaunchMobile mobile={'13000000000'} />
</div>
</div>
)
);
};
```
2 changes: 1 addition & 1 deletion src/components/RightContent/AvatarDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { history, useModel } from 'umi';
import { stringify } from 'querystring';
import HeaderDropdown from '../HeaderDropdown';
import styles from './index.less';
import { outLogin } from '@/services/ant-design-pro/api';
import { outLogin } from '@/services/ant-design-pro/login';
import type { MenuInfo } from 'rc-menu/lib/interface';

export type GlobalHeaderRightProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/TableList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ProDescriptions from '@ant-design/pro-descriptions';
import type { FormValueType } from './components/UpdateForm';
import UpdateForm from './components/UpdateForm';
import { rule, addRule, updateRule, removeRule } from '@/services/ant-design-pro/rule';
import {getDrawerWidth} from "@/utils/utils";
import { getDrawerWidth } from '@/utils/utils';
/**
* @en-US Add node
* @zh-CN 添加节点
Expand Down
4 changes: 2 additions & 2 deletions src/utils/account.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {get,set} from "local-storage";
import { get, set } from 'local-storage';

export class BaseStorage<T> {
private readonly key: string;
Expand All @@ -8,7 +8,7 @@ export class BaseStorage<T> {
}

public Set(val: T) {
set(this.key, val)
set(this.key, val);
}
public Get(): T {
return get<T>(this.key);
Expand Down

0 comments on commit 4a78916

Please sign in to comment.