@zw-team/react-lib 1.0.5-beta.5 → 1.0.5-beta.7
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/dist/components/AccessReport/index.d.ts +1 -1
- package/dist/components/AccessReport/index.js +17 -2
- package/dist/components/ConfigProvider/ConfigContext.js +3 -0
- package/dist/components/ConfigProvider/ConfigProvider.js +24 -6
- package/dist/components/ConfigProvider/types.d.ts +21 -0
- package/dist/components/Form/Form.js +6 -2
- package/dist/components/FormItem/FormItem.js +6 -2
- package/dist/components/NavbarTool/NavbarTool.js +35 -16
- package/dist/components/NavbarTool/components/index.js +2 -2
- package/dist/components/NavbarTool/types.d.ts +13 -0
- package/dist/components/NoticeCenter/NoticeCenter.js +150 -84
- package/dist/components/NoticeCenter/noticeCenter.scss +48 -4
- package/dist/package.json +1 -1
- package/dist/utils/request/defaultRequest.js +6 -3
- package/dist/utils/request/index.d.ts +4 -0
- package/dist/utils/request/index.js +21 -1
- package/dist/utils/tools.d.ts +9 -0
- package/dist/utils/tools.js +15 -1
- package/doc/v1.0.5.md +252 -0
- package/doc//345/260/217/345/267/245/345/205/267/346/216/245/345/205/245/346/266/210/346/201/257/344/270/255/345/277/203.md +324 -0
- package/package.json +3 -2
|
@@ -9,7 +9,7 @@ declare class AccessReport {
|
|
|
9
9
|
authorization: string;
|
|
10
10
|
baseUrl: string;
|
|
11
11
|
constructor({ system, authorization, env, mainOrigin, }: AccessReportOptions);
|
|
12
|
-
report(router: string, page: string | string[]):
|
|
12
|
+
report(router: string, page: string | string[]): Promise<import("axios").AxiosResponse<any, any, {}>> | undefined;
|
|
13
13
|
loginReport(): void;
|
|
14
14
|
accessReportSavev(data: any): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
15
15
|
browserType(): {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getServiceURL } from "../../config/index.js";
|
|
2
2
|
import defaultRequest from "../../utils/request/defaultRequest.js";
|
|
3
|
+
import { isToolSystem } from "../../utils/tools.js";
|
|
3
4
|
function isAbsoluteUrl(url) {
|
|
4
5
|
return /^https?:\/\//i.test(url);
|
|
5
6
|
}
|
|
@@ -22,10 +23,24 @@ class AccessReport_AccessReport {
|
|
|
22
23
|
this.baseUrl = resolveBaseUrl(getServiceURL(void 0, env), mainOrigin);
|
|
23
24
|
}
|
|
24
25
|
report(router, page) {
|
|
25
|
-
|
|
26
|
+
const loginDevice = this.browserType();
|
|
27
|
+
if ('ark' === this.systemName || isToolSystem()) return defaultRequest({
|
|
28
|
+
url: '/api/admin/track/access',
|
|
29
|
+
method: 'post',
|
|
30
|
+
headers: {
|
|
31
|
+
'Login-Device': JSON.stringify(loginDevice)
|
|
32
|
+
},
|
|
33
|
+
data: {
|
|
34
|
+
page: Array.isArray(page) ? page : [
|
|
35
|
+
page
|
|
36
|
+
],
|
|
37
|
+
router,
|
|
38
|
+
login_device: loginDevice
|
|
39
|
+
}
|
|
40
|
+
});
|
|
26
41
|
const params = {
|
|
27
42
|
system: this.systemName,
|
|
28
|
-
login_device:
|
|
43
|
+
login_device: loginDevice,
|
|
29
44
|
router: this.systemName + '-' + router,
|
|
30
45
|
page
|
|
31
46
|
};
|
|
@@ -4,6 +4,7 @@ import js_cookie from "js-cookie";
|
|
|
4
4
|
import { useCallback, useEffect, useState } from "react";
|
|
5
5
|
import { initProdEnvWarning } from "../../utils/advisory.js";
|
|
6
6
|
import { loadIcon, loadSvg } from "../../utils/svgIcon/index.js";
|
|
7
|
+
import { isToolSystem, setToolCsrfToken } from "../../utils/tools.js";
|
|
7
8
|
import AccessReport from "../AccessReport/index.js";
|
|
8
9
|
import { ConfigContext, defaultConfig } from "./ConfigContext.js";
|
|
9
10
|
const ConfigProvider_ConfigProvider_ConfigProvider = ({ children, antdConfig, ...restProps })=>{
|
|
@@ -28,16 +29,23 @@ const ConfigProvider_ConfigProvider_ConfigProvider = ({ children, antdConfig, ..
|
|
|
28
29
|
...newConfig
|
|
29
30
|
}));
|
|
30
31
|
}, []);
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const liveCsrfToken = restProps.csrfToken;
|
|
33
|
+
if (void 0 !== liveCsrfToken) setToolCsrfToken(liveCsrfToken);
|
|
34
|
+
if (contextValue.env) {
|
|
34
35
|
window.$BiEnv = contextValue.env;
|
|
35
|
-
window.$BiSystem = contextValue.system;
|
|
36
36
|
js_cookie.set('$BiEnv', contextValue.env);
|
|
37
|
+
}
|
|
38
|
+
if (contextValue.system) {
|
|
39
|
+
window.$BiSystem = contextValue.system;
|
|
37
40
|
js_cookie.set('$BiSystem', contextValue.system);
|
|
41
|
+
}
|
|
42
|
+
window.$BI = contextValue;
|
|
43
|
+
window.$AccessReport = contextValue.$AccessReport;
|
|
44
|
+
const install = ()=>{
|
|
38
45
|
initProdEnvWarning(contextValue.env || 'production', contextValue.showProdEnvWarning);
|
|
39
|
-
|
|
40
|
-
if (
|
|
46
|
+
const skipZqIcon = 'ark' === contextValue.system || isToolSystem();
|
|
47
|
+
if (!skipZqIcon) loadSvg(contextValue.system, contextValue.env || 'production', contextValue.mainOrigin);
|
|
48
|
+
if (contextValue.needIcon && !skipZqIcon) loadIcon(contextValue.env || 'production', (data)=>{
|
|
41
49
|
updateConfig({
|
|
42
50
|
iconList: data.data,
|
|
43
51
|
iconInit: true
|
|
@@ -47,6 +55,16 @@ const ConfigProvider_ConfigProvider_ConfigProvider = ({ children, antdConfig, ..
|
|
|
47
55
|
useEffect(()=>{
|
|
48
56
|
install();
|
|
49
57
|
}, []);
|
|
58
|
+
useEffect(()=>{
|
|
59
|
+
if (void 0 === restProps.csrfToken) return;
|
|
60
|
+
setToolCsrfToken(restProps.csrfToken);
|
|
61
|
+
setContextValue((prev)=>prev.csrfToken === restProps.csrfToken ? prev : {
|
|
62
|
+
...prev,
|
|
63
|
+
csrfToken: restProps.csrfToken
|
|
64
|
+
});
|
|
65
|
+
}, [
|
|
66
|
+
restProps.csrfToken
|
|
67
|
+
]);
|
|
50
68
|
return /*#__PURE__*/ jsx(ConfigContext.Provider, {
|
|
51
69
|
value: {
|
|
52
70
|
contextValue,
|
|
@@ -5,7 +5,28 @@ export interface ContextValue {
|
|
|
5
5
|
system: string;
|
|
6
6
|
mainOrigin?: string;
|
|
7
7
|
request: any;
|
|
8
|
+
/**
|
|
9
|
+
* 小工具 BFF CSRF token,由宿主项目获取后注入;
|
|
10
|
+
* 组件库请求时自动放到 X-CSRF-Token,不负责向 /auth/csrf 获取。
|
|
11
|
+
*/
|
|
12
|
+
csrfToken?: string;
|
|
8
13
|
needIcon: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 是否显示下载中心,仅对 system="ark" 生效。
|
|
16
|
+
* 与 BiNavbarTool 同名 prop 任一为 true 即显示;非 ark 忽略该参数。
|
|
17
|
+
*/
|
|
18
|
+
downloadCenter?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 是否显示通知中心,仅对 system="ark" 生效。
|
|
21
|
+
* 与 BiNavbarTool 同名 prop 任一为 true 即显示;非 ark 忽略该参数。
|
|
22
|
+
* 通知中心展示时同步初始化其 WebSocket。
|
|
23
|
+
*/
|
|
24
|
+
noticeCenter?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 是否显示系统入口,仅对 system="ark" 生效(ark 默认不显示,可按需打开)。
|
|
27
|
+
* 与 BiNavbarTool 同名 prop 任一为 true 即显示;非 ark 忽略该参数。
|
|
28
|
+
*/
|
|
29
|
+
systemLink?: boolean;
|
|
9
30
|
iconInit: boolean;
|
|
10
31
|
iconList: Record<string, any>;
|
|
11
32
|
componentsKeys: string | number;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import "./Form.css";
|
|
3
3
|
import { Form } from "antd";
|
|
4
|
+
import { classNames } from "../../utils/index.js";
|
|
4
5
|
const BaseForm = (props)=>{
|
|
5
|
-
const { form: externalForm, children, layout = 'inline', ...rest } = props;
|
|
6
|
+
const { form: externalForm, children, layout = 'inline', className, ...rest } = props;
|
|
6
7
|
const [internalForm] = Form.useForm();
|
|
7
8
|
const form = externalForm ?? internalForm;
|
|
8
9
|
return /*#__PURE__*/ jsx("div", {
|
|
9
|
-
className:
|
|
10
|
+
className: classNames([
|
|
11
|
+
'search-form',
|
|
12
|
+
className
|
|
13
|
+
]),
|
|
10
14
|
children: /*#__PURE__*/ jsx(Form, {
|
|
11
15
|
form: form,
|
|
12
16
|
layout: layout,
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "../../utils/index.js";
|
|
2
3
|
import "./FormItem.css";
|
|
3
4
|
import { Form } from "antd";
|
|
4
5
|
const FormItem = (props)=>{
|
|
5
|
-
const { children, label, button, ...rest } = props;
|
|
6
|
+
const { children, label, button, className, ...rest } = props;
|
|
6
7
|
return /*#__PURE__*/ jsxs("div", {
|
|
7
|
-
className:
|
|
8
|
+
className: classNames([
|
|
9
|
+
button ? 'search-item-button search-item' : 'search-item',
|
|
10
|
+
className
|
|
11
|
+
]),
|
|
8
12
|
children: [
|
|
9
13
|
label && !button && /*#__PURE__*/ jsx("div", {
|
|
10
14
|
className: 'string' == typeof label ? 'search-item-label' : 'search-item-label search-label-select',
|
|
@@ -2,13 +2,21 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { BiAvatar, BiNoticeCenter, BiSystemLink } from "../index.js";
|
|
4
4
|
import request from "../../utils/request/index.js";
|
|
5
|
+
import { useConfig } from "../ConfigProvider/ConfigContext.js";
|
|
5
6
|
import components from "./components/index.js";
|
|
6
7
|
import "./index.css";
|
|
7
8
|
import { getEnv, getSystem } from "../../utils/tools.js";
|
|
8
9
|
const avatar = 'https://zqingalioss.wozhangwan.com/zhangqing-test/uploads/9211/2025-10-21/1761024983_4SdTSjcJK8.png';
|
|
9
|
-
const BiNavbarTool = ({ downloadCenter
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const BiNavbarTool = ({ downloadCenter, noticeCenter, systemLink, avatarNode, ...restProps })=>{
|
|
11
|
+
const { contextValue } = useConfig();
|
|
12
|
+
const system = contextValue.system || getSystem() || '';
|
|
13
|
+
const env = contextValue.env || getEnv() || '';
|
|
14
|
+
const isArk = 'ark' === system;
|
|
15
|
+
const showDownloadCenter = isArk ? true === downloadCenter || true === contextValue.downloadCenter : false !== downloadCenter;
|
|
16
|
+
const showNoticeCenter = isArk ? true === noticeCenter || true === contextValue.noticeCenter : false !== noticeCenter;
|
|
17
|
+
const showSystemLink = isArk ? true === systemLink || true === contextValue.systemLink : false !== systemLink;
|
|
18
|
+
const enableNoticeWs = showNoticeCenter;
|
|
19
|
+
const toolCsrfReady = !isArk || Boolean(contextValue.csrfToken);
|
|
12
20
|
const wsRef = useRef(null);
|
|
13
21
|
const heartTimer = useRef(null);
|
|
14
22
|
const reconnectTimer = useRef(null);
|
|
@@ -18,15 +26,20 @@ const BiNavbarTool = ({ downloadCenter = true, noticeCenter = true, systemLink =
|
|
|
18
26
|
const [downloadStatus, setDownloadStatus] = useState(false);
|
|
19
27
|
const isMounted = useRef(true);
|
|
20
28
|
const WebSocketInit = useCallback(async ()=>{
|
|
21
|
-
if (!isMounted.current ||
|
|
29
|
+
if (!isMounted.current || !enableNoticeWs || !toolCsrfReady) return;
|
|
22
30
|
try {
|
|
23
31
|
const res = await request({
|
|
24
32
|
env,
|
|
25
|
-
system: '
|
|
26
|
-
api: '/
|
|
33
|
+
system: 'service_center',
|
|
34
|
+
api: '/api/admin/message/getMCUrl',
|
|
35
|
+
data: {
|
|
36
|
+
system: system
|
|
37
|
+
}
|
|
27
38
|
});
|
|
28
39
|
if (!isMounted.current) return;
|
|
29
|
-
|
|
40
|
+
if (res?.status_code !== void 0 && 1 !== res.status_code) return void console.log('getMCUrl failed:', res?.msg);
|
|
41
|
+
const url = res?.data?.url ?? res?.url;
|
|
42
|
+
if (!url) return void console.log('getMCUrl: empty ws url');
|
|
30
43
|
const ws = new WebSocket(url);
|
|
31
44
|
wsRef.current = ws;
|
|
32
45
|
ws.onopen = wsOnopen;
|
|
@@ -39,7 +52,9 @@ const BiNavbarTool = ({ downloadCenter = true, noticeCenter = true, systemLink =
|
|
|
39
52
|
}
|
|
40
53
|
}, [
|
|
41
54
|
env,
|
|
42
|
-
system
|
|
55
|
+
system,
|
|
56
|
+
enableNoticeWs,
|
|
57
|
+
toolCsrfReady
|
|
43
58
|
]);
|
|
44
59
|
const wsOnopen = ()=>{
|
|
45
60
|
console.log('WebSocket 连接成功');
|
|
@@ -87,7 +102,7 @@ const BiNavbarTool = ({ downloadCenter = true, noticeCenter = true, systemLink =
|
|
|
87
102
|
useEffect(()=>{
|
|
88
103
|
isMounted.current = true;
|
|
89
104
|
reconnectCount.current = 0;
|
|
90
|
-
WebSocketInit();
|
|
105
|
+
if (enableNoticeWs && toolCsrfReady) WebSocketInit();
|
|
91
106
|
return ()=>{
|
|
92
107
|
console.log('%c 组件卸载,清除心跳定时器', 'color: white; background-color: #409EFF; padding: 2px 5px; border-radius: 2px;');
|
|
93
108
|
isMounted.current = false;
|
|
@@ -106,25 +121,29 @@ const BiNavbarTool = ({ downloadCenter = true, noticeCenter = true, systemLink =
|
|
|
106
121
|
}
|
|
107
122
|
};
|
|
108
123
|
}, [
|
|
109
|
-
WebSocketInit
|
|
124
|
+
WebSocketInit,
|
|
125
|
+
enableNoticeWs,
|
|
126
|
+
toolCsrfReady
|
|
110
127
|
]);
|
|
111
128
|
return /*#__PURE__*/ jsxs("div", {
|
|
112
129
|
className: "bi-navbar-tool",
|
|
113
130
|
children: [
|
|
114
|
-
|
|
131
|
+
showDownloadCenter && /*#__PURE__*/ jsx(components, {
|
|
115
132
|
...restProps,
|
|
116
133
|
loading: downloadStatus,
|
|
117
134
|
system: system,
|
|
118
135
|
env: env,
|
|
119
|
-
requestFn: request
|
|
136
|
+
requestFn: request,
|
|
137
|
+
taskCenter: isArk ? true === restProps.taskCenter : false !== restProps.taskCenter,
|
|
138
|
+
downloadCenter: isArk ? false !== restProps.downloadCenter : false !== restProps.downloadCenter
|
|
120
139
|
}),
|
|
121
|
-
|
|
140
|
+
showNoticeCenter && /*#__PURE__*/ jsx(BiNoticeCenter, {
|
|
122
141
|
...restProps,
|
|
123
142
|
ref: noticeCenterRef,
|
|
124
143
|
system: system,
|
|
125
144
|
headerHeight: "64px"
|
|
126
145
|
}),
|
|
127
|
-
(
|
|
146
|
+
(showDownloadCenter || showNoticeCenter) && /*#__PURE__*/ jsx("div", {
|
|
128
147
|
className: "divider"
|
|
129
148
|
}),
|
|
130
149
|
avatarNode || /*#__PURE__*/ jsx(BiAvatar, {
|
|
@@ -132,10 +151,10 @@ const BiNavbarTool = ({ downloadCenter = true, noticeCenter = true, systemLink =
|
|
|
132
151
|
image: restProps.avatar || avatar,
|
|
133
152
|
logout: restProps.logout
|
|
134
153
|
}),
|
|
135
|
-
|
|
154
|
+
showSystemLink && /*#__PURE__*/ jsx("div", {
|
|
136
155
|
className: "divider"
|
|
137
156
|
}),
|
|
138
|
-
|
|
157
|
+
showSystemLink && /*#__PURE__*/ jsx(BiSystemLink, {})
|
|
139
158
|
]
|
|
140
159
|
});
|
|
141
160
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Badge, Button, Drawer, Tabs, Tooltip } from "antd";
|
|
3
|
-
import { classNames } from "../../../utils/classNames.js";
|
|
4
3
|
import { useCallback, useState } from "react";
|
|
5
4
|
import { BiDownloadCenter, BiTaskCenter } from "../../index.js";
|
|
5
|
+
import { classNames } from "../../../utils/classNames.js";
|
|
6
6
|
import "./index.css";
|
|
7
7
|
const DownloadCenter = (props)=>{
|
|
8
8
|
const { headerHeight = '50', loading = false, userId = '', system = '', taskCenter = true, downloadCenter = true, env, requestFn, className, style } = props;
|
|
@@ -82,7 +82,7 @@ const DownloadCenter = (props)=>{
|
|
|
82
82
|
},
|
|
83
83
|
onClose: handleDrawerClose,
|
|
84
84
|
children: [
|
|
85
|
-
'DownloadCenter' === tabsName && /*#__PURE__*/ jsx(BiDownloadCenter, {
|
|
85
|
+
'DownloadCenter' === tabsName && downloadCenter && /*#__PURE__*/ jsx(BiDownloadCenter, {
|
|
86
86
|
...props
|
|
87
87
|
}),
|
|
88
88
|
'TaskCenter' === tabsName && taskCenter && /*#__PURE__*/ jsx(BiTaskCenter, {
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
export interface BiNavbarToolProps {
|
|
2
2
|
token?: string;
|
|
3
|
+
/**
|
|
4
|
+
* 是否显示下载中心,默认 true。
|
|
5
|
+
* 非 ark 仅看该 prop;ark 下与 ConfigProvider.downloadCenter 任一为 true 即显示。
|
|
6
|
+
*/
|
|
3
7
|
downloadCenter?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* 是否显示通知中心,默认 true。
|
|
10
|
+
* 非 ark 仅看该 prop;ark 下与 ConfigProvider.noticeCenter 任一为 true 即显示。
|
|
11
|
+
* 展示时同步初始化通知 WebSocket。
|
|
12
|
+
*/
|
|
4
13
|
noticeCenter?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 是否显示系统入口,默认 true(ark 默认不显示)。
|
|
16
|
+
* 非 ark 仅看该 prop;ark 下与 ConfigProvider.systemLink 任一为 true 即显示。
|
|
17
|
+
*/
|
|
5
18
|
systemLink?: boolean;
|
|
6
19
|
avatarNode?: React.ReactNode;
|
|
7
20
|
userId?: string;
|
|
@@ -8,6 +8,37 @@ import { diffTime } from "../../utils/time/index.js";
|
|
|
8
8
|
import { getEnv } from "../../utils/tools.js";
|
|
9
9
|
import "./noticeCenter.scss";
|
|
10
10
|
const BiNoticeCenter = /*#__PURE__*/ forwardRef(({ headerHeight, system }, ref)=>{
|
|
11
|
+
const NOTICE_TYPE_CLASS = {
|
|
12
|
+
1: {
|
|
13
|
+
name: '版本更新',
|
|
14
|
+
color: '#1890FF'
|
|
15
|
+
},
|
|
16
|
+
2: {
|
|
17
|
+
name: '系统维护',
|
|
18
|
+
color: '#FA8C16'
|
|
19
|
+
},
|
|
20
|
+
3: {
|
|
21
|
+
name: '故障通知',
|
|
22
|
+
color: '#F5222D'
|
|
23
|
+
},
|
|
24
|
+
4: {
|
|
25
|
+
name: '运营活动',
|
|
26
|
+
color: '#52C41A'
|
|
27
|
+
},
|
|
28
|
+
5: {
|
|
29
|
+
name: '业务通知',
|
|
30
|
+
color: '#722ED1'
|
|
31
|
+
},
|
|
32
|
+
6: {
|
|
33
|
+
name: '系统公告',
|
|
34
|
+
color: '#8C8C8C'
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const normalizeNoticeType = (noticeType)=>{
|
|
38
|
+
const type = String(noticeType || '1');
|
|
39
|
+
return NOTICE_TYPE_CLASS[type] ? type : '1';
|
|
40
|
+
};
|
|
41
|
+
const getNoticeTypeName = (noticeType)=>NOTICE_TYPE_CLASS[normalizeNoticeType(noticeType)].name;
|
|
11
42
|
const [detailData, setDetailData] = useState({
|
|
12
43
|
_id: {
|
|
13
44
|
oid: ''
|
|
@@ -25,10 +56,11 @@ const BiNoticeCenter = /*#__PURE__*/ forwardRef(({ headerHeight, system }, ref)=
|
|
|
25
56
|
const [last_send_time, setLastSendTime] = useState('');
|
|
26
57
|
const [badgeNum, setBadgeNum] = useState(0);
|
|
27
58
|
const [detailVisible, setDetailVisible] = useState(false);
|
|
28
|
-
const dialogImg = 'https://
|
|
59
|
+
const dialogImg = (theme = 'light')=>`https://frontend-oss.zzwwiidd.com/bi-element-ui/NoticeCenter/notice-empty-${theme}.png`;
|
|
29
60
|
const [dialogVisible, setDialogVisible] = useState(false);
|
|
30
61
|
const [openNotice, setOpenNotice] = useState({
|
|
31
62
|
id: '',
|
|
63
|
+
notice_type: '1',
|
|
32
64
|
title: '',
|
|
33
65
|
content: "",
|
|
34
66
|
user_name: '',
|
|
@@ -78,6 +110,7 @@ const BiNoticeCenter = /*#__PURE__*/ forwardRef(({ headerHeight, system }, ref)=
|
|
|
78
110
|
});
|
|
79
111
|
popupNotice({
|
|
80
112
|
id: item._id.oid,
|
|
113
|
+
notice_type: item.notice_type,
|
|
81
114
|
title: item.title,
|
|
82
115
|
content: item.content,
|
|
83
116
|
user_name: item.user_name,
|
|
@@ -91,6 +124,7 @@ const BiNoticeCenter = /*#__PURE__*/ forwardRef(({ headerHeight, system }, ref)=
|
|
|
91
124
|
dialogSource.current = source;
|
|
92
125
|
setOpenNotice({
|
|
93
126
|
id: data.id,
|
|
127
|
+
notice_type: normalizeNoticeType(data.notice_type),
|
|
94
128
|
title: data.title,
|
|
95
129
|
content: data.content,
|
|
96
130
|
user_name: data.user_name,
|
|
@@ -104,6 +138,7 @@ const BiNoticeCenter = /*#__PURE__*/ forwardRef(({ headerHeight, system }, ref)=
|
|
|
104
138
|
dialogSource.current = 'external';
|
|
105
139
|
setOpenNotice({
|
|
106
140
|
id: '',
|
|
141
|
+
notice_type: normalizeNoticeType(data.notice_type),
|
|
107
142
|
title: data.title || '',
|
|
108
143
|
content: data.content || '',
|
|
109
144
|
user_name: data.user_name || '',
|
|
@@ -211,31 +246,55 @@ const BiNoticeCenter = /*#__PURE__*/ forwardRef(({ headerHeight, system }, ref)=
|
|
|
211
246
|
await request({
|
|
212
247
|
env: getEnv(),
|
|
213
248
|
system: 'zq',
|
|
214
|
-
api: '/api/system_notice/close',
|
|
249
|
+
api: '/api/admin/system_notice/close',
|
|
215
250
|
data: {
|
|
216
251
|
id
|
|
217
252
|
}
|
|
218
253
|
});
|
|
219
254
|
};
|
|
220
255
|
const NoticeModal = /*#__PURE__*/ jsxs(Modal, {
|
|
221
|
-
title:
|
|
256
|
+
title: null,
|
|
222
257
|
open: dialogVisible,
|
|
223
258
|
width: 680,
|
|
259
|
+
closable: false,
|
|
224
260
|
onCancel: ()=>noticeClose(openNotice.extra_id),
|
|
225
261
|
style: {
|
|
226
262
|
top: '38px'
|
|
227
263
|
},
|
|
228
264
|
footer: null,
|
|
229
265
|
wrapClassName: "notice-open-dialog",
|
|
266
|
+
styles: {
|
|
267
|
+
root: {
|
|
268
|
+
padding: 0,
|
|
269
|
+
background: 'transparent',
|
|
270
|
+
boxShadow: 'none',
|
|
271
|
+
borderRadius: 0,
|
|
272
|
+
overflow: 'hidden'
|
|
273
|
+
},
|
|
274
|
+
body: {
|
|
275
|
+
padding: 0
|
|
276
|
+
},
|
|
277
|
+
header: {
|
|
278
|
+
display: 'none',
|
|
279
|
+
padding: 0,
|
|
280
|
+
marginBottom: 0
|
|
281
|
+
}
|
|
282
|
+
},
|
|
230
283
|
children: [
|
|
231
284
|
/*#__PURE__*/ jsxs("div", {
|
|
232
285
|
className: "notice-open-container",
|
|
233
286
|
children: [
|
|
234
|
-
/*#__PURE__*/
|
|
287
|
+
/*#__PURE__*/ jsxs("div", {
|
|
235
288
|
className: "notice-bg",
|
|
236
|
-
children:
|
|
237
|
-
|
|
238
|
-
|
|
289
|
+
children: [
|
|
290
|
+
/*#__PURE__*/ jsx("img", {
|
|
291
|
+
src: dialogImg()
|
|
292
|
+
}),
|
|
293
|
+
/*#__PURE__*/ jsx("p", {
|
|
294
|
+
className: "notice-type",
|
|
295
|
+
children: getNoticeTypeName(openNotice.notice_type)
|
|
296
|
+
})
|
|
297
|
+
]
|
|
239
298
|
}),
|
|
240
299
|
/*#__PURE__*/ jsxs("div", {
|
|
241
300
|
className: "notice-open-box",
|
|
@@ -306,93 +365,100 @@ const BiNoticeCenter = /*#__PURE__*/ forwardRef(({ headerHeight, system }, ref)=
|
|
|
306
365
|
})
|
|
307
366
|
]
|
|
308
367
|
});
|
|
368
|
+
const noticeHeader = /*#__PURE__*/ jsxs("div", {
|
|
369
|
+
className: "notice-header",
|
|
370
|
+
children: [
|
|
371
|
+
/*#__PURE__*/ jsx("span", {
|
|
372
|
+
children: "系统通知"
|
|
373
|
+
}),
|
|
374
|
+
/*#__PURE__*/ jsx(Button, {
|
|
375
|
+
type: "text",
|
|
376
|
+
disabled: 0 === badgeNum && !currentUnreadNum(),
|
|
377
|
+
onClick: ()=>noticeAllRead(),
|
|
378
|
+
children: 0 !== badgeNum || currentUnreadNum() ? '全部标为已读' : '全部已读'
|
|
379
|
+
})
|
|
380
|
+
]
|
|
381
|
+
});
|
|
309
382
|
const prpoverContent = /*#__PURE__*/ jsx("div", {
|
|
310
383
|
className: "bi-notice-box",
|
|
311
|
-
children: /*#__PURE__*/
|
|
384
|
+
children: /*#__PURE__*/ jsx(Card, {
|
|
385
|
+
title: noticeHeader,
|
|
312
386
|
style: {
|
|
313
387
|
padding: 0
|
|
314
388
|
},
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
389
|
+
styles: {
|
|
390
|
+
body: {
|
|
391
|
+
padding: '0'
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
395
|
+
style: {
|
|
396
|
+
height: '400px',
|
|
397
|
+
overflowY: 'auto'
|
|
398
|
+
},
|
|
399
|
+
children: /*#__PURE__*/ jsxs(react_infinite_scroller, {
|
|
400
|
+
loadMore: loadMore,
|
|
401
|
+
hasMore: !noMore,
|
|
402
|
+
useWindow: false,
|
|
403
|
+
pageStart: 0,
|
|
404
|
+
className: "notice-list",
|
|
331
405
|
style: {
|
|
332
|
-
height: '400px'
|
|
333
|
-
overflowY: 'auto'
|
|
406
|
+
height: '400px'
|
|
334
407
|
},
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
hasMore: !noMore,
|
|
338
|
-
useWindow: false,
|
|
339
|
-
pageStart: 0,
|
|
340
|
-
className: "notice-list",
|
|
408
|
+
loader: /*#__PURE__*/ jsx("div", {
|
|
409
|
+
className: "loader",
|
|
341
410
|
style: {
|
|
342
|
-
|
|
411
|
+
textAlign: 'center'
|
|
343
412
|
},
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}) : ''
|
|
392
|
-
]
|
|
393
|
-
})
|
|
413
|
+
children: "Loading..."
|
|
414
|
+
}, 0),
|
|
415
|
+
children: [
|
|
416
|
+
noticeList.map((item, index)=>/*#__PURE__*/ jsxs("li", {
|
|
417
|
+
className: `notice-item ${!item.is_read ? 'unread' : ''}`,
|
|
418
|
+
onClick: ()=>detail(item),
|
|
419
|
+
children: [
|
|
420
|
+
/*#__PURE__*/ jsxs("div", {
|
|
421
|
+
className: "header",
|
|
422
|
+
children: [
|
|
423
|
+
/*#__PURE__*/ jsx("p", {
|
|
424
|
+
className: "title",
|
|
425
|
+
children: item.title
|
|
426
|
+
}),
|
|
427
|
+
/*#__PURE__*/ jsx("p", {
|
|
428
|
+
className: "time",
|
|
429
|
+
children: item.send_time
|
|
430
|
+
})
|
|
431
|
+
]
|
|
432
|
+
}),
|
|
433
|
+
/*#__PURE__*/ jsxs("div", {
|
|
434
|
+
className: "notice-content-box",
|
|
435
|
+
children: [
|
|
436
|
+
/*#__PURE__*/ jsx("div", {
|
|
437
|
+
className: "content",
|
|
438
|
+
children: item.describe
|
|
439
|
+
}),
|
|
440
|
+
/*#__PURE__*/ jsxs("div", {
|
|
441
|
+
className: "username",
|
|
442
|
+
children: [
|
|
443
|
+
"产品负责人: ",
|
|
444
|
+
item.user_name || '-'
|
|
445
|
+
]
|
|
446
|
+
})
|
|
447
|
+
]
|
|
448
|
+
})
|
|
449
|
+
]
|
|
450
|
+
}, `notice_${index}`)),
|
|
451
|
+
noMore ? /*#__PURE__*/ jsx("p", {
|
|
452
|
+
style: {
|
|
453
|
+
fontSize: '14px',
|
|
454
|
+
color: '#5e6d82',
|
|
455
|
+
textAlign: 'center'
|
|
456
|
+
},
|
|
457
|
+
children: "没有更多了"
|
|
458
|
+
}) : ''
|
|
459
|
+
]
|
|
394
460
|
})
|
|
395
|
-
|
|
461
|
+
})
|
|
396
462
|
})
|
|
397
463
|
});
|
|
398
464
|
const NoticePopover = /*#__PURE__*/ jsx(Popover, {
|