@tuya-sat/sdf-main-sdk 0.0.1-beta.1
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/.vscode/settings.json +5 -0
- package/README.md +1 -0
- package/antd.less.overwrite.js +56 -0
- package/color.js +140 -0
- package/dark-variable.less +1449 -0
- package/package.json +74 -0
- package/scripts/gen-localize-file.mjs +56 -0
- package/src/App.less +156 -0
- package/src/App.tsx +87 -0
- package/src/api/index.ts +52 -0
- package/src/api/req.ts +23 -0
- package/src/api/res.ts +29 -0
- package/src/api/urls.ts +30 -0
- package/src/api/utils.ts +41 -0
- package/src/assets/imgs/404.svg +194 -0
- package/src/assets/imgs/reLogin.png +0 -0
- package/src/components/404/index.tsx +44 -0
- package/src/components/500/index.tsx +49 -0
- package/src/components/BCustomNav/index.module.less +17 -0
- package/src/components/BCustomNav/index.tsx +108 -0
- package/src/components/BForgot/index.module.less +5 -0
- package/src/components/BForgot/index.tsx +96 -0
- package/src/components/BHeaderUser/account.png +0 -0
- package/src/components/BHeaderUser/app-scan-en.png +0 -0
- package/src/components/BHeaderUser/app-scan-zh.png +0 -0
- package/src/components/BHeaderUser/app-scan.png +0 -0
- package/src/components/BHeaderUser/components/BSwitchLang/index.module.less +6 -0
- package/src/components/BHeaderUser/components/BSwitchLang/index.tsx +56 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/Drawer/Content.tsx +199 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/Drawer/index.module.less +11 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/Drawer/index.tsx +27 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/hooks.ts +104 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/index.module.less +70 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/index.tsx +184 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/table/index.tsx +184 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/table/read.tsx +67 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/tools/index.tsx +116 -0
- package/src/components/BHeaderUser/components/Badge/index.module.less +99 -0
- package/src/components/BHeaderUser/components/Badge/index.tsx +179 -0
- package/src/components/BHeaderUser/index.module.less +105 -0
- package/src/components/BHeaderUser/index.tsx +261 -0
- package/src/components/BHeaderUser/logout.tsx +26 -0
- package/src/components/BLayout/components/Header/index.module.less +27 -0
- package/src/components/BLayout/components/Header/index.tsx +36 -0
- package/src/components/BLayout/components/Layout/empty.tsx +35 -0
- package/src/components/BLayout/components/Layout/emptyPage.png +0 -0
- package/src/components/BLayout/components/Layout/index.tsx +72 -0
- package/src/components/BLayout/components/Logo.tsx +6 -0
- package/src/components/BLayout/components/Menu/collapse.tsx +41 -0
- package/src/components/BLayout/components/Menu/image/close.tsx +26 -0
- package/src/components/BLayout/components/Menu/image/closedefault.tsx +26 -0
- package/src/components/BLayout/components/Menu/image/open.tsx +38 -0
- package/src/components/BLayout/components/Menu/image/opendefault.tsx +38 -0
- package/src/components/BLayout/components/Menu/index.module.less +125 -0
- package/src/components/BLayout/components/Menu/index.tsx +244 -0
- package/src/components/BLayout/components/MenuIcon.module.less +5 -0
- package/src/components/BLayout/components/MenuIcon.tsx +46 -0
- package/src/components/BLayout/components/MultiSider/index.module.less +104 -0
- package/src/components/BLayout/components/MultiSider/index.tsx +172 -0
- package/src/components/BLayout/components/Sider/index.less +64 -0
- package/src/components/BLayout/components/Sider/index.module.less +17 -0
- package/src/components/BLayout/components/Sider/index.tsx +34 -0
- package/src/components/BLayout/index.tsx +78 -0
- package/src/components/BLayoutLogin/index.module.less +65 -0
- package/src/components/BLayoutLogin/index.tsx +68 -0
- package/src/components/BLayoutLogin/login.jpg +0 -0
- package/src/components/BLogin/component/Clause/index.module.less +25 -0
- package/src/components/BLogin/component/Clause/index.tsx +58 -0
- package/src/components/BLogin/component/ForgotBtn/index.module.less +9 -0
- package/src/components/BLogin/component/ForgotBtn/index.tsx +18 -0
- package/src/components/BLogin/component/Password/index.tsx +39 -0
- package/src/components/BLogin/component/SubmitBtn/index.tsx +30 -0
- package/src/components/BLogin/component/TenanSpace/index.tsx +28 -0
- package/src/components/BLogin/component/Title/index.module.less +6 -0
- package/src/components/BLogin/component/Title/index.tsx +12 -0
- package/src/components/BLogin/component/UserName/index.tsx +48 -0
- package/src/components/BLogin/component/VerifyCode/index.module.less +11 -0
- package/src/components/BLogin/component/VerifyCode/index.tsx +165 -0
- package/src/components/BLogin/index.module.less +31 -0
- package/src/components/BLogin/index.tsx +210 -0
- package/src/components/BRegister/components/TenantName/index.tsx +26 -0
- package/src/components/BRegister/index.module.less +5 -0
- package/src/components/BRegister/index.tsx +71 -0
- package/src/components/Back/index.tsx +25 -0
- package/src/components/IconFont/font.js +66 -0
- package/src/components/IconFont/index.tsx +18 -0
- package/src/components/MicroComponent/Header/index.module.less +7 -0
- package/src/components/MicroComponent/Header/index.tsx +220 -0
- package/src/components/PForgot/index.tsx +10 -0
- package/src/components/PLogin/index.tsx +12 -0
- package/src/components/PRegister/index.tsx +10 -0
- package/src/components/PSetting/index.module.less +53 -0
- package/src/components/PSetting/index.tsx +420 -0
- package/src/constant/chargeStatus.ts +6 -0
- package/src/constant/imgs.ts +6 -0
- package/src/constant/index.ts +293 -0
- package/src/dark-variable.less +1449 -0
- package/src/global.d.ts +54 -0
- package/src/hooks/index.ts +133 -0
- package/src/index.css +1493 -0
- package/src/index.tsx +105 -0
- package/src/lang/en.json +266 -0
- package/src/lang/index.ts +44 -0
- package/src/lang/utils.ts +285 -0
- package/src/lang/zh.json +270 -0
- package/src/micro-script/theme/index.ts +29 -0
- package/src/micro-script/theme/theme-css/static.js +73 -0
- package/src/micro-script/theme/theme-css/subscriber.ts +201 -0
- package/src/micro-script/theme/util/index.ts +58 -0
- package/src/mqtt/index.ts +121 -0
- package/src/pages/403.tsx +18 -0
- package/src/pages/404.tsx +17 -0
- package/src/pages/expiration.tsx +23 -0
- package/src/pages/forgot.tsx +9 -0
- package/src/pages/home/index.tsx +172 -0
- package/src/pages/home/setting/index.tsx +7 -0
- package/src/pages/index.ts +50 -0
- package/src/pages/login.tsx +46 -0
- package/src/pages/register.tsx +9 -0
- package/src/pages/relogin/index.module.less +0 -0
- package/src/pages/relogin/index.tsx +54 -0
- package/src/plugins/index.ts +11 -0
- package/src/public-path.js +8 -0
- package/src/qiankun/globalState.ts +6 -0
- package/src/qiankun/index.ts +174 -0
- package/src/qiankun/utils/index.ts +69 -0
- package/src/qiankun/xhook/index.ts +193 -0
- package/src/reportWebVitals.ts +15 -0
- package/src/sentry/index.ts +33 -0
- package/src/sky/index.ts +57 -0
- package/src/theme/custom-dark.less +64 -0
- package/src/theme/custom-light.less +48 -0
- package/src/theme/index.less +327 -0
- package/src/theme/variable.less +13 -0
- package/src/utils/checkPass.ts +21 -0
- package/src/utils/common.ts +195 -0
- package/src/utils/eventBus.ts +112 -0
- package/src/utils/gt.js +293 -0
- package/src/utils/index.ts +89 -0
- package/src/utils/theme/base.ts +110 -0
- package/src/utils/theme/changeCssVariable.ts +157 -0
- package/src/utils/theme/changeMenuCssVariable.ts +176 -0
- package/src/utils/theme/index.ts +85 -0
- package/src/utils/theme/store.ts +37 -0
- package/tsconfig.json +28 -0
- package/typings.d.ts +10 -0
- package/webpack.config.js +103 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
@menuWidth: 250px;
|
|
2
|
+
|
|
3
|
+
.wrap {
|
|
4
|
+
margin-right: 16px;
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: flex-end;
|
|
7
|
+
height: 48px;
|
|
8
|
+
align-items: center;
|
|
9
|
+
flex: 1;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
.wrap-icon {
|
|
12
|
+
margin-left: 24px;
|
|
13
|
+
height: 24px;
|
|
14
|
+
line-height: 24px;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
}
|
|
18
|
+
.icon {
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
color: #555;
|
|
21
|
+
&:hover {
|
|
22
|
+
color: rgb(24, 144, 255);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.qrTitle {
|
|
28
|
+
// color: #262626;
|
|
29
|
+
font-weight: bold;
|
|
30
|
+
font-size: 14px;
|
|
31
|
+
text-align: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.hintImage {
|
|
35
|
+
height: 200px;
|
|
36
|
+
margin-left: -10px;
|
|
37
|
+
background-repeat: no-repeat;
|
|
38
|
+
background-size: contain;
|
|
39
|
+
}
|
|
40
|
+
.menu {
|
|
41
|
+
width: 250px;
|
|
42
|
+
// height: 122px;
|
|
43
|
+
margin: -12px -16px;
|
|
44
|
+
.menuTop {
|
|
45
|
+
// height: 74px;
|
|
46
|
+
padding: 16px 8px 8px 12px;
|
|
47
|
+
.menu-top-user {
|
|
48
|
+
display: flex;
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
height: 22px;
|
|
51
|
+
margin-bottom: 8px;
|
|
52
|
+
.account {
|
|
53
|
+
font-size: 14px;
|
|
54
|
+
// color: #000;
|
|
55
|
+
font-weight: 400;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
width: @menuWidth - 12px - 54px - 8px;
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
text-overflow: ellipsis;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.link {
|
|
63
|
+
// color: #1890ff;
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.account-info {
|
|
69
|
+
// overflow: hidden;
|
|
70
|
+
// white-space: nowrap;
|
|
71
|
+
// text-overflow: ellipsis;
|
|
72
|
+
// height: 22px;
|
|
73
|
+
// line-height: 22px;
|
|
74
|
+
max-width: @menuWidth - 24px;
|
|
75
|
+
color: #979797;
|
|
76
|
+
.role {
|
|
77
|
+
max-width: @menuWidth - 24px;
|
|
78
|
+
color: #979797;
|
|
79
|
+
font-size: 12px;
|
|
80
|
+
font-weight: 400;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
.menu-bottom {
|
|
85
|
+
padding-left: 12px;
|
|
86
|
+
height: 48px;
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: start-end;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
.menu-bottom-logout {
|
|
93
|
+
margin-right: 10px;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.rightMenu {
|
|
99
|
+
height: 100%;
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
& > div {
|
|
103
|
+
margin: 0 12px;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { Popover, Row, Col, Spin, Tag, Typography } from 'antd';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { useHistory, useLocation } from 'react-router-dom';
|
|
4
|
+
import IconFont from '@/components/IconFont';
|
|
5
|
+
import { api, URLS } from '@/api';
|
|
6
|
+
import QRCode from 'qrcode.react';
|
|
7
|
+
import appImgEn from './app-scan-en.png';
|
|
8
|
+
import appImgZh from './app-scan-zh.png';
|
|
9
|
+
import styles from './index.module.less';
|
|
10
|
+
import { useState, useEffect } from 'react';
|
|
11
|
+
import { isMessageCt, isSupportMultiLang, safeLogout } from '@/utils/common';
|
|
12
|
+
import { isSupportMobileWithFallback } from '@/qiankun/utils';
|
|
13
|
+
import Badge from './components/Badge';
|
|
14
|
+
import cx from 'classnames';
|
|
15
|
+
import BSwitchLang from './components/BSwitchLang';
|
|
16
|
+
import { switchLang } from '@/lang/utils';
|
|
17
|
+
import BCustomNav from '../BCustomNav';
|
|
18
|
+
import LogoutSvg from './logout';
|
|
19
|
+
import { isSupportLightDarkSwitch, LIGHT } from '@/utils/theme/base';
|
|
20
|
+
import { useTheme } from '@/utils/theme';
|
|
21
|
+
import { eventEmiter, eventNames } from '@/utils';
|
|
22
|
+
|
|
23
|
+
const logout = (history) => {
|
|
24
|
+
safeLogout(history);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const { Text } = Typography;
|
|
28
|
+
const UserInfoMenu = () => {
|
|
29
|
+
const { t, i18n } = useTranslation();
|
|
30
|
+
const history = useHistory();
|
|
31
|
+
const { pathname } = useLocation();
|
|
32
|
+
|
|
33
|
+
const [visible, setVisible] = useState(false);
|
|
34
|
+
const [userName, setUserName] = useState('');
|
|
35
|
+
const [roles, setRoles] = useState([]);
|
|
36
|
+
|
|
37
|
+
// 控制主题图标切换
|
|
38
|
+
const { theme, changeTheme } = useTheme();
|
|
39
|
+
const [QRUrl, setQR] = useState('');
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
// eventEmiter.addListener(eventNames.USER_NAME, (val) => {
|
|
43
|
+
// setUserName(val);
|
|
44
|
+
// });
|
|
45
|
+
api.get(URLS.USER_INFO).then((res) => {
|
|
46
|
+
setUserName(res.user_nick_name || res.user_name);
|
|
47
|
+
setRoles(
|
|
48
|
+
res.roles.map((role) => {
|
|
49
|
+
return {
|
|
50
|
+
...role,
|
|
51
|
+
role_name: role.role_name === 'admin' ? t('admin') : role.role_name,
|
|
52
|
+
};
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
window._SDF.user = {
|
|
56
|
+
user_name: res.user_name,
|
|
57
|
+
user_nick_name: res.user_nick_name,
|
|
58
|
+
roles: res.roles,
|
|
59
|
+
mobile: res.mobile,
|
|
60
|
+
email: res.email,
|
|
61
|
+
country_code: res.country_code,
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
}, []);
|
|
65
|
+
|
|
66
|
+
const mainConfig = () => {
|
|
67
|
+
console.log('micro_app_config', window._SDF.saas?.main_app_config);
|
|
68
|
+
if (window._SDF.saas?.main_app_config) {
|
|
69
|
+
return JSON.parse(window._SDF.saas?.main_app_config);
|
|
70
|
+
} else {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const QRTitle = () => {
|
|
76
|
+
const qrcodeDoc = mainConfig()?.qrcodeDoc || '';
|
|
77
|
+
if (qrcodeDoc) {
|
|
78
|
+
return (
|
|
79
|
+
<Row justify="center">
|
|
80
|
+
<Col>
|
|
81
|
+
<div
|
|
82
|
+
className={cx(styles.qrTitle, 'main-app-qrTitle')}
|
|
83
|
+
dangerouslySetInnerHTML={{ __html: qrcodeDoc }}
|
|
84
|
+
></div>
|
|
85
|
+
</Col>
|
|
86
|
+
</Row>
|
|
87
|
+
);
|
|
88
|
+
} else {
|
|
89
|
+
return (
|
|
90
|
+
<>
|
|
91
|
+
<Row justify="center">
|
|
92
|
+
<Col>
|
|
93
|
+
<div className={cx(styles.qrTitle, 'main-app-qrTitle')}>
|
|
94
|
+
{t('appHint1')}
|
|
95
|
+
</div>
|
|
96
|
+
</Col>
|
|
97
|
+
</Row>
|
|
98
|
+
<Row justify="center">
|
|
99
|
+
<Col>
|
|
100
|
+
<div className={cx(styles.qrTitle, 'main-app-qrTitle')}>
|
|
101
|
+
{t('appHint2')}
|
|
102
|
+
</div>
|
|
103
|
+
</Col>
|
|
104
|
+
</Row>
|
|
105
|
+
</>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const QrImg = () => {
|
|
111
|
+
const qrcodeUrl = mainConfig()?.qrcodeUrl || '';
|
|
112
|
+
if (qrcodeUrl) {
|
|
113
|
+
return (
|
|
114
|
+
<Row justify="center" style={{ width: 430 }}>
|
|
115
|
+
<img className={styles.hintImage} alt="" src={qrcodeUrl} />
|
|
116
|
+
</Row>
|
|
117
|
+
);
|
|
118
|
+
} else {
|
|
119
|
+
return (
|
|
120
|
+
<Row justify="center" style={{ width: 430 }}>
|
|
121
|
+
<Col span={12}>
|
|
122
|
+
<QRCode id="qrcode" includeMargin size={200} value={QRUrl} />
|
|
123
|
+
</Col>
|
|
124
|
+
<Col span={12}>
|
|
125
|
+
<div
|
|
126
|
+
className={styles.hintImage}
|
|
127
|
+
style={{
|
|
128
|
+
backgroundImage: `url("${
|
|
129
|
+
i18n.language.includes('zh') ? appImgZh : appImgEn
|
|
130
|
+
}")`,
|
|
131
|
+
}}
|
|
132
|
+
/>
|
|
133
|
+
{/* <img className={styles.hintImage} alt="" src={appImg} /> */}
|
|
134
|
+
</Col>
|
|
135
|
+
</Row>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const qrCode = () => {
|
|
141
|
+
return (
|
|
142
|
+
<Spin spinning={!QRUrl}>
|
|
143
|
+
<QRTitle />
|
|
144
|
+
<QrImg />
|
|
145
|
+
</Spin>
|
|
146
|
+
);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const goSetting = () => {
|
|
150
|
+
setVisible(false);
|
|
151
|
+
if (pathname === '/application/setting') {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (pathname === '/application/notification') {
|
|
155
|
+
history.replace('/application/setting');
|
|
156
|
+
} else {
|
|
157
|
+
history.push('/application/setting');
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const menu = (
|
|
162
|
+
<div className={styles.menu}>
|
|
163
|
+
<div className={cx(styles.menuTop, 'main-app-setting-top')}>
|
|
164
|
+
<div className={styles['menu-top-user']}>
|
|
165
|
+
<span
|
|
166
|
+
className={cx(styles.account, 'main-app-account')}
|
|
167
|
+
title={userName}
|
|
168
|
+
>
|
|
169
|
+
{userName}
|
|
170
|
+
</span>
|
|
171
|
+
<span
|
|
172
|
+
className={cx(styles.link, 'main-app-link')}
|
|
173
|
+
onClick={goSetting}
|
|
174
|
+
>
|
|
175
|
+
{t('setting.title')}
|
|
176
|
+
</span>
|
|
177
|
+
</div>
|
|
178
|
+
<div className={styles['account-info']}>
|
|
179
|
+
{roles.map((item) => (
|
|
180
|
+
<Tag style={{ marginBottom: '5px' }} key={item.role_name}>
|
|
181
|
+
<Text ellipsis style={{ maxWidth: '210px' }}>
|
|
182
|
+
{item.role_name}
|
|
183
|
+
</Text>
|
|
184
|
+
</Tag>
|
|
185
|
+
))}
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
<div
|
|
189
|
+
className={cx(styles['menu-bottom'], 'main-app-setting-bottom')}
|
|
190
|
+
onClick={() => logout(history)}
|
|
191
|
+
>
|
|
192
|
+
<LogoutSvg
|
|
193
|
+
className={cx(
|
|
194
|
+
styles['menu-bottom-logout'],
|
|
195
|
+
'main-app-setting-bottom-img'
|
|
196
|
+
)}
|
|
197
|
+
/>
|
|
198
|
+
<span>{t('menu.logout')}</span>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
const onVisibleChange = (visible) => {
|
|
204
|
+
if (visible && !QRUrl) {
|
|
205
|
+
api.get<string, string>(URLS.QRCODE).then((res) => {
|
|
206
|
+
setQR(res);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
const onVisibleChangeSetting = (visible) => {
|
|
212
|
+
setVisible(visible);
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
return (
|
|
216
|
+
<div className={styles.wrap}>
|
|
217
|
+
<BCustomNav />
|
|
218
|
+
{isSupportMultiLang() && <BSwitchLang toChangeLang={switchLang} />}
|
|
219
|
+
{isMessageCt() && <Badge />}
|
|
220
|
+
{isSupportLightDarkSwitch() && (
|
|
221
|
+
<div className={styles['wrap-icon']} onClick={changeTheme}>
|
|
222
|
+
<IconFont
|
|
223
|
+
type={theme === LIGHT ? 'icon-qianse' : 'icon-shense'}
|
|
224
|
+
className={cx(styles.icon, 'main-nav-text-color')}
|
|
225
|
+
/>
|
|
226
|
+
</div>
|
|
227
|
+
)}
|
|
228
|
+
{isSupportMobileWithFallback() && (
|
|
229
|
+
<Popover
|
|
230
|
+
content={qrCode}
|
|
231
|
+
placement="bottomRight"
|
|
232
|
+
arrowPointAtCenter
|
|
233
|
+
onVisibleChange={onVisibleChange}
|
|
234
|
+
>
|
|
235
|
+
<div className={styles['wrap-icon']}>
|
|
236
|
+
<IconFont
|
|
237
|
+
type="icon-mobile1"
|
|
238
|
+
className={cx(styles.icon, 'main-nav-text-color')}
|
|
239
|
+
/>
|
|
240
|
+
</div>
|
|
241
|
+
</Popover>
|
|
242
|
+
)}
|
|
243
|
+
<Popover
|
|
244
|
+
content={menu}
|
|
245
|
+
visible={visible}
|
|
246
|
+
placement="bottomRight"
|
|
247
|
+
onVisibleChange={onVisibleChangeSetting}
|
|
248
|
+
arrowPointAtCenter
|
|
249
|
+
>
|
|
250
|
+
<div className={styles['wrap-icon']}>
|
|
251
|
+
<IconFont
|
|
252
|
+
type="icon-xingzhuangjiehe"
|
|
253
|
+
className={cx(styles.icon, 'main-nav-text-color')}
|
|
254
|
+
/>
|
|
255
|
+
</div>
|
|
256
|
+
</Popover>
|
|
257
|
+
</div>
|
|
258
|
+
);
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
export default UserInfoMenu;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const LogoutSvg = ({ className }) => {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
className={className}
|
|
5
|
+
width="16"
|
|
6
|
+
height="16"
|
|
7
|
+
viewBox="0 0 16 16"
|
|
8
|
+
fill="none"
|
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
+
>
|
|
11
|
+
<path
|
|
12
|
+
d="M7.83334 1.99992C7.83334 2.36811 7.53487 2.66659 7.16668 2.66659H4.66668C3.95261 2.66659 3.36965 3.22791 3.33498 3.93337L3.33334 3.99992L3.33334 11.6666C3.33334 12.3807 3.89467 12.9636 4.60013 12.9983L4.66668 12.9999H7.16668C7.53487 12.9999 7.83334 13.2984 7.83334 13.6666C7.83334 14.0348 7.53487 14.3333 7.16668 14.3333H4.66668C3.22171 14.3333 2.04516 13.184 2.00128 11.7496L2.00001 11.6666L2.00001 3.99992C2.00001 2.55495 3.14929 1.3784 4.58362 1.33452L4.66668 1.33325L7.16668 1.33325C7.53487 1.33325 7.83334 1.63173 7.83334 1.99992Z"
|
|
13
|
+
fill="#595959"
|
|
14
|
+
/>
|
|
15
|
+
<path
|
|
16
|
+
d="M10.5 4.77614C10.2397 4.51578 10.2397 4.09368 10.5001 3.83333C10.7604 3.57298 11.1825 3.57298 11.4429 3.83333L14.1953 6.58578C14.9764 7.36682 14.9764 8.63316 14.1953 9.4142L11.4429 12.1667C11.1825 12.427 10.7604 12.427 10.5001 12.1667C10.2397 11.9063 10.2397 11.4842 10.5 11.2238L13.7237 7.99999L10.5 4.77614Z"
|
|
17
|
+
fill="#595959"
|
|
18
|
+
/>
|
|
19
|
+
<path
|
|
20
|
+
d="M6.66635 7.99996C6.66635 7.63177 6.96483 7.33329 7.33302 7.33329H13.9997C14.3679 7.33329 14.6664 7.63177 14.6664 7.99996C14.6664 8.36815 14.3679 8.66663 13.9997 8.66663H7.33302C6.96483 8.66663 6.66635 8.36815 6.66635 7.99996Z"
|
|
21
|
+
fill="#595959"
|
|
22
|
+
/>
|
|
23
|
+
</svg>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
export default LogoutSvg;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.header {
|
|
2
|
+
height: 48px;
|
|
3
|
+
min-height: 48px;
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: space-between;
|
|
6
|
+
align-items: center;
|
|
7
|
+
padding: 0 16px;
|
|
8
|
+
width: 100%;
|
|
9
|
+
// background-color: #fff !important;
|
|
10
|
+
// border-bottom: 1px solid #eee;
|
|
11
|
+
.logo {
|
|
12
|
+
position: relative;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
min-width: fit-content;
|
|
18
|
+
|
|
19
|
+
h1 {
|
|
20
|
+
font-size: 18px;
|
|
21
|
+
font-weight: 700;
|
|
22
|
+
height: 32px;
|
|
23
|
+
line-height: 32px;
|
|
24
|
+
margin: 0 0 0 12px;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Layout, Tag } from 'antd';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import HeaderUser from '@/components/BHeaderUser';
|
|
4
|
+
import Logo from '../Logo';
|
|
5
|
+
import styles from './index.module.less';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import { oemSaasAy } from '@/lang/utils';
|
|
8
|
+
import { CHARGE_STATUS } from '@/constant';
|
|
9
|
+
|
|
10
|
+
const { Header } = Layout;
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
13
|
+
export default ({ onHeaderClick }) => {
|
|
14
|
+
const { title } = oemSaasAy();
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Header className={cx('main-app-layout-header', styles.header)}>
|
|
19
|
+
<div className={styles.logo} onClick={onHeaderClick}>
|
|
20
|
+
<Logo />
|
|
21
|
+
{window._SDF_CONFIG?.saas?.LOGO_INSTEAD_OF_TITLE !== true && (
|
|
22
|
+
<h1 className="main-nav-title">{title}</h1>
|
|
23
|
+
)}
|
|
24
|
+
</div>
|
|
25
|
+
{window?._SDF.saas.charge_status === CHARGE_STATUS.TRIAL && (
|
|
26
|
+
<Tag
|
|
27
|
+
color="yellow"
|
|
28
|
+
style={{ borderRadius: '10px', marginLeft: '10px' }}
|
|
29
|
+
>
|
|
30
|
+
{t('trial')}
|
|
31
|
+
</Tag>
|
|
32
|
+
)}
|
|
33
|
+
<HeaderUser />
|
|
34
|
+
</Header>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useTranslation } from 'react-i18next';
|
|
2
|
+
import emptyPage from './emptyPage.png';
|
|
3
|
+
|
|
4
|
+
const EmptyPage = () => {
|
|
5
|
+
const { t } = useTranslation();
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
style={{
|
|
9
|
+
width: '100%',
|
|
10
|
+
height: '100vh',
|
|
11
|
+
display: 'flex',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
<div
|
|
17
|
+
style={{
|
|
18
|
+
display: 'flex',
|
|
19
|
+
flexDirection: 'column',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
}}
|
|
23
|
+
>
|
|
24
|
+
<img
|
|
25
|
+
style={{ width: '384px', height: '254px' }}
|
|
26
|
+
src={emptyPage}
|
|
27
|
+
alt="当前账号无权限"
|
|
28
|
+
/>
|
|
29
|
+
<span>{t('emptyPage')}</span>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default EmptyPage;
|
|
Binary file
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Layout } from 'antd';
|
|
3
|
+
import { useHistory, Switch, Route } from 'react-router-dom';
|
|
4
|
+
import Header from '../Header';
|
|
5
|
+
import { MenuType } from '../Menu';
|
|
6
|
+
import SingleSider from '../Sider';
|
|
7
|
+
import MultiSider from '../MultiSider';
|
|
8
|
+
import { IMenu } from '../Menu';
|
|
9
|
+
import Notice from '@/components/BHeaderUser/components/Badge/components/Notice';
|
|
10
|
+
import SettingPage from '@/pages/home/setting';
|
|
11
|
+
import { getDeepestPath } from '@/utils/common';
|
|
12
|
+
import EmptyPage from '@/components/BLayout/components/Layout/empty';
|
|
13
|
+
import { CHARGE_STATUS } from '@/constant';
|
|
14
|
+
import Expiration from '@/pages/expiration';
|
|
15
|
+
|
|
16
|
+
export interface ILayoutProps {
|
|
17
|
+
mode: MenuType;
|
|
18
|
+
menus: Array<IMenu>;
|
|
19
|
+
entries: string[];
|
|
20
|
+
children: ReactNode | HTMLElement;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const { Content } = Layout;
|
|
24
|
+
|
|
25
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
26
|
+
export default (props: ILayoutProps) => {
|
|
27
|
+
const { mode, menus, children, entries } = props;
|
|
28
|
+
const history = useHistory();
|
|
29
|
+
const handleHeaderClick = () => {
|
|
30
|
+
if (menus.length === 0) {
|
|
31
|
+
history.push('/403');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const path = getDeepestPath(menus[0]);
|
|
35
|
+
history.push(path);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Layout style={{ height: '100vh' }}>
|
|
40
|
+
<Header onHeaderClick={handleHeaderClick} />
|
|
41
|
+
|
|
42
|
+
<Content style={{ height: 'calc(100vh - 48px)' }}>
|
|
43
|
+
<Switch>
|
|
44
|
+
<Route path="/application/setting" exact>
|
|
45
|
+
<SettingPage />
|
|
46
|
+
</Route>
|
|
47
|
+
<Route path="/application/notification" exact>
|
|
48
|
+
<Notice />
|
|
49
|
+
</Route>
|
|
50
|
+
<Route path="*">
|
|
51
|
+
{entries ? (
|
|
52
|
+
entries.length === 0 ? (
|
|
53
|
+
<EmptyPage />
|
|
54
|
+
) : window._SDF.saas.charge_status === CHARGE_STATUS.EXPIRED ? (
|
|
55
|
+
<Expiration />
|
|
56
|
+
) : (
|
|
57
|
+
<Layout>
|
|
58
|
+
{mode === MenuType.GROUP ? (
|
|
59
|
+
<MultiSider menus={menus} />
|
|
60
|
+
) : (
|
|
61
|
+
<SingleSider menus={menus} />
|
|
62
|
+
)}
|
|
63
|
+
<Content>{children}</Content>
|
|
64
|
+
</Layout>
|
|
65
|
+
)
|
|
66
|
+
) : null}
|
|
67
|
+
</Route>
|
|
68
|
+
</Switch>
|
|
69
|
+
</Content>
|
|
70
|
+
</Layout>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import OpenDefaultSvg from './image/opendefault';
|
|
4
|
+
import OpenSvg from './image/open';
|
|
5
|
+
import CloseSvg from './image/close';
|
|
6
|
+
import CloseDefaultSvg from './image/closedefault';
|
|
7
|
+
import styles from './index.module.less';
|
|
8
|
+
|
|
9
|
+
const CollapseButton = ({ collapsed, toggleCollapsed }) => {
|
|
10
|
+
const [mouseHover, setMouseHover] = useState(false);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div className={styles.collapsed}>
|
|
14
|
+
<div
|
|
15
|
+
className={cx(styles.svgContainer, 'main-svg-container')}
|
|
16
|
+
onClick={toggleCollapsed}
|
|
17
|
+
onMouseEnter={() => {
|
|
18
|
+
setMouseHover(true);
|
|
19
|
+
}}
|
|
20
|
+
onMouseLeave={() => {
|
|
21
|
+
setMouseHover(false);
|
|
22
|
+
}}
|
|
23
|
+
>
|
|
24
|
+
{collapsed ? (
|
|
25
|
+
mouseHover ? (
|
|
26
|
+
<OpenSvg />
|
|
27
|
+
) : (
|
|
28
|
+
<OpenDefaultSvg />
|
|
29
|
+
)
|
|
30
|
+
) : mouseHover ? (
|
|
31
|
+
<CloseSvg />
|
|
32
|
+
) : (
|
|
33
|
+
<CloseDefaultSvg />
|
|
34
|
+
)}
|
|
35
|
+
</div>
|
|
36
|
+
<div className={cx(styles.line, 'main-collapsed-line')}></div>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default CollapseButton;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const CloseSvg = () => {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
width="14"
|
|
5
|
+
height="40"
|
|
6
|
+
viewBox="0 0 14 40"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
>
|
|
10
|
+
<path
|
|
11
|
+
d="M0 0L10.7032 1.91128C12.6109 2.25194 14 3.9111 14 5.84899V34.151C14 36.0889 12.6109 37.7481 10.7032 38.0887L0 40V0Z"
|
|
12
|
+
fill="#1890FF"
|
|
13
|
+
/>
|
|
14
|
+
<path
|
|
15
|
+
d="M10.2929 23.3535C10.4881 23.5487 10.8047 23.5487 11 23.3535C11.1952 23.1582 11.1952 22.8416 11 22.6464L8.70722 20.3535L11 18.0606C11.1952 17.8653 11.1952 17.5487 11 17.3535C10.8047 17.1582 10.4881 17.1582 10.2929 17.3535L7.64642 19.9999C7.46143 20.1849 7.4517 20.4788 7.61721 20.6752L7.64642 20.707L10.2929 23.3535Z"
|
|
16
|
+
fill="white"
|
|
17
|
+
/>
|
|
18
|
+
<path
|
|
19
|
+
d="M7.29286 23.3535C7.48812 23.5487 7.80471 23.5487 7.99997 23.3535C8.19524 23.1582 8.19524 22.8416 7.99998 22.6464L5.70722 20.3535L7.99998 18.0606C8.19524 17.8653 8.19524 17.5487 7.99997 17.3535C7.80471 17.1582 7.48812 17.1582 7.29286 17.3535L4.64642 19.9999C4.46143 20.1849 4.4517 20.4788 4.61721 20.6752L4.64642 20.707L7.29286 23.3535Z"
|
|
20
|
+
fill="white"
|
|
21
|
+
/>
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default CloseSvg;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const CloseDefaultSvg = () => {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
width="15"
|
|
5
|
+
height="40"
|
|
6
|
+
viewBox="0 0 15 40"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
>
|
|
10
|
+
<path
|
|
11
|
+
d="M0.5 0L11.2032 1.91128C13.1109 2.25194 14.5 3.9111 14.5 5.84899V34.151C14.5 36.0889 13.1109 37.7481 11.2032 38.0887L0.5 40V0Z"
|
|
12
|
+
fill="#E6E9EA"
|
|
13
|
+
/>
|
|
14
|
+
<path
|
|
15
|
+
d="M10.2929 23.3535C10.4881 23.5487 10.8047 23.5487 11 23.3535C11.1952 23.1582 11.1952 22.8416 11 22.6464L8.70722 20.3535L11 18.0606C11.1952 17.8653 11.1952 17.5487 11 17.3535C10.8047 17.1582 10.4881 17.1582 10.2929 17.3535L7.64642 19.9999C7.46143 20.1849 7.4517 20.4788 7.61721 20.6752L7.64642 20.707L10.2929 23.3535Z"
|
|
16
|
+
fill="black"
|
|
17
|
+
/>
|
|
18
|
+
<path
|
|
19
|
+
d="M7.29286 23.3535C7.48812 23.5487 7.80471 23.5487 7.99997 23.3535C8.19524 23.1582 8.19524 22.8416 7.99998 22.6464L5.70722 20.3535L7.99998 18.0606C8.19524 17.8653 8.19524 17.5487 7.99997 17.3535C7.80471 17.1582 7.48812 17.1582 7.29286 17.3535L4.64642 19.9999C4.46143 20.1849 4.4517 20.4788 4.61721 20.6752L4.64642 20.707L7.29286 23.3535Z"
|
|
20
|
+
fill="black"
|
|
21
|
+
/>
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default CloseDefaultSvg;
|