Skip to content

Commit

Permalink
优化多页切功能,修复util.less 报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackstraw authored and Jackstraw committed Oct 14, 2020
1 parent 9d80150 commit 9776072
Show file tree
Hide file tree
Showing 26 changed files with 336 additions and 646 deletions.
4 changes: 4 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
registry=http://registry.npm.taobao.org
# registry=https://registry.npmjs.org
# username=wennn
# passowrd=wennn@2020
1 change: 1 addition & 0 deletions config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default {
APP_TYPE: process.env.APP_TYPE || '',
APP_VERSION: process.env.APP_VERSION || version,
},
hash:true,
treeShaking: true,
targets: {
ie: 11,
Expand Down
44 changes: 22 additions & 22 deletions config/plugin.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@ import path from 'path';

export default config => {
// pro 和 开发环境再添加这个插件
if (process.env.APP_TYPE === 'site' || process.env.NODE_ENV !== 'production') {
// 将所有 less 合并为一个供 themePlugin使用
const outFile = path.join(__dirname, '../.temp/ant-design-pro.less');
const stylesDir = path.join(__dirname, '../src/');
// if (process.env.APP_TYPE === 'site' || process.env.NODE_ENV !== 'production') {
// // 将所有 less 合并为一个供 themePlugin使用
// const outFile = path.join(__dirname, '../.temp/ant-design-pro.less');
// const stylesDir = path.join(__dirname, '../src/');

config.plugin('merge-less').use(MergeLessPlugin, [
{
stylesDir,
outFile,
},
]);
// config.plugin('merge-less').use(MergeLessPlugin, [
// {
// stylesDir,
// outFile,
// },
// ]);

config.plugin('ant-design-theme').use(AntDesignThemePlugin, [
{
antDir: path.join(__dirname, '../node_modules/antd'),
stylesDir,
varFile: path.join(__dirname, '../node_modules/antd/lib/style/themes/default.less'),
mainLessFile: outFile, // themeVariables: ['@primary-color'],
indexFileName: 'index.html',
generateOne: true,
lessUrl: 'https://gw.alipayobjects.com/os/lib/less.js/3.8.1/less.min.js',
},
]);
}
// config.plugin('ant-design-theme').use(AntDesignThemePlugin, [
// {
// antDir: path.join(__dirname, '../node_modules/antd'),
// stylesDir,
// varFile: path.join(__dirname, '../node_modules/antd/lib/style/themes/default.less'),
// mainLessFile: outFile, // themeVariables: ['@primary-color'],
// indexFileName: 'index.html',
// generateOne: true,
// lessUrl: 'https://gw.alipayobjects.com/os/lib/less.js/3.8.1/less.min.js',
// },
// ]);
// }
};
59 changes: 30 additions & 29 deletions config/routes/example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,35 @@ export default [
},
],
},
{
name: 'exception',
icon: 'warning',
path: '/exception',
routes: [
// exception
{
path: '/exception/403',
name: 'not-permission',
component: './example/Exception/403',
},
{
path: '/exception/404',
name: 'not-find',
component: './example/Exception/404',
},
{
path: '/exception/500',
name: 'server-error',
component: './example/Exception/500',
},
{
path: '/exception/trigger',
name: 'trigger',
hideInMenu: true,
component: './example/Exception/TriggerException',
},
],
},
// // list
// {
// path: '/list',
Expand Down Expand Up @@ -161,35 +190,7 @@ export default [
// { path: '/result/fail', name: 'fail', component: './Result/Error' },
// ],
// },
// {
// name: 'exception',
// icon: 'warning',
// path: '/exception',
// routes: [
// // exception
// {
// path: '/exception/403',
// name: 'not-permission',
// component: './Exception/403',
// },
// {
// path: '/exception/404',
// name: 'not-find',
// component: './Exception/404',
// },
// {
// path: '/exception/500',
// name: 'server-error',
// component: './Exception/500',
// },
// {
// path: '/exception/trigger',
// name: 'trigger',
// hideInMenu: true,
// component: './Exception/TriggerException',
// },
// ],
// },

// {
// name: 'account',
// icon: 'user',
Expand Down
2 changes: 1 addition & 1 deletion mock/busi/sys/user_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default {
[`${getMockPre('SYS_USER_INFO_LOGIN')}`]: userLogin,
[`${getMockPre('SYS_USER_INFO_GETCURUSER')}`]: getCurrentUser,
[`${getMockPre('SYS_USER_INFO_LOGINOUT')}`]: loginOut,
[`${getMockPre('SYS_USER_INFO_CHANGE_ROLE')}`]: changeRole,
// [`${getMockPre('SYS_USER_INFO_CHANGE_ROLE')}`]: changeRole,
[`${getMockPre('SYS_PARAMS')}`]: getSysParams,
[`${getMockPre('SYS_ROLE_QUERY_FOR_USER')}`]: getRoleForUser,
};
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"tslint": "npm run tslint:fix",
"tslint:fix": "tslint --fix 'src/**/*.ts*'",
"test": "umi test",
"test:component": "umi test ./src/components",
"test:all": "node ./tests/run-tests.js",
"prettier": "node ./scripts/prettier.js",
"docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up",
Expand Down Expand Up @@ -56,6 +55,7 @@
"mobx-react": "^5.4.4",
"moment": "^2.22.2",
"moment-timezone": "^0.5.27",
"nan-my-component": "^1.0.6",
"numeral": "^2.0.6",
"nzh": "^1.0.3",
"omit.js": "^1.0.0",
Expand Down Expand Up @@ -121,8 +121,12 @@
"engines": {
"node": ">=8.0.0"
},
"keywords":[
"react","ant-design","menu tab","typescript","jsx"
"keywords": [
"react",
"ant-design",
"menu tab",
"typescript",
"jsx"
],
"author": "wennn",
"license": "ISC",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Action/Act.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Dropdown, Menu, Divider, Icon } from 'antd';

const ActItem = ({ children, text, className, ...others }) => {
return (
<a key="a" className={`ant-dropdown-link ${className}`} {...others} href="javascript:;">
<a key="a" className={`ant-dropdown-link ${className}`} {...others} href="#!">
{text || children}
</a>
);
Expand Down Expand Up @@ -44,7 +44,7 @@ class Act extends React.Component {
if (menuItems.length > 0) {
dropdowns.push(
<Dropdown key="ant-dropdown-link" overlay={menu}>
<a className="ant-dropdown-link" href="javascript:;">
<a className="ant-dropdown-link" href="#!">
<Icon type="ellipsis" />
</a>
</Dropdown>
Expand Down
2 changes: 1 addition & 1 deletion src/components/AgGrid/AgGridPro.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ import UserFilter from './UserFilter';

const ActItem = ({ text, className, ...others }) => {
return (
<a key="a" className='ant-dropdown-link' {...others} href="javascript:;">
<a key="a" className='ant-dropdown-link' {...others} href="#!">
{text}
</a>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/AgGrid/BlurCom.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default Ele => class BlurCom extends React.Component {
// // eslint-disable-next-line react/no-find-dom-node
const tRef = ReactDOM.findDOMNode(this.tableRef);
const clickEle = e.target;
const classNames = clickEle.parentNode&&clickEle.parentNode.className||clickEle.className||"";
const classNames = clickEle.parentNode&&clickEle.parentNode.className||clickEle.className||[];
if (tRef && tRef != clickEle && !tRef.contains(clickEle) && !classNames.includes('ag-react-container')) {
if(this.agApi)this.agApi.stopEditing();
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/AgGrid/Editer/ActionCellRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ export default class ActionCellRenderer extends Component {
okText="Yes"
cancelText="No"
>
<a key="aa" className="ant-dropdown-link" href="javascript:;">
<a key="aa" className="ant-dropdown-link" href="#!">
aa
</a>
</Popconfirm>
<a key="a" className="ant-dropdown-link" onClick={() => alert(0)} href="javascript:;">
<a key="a" className="ant-dropdown-link" onClick={() => alert(0)} href="#!">
a
</a>
<a
key="b"
className="ant-dropdown-link"
hidden
onClick={() => alert(0)}
href="javascript:;"
href="#!"
>
b
</a>
Expand All @@ -35,7 +35,7 @@ export default class ActionCellRenderer extends Component {
className="ant-dropdown-link"
disabled
onClick={() => alert(0)}
href="javascript:;"
href="#!"
>
c
</a>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Exception/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class Exception extends React.PureComponent {
/>
</div>
<div className={styles.content}>
<h1>{title || config[pageType].title}</h1>
<h1>{config[pageType].title}</h1>
<h2>{title}</h2>
<div className={styles.desc}>{desc || config[pageType].desc}</div>
<div className={styles.actions}>
{actions ||
Expand Down
2 changes: 1 addition & 1 deletion src/components/GlobalHeader/RightContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default class GlobalHeaderRight extends PureComponent {
<span>
<a
// target="_blank"
href="javascript:;"
href="#!"
// rel="noopener noreferrer"
className={styles.action}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/SiderMenu/MenuLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

import Link from 'umi/link';

export default ({children,to=false,...other}) =>to?<Link to {...other}>{children}</Link>:<a href="javascript:;" {...other}>{children}</a>;
export default ({children,to=false,...other}) =>to?<Link to {...other}>{children}</Link>:<a href="#!" {...other}>{children}</a>;
2 changes: 1 addition & 1 deletion src/components/Viewer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class Viewer extends React.PureComponent {
<Fragment>
{tiggerTitle ? (
<a
href="javascript:;"
href="#!"
onClick={() => {
this.showViewer(!visible);
}}
Expand Down
2 changes: 1 addition & 1 deletion src/components/WConfirm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class WConfirm extends PureComponent {

if (disabled) {
return (
<a href="javascript:;" disabled>
<a href="#!" disabled>
{children}
</a>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/WConfirm/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import WConfirm from 'components/WConfirm/WConfirm'

return (
<WConfirm type="del" disabled>
<a href=" javascript:; ">删除</a>
<a href=" #! ">删除</a>
</WConfirm>

Expand Down
Loading

0 comments on commit 9776072

Please sign in to comment.