tntd 1.4.19 → 1.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Handle/README.md +0 -20
- package/components/Handle/index.js +27 -6
- package/components/Layout/Avatar.js +4 -4
- package/components/Layout/EnterpriseLayout/Avatar.js +10 -7
- package/components/Layout/EnterpriseLayout/Language.js +5 -3
- package/components/Layout/EnterpriseLayout/Theme.js +6 -7
- package/components/Layout/EnterpriseLayout/index.js +1 -1
- package/components/Layout/HeaderActions.js +13 -10
- package/components/Layout/HeaderTabs.js +13 -14
- package/components/Layout/Layout.js +2 -0
- package/components/Layout/index.js +2 -1
- package/components/Layout/storage.js +12 -2
- package/components/Page/index.js +2 -2
- package/components/locale.js +15 -4
- package/dist/1.tntd.js +1 -12
- package/dist/stats.json +5247 -5069
- package/dist/tntd.js +14 -3
- package/es/Handle/README.md +0 -20
- package/es/Handle/index.js +38 -13
- package/es/Layout/Avatar.js +4 -4
- package/es/Layout/EnterpriseLayout/Avatar.js +16 -8
- package/es/Layout/EnterpriseLayout/Language.js +6 -3
- package/es/Layout/EnterpriseLayout/Theme.js +10 -6
- package/es/Layout/HeaderActions.js +15 -12
- package/es/Layout/HeaderTabs.js +13 -14
- package/es/Layout/Layout.js +3 -1
- package/es/Layout/index.js +3 -2
- package/es/Layout/storage.js +19 -3
- package/es/Page/index.js +3 -2
- package/es/locale.js +14 -4
- package/lib/Handle/README.md +0 -20
- package/lib/Handle/index.js +39 -13
- package/lib/Layout/Avatar.js +5 -5
- package/lib/Layout/EnterpriseLayout/Avatar.js +19 -9
- package/lib/Layout/EnterpriseLayout/Language.js +5 -2
- package/lib/Layout/EnterpriseLayout/Theme.js +9 -5
- package/lib/Layout/HeaderActions.js +8 -5
- package/lib/Layout/HeaderTabs.js +8 -9
- package/lib/Layout/Layout.js +3 -1
- package/lib/Layout/index.js +3 -2
- package/lib/Layout/storage.js +28 -5
- package/lib/Page/index.js +3 -2
- package/lib/locale.js +18 -4
- package/package.json +1 -1
|
@@ -54,26 +54,6 @@ const Demo = props => {
|
|
|
54
54
|
<a>查看</a>
|
|
55
55
|
<a>编辑</a>
|
|
56
56
|
<a>测试</a>
|
|
57
|
-
{
|
|
58
|
-
false &&
|
|
59
|
-
<a>导入</a>
|
|
60
|
-
}
|
|
61
|
-
<a>导出</a>
|
|
62
|
-
<Popconfirm
|
|
63
|
-
title="Are you sure delete this task?"
|
|
64
|
-
onConfirm={void 0}
|
|
65
|
-
onCancel={void 0}
|
|
66
|
-
okText="Yes"
|
|
67
|
-
cancelText="No"
|
|
68
|
-
onClick={e => e.stopPropagation()}
|
|
69
|
-
getPopupContainer={trigger => trigger.parentNode}
|
|
70
|
-
trigger="hover"
|
|
71
|
-
overlayStyle={{
|
|
72
|
-
width: 300
|
|
73
|
-
}}
|
|
74
|
-
>
|
|
75
|
-
<a>Delete</a>
|
|
76
|
-
</Popconfirm>
|
|
77
57
|
</Handle>
|
|
78
58
|
)
|
|
79
59
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { Fragment } from 'react';
|
|
2
2
|
import { Dropdown, Menu, Divider } from 'antd';
|
|
3
|
+
import { getText, getLanguage } from '../locale';
|
|
3
4
|
import Icon from '../Icon';
|
|
4
5
|
import './index.less';
|
|
5
6
|
|
|
6
7
|
const clsPrefix = 'tnt-more-menus';
|
|
7
8
|
|
|
8
9
|
export default props => {
|
|
9
|
-
const { children = [], type, num = 3,
|
|
10
|
+
const { children = [], type, num = 3, divider = true, lessOneMoreFit, ...rest } = props || {};
|
|
11
|
+
let { lang } = props||{};
|
|
12
|
+
if(!lang){
|
|
13
|
+
lang = getLanguage();
|
|
14
|
+
}
|
|
10
15
|
let newChildren = [];
|
|
11
16
|
if(Array.isArray(children)){
|
|
12
17
|
newChildren = children?.filter(item => !!item) || [];
|
|
@@ -39,16 +44,32 @@ export default props => {
|
|
|
39
44
|
</Fragment>
|
|
40
45
|
));
|
|
41
46
|
}
|
|
42
|
-
const menu = (
|
|
47
|
+
const menu = (childArr)=>(
|
|
43
48
|
<Menu className="org-pop-opera-btn">
|
|
44
49
|
{
|
|
45
|
-
|
|
50
|
+
childArr?.map(
|
|
46
51
|
(child,i) => <Menu.Item key={i}>{child}</Menu.Item>
|
|
47
52
|
)
|
|
48
53
|
}
|
|
49
54
|
</Menu>
|
|
50
55
|
);
|
|
51
56
|
|
|
57
|
+
if(lang === 'en'){
|
|
58
|
+
return (
|
|
59
|
+
<Dropdown overlay={menu(newChildren||[])} arrow>
|
|
60
|
+
{
|
|
61
|
+
type === 'icon' ?
|
|
62
|
+
<Icon type="more" /> :
|
|
63
|
+
<a className="ant-dropdown-more">
|
|
64
|
+
{getText('handleMore',lang)}
|
|
65
|
+
<i className={`${clsPrefix}-dropdown-icon`}>
|
|
66
|
+
<Icon type="down" />
|
|
67
|
+
</i>
|
|
68
|
+
</a>
|
|
69
|
+
}
|
|
70
|
+
</Dropdown>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
52
73
|
return (
|
|
53
74
|
<div
|
|
54
75
|
onClick={(e) => { e.stopPropagation(); }}
|
|
@@ -56,13 +77,13 @@ export default props => {
|
|
|
56
77
|
>
|
|
57
78
|
{preChildPart}
|
|
58
79
|
{
|
|
59
|
-
lastChildPart?.length
|
|
60
|
-
<Dropdown overlay={menu} arrow>
|
|
80
|
+
!!lastChildPart?.length &&
|
|
81
|
+
<Dropdown overlay={menu(lastChildPart||[])} arrow>
|
|
61
82
|
{
|
|
62
83
|
type === 'icon' ?
|
|
63
84
|
<Icon type="more" /> :
|
|
64
85
|
<a className="ant-dropdown-more">
|
|
65
|
-
{
|
|
86
|
+
{getText('handleMore',lang)}
|
|
66
87
|
<i className={`${clsPrefix}-dropdown-icon`}>
|
|
67
88
|
<Icon type="down" />
|
|
68
89
|
</i>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import styled, { createGlobalStyle } from 'styled-components';
|
|
3
3
|
import { Popover, Button } from 'antd';
|
|
4
|
-
import deleteAllCookiesFactory from 'delete-all-cookies';
|
|
5
4
|
import { get } from 'lodash';
|
|
6
5
|
import images from './images';
|
|
7
6
|
import ActionsContext from './ActionsContext';
|
|
7
|
+
import { clearLoginCookie } from './storage';
|
|
8
8
|
|
|
9
9
|
const Avatar = styled.li`
|
|
10
10
|
margin-right: 0;
|
|
@@ -81,7 +81,7 @@ const UserInfoContent = props => {
|
|
|
81
81
|
<UserInfoWrapper className="user-info-setting-wrap">
|
|
82
82
|
<div className="user-info-body">
|
|
83
83
|
<p className="user-info-body-username">
|
|
84
|
-
{userInfo.userName || '
|
|
84
|
+
{userInfo.userName || getText('nameNull')}
|
|
85
85
|
</p>
|
|
86
86
|
<p className="user-info-body-account">
|
|
87
87
|
{userInfo.account}
|
|
@@ -95,9 +95,9 @@ const UserInfoContent = props => {
|
|
|
95
95
|
onClick={() => {
|
|
96
96
|
if (onLogout) {
|
|
97
97
|
onLogout();
|
|
98
|
-
|
|
98
|
+
clearLoginCookie();
|
|
99
99
|
} else {
|
|
100
|
-
|
|
100
|
+
clearLoginCookie();
|
|
101
101
|
window.location.href = `/user/login?callbackUrl=${window.encodeURI(location.href)}`;
|
|
102
102
|
}
|
|
103
103
|
}}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
1
2
|
import styled, { createGlobalStyle } from 'styled-components';
|
|
2
3
|
import { Popover, Row, Divider } from 'antd';
|
|
3
|
-
import deleteAllCookiesFactory from 'delete-all-cookies';
|
|
4
4
|
import { get } from 'lodash';
|
|
5
5
|
import images from '../images';
|
|
6
|
+
import ActionsContext from '../ActionsContext';
|
|
6
7
|
import Language from './Language';
|
|
7
8
|
import Theme from './Theme';
|
|
9
|
+
import { getLanguageStore, clearLoginCookie } from '../storage';
|
|
8
10
|
|
|
9
11
|
const Avatar = styled.li`
|
|
10
12
|
margin-right: 0;
|
|
@@ -83,6 +85,7 @@ const UserInfoWrapper = styled.div`
|
|
|
83
85
|
|
|
84
86
|
const UserInfoContent = props => {
|
|
85
87
|
const { userInfo, config={}, onLogout, onChangePassword = () => true, onPersonalSetting = () => true, onLanguageChange, onThemeChange } = props;
|
|
88
|
+
const { getText } = useContext(ActionsContext);
|
|
86
89
|
const {
|
|
87
90
|
language = true,
|
|
88
91
|
} = config || {};
|
|
@@ -90,7 +93,7 @@ const UserInfoContent = props => {
|
|
|
90
93
|
<UserInfoWrapper className="user-info-setting-wrap">
|
|
91
94
|
<ul className="user-info-body">
|
|
92
95
|
<li className="user-info-body-username">
|
|
93
|
-
{userInfo.userName || '
|
|
96
|
+
{userInfo.userName || getText('nameNull')}
|
|
94
97
|
<span className="user-info-body-account">{userInfo.account}</span>
|
|
95
98
|
</li>
|
|
96
99
|
{
|
|
@@ -106,22 +109,22 @@ const UserInfoContent = props => {
|
|
|
106
109
|
/>
|
|
107
110
|
</ul>
|
|
108
111
|
<Row className="user-info-footer" type="flex" justify="space-between" align="middle">
|
|
109
|
-
<a onClick={onPersonalSetting} href="/bridge/userCenter?currentTab=1"
|
|
112
|
+
<a onClick={onPersonalSetting} href="/bridge/userCenter?currentTab=1">{getText('personalSettings')}</a>
|
|
110
113
|
<Divider type="vertical"/>
|
|
111
|
-
<a onClick={onChangePassword} href="/bridge/userCenter?currentTab=2"
|
|
114
|
+
<a onClick={onChangePassword} href="/bridge/userCenter?currentTab=2" style={getLanguageStore()==='en' ? { flex: 2 } : {}}>{getText('changePwd')}</a>
|
|
112
115
|
<Divider type="vertical"/>
|
|
113
116
|
<a
|
|
114
117
|
className="user-info-footer-signout"
|
|
115
118
|
onClick={() => {
|
|
116
119
|
if (onLogout) {
|
|
117
120
|
onLogout();
|
|
118
|
-
|
|
121
|
+
clearLoginCookie();
|
|
119
122
|
} else {
|
|
120
|
-
|
|
123
|
+
clearLoginCookie();
|
|
121
124
|
window.location.href = `/user/login?callbackUrl=${window.encodeURI(location.href)}`;
|
|
122
125
|
}
|
|
123
126
|
}}
|
|
124
|
-
|
|
127
|
+
>{getText('signOut')}</a>
|
|
125
128
|
</Row>
|
|
126
129
|
</UserInfoWrapper>
|
|
127
130
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import { useState, useMemo } from 'react';
|
|
2
2
|
import styled, { withTheme } from 'styled-components';
|
|
3
3
|
import { get } from 'lodash';
|
|
4
4
|
import Iconfont from '../Iconfont';
|
|
@@ -68,11 +68,13 @@ export default withTheme(
|
|
|
68
68
|
onChange && onChange(lang);
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
+
const otherLanguage = useMemo(()=> language === 'cn' ? 'en' : 'cn',[language]);
|
|
72
|
+
|
|
71
73
|
return (
|
|
72
74
|
<Language onClick={switchLanguage}>
|
|
73
|
-
<Iconfont type={`flag-${
|
|
75
|
+
<Iconfont type={`flag-${otherLanguage}`} />
|
|
74
76
|
<span>
|
|
75
|
-
{get(languagesMap[
|
|
77
|
+
{get(languagesMap[otherLanguage], 'name')}
|
|
76
78
|
</span>
|
|
77
79
|
</Language>
|
|
78
80
|
);
|
|
@@ -2,7 +2,7 @@ import { useState } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { Row } from 'antd';
|
|
4
4
|
import Iconfont from '../Iconfont';
|
|
5
|
-
import { setThemeStore, getThemeStore } from '../storage';
|
|
5
|
+
import { setThemeStore, getThemeStore, getLanguageStore } from '../storage';
|
|
6
6
|
|
|
7
7
|
const Theme = styled.li`
|
|
8
8
|
margin-top: 20px;
|
|
@@ -56,9 +56,9 @@ const Theme = styled.li`
|
|
|
56
56
|
`;
|
|
57
57
|
|
|
58
58
|
const themes = [
|
|
59
|
-
{ value: 'themeS3', label: '科技蓝' },
|
|
60
|
-
{ value: 'themeS2', label: '暗夜黑' },
|
|
61
|
-
{ value: 'themeS1', label: '极致白' },
|
|
59
|
+
{ value: 'themeS3', label: '科技蓝', enLabel: 'Blue' },
|
|
60
|
+
{ value: 'themeS2', label: '暗夜黑', enLabel: 'Black' },
|
|
61
|
+
{ value: 'themeS1', label: '极致白', enLabel: 'White' },
|
|
62
62
|
];
|
|
63
63
|
|
|
64
64
|
export default props => {
|
|
@@ -80,15 +80,14 @@ export default props => {
|
|
|
80
80
|
<Theme>
|
|
81
81
|
<Row type="flex" justify="space-between" className="user-info-body-theme-row">
|
|
82
82
|
{
|
|
83
|
-
themes.map(({ value, label }) => (
|
|
83
|
+
themes.map(({ value, label, enLabel }) => (
|
|
84
84
|
<div className={value} onClick={changeTheme.bind(this, value)}>
|
|
85
|
-
{label}
|
|
85
|
+
{getLanguageStore() === 'en' ? enLabel: label }
|
|
86
86
|
{
|
|
87
87
|
theme === value &&
|
|
88
88
|
<span className="icon-checked-wrap"></span>
|
|
89
89
|
}
|
|
90
90
|
</div>
|
|
91
|
-
|
|
92
91
|
))
|
|
93
92
|
}
|
|
94
93
|
</Row>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import styled, { withTheme } from
|
|
2
|
-
import { Divider } from
|
|
3
|
-
import GlobalNavigation from
|
|
4
|
-
import Language from
|
|
5
|
-
import Theme from
|
|
6
|
-
import LanguageTheme from
|
|
7
|
-
import Application from
|
|
8
|
-
import Avatar from
|
|
1
|
+
import styled, { withTheme } from 'styled-components';
|
|
2
|
+
import { Divider } from 'antd';
|
|
3
|
+
import GlobalNavigation from './GlobalNavigation';
|
|
4
|
+
import Language from './Language';
|
|
5
|
+
import Theme from './Theme';
|
|
6
|
+
import LanguageTheme from './CompatibleLanguage';
|
|
7
|
+
import Application from './Application';
|
|
8
|
+
import Avatar from './Avatar';
|
|
9
9
|
|
|
10
10
|
const Actions = styled.ul`
|
|
11
11
|
list-style: none;
|
|
@@ -54,6 +54,7 @@ const Actions = styled.ul`
|
|
|
54
54
|
|
|
55
55
|
export default withTheme((props) => {
|
|
56
56
|
const {
|
|
57
|
+
type,
|
|
57
58
|
config: {
|
|
58
59
|
theme = true,
|
|
59
60
|
avatar = true,
|
|
@@ -71,6 +72,7 @@ export default withTheme((props) => {
|
|
|
71
72
|
onThemeChange,
|
|
72
73
|
onApplicationChange,
|
|
73
74
|
onAppChange,
|
|
75
|
+
onOrgChange,
|
|
74
76
|
onCollapseChange,
|
|
75
77
|
onPersonalSetting,
|
|
76
78
|
onChangePassword,
|
|
@@ -84,7 +86,7 @@ export default withTheme((props) => {
|
|
|
84
86
|
<Actions {...rest}>
|
|
85
87
|
{extraActions}
|
|
86
88
|
{globalNavigation && <GlobalNavigation headerRef={headerRef} menus={menus} />}
|
|
87
|
-
{!compatible ? (
|
|
89
|
+
{type !== 'enterprise' && (!compatible ? (
|
|
88
90
|
<>
|
|
89
91
|
{language && <Language language={userInfo.lang} onChange={onLanguageChange} />}
|
|
90
92
|
{theme && <Theme theme={userInfo.theme} onChange={onThemeChange} />}
|
|
@@ -97,7 +99,7 @@ export default withTheme((props) => {
|
|
|
97
99
|
onLanguageChange={onLanguageChange}
|
|
98
100
|
onThemeChange={onThemeChange}
|
|
99
101
|
/>
|
|
100
|
-
)}
|
|
102
|
+
))}
|
|
101
103
|
{application && (
|
|
102
104
|
<Application language={userInfo.lang} apps={apps} onChange={onApplicationChange} />
|
|
103
105
|
)}
|
|
@@ -115,6 +117,7 @@ export default withTheme((props) => {
|
|
|
115
117
|
theme,
|
|
116
118
|
language,
|
|
117
119
|
}}
|
|
120
|
+
onLanguageChange={onLanguageChange}
|
|
118
121
|
/>
|
|
119
122
|
) : (
|
|
120
123
|
<Avatar
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useState, useEffect, useRef } from
|
|
2
|
-
import styled, { withTheme } from
|
|
3
|
-
import cn from
|
|
4
|
-
import { get } from
|
|
5
|
-
import Icon from
|
|
1
|
+
import { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import styled, { withTheme } from 'styled-components';
|
|
3
|
+
import cn from 'classnames';
|
|
4
|
+
import { get } from 'lodash';
|
|
5
|
+
import Icon from '../Icon';
|
|
6
6
|
|
|
7
7
|
const TabsContainer = styled.div`
|
|
8
8
|
display: flex;
|
|
@@ -78,7 +78,7 @@ const TabItem = styled.li`
|
|
|
78
78
|
padding: 0 20px 0 10px;
|
|
79
79
|
cursor: pointer;
|
|
80
80
|
display: inline-block;
|
|
81
|
-
line-height: ${props => (props.theme.size ===
|
|
81
|
+
line-height: ${props => (props.theme.size === 'large' ? '46px' : '36px')};
|
|
82
82
|
/* transition: background-color .5; */
|
|
83
83
|
width: 130px;
|
|
84
84
|
color: rgba(255,255,255,.6);
|
|
@@ -176,7 +176,7 @@ export const HeaderTabs = withTheme(
|
|
|
176
176
|
language,
|
|
177
177
|
...props
|
|
178
178
|
}) => {
|
|
179
|
-
const [selectedKey, setSelectedKey] = useState(props.selectedKey || get(tabs,
|
|
179
|
+
const [selectedKey, setSelectedKey] = useState(props.selectedKey || get(tabs, '0.key'));
|
|
180
180
|
const [tabItems, setTabItems] = useState(tabs || []);
|
|
181
181
|
const [arrowVisible, setArrowVisible] = useState(false);
|
|
182
182
|
const [tabsPositionFlags, setTabsPositionFlags] = useState({ start: true, end: true });
|
|
@@ -212,7 +212,7 @@ export const HeaderTabs = withTheme(
|
|
|
212
212
|
const tabsDom = getTabsDom();
|
|
213
213
|
const parentBBox = tabsDom.parentNode.getBoundingClientRect();
|
|
214
214
|
const parentWidth = parentBBox.width - 32;
|
|
215
|
-
let x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g,
|
|
215
|
+
let x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g, ''));
|
|
216
216
|
const index = Math.ceil(x / 130);
|
|
217
217
|
const trueX = index * 130;
|
|
218
218
|
let newX = Math.min(0, -(trueX - parentWidth));
|
|
@@ -230,7 +230,7 @@ export const HeaderTabs = withTheme(
|
|
|
230
230
|
const parentWidth = parentBBox.width - 32;
|
|
231
231
|
const width = tabItems.length * 130;
|
|
232
232
|
|
|
233
|
-
let x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g,
|
|
233
|
+
let x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g, ''));
|
|
234
234
|
const index = Math.floor(x / 130);
|
|
235
235
|
const trueX = index * 130;
|
|
236
236
|
let newX = Math.max(-(width - parentWidth), -(trueX + parentWidth));
|
|
@@ -247,7 +247,7 @@ export const HeaderTabs = withTheme(
|
|
|
247
247
|
const index = tabs.indexOf(tabs.find(({ key }) => key === selectedKey));
|
|
248
248
|
if (index === -1) return;
|
|
249
249
|
const tabsDom = getTabsDom();
|
|
250
|
-
let x = -+tabsDom.style.transform.replace(/[^\d.-]/g,
|
|
250
|
+
let x = -+tabsDom.style.transform.replace(/[^\d.-]/g, '');
|
|
251
251
|
const bbox = {
|
|
252
252
|
left: index * 130,
|
|
253
253
|
right: (index + 1) * 130,
|
|
@@ -276,8 +276,7 @@ export const HeaderTabs = withTheme(
|
|
|
276
276
|
};
|
|
277
277
|
|
|
278
278
|
useEffect(() => {
|
|
279
|
-
setSelectedKey(props.selectedKey || get(tabs,
|
|
280
|
-
// const t = [{'code':'tagdata','enName':'tagdata','icon':'layer-color','menuName':'打标数据管理打标数据管理打标数据管理','path':'/orion/tag/datalist','key':'tagdata','name':'打标数据管理打标数据管理打标数据管理'},{'code':'taglist','enName':'taglist','icon':'home','menuName':'标签管理','path':'http://baidu.com/orion/tag/list','key':'taglist','name':'标签管理'},{'code':'relation1','enName':'dadicasesearch1','icon':'home','menuName':'案件检索1','path':'/orion/case/relation1','key':'relation1','name':'案件检索1'},{'code':'dadicasesearch-0','enName':'dadicasesearch','icon':'home','menuName':'案件检索-0','path':'/orion/case/relation0','key':'dadicasesearch-0','name':'案件检索-0'},{'code':'dadicasesearch-1','enName':'dadicasesearch','icon':'home','menuName':'案件检索-1','path':'/orion/case/relation1','key':'dadicasesearch-1','name':'案件检索-1'},{'code':'dadicasesearch-2','enName':'dadicasesearch','icon':'home','menuName':'案件检索-2','path':'/orion/case/relation2','key':'dadicasesearch-2','name':'案件检索-2'},{'code':'dadicasesearch-3','enName':'dadicasesearch','icon':'home','menuName':'案件检索-3','path':'/orion/case/relation3','key':'dadicasesearch-3','name':'案件检索-3'},{'code':'dadicasesearch-4','enName':'dadicasesearch','icon':'home','menuName':'案件检索-4','path':'/orion/case/relation4','key':'dadicasesearch-4','name':'案件检索-4'},{'code':'dadicasesearch-5','enName':'dadicasesearch','icon':'home','menuName':'案件检索-5','path':'/orion/case/relation5','key':'dadicasesearch-5','name':'案件检索-5'},{'code':'dadicasesearch-6','enName':'dadicasesearch','icon':'home','menuName':'案件检索-6','path':'/orion/case/relation6','key':'dadicasesearch-6','name':'案件检索-6'},{'code':'dadicasesearch-7','enName':'dadicasesearch','icon':'home','menuName':'案件检索-7','path':'/orion/case/relation7','key':'dadicasesearch-7','name':'案件检索-7'},{'code':'dadicasesearch-8','enName':'dadicasesearch','icon':'home','menuName':'案件检索-8','path':'/orion/case/relation8','key':'dadicasesearch-8','name':'案件检索-8'}] ;
|
|
279
|
+
setSelectedKey(props.selectedKey || get(tabs, '0.key'));
|
|
281
280
|
setTabItems(tabs);
|
|
282
281
|
}, [tabs, props.selectedKey]);
|
|
283
282
|
|
|
@@ -296,7 +295,7 @@ export const HeaderTabs = withTheme(
|
|
|
296
295
|
return (
|
|
297
296
|
<TabsContainer
|
|
298
297
|
{...props}
|
|
299
|
-
className={cn(
|
|
298
|
+
className={cn('tnt-layout-header-tabs', { [className]: className })}
|
|
300
299
|
>
|
|
301
300
|
<Tabs className="tnt-layout-header-tabs-content" ref={tabsRef}>
|
|
302
301
|
{tabItems.map((tab, index) => (
|
|
@@ -314,7 +313,7 @@ export const HeaderTabs = withTheme(
|
|
|
314
313
|
{
|
|
315
314
|
cn: tab.name,
|
|
316
315
|
en: tab.enName || tab.name,
|
|
317
|
-
}[language ||
|
|
316
|
+
}[language || 'cn']
|
|
318
317
|
}
|
|
319
318
|
</a>
|
|
320
319
|
{tab.closable !== false && tabItems.length > 1 && (
|
|
@@ -79,6 +79,7 @@ const TNTLayout = styled(Layout)`
|
|
|
79
79
|
export default withTheme(
|
|
80
80
|
props => {
|
|
81
81
|
const {
|
|
82
|
+
type,
|
|
82
83
|
logo,
|
|
83
84
|
name,
|
|
84
85
|
enName,
|
|
@@ -224,6 +225,7 @@ export default withTheme(
|
|
|
224
225
|
</Sider>
|
|
225
226
|
<Content>
|
|
226
227
|
<Header
|
|
228
|
+
type={type}
|
|
227
229
|
userInfo={userInfo}
|
|
228
230
|
config={config}
|
|
229
231
|
collapsed={collapsed}
|
|
@@ -45,7 +45,7 @@ const TNTLayout = ({ type, config, showMenuInIframe = false, ...props }) => {
|
|
|
45
45
|
const actionsContextValue = createActions({ language: getLanguageStore() || userInfo.lang || 'cn' });
|
|
46
46
|
const onLanguageChange = language => {
|
|
47
47
|
actionsContextValue.setLanguage(language);
|
|
48
|
-
props
|
|
48
|
+
props.onLanguageChange && (props.onLanguageChange(language));
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
// layout上的指定的属性优先级会高于extendMap中的属性
|
|
@@ -83,6 +83,7 @@ const TNTLayout = ({ type, config, showMenuInIframe = false, ...props }) => {
|
|
|
83
83
|
isInIframe={isInIframe}
|
|
84
84
|
userInfo={userInfo}
|
|
85
85
|
onLanguageChange={onLanguageChange}
|
|
86
|
+
type={type}
|
|
86
87
|
/>
|
|
87
88
|
}
|
|
88
89
|
{
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import Cookies from 'universal-cookie';
|
|
1
2
|
import { safeParseJSON } from '../utils';
|
|
2
3
|
|
|
4
|
+
const cookies = new Cookies();
|
|
5
|
+
|
|
3
6
|
export const getSideMenuStore = () => safeParseJSON(localStorage.getItem('sideMenu'), {});
|
|
4
7
|
export const setSideMenuStore = (params = {}) => {
|
|
5
8
|
localStorage.setItem('sideMenu', JSON.stringify({
|
|
@@ -25,8 +28,15 @@ export const setCurrentOrgTreeStore = (currentOrgTree = []) => {
|
|
|
25
28
|
export const getCurrentOrgTreeStore = () => safeParseJSON(localStorage.getItem('currentOrgTree'), []);
|
|
26
29
|
|
|
27
30
|
|
|
28
|
-
export const setLanguageStore = lang => localStorage.setItem('lang', lang);
|
|
29
|
-
export const getLanguageStore = () => localStorage.getItem('lang');
|
|
31
|
+
// export const setLanguageStore = lang => localStorage.setItem('lang', lang);
|
|
32
|
+
// export const getLanguageStore = () => localStorage.getItem('lang');
|
|
33
|
+
export const setLanguageStore = lang => cookies.set('lang', lang, { path: '/' });
|
|
34
|
+
export const getLanguageStore = () => cookies.get('lang', { path: '/' });
|
|
30
35
|
|
|
31
36
|
export const setThemeStore = theme => localStorage.setItem('theme', theme);
|
|
32
37
|
export const getThemeStore = () => localStorage.getItem('theme');
|
|
38
|
+
|
|
39
|
+
export const clearLoginCookie = () => {
|
|
40
|
+
cookies.remove('_td_token_', { path: '/' });
|
|
41
|
+
cookies.remove('_uid_', { path: '/' });
|
|
42
|
+
};
|
package/components/Page/index.js
CHANGED
|
@@ -106,8 +106,8 @@ const PageLayout = ({
|
|
|
106
106
|
{title}
|
|
107
107
|
</div>
|
|
108
108
|
{
|
|
109
|
-
[center, extra].map(item => (
|
|
110
|
-
<div className={`${clsPrefix}-header-section`}>
|
|
109
|
+
[center, extra].map((item, i) => (
|
|
110
|
+
<div className={`${clsPrefix}-header-section`} key={i}>
|
|
111
111
|
{item}
|
|
112
112
|
</div>
|
|
113
113
|
))
|
package/components/locale.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import Cookies from 'universal-cookie';
|
|
2
|
+
|
|
3
|
+
const cookies = new Cookies();
|
|
1
4
|
|
|
2
5
|
export const zh_CN = {
|
|
3
6
|
globalNavigation: '全局导航',
|
|
@@ -14,9 +17,13 @@ export const zh_CN = {
|
|
|
14
17
|
totalRecords: '共%s条记录',
|
|
15
18
|
|
|
16
19
|
// user popover
|
|
20
|
+
nameNull: '暂无昵称',
|
|
17
21
|
personalSettings: '个人设置',
|
|
18
22
|
changePwd: '修改密码',
|
|
19
|
-
signOut: '退出'
|
|
23
|
+
signOut: '退出',
|
|
24
|
+
|
|
25
|
+
// Handle
|
|
26
|
+
handleMore:'更多'
|
|
20
27
|
};
|
|
21
28
|
|
|
22
29
|
export const en_US = {
|
|
@@ -35,9 +42,13 @@ export const en_US = {
|
|
|
35
42
|
totalRecords: 'Total of %s records',
|
|
36
43
|
|
|
37
44
|
// user popover
|
|
38
|
-
|
|
45
|
+
nameNull: 'No nickname yet',
|
|
46
|
+
personalSettings: 'Setting',
|
|
39
47
|
changePwd: 'Change password',
|
|
40
|
-
signOut: 'Sign out'
|
|
48
|
+
signOut: 'Sign out',
|
|
49
|
+
|
|
50
|
+
// Handle
|
|
51
|
+
handleMore:'More'
|
|
41
52
|
};
|
|
42
53
|
|
|
43
54
|
export const getText = (key, language = 'cn', ...params) => {
|
|
@@ -55,6 +66,6 @@ export const getText = (key, language = 'cn', ...params) => {
|
|
|
55
66
|
return text;
|
|
56
67
|
};
|
|
57
68
|
|
|
58
|
-
export const getLanguage = () =>
|
|
69
|
+
export const getLanguage = () => cookies.get('lang', { path: '/' }) || 'cn';
|
|
59
70
|
|
|
60
71
|
export default { en_US, zh_CN };
|
package/dist/1.tntd.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
(window.webpackJsonptntd=window.webpackJsonptntd||[]).push([[1],{
|
|
2
|
-
/*!
|
|
3
|
-
* cookie
|
|
4
|
-
* Copyright(c) 2012-2014 Roman Shtylman
|
|
5
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
*/t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var r={},t=t||{},n=e.split(p),o=t.decode||u,i=0;i<n.length;i++){var a,s=n[i],c=s.indexOf("=");c<0||(a=s.substr(0,c).trim(),'"'==(s=s.substr(++c,s.length).trim())[0]&&(s=s.slice(1,-1)),null==r[a]&&(r[a]=function(t,e){try{return e(t)}catch(e){return t}}(s,o)))}return r},t.serialize=function(e,t,r){var n=r||{},r=n.encode||i;if("function"!=typeof r)throw new TypeError("option encode is invalid");if(!a.test(e))throw new TypeError("argument name is invalid");t=r(t);if(t&&!a.test(t))throw new TypeError("argument val is invalid");var o=e+"="+t;if(null!=n.maxAge){t=+n.maxAge;if(isNaN(t))throw new Error("maxAge should be a Number");o+="; Max-Age="+Math.floor(t)}if(n.domain){if(!a.test(n.domain))throw new TypeError("option domain is invalid");o+="; Domain="+n.domain}if(n.path){if(!a.test(n.path))throw new TypeError("option path is invalid");o+="; Path="+n.path}if(n.expires){if("function"!=typeof n.expires.toUTCString)throw new TypeError("option expires is invalid");o+="; Expires="+n.expires.toUTCString()}n.httpOnly&&(o+="; HttpOnly");n.secure&&(o+="; Secure");if(n.sameSite)switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o};var u=decodeURIComponent,i=encodeURIComponent,p=/; */,a=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/},76:function(e,t,r){"use strict";
|
|
8
|
-
/*
|
|
9
|
-
object-assign
|
|
10
|
-
(c) Sindre Sorhus
|
|
11
|
-
@license MIT
|
|
12
|
-
*/var c=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"!==Object.keys(Object.assign({},n)).join("")?void 0:1}catch(e){return}}()?Object.assign:function(e,t){for(var r,n=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o<arguments.length;o++){for(var i in r=Object(arguments[o]))u.call(r,i)&&(n[i]=r[i]);if(c)for(var a=c(r),s=0;s<a.length;s++)p.call(r,a[s])&&(n[a[s]]=r[a[s]])}return n}},77:function(e,t,r){"use strict";r.r(t);var p=r(0),l=r(1),o=r(75);function i(e,t){void 0===t&&(t={});var r,n=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(r=n,!(t=void 0===(t=t.doNotParse)?!r||"{"!==r[0]&&"["!==r[0]&&'"'!==r[0]:t))try{return JSON.parse(n)}catch(e){}return e}var a=r(76);function n(e,t){var r=this;this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.cookies=(t=t,"string"==typeof(e=e)?o.parse(e,t):"object"==typeof e&&null!==e?e:{}),new Promise(function(){r.HAS_DOCUMENT_COOKIE="object"==typeof document&&"string"==typeof document.cookie}).catch(function(){})}function f(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw i}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var m=new(n.prototype._updateBrowserValues=function(e){this.HAS_DOCUMENT_COOKIE&&(this.cookies=o.parse(document.cookie,e))},n.prototype._emitChange=function(e){for(var t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)},n.prototype.get=function(e,t,r){return void 0===t&&(t={}),this._updateBrowserValues(r),i(this.cookies[e],t)},n.prototype.getAll=function(e,t){void 0===e&&(e={}),this._updateBrowserValues(t);var r,n={};for(r in this.cookies)n[r]=i(this.cookies[r],e);return n},n.prototype.set=function(e,t,r){var n;"object"==typeof t&&(t=JSON.stringify(t)),this.cookies=a({},this.cookies,((n={})[e]=t,n)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=o.serialize(e,t,r)),this._emitChange({name:e,value:t,options:r})},n.prototype.remove=function(e,t){var r=t=a({},t,{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=a({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=o.serialize(e,"",r)),this._emitChange({name:e,value:void 0,options:t})},n.prototype.addChangeListener=function(e){this.changeListeners.push(e)},n.prototype.removeChangeListener=function(e){e=this.changeListeners.indexOf(e);0<=e&&this.changeListeners.splice(e,1)},n),y={account:void 0,password:void 0};t.default=function(e){var t=e.visible,n=e.close,r=e.signIn,o=d(Object(p.useState)(!1),2),i=o[0],a=o[1],e=localStorage.getItem("accountInfo");if(e)try{y=JSON.parse(e)}catch(e){}function s(e,t){u(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?f(Object(r),!0).forEach(function(e){h(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},c,h({},e,t.target.value)))}var o=d(Object(p.useState)(y),2),c=o[0],u=o[1],e=c.account,o=c.password;return React.createElement(l.Modal,{title:"开发者模拟登陆",visible:t,maskClosable:!1,onOk:function(){a(!0);var e=r&&r(c);e&&e.then&&e.then(function(r){l.message.success("模拟登陆成功"),localStorage.setItem("accountInfo",JSON.stringify(c)),a(!1),setTimeout(function(){var e=r||{},t=e.tdToken,e=e.userId;m.set("_td_token_",t,{path:"/"}),m.set("_uid_",e,{path:"/"}),n()},500)}).catch(function(e){throw a(!1),e})},onCancel:n,confirmLoading:i},React.createElement(l.Form,{labelCol:{span:5},wrapperCol:{span:18}},React.createElement(l.Form.Item,{label:"用户名:"},React.createElement(l.Input,{type:"text",placeholder:"请输入用户名",value:e||void 0,onChange:function(e){return s("account",e)}})),React.createElement(l.Form.Item,{label:"密码:"},React.createElement(l.Input,{type:"text",placeholder:"请输入用户名",value:o||void 0,onChange:function(e){return s("password",e)}}))))}}}]);
|
|
1
|
+
(window.webpackJsonptntd=window.webpackJsonptntd||[]).push([[1],{76:function(e,t,n){"use strict";n.r(t);var s=n(0),p=n(1);function f(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var c,i=e[Symbol.iterator]();!(r=(c=i.next()).done)&&(n.push(c.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==i.return||i.return()}finally{if(o)throw a}}return n}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var y=new(n(10).a),m={account:void 0,password:void 0};t.default=function(e){var t=e.visible,r=e.close,n=e.signIn,o=d(Object(s.useState)(!1),2),a=o[0],c=o[1],e=localStorage.getItem("accountInfo");if(e)try{m=JSON.parse(e)}catch(e){}function i(e,t){l(function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?f(Object(n),!0).forEach(function(e){b(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({},u,b({},e,t.target.value)))}var o=d(Object(s.useState)(m),2),u=o[0],l=o[1],e=u.account,o=u.password;return React.createElement(p.Modal,{title:"开发者模拟登陆",visible:t,maskClosable:!1,onOk:function(){c(!0);var e=n&&n(u);e&&e.then&&e.then(function(n){p.message.success("模拟登陆成功"),localStorage.setItem("accountInfo",JSON.stringify(u)),c(!1),setTimeout(function(){var e=n||{},t=e.tdToken,e=e.userId;y.set("_td_token_",t,{path:"/"}),y.set("_uid_",e,{path:"/"}),r()},500)}).catch(function(e){throw c(!1),e})},onCancel:r,confirmLoading:a},React.createElement(p.Form,{labelCol:{span:5},wrapperCol:{span:18}},React.createElement(p.Form.Item,{label:"用户名:"},React.createElement(p.Input,{type:"text",placeholder:"请输入用户名",value:e||void 0,onChange:function(e){return i("account",e)}})),React.createElement(p.Form.Item,{label:"密码:"},React.createElement(p.Input,{type:"text",placeholder:"请输入用户名",value:o||void 0,onChange:function(e){return i("password",e)}}))))}}}]);
|