@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,56 @@
|
|
|
1
|
+
import { FC, useCallback } from 'react';
|
|
2
|
+
import { Menu, Dropdown } from 'antd';
|
|
3
|
+
import { GlobalOutlined, DownOutlined } from '@ant-design/icons';
|
|
4
|
+
import { langList, gLang } from '@/lang/utils';
|
|
5
|
+
import Cookies from 'js-cookie';
|
|
6
|
+
import styles from './index.module.less';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
interface Lang {
|
|
9
|
+
label: string;
|
|
10
|
+
value: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IBSwitchLangProps {
|
|
13
|
+
lang?: Lang[];
|
|
14
|
+
className?: string;
|
|
15
|
+
toChangeLang?: (lang: string) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const BSwitchLang: FC<IBSwitchLangProps> = (props) => {
|
|
19
|
+
const { className, toChangeLang } = props;
|
|
20
|
+
const { t } = useTranslation();
|
|
21
|
+
const onLangChange = useCallback((e) => {
|
|
22
|
+
if (Cookies.get('main-i18next') !== e.key) {
|
|
23
|
+
toChangeLang(e.key);
|
|
24
|
+
}
|
|
25
|
+
}, []);
|
|
26
|
+
const supported_language = window._SDF?.saas?.supported_language;
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div>
|
|
30
|
+
{langList().length === 1 ? null : (
|
|
31
|
+
<Dropdown
|
|
32
|
+
className={className}
|
|
33
|
+
overlay={
|
|
34
|
+
<Menu onClick={onLangChange}>
|
|
35
|
+
{langList().map((item) => (
|
|
36
|
+
<Menu.Item key={item.value}>{item.label}</Menu.Item>
|
|
37
|
+
))}
|
|
38
|
+
</Menu>
|
|
39
|
+
}
|
|
40
|
+
>
|
|
41
|
+
<span className={styles.switchLang}>
|
|
42
|
+
<GlobalOutlined style={{ fontSize: '22px', margin: '0px 10px' }} />
|
|
43
|
+
<span style={{ marginRight: 10, whiteSpace: 'nowrap' }}>
|
|
44
|
+
{supported_language
|
|
45
|
+
? supported_language[gLang()]
|
|
46
|
+
: t('login.lang')}
|
|
47
|
+
</span>
|
|
48
|
+
<DownOutlined />
|
|
49
|
+
</span>
|
|
50
|
+
</Dropdown>
|
|
51
|
+
)}
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default BSwitchLang;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { Tabs, Switch, Checkbox, Row, Col, Space, Button } from 'antd';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import styled from './index.module.less';
|
|
4
|
+
const { TabPane } = Tabs;
|
|
5
|
+
|
|
6
|
+
const Content = () => {
|
|
7
|
+
const callback = (key) => {};
|
|
8
|
+
function CheckboxonChange(e) {}
|
|
9
|
+
const onChange = (checked) => {};
|
|
10
|
+
return (
|
|
11
|
+
<Tabs defaultActiveKey="1" onChange={callback}>
|
|
12
|
+
<TabPane tab="告警消息" key="1">
|
|
13
|
+
<Space direction="vertical" size={24}>
|
|
14
|
+
<Row>
|
|
15
|
+
<Col>
|
|
16
|
+
<span className={styled['drawer-tab-title']}>会议通知</span>
|
|
17
|
+
<Switch defaultChecked onChange={onChange} />
|
|
18
|
+
</Col>
|
|
19
|
+
</Row>
|
|
20
|
+
<Row>
|
|
21
|
+
<Col>
|
|
22
|
+
<Checkbox
|
|
23
|
+
className={cx(
|
|
24
|
+
styled['drawer-tab-check-title'],
|
|
25
|
+
'main-app-message-drawer-tab-check-title',
|
|
26
|
+
)}
|
|
27
|
+
onChange={CheckboxonChange}
|
|
28
|
+
>
|
|
29
|
+
App Push
|
|
30
|
+
</Checkbox>
|
|
31
|
+
<span
|
|
32
|
+
className={cx(
|
|
33
|
+
styled['drawer-tab-check-describe'],
|
|
34
|
+
'main-app-message-drawer-tab-check-describe',
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
37
|
+
消息通过 App Push 发送给用户
|
|
38
|
+
</span>
|
|
39
|
+
</Col>
|
|
40
|
+
</Row>
|
|
41
|
+
<Row>
|
|
42
|
+
<Col>
|
|
43
|
+
<Checkbox onChange={CheckboxonChange}>邮件通知</Checkbox>
|
|
44
|
+
<span
|
|
45
|
+
className={cx(
|
|
46
|
+
styled['drawer-tab-check-describe'],
|
|
47
|
+
'main-app-message-drawer-tab-check-describe',
|
|
48
|
+
)}
|
|
49
|
+
>
|
|
50
|
+
消息通过邮件发送给用户
|
|
51
|
+
</span>
|
|
52
|
+
</Col>
|
|
53
|
+
</Row>
|
|
54
|
+
<Row>
|
|
55
|
+
<Col>
|
|
56
|
+
<Checkbox onChange={CheckboxonChange}>短信通知</Checkbox>
|
|
57
|
+
<span
|
|
58
|
+
className={cx(
|
|
59
|
+
styled['drawer-tab-check-describe'],
|
|
60
|
+
'main-app-message-drawer-tab-check-describe',
|
|
61
|
+
)}
|
|
62
|
+
>
|
|
63
|
+
消息通过短信发送给用户
|
|
64
|
+
</span>
|
|
65
|
+
</Col>
|
|
66
|
+
</Row>
|
|
67
|
+
<Row>
|
|
68
|
+
<Col>
|
|
69
|
+
<span className={styled['drawer-tab-title']}>
|
|
70
|
+
IoT平台消息通知
|
|
71
|
+
</span>
|
|
72
|
+
<Switch defaultChecked onChange={onChange} />
|
|
73
|
+
</Col>
|
|
74
|
+
</Row>
|
|
75
|
+
<Row>
|
|
76
|
+
<Col>
|
|
77
|
+
<span className={styled['drawer-tab-title']}>设备告警</span>
|
|
78
|
+
<Switch defaultChecked onChange={onChange} />
|
|
79
|
+
</Col>
|
|
80
|
+
</Row>
|
|
81
|
+
</Space>
|
|
82
|
+
</TabPane>
|
|
83
|
+
<TabPane tab="业务消息" key="2">
|
|
84
|
+
<Space direction="vertical" size={24}>
|
|
85
|
+
<Row>
|
|
86
|
+
<Col>
|
|
87
|
+
<span className={styled['drawer-tab-title']}>会议通知</span>
|
|
88
|
+
<Switch defaultChecked onChange={onChange} />
|
|
89
|
+
</Col>
|
|
90
|
+
</Row>
|
|
91
|
+
<Row>
|
|
92
|
+
<Col>
|
|
93
|
+
<Checkbox
|
|
94
|
+
className={cx(
|
|
95
|
+
styled['drawer-tab-check-title'],
|
|
96
|
+
'main-app-message-drawer-tab-check-title',
|
|
97
|
+
)}
|
|
98
|
+
onChange={CheckboxonChange}
|
|
99
|
+
>
|
|
100
|
+
App Push
|
|
101
|
+
</Checkbox>
|
|
102
|
+
<span
|
|
103
|
+
className={cx(
|
|
104
|
+
styled['drawer-tab-check-describe'],
|
|
105
|
+
'main-app-message-drawer-tab-check-describe',
|
|
106
|
+
)}
|
|
107
|
+
>
|
|
108
|
+
消息通过 App Push 发送给用户
|
|
109
|
+
</span>
|
|
110
|
+
</Col>
|
|
111
|
+
</Row>
|
|
112
|
+
<Row>
|
|
113
|
+
<Col>
|
|
114
|
+
<Checkbox onChange={CheckboxonChange}>邮件通知</Checkbox>
|
|
115
|
+
<span
|
|
116
|
+
className={cx(
|
|
117
|
+
styled['drawer-tab-check-describe'],
|
|
118
|
+
'main-app-message-drawer-tab-check-describe',
|
|
119
|
+
)}
|
|
120
|
+
>
|
|
121
|
+
消息通过邮件发送给用户
|
|
122
|
+
</span>
|
|
123
|
+
</Col>
|
|
124
|
+
</Row>
|
|
125
|
+
<Row>
|
|
126
|
+
<Col>
|
|
127
|
+
<Checkbox onChange={CheckboxonChange}>短信通知</Checkbox>
|
|
128
|
+
<span
|
|
129
|
+
className={cx(
|
|
130
|
+
styled['drawer-tab-check-describe'],
|
|
131
|
+
'main-app-message-drawer-tab-check-describe',
|
|
132
|
+
)}
|
|
133
|
+
>
|
|
134
|
+
消息通过短信发送给用户
|
|
135
|
+
</span>
|
|
136
|
+
</Col>
|
|
137
|
+
</Row>
|
|
138
|
+
<Row>
|
|
139
|
+
<Col>
|
|
140
|
+
<span className={styled['drawer-tab-title']}>
|
|
141
|
+
场景自动化/模板
|
|
142
|
+
</span>
|
|
143
|
+
<Switch defaultChecked onChange={onChange} />
|
|
144
|
+
</Col>
|
|
145
|
+
</Row>
|
|
146
|
+
<Row>
|
|
147
|
+
<Col>
|
|
148
|
+
<Checkbox
|
|
149
|
+
className={cx(
|
|
150
|
+
styled['drawer-tab-check-title'],
|
|
151
|
+
'main-app-message-drawer-tab-check-title',
|
|
152
|
+
)}
|
|
153
|
+
onChange={CheckboxonChange}
|
|
154
|
+
>
|
|
155
|
+
App Push
|
|
156
|
+
</Checkbox>
|
|
157
|
+
<span
|
|
158
|
+
className={cx(
|
|
159
|
+
styled['drawer-tab-check-describe'],
|
|
160
|
+
'main-app-message-drawer-tab-check-describe',
|
|
161
|
+
)}
|
|
162
|
+
>
|
|
163
|
+
消息通过 App Push 发送给用户
|
|
164
|
+
</span>
|
|
165
|
+
</Col>
|
|
166
|
+
</Row>
|
|
167
|
+
<Row>
|
|
168
|
+
<Col>
|
|
169
|
+
<Checkbox onChange={CheckboxonChange}>邮件通知</Checkbox>
|
|
170
|
+
<span
|
|
171
|
+
className={cx(
|
|
172
|
+
styled['drawer-tab-check-describe'],
|
|
173
|
+
'main-app-message-drawer-tab-check-describe',
|
|
174
|
+
)}
|
|
175
|
+
>
|
|
176
|
+
消息通过邮件发送给用户
|
|
177
|
+
</span>
|
|
178
|
+
</Col>
|
|
179
|
+
</Row>
|
|
180
|
+
<Row>
|
|
181
|
+
<Col>
|
|
182
|
+
<Checkbox onChange={CheckboxonChange}>短信通知</Checkbox>
|
|
183
|
+
<span
|
|
184
|
+
className={cx(
|
|
185
|
+
styled['drawer-tab-check-describe'],
|
|
186
|
+
'main-app-message-drawer-tab-check-describe',
|
|
187
|
+
)}
|
|
188
|
+
>
|
|
189
|
+
消息通过短信发送给用户
|
|
190
|
+
</span>
|
|
191
|
+
</Col>
|
|
192
|
+
</Row>
|
|
193
|
+
</Space>
|
|
194
|
+
</TabPane>
|
|
195
|
+
</Tabs>
|
|
196
|
+
);
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export default Content;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import IconFont from '@/components/IconFont';
|
|
2
|
+
import { Drawer as DrawerAntd } from 'antd';
|
|
3
|
+
import Content from './Content';
|
|
4
|
+
|
|
5
|
+
const Drawer = ({ setVisible, visible }) => {
|
|
6
|
+
const onClose = () => {
|
|
7
|
+
setVisible(false);
|
|
8
|
+
};
|
|
9
|
+
return (
|
|
10
|
+
<DrawerAntd
|
|
11
|
+
title="消息配置"
|
|
12
|
+
placement="right"
|
|
13
|
+
closable={false}
|
|
14
|
+
width={520}
|
|
15
|
+
onClose={onClose}
|
|
16
|
+
visible={visible}
|
|
17
|
+
extra={
|
|
18
|
+
<div onClick={onClose} style={{ transform: 'rotate(45deg)' }}>
|
|
19
|
+
<IconFont type="icon-tianjia"></IconFont>
|
|
20
|
+
</div>
|
|
21
|
+
}
|
|
22
|
+
>
|
|
23
|
+
<Content />
|
|
24
|
+
</DrawerAntd>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
export default Drawer;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { api, URLS } from '@/api';
|
|
3
|
+
|
|
4
|
+
export interface Inotice {
|
|
5
|
+
message_id: string; // 通知消息 ID
|
|
6
|
+
message_content: string; // 消息内容
|
|
7
|
+
read_status: string; // 消息状态
|
|
8
|
+
message_category: string; // 消息来源
|
|
9
|
+
message_category_description: string; // 消息来源描述
|
|
10
|
+
message_type: string; // 通知消息类型
|
|
11
|
+
message_type_description: string; //消息类型描述
|
|
12
|
+
create_time: string; // 创建时间
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface Ipagination {
|
|
16
|
+
pageSize: number;
|
|
17
|
+
current: number;
|
|
18
|
+
total: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* get请求 拼接url参数地址
|
|
23
|
+
* @param url 原url地址
|
|
24
|
+
* @param body 传入的参数
|
|
25
|
+
* @returns 返回拼接的url地址
|
|
26
|
+
*/
|
|
27
|
+
function getTransUrl(url, body: Record<string, any>) {
|
|
28
|
+
const queryArr = Object.keys(body)
|
|
29
|
+
.map((key) => (body[key] !== void 0 ? `${key}=${body[key]}` : null))
|
|
30
|
+
.filter((v) => v);
|
|
31
|
+
if (url.indexOf('?') !== -1) {
|
|
32
|
+
url = `${url}&${queryArr.join('&')}`;
|
|
33
|
+
} else {
|
|
34
|
+
url = `${url}?${queryArr.join('&')}`;
|
|
35
|
+
}
|
|
36
|
+
return url;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const useReadCount = () => {
|
|
40
|
+
const [count, setCount] = useState<number>(0);
|
|
41
|
+
const [d, setD] = useState<any>({});
|
|
42
|
+
const getData = async () => {
|
|
43
|
+
const count = (await api.get(
|
|
44
|
+
`${URLS.NOTICE_UNREAD_COUNT_GET}?message_type=`
|
|
45
|
+
)) as any;
|
|
46
|
+
setCount(count || 0);
|
|
47
|
+
setD({});
|
|
48
|
+
};
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
getData();
|
|
51
|
+
}, []);
|
|
52
|
+
|
|
53
|
+
return [count, getData] as const;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const useNoticeList = (
|
|
57
|
+
type: string,
|
|
58
|
+
origin: string,
|
|
59
|
+
status: string,
|
|
60
|
+
pageSize: number
|
|
61
|
+
) => {
|
|
62
|
+
const [list, setList] = useState([]);
|
|
63
|
+
const [loading, setLoading] = useState(false);
|
|
64
|
+
|
|
65
|
+
const [total, setTotal] = useState(0);
|
|
66
|
+
|
|
67
|
+
const getData = async (pageSize: number, current: number) => {
|
|
68
|
+
const url = getTransUrl(URLS.NOTICE_QUERY_LIST_GET, {
|
|
69
|
+
messageType: type,
|
|
70
|
+
microAppCode: origin,
|
|
71
|
+
read_flag: status,
|
|
72
|
+
page_no: current,
|
|
73
|
+
page_size: pageSize,
|
|
74
|
+
});
|
|
75
|
+
setLoading(true);
|
|
76
|
+
const result = await api.get(url);
|
|
77
|
+
setLoading(false);
|
|
78
|
+
setList(result?.data || []);
|
|
79
|
+
setTotal(result?.total || 0);
|
|
80
|
+
setLoading(false);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
getData(pageSize, 1);
|
|
85
|
+
}, [type, origin, status]);
|
|
86
|
+
|
|
87
|
+
return { loading, list, getData, total } as const;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const noticeDelete = async (checked: string[]) => {
|
|
91
|
+
const result = await api.delete(
|
|
92
|
+
`${URLS.NOTICE_DELETE_DELETE}${checked.join(',')}`
|
|
93
|
+
);
|
|
94
|
+
return result;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const readStatus = async (read_flag: string, checked: string[]) => {
|
|
98
|
+
const result = await api.put(
|
|
99
|
+
`${URLS.NOTICE_HANDLE_READ_PUT}/${read_flag}?message_ids=${checked.join(
|
|
100
|
+
','
|
|
101
|
+
)}`
|
|
102
|
+
);
|
|
103
|
+
return result;
|
|
104
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
.notice {
|
|
2
|
+
padding: 0px 32px 24px;
|
|
3
|
+
width: 1000px;
|
|
4
|
+
height: calc(100% - 64px);
|
|
5
|
+
margin: 32px auto;
|
|
6
|
+
overflow-y: auto;
|
|
7
|
+
|
|
8
|
+
.header {
|
|
9
|
+
display: flex;
|
|
10
|
+
line-height: 56px;
|
|
11
|
+
justify-items: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
h3 {
|
|
14
|
+
margin-left: 10px;
|
|
15
|
+
font-size: 16px;
|
|
16
|
+
font-weight: 600;
|
|
17
|
+
line-height: 24px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.selected {
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
margin-bottom: 16px;
|
|
24
|
+
&-left {
|
|
25
|
+
float: left;
|
|
26
|
+
div {
|
|
27
|
+
margin-right: 8px;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
&-right {
|
|
31
|
+
float: right;
|
|
32
|
+
button {
|
|
33
|
+
margin-left: 8px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.tools {
|
|
39
|
+
.noChecked {
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: space-between;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.checked {
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 54px;
|
|
48
|
+
line-height: 54px;
|
|
49
|
+
margin: 0 0 16px;
|
|
50
|
+
&-left {
|
|
51
|
+
float: left;
|
|
52
|
+
button {
|
|
53
|
+
margin-right: 8px;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
&-right {
|
|
57
|
+
float: right;
|
|
58
|
+
button {
|
|
59
|
+
margin-left: 8px;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.action {
|
|
66
|
+
height: 22px;
|
|
67
|
+
line-height: 22px;
|
|
68
|
+
display: inline-block;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import Table from './table';
|
|
4
|
+
import Tools from './tools';
|
|
5
|
+
import Back from '@/components/Back';
|
|
6
|
+
|
|
7
|
+
import { useNoticeList } from './hooks';
|
|
8
|
+
|
|
9
|
+
import styles from './index.module.less';
|
|
10
|
+
import cx from 'classnames';
|
|
11
|
+
import { Button, Select, Form } from 'antd';
|
|
12
|
+
const { Option } = Select;
|
|
13
|
+
|
|
14
|
+
const XTitle = () => {
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
return (
|
|
17
|
+
<div className={styles.header}>
|
|
18
|
+
<Back />
|
|
19
|
+
<span style={{ fontSize: '16px', fontWeight: '600', marginLeft: '10px' }}>
|
|
20
|
+
{t('notice.title')}
|
|
21
|
+
</span>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const MessageTypeSelect = ({ setType }) => {
|
|
27
|
+
const { t } = useTranslation();
|
|
28
|
+
return (
|
|
29
|
+
<Form.Item label={t('notice.typeSelect.placeholder')}>
|
|
30
|
+
<Select
|
|
31
|
+
dropdownMatchSelectWidth={false}
|
|
32
|
+
style={{ width: 114 }}
|
|
33
|
+
defaultValue=""
|
|
34
|
+
onChange={(value) => setType(value)}
|
|
35
|
+
>
|
|
36
|
+
<Option value="">{t('notice.typeSelect.all')}</Option>
|
|
37
|
+
<Option value="1">{t('notice.typeSelect.alert')}</Option>
|
|
38
|
+
<Option value="3">{t('notice.typeSelect.message')}</Option>
|
|
39
|
+
</Select>
|
|
40
|
+
</Form.Item>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const apps = () => {
|
|
45
|
+
const entry_info = window?._SDF?.saasInfo?.entry_info || {};
|
|
46
|
+
const microApps = window?._SDF?.saasInfo?.apps;
|
|
47
|
+
if (entry_info?.entry_mode === 'normal') {
|
|
48
|
+
return entry_info.entries.map((entry) => {
|
|
49
|
+
return {
|
|
50
|
+
...entry,
|
|
51
|
+
microAppCode: microApps.find(
|
|
52
|
+
(app) => app.oem_micro_app_id === entry.oem_micro_app_id,
|
|
53
|
+
).microAppCode,
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
let entries = [];
|
|
58
|
+
entry_info.entries.forEach((entry) => {
|
|
59
|
+
entries = [...entries, ...entry.sub_entry_list];
|
|
60
|
+
});
|
|
61
|
+
return entries.map((entry) => {
|
|
62
|
+
return {
|
|
63
|
+
...entry,
|
|
64
|
+
microAppCode: microApps.find(
|
|
65
|
+
(app) => app.oem_micro_app_id === entry.oem_micro_app_id,
|
|
66
|
+
).microAppCode,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const MessageOriginSelect = ({ setOrigin }) => {
|
|
73
|
+
const { t } = useTranslation();
|
|
74
|
+
return (
|
|
75
|
+
<Form.Item label={t('notice.originSelect.placeholder')}>
|
|
76
|
+
<Select
|
|
77
|
+
style={{ width: 114 }}
|
|
78
|
+
dropdownMatchSelectWidth={false}
|
|
79
|
+
defaultValue=""
|
|
80
|
+
onChange={(value) => setOrigin(value)}
|
|
81
|
+
>
|
|
82
|
+
<Option value="">{t('notice.originSelect.all')}</Option>
|
|
83
|
+
|
|
84
|
+
{apps().map((app) => {
|
|
85
|
+
return (
|
|
86
|
+
<Option key={app.microAppCode} value={app.microAppCode}>
|
|
87
|
+
{app.entry_name}
|
|
88
|
+
</Option>
|
|
89
|
+
);
|
|
90
|
+
})}
|
|
91
|
+
</Select>
|
|
92
|
+
</Form.Item>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const MessageStatusSelect = ({ setStatus }) => {
|
|
97
|
+
const { t } = useTranslation();
|
|
98
|
+
return (
|
|
99
|
+
<Form.Item label={t('notice.StatusSelect.placeholder')}>
|
|
100
|
+
<Select
|
|
101
|
+
style={{ width: 114 }}
|
|
102
|
+
defaultValue="0"
|
|
103
|
+
onChange={(value) => setStatus(value)}
|
|
104
|
+
>
|
|
105
|
+
<Option value="">{t('notice.StatusSelect.all')}</Option>
|
|
106
|
+
<Option value="1">{t('notice.StatusSelect.readed')}</Option>
|
|
107
|
+
<Option value="0">{t('notice.StatusSelect.unread')}</Option>
|
|
108
|
+
</Select>
|
|
109
|
+
</Form.Item>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const MarkButtons = () => {
|
|
114
|
+
const { t } = useTranslation();
|
|
115
|
+
const onClick = () => {
|
|
116
|
+
//TODO 标记所有消息已读
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<div className={styles['selected-right']}>
|
|
121
|
+
<Button type="primary" onClick={onClick}>
|
|
122
|
+
{t('notice.buttons.read')}
|
|
123
|
+
</Button>
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const SearchForm = ({ setType, setOrigin, setStatus }) => {
|
|
129
|
+
return (
|
|
130
|
+
<div className={styles.selected}>
|
|
131
|
+
<Form className={styles['selected-left']} layout="inline">
|
|
132
|
+
<MessageTypeSelect setType={setType} />
|
|
133
|
+
<MessageOriginSelect setOrigin={setOrigin} />
|
|
134
|
+
<MessageStatusSelect setStatus={setStatus} />
|
|
135
|
+
</Form>
|
|
136
|
+
</div>
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const Notice = () => {
|
|
141
|
+
const [type, setType] = useState('');
|
|
142
|
+
const [origin, setOrigin] = useState('');
|
|
143
|
+
const [status, setStatus] = useState('0');
|
|
144
|
+
const [selectedRowKeys, setSelectedRowKeys] = useState<string[]>([]);
|
|
145
|
+
const [current, setCurrent] = useState(1);
|
|
146
|
+
const [pageSize, setPageSize] = useState(10);
|
|
147
|
+
const { loading, list, getData, total } = useNoticeList(
|
|
148
|
+
type,
|
|
149
|
+
origin,
|
|
150
|
+
status,
|
|
151
|
+
pageSize,
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<div className={cx(styles.notice, 'main-app-notice')}>
|
|
156
|
+
<XTitle />
|
|
157
|
+
<SearchForm
|
|
158
|
+
setType={setType}
|
|
159
|
+
setOrigin={setOrigin}
|
|
160
|
+
setStatus={setStatus}
|
|
161
|
+
/>
|
|
162
|
+
<Tools
|
|
163
|
+
pageSize={pageSize}
|
|
164
|
+
getData={getData}
|
|
165
|
+
selectedRowKeys={selectedRowKeys}
|
|
166
|
+
setSelectedRowKeys={setSelectedRowKeys}
|
|
167
|
+
/>
|
|
168
|
+
<Table
|
|
169
|
+
list={list}
|
|
170
|
+
loading={loading}
|
|
171
|
+
total={total}
|
|
172
|
+
pageSize={pageSize}
|
|
173
|
+
setPageSize={setPageSize}
|
|
174
|
+
current={current}
|
|
175
|
+
setCurrent={setCurrent}
|
|
176
|
+
getData={getData}
|
|
177
|
+
selectedRowKeys={selectedRowKeys}
|
|
178
|
+
setSelectedRowKeys={setSelectedRowKeys}
|
|
179
|
+
/>
|
|
180
|
+
</div>
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export default Notice;
|