beer-assembly-biz 1.1.1-alpha.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/AppLayout.d.ts ADDED
@@ -0,0 +1,122 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { MenuDataItem } from '@ant-design/pro-components';
3
+ /**
4
+ * 应用属性
5
+ */
6
+ declare type App = {
7
+ /**
8
+ * Key
9
+ */
10
+ key: string;
11
+ /**
12
+ * App代码
13
+ */
14
+ appCode: string;
15
+ /**
16
+ * App名称
17
+ */
18
+ name: string;
19
+ /**
20
+ * App图标
21
+ */
22
+ icon: string;
23
+ /**
24
+ * App描述
25
+ */
26
+ description: string;
27
+ /**
28
+ * 路径
29
+ */
30
+ path: string;
31
+ /**
32
+ * App 默认路径
33
+ */
34
+ defaultPath: string;
35
+ };
36
+ /**
37
+ * 用户信息实体.
38
+ */
39
+ declare type UserInfo = {
40
+ /**
41
+ * 用户ID.
42
+ */
43
+ id: string | undefined;
44
+ /**
45
+ * 企业名称.
46
+ */
47
+ companyName: string | undefined;
48
+ /**
49
+ * 昵称.
50
+ */
51
+ nickName: string | undefined;
52
+ /**
53
+ * 头像.
54
+ */
55
+ avatar: string | undefined;
56
+ };
57
+ /**
58
+ * 布局属性
59
+ */
60
+ declare type LayoutProps = {
61
+ /**
62
+ * App
63
+ */
64
+ app: App;
65
+ /**
66
+ * App列表 (切换应用)
67
+ */
68
+ apps: App[];
69
+ /**
70
+ * 布局内容
71
+ */
72
+ children: ReactNode;
73
+ /**
74
+ * 路径
75
+ */
76
+ path: string;
77
+ /**
78
+ * 子路径路径分割符号, 用去区分是否子路径判断子路径的菜单归属
79
+ */
80
+ pathPartition: string[];
81
+ /**
82
+ * 左侧: Logo样式
83
+ */
84
+ logo?: {
85
+ /**
86
+ * 高度
87
+ */
88
+ height: number;
89
+ /**
90
+ * Logo 路径
91
+ */
92
+ path: string;
93
+ };
94
+ /**
95
+ * 右侧: 用户下拉选菜单
96
+ */
97
+ userMenus?: {
98
+ key: string;
99
+ type?: string;
100
+ label: string;
101
+ }[];
102
+ /**
103
+ * 头部: 从右到左菜单
104
+ */
105
+ headerMenus?: ReactNode[];
106
+ /**
107
+ * 切换菜单触发事件
108
+ * @param path 路径.
109
+ */
110
+ toLink?: (path: string) => void;
111
+ /**
112
+ * 请求获取用户信息
113
+ */
114
+ requestUser?: () => Promise<UserInfo>;
115
+ /**
116
+ * 请求获取菜单信息
117
+ * @param appCode 应用代码
118
+ */
119
+ requestMenus?: (appCode: string) => Promise<MenuDataItem[]>;
120
+ };
121
+ declare const Component: (props: LayoutProps) => React.JSX.Element;
122
+ export default Component;
package/AppLayout.js ADDED
@@ -0,0 +1,324 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { css } from '@emotion/css';
3
+ import { ProConfigProvider, ProLayout } from '@ant-design/pro-components';
4
+ import { Dropdown, message, Typography } from 'antd';
5
+ import { Session } from 'beer-network/session';
6
+ import dayjs from 'dayjs';
7
+ import ImageLayout01 from './images/layout_01.png';
8
+ import ImageLayout02 from './images/layout_02.png';
9
+ import ImageLayout03 from './images/layout_03.png';
10
+ dayjs.locale('zh-cn');
11
+ const Component = (props) => {
12
+ const [messageApi, contextHolder] = message.useMessage();
13
+ // App
14
+ const [app, setApp] = useState({});
15
+ // 用户
16
+ const [userInfo, setUserInfo] = useState();
17
+ // 菜单是否折叠
18
+ const [collapsed, setCollapsed] = useState(false);
19
+ // 菜单的选择
20
+ const [pathKeys, setPathKeys] = useState([]);
21
+ // 获取参数参数
22
+ const [appParams, setAppParams] = useState();
23
+ // 菜单列表
24
+ const [menus, setMenus] = useState();
25
+ // 跳转页面
26
+ const toLink = (value) => {
27
+ if (props?.toLink === undefined) {
28
+ window.history.pushState({}, '', value);
29
+ return;
30
+ }
31
+ props?.toLink?.(value);
32
+ };
33
+ // 获取全部菜单
34
+ const requestMenuItems = async () => {
35
+ if (app === undefined || app.name === undefined) {
36
+ return [];
37
+ }
38
+ const result = await props?.requestMenus?.(app?.appCode);
39
+ if (result === undefined) {
40
+ return [];
41
+ }
42
+ setMenus(result);
43
+ return result;
44
+ };
45
+ // 基于路径刷新页面菜单
46
+ const refreshPath = async () => {
47
+ if (menus === undefined || menus.length <= 0) {
48
+ return;
49
+ }
50
+ const items = menus.map(it => [{
51
+ path: it.path,
52
+ key: it.key
53
+ }, ...(it.children?.map(c => {
54
+ return {
55
+ path: c.path,
56
+ key: c.key
57
+ };
58
+ }) || [])])
59
+ .flat()
60
+ .filter(it => it !== undefined);
61
+ let result = items.find(it => it.path === window.location.pathname);
62
+ if (result !== undefined) {
63
+ setPathKeys(result.key === undefined ? [] : [result.key]);
64
+ return;
65
+ }
66
+ // 如果匹配到分割符号
67
+ const locationPath = window.location.pathname.toUpperCase();
68
+ const partition = (props?.pathPartition || []).find(path => locationPath.indexOf(`/${path}/`) > -1);
69
+ if (partition !== undefined) {
70
+ const partitionPath = locationPath.split(`/${partition}/`)[0].toLowerCase();
71
+ result = items.find(it => it.path === partitionPath);
72
+ if (result !== undefined) {
73
+ setPathKeys(result.key === undefined ? [] : [result.key]);
74
+ return;
75
+ }
76
+ }
77
+ result = items.find(it => it !== undefined && it.path !== undefined && window.location.pathname.startsWith(it.path));
78
+ if (result !== undefined) {
79
+ setPathKeys(result.key === undefined ? [] : [result.key]);
80
+ }
81
+ };
82
+ // 退出登录
83
+ const onLogout = async () => {
84
+ messageApi.success('退出登录成功!')
85
+ .then();
86
+ setTimeout(() => {
87
+ Session.logout('/auth/login');
88
+ }, 800);
89
+ };
90
+ // 更新属性触发: 应用
91
+ useEffect(() => {
92
+ setApp(props.app);
93
+ setAppParams({ app: props.app?.appCode });
94
+ }, [props.app]);
95
+ // 更新属性触发: 菜单和路径
96
+ useEffect(() => {
97
+ refreshPath()
98
+ .then();
99
+ }, [menus, props.path]);
100
+ // 更新属性触发: 请求用户信息
101
+ useEffect(() => {
102
+ props?.requestUser?.()
103
+ ?.then(userInfo => {
104
+ // 更新缓存到Session
105
+ if (userInfo === undefined || userInfo?.id === undefined) {
106
+ return;
107
+ }
108
+ setUserInfo(userInfo);
109
+ sessionStorage.setItem('SESSION', JSON.stringify(userInfo));
110
+ });
111
+ }, [props?.requestUser]);
112
+ return React.createElement(ProConfigProvider, { hashed: false },
113
+ contextHolder,
114
+ React.createElement(ProLayout, { className: css `
115
+ .ant-pro-sider-logo {
116
+ .ant-pro-layout-apps-icon {
117
+ display: ${collapsed ? 'flex' : 'none'};
118
+ }
119
+ }
120
+
121
+ .ant-pro-global-header {
122
+ .ant-pro-layout-apps-icon {
123
+ display: ${collapsed ? 'none' : 'flex'};
124
+ }
125
+ }
126
+
127
+ .ant-pro-global-header {
128
+ .ant-pro-layout-apps-icon {
129
+ margin-inline-end: 4px;
130
+ }
131
+ }
132
+
133
+ .ant-pro-global-header-header-actions-avatar {
134
+ padding: 3px;
135
+
136
+ & > div {
137
+ height: 36px;
138
+ line-height: 1.5;
139
+ }
140
+ }
141
+
142
+ .ant-pro-sider-logo {
143
+ padding-block: 10px;
144
+ }
145
+
146
+ .ant-pro-sider-logo-collapsed {
147
+ padding: 10px 6px 2px 6px;
148
+ }
149
+
150
+ .ant-pro-sider-collapsed-button {
151
+ inset-block-start: 15px;
152
+ }
153
+ `, selectedKeys: pathKeys, locale: "zh-CN", navTheme: "light", fixSiderbar: true, layout: "mix", contentWidth: "Fluid", splitMenus: false, bgLayoutImgList: [
154
+ {
155
+ src: ImageLayout01,
156
+ left: 85,
157
+ bottom: 100,
158
+ height: '303px'
159
+ },
160
+ {
161
+ src: ImageLayout02,
162
+ bottom: -68,
163
+ right: -45,
164
+ height: '303px'
165
+ },
166
+ {
167
+ src: ImageLayout03,
168
+ bottom: 0,
169
+ left: 0,
170
+ width: '331px'
171
+ }
172
+ ], siderWidth: 200, token: {
173
+ bgLayout: '#f5f7fa',
174
+ header: {
175
+ heightLayoutHeader: 48
176
+ },
177
+ sider: {
178
+ menuHeight: 32,
179
+ paddingBlockLayoutMenu: 4,
180
+ paddingInlineLayoutMenu: 4,
181
+ colorMenuBackground: '#fff',
182
+ colorTextMenu: 'rgb(87, 89, 102)',
183
+ colorBgMenuItemSelected: 'rgba(0,0,0,0.08)'
184
+ },
185
+ pageContainer: {
186
+ paddingInlinePageContainerContent: 0,
187
+ paddingBlockPageContainerContent: 0
188
+ }
189
+ }, siderMenuType: 'sub', fixedHeader: true, appList: (props.apps?.length || 0) > 1 || collapsed ? props.apps?.map(it => {
190
+ return {
191
+ ...it,
192
+ icon: React.createElement("img", { src: it.icon, alt: "" }),
193
+ title: it.name,
194
+ desc: it.description,
195
+ url: it.defaultPath || it.path
196
+ };
197
+ }) : [], menuHeaderRender: (_logo, _title, props) => {
198
+ setTimeout(() => {
199
+ setCollapsed(props?.collapsed === true);
200
+ });
201
+ return React.createElement(React.Fragment, null, props?.collapsed ? undefined : React.createElement("div", { style: {
202
+ padding: '2px 0',
203
+ textIndent: 10,
204
+ fontSize: 15,
205
+ color: '#333',
206
+ fontWeight: 500
207
+ } }, app?.name));
208
+ }, menu: {
209
+ collapsedShowTitle: false,
210
+ collapsedShowGroupTitle: false,
211
+ params: appParams,
212
+ request: async () => {
213
+ return requestMenuItems();
214
+ }
215
+ }, subMenuItemRender: (props, _defaultDom, menuProps) => {
216
+ return React.createElement("div", { style: {
217
+ height: 32,
218
+ fontSize: 13,
219
+ display: 'flex',
220
+ alignItems: 'center',
221
+ justifyContent: menuProps.collapsed ? 'center' : undefined,
222
+ cursor: 'pointer',
223
+ width: '100%',
224
+ color: '#0c0d0e'
225
+ } },
226
+ React.createElement("img", { src: (props.icon || '') === '' ? undefined : props.icon?.toString(), style: {
227
+ width: 20,
228
+ display: 'block',
229
+ marginInlineEnd: menuProps.collapsed ? 0 : 4
230
+ }, alt: "" }),
231
+ menuProps.collapsed ? undefined : props.name);
232
+ }, menuItemRender: (props, defaultDom, menuProps) => {
233
+ const isSub = (props.locale?.toString()
234
+ ?.split('.') || []).length > 2;
235
+ return React.createElement("a", { style: {
236
+ fontSize: 13,
237
+ userSelect: 'none',
238
+ height: 32,
239
+ display: 'flex',
240
+ alignItems: 'center',
241
+ justifyContent: menuProps.collapsed && !isSub ? 'center' : undefined,
242
+ cursor: 'pointer',
243
+ color: '#0c0d0e'
244
+ }, onClick: (e) => {
245
+ e.preventDefault();
246
+ if (props.isUrl || !props.path) {
247
+ return;
248
+ }
249
+ toLink(props.path);
250
+ }, href: props.path },
251
+ (props.icon || '') === '' ? undefined : React.createElement("img", { src: props.icon?.toString(), style: {
252
+ width: 20,
253
+ display: 'block',
254
+ marginInlineEnd: menuProps.collapsed ? undefined : 4
255
+ }, alt: "" }),
256
+ menuProps.collapsed && !isSub ? undefined : props.name);
257
+ }, logo: React.createElement("div", { className: css `
258
+ display: flex;
259
+ align-items: center;
260
+
261
+ & > img {
262
+ height: ${props?.logo?.height || 22}px;
263
+ display: block;
264
+ margin: 0 6px;
265
+ }
266
+ ` },
267
+ React.createElement("img", { src: props?.logo?.path, alt: "" })), title: false, avatarProps: {
268
+ src: (userInfo?.avatar || '') === '' ? '/avatar.png' : userInfo?.avatar,
269
+ size: 'small',
270
+ title: React.createElement("span", { style: {
271
+ color: '#333',
272
+ fontSize: 14
273
+ } }, userInfo?.nickName || '系统用户'),
274
+ render: (_props, dom) => {
275
+ return (React.createElement(Dropdown, { menu: {
276
+ items: [
277
+ {
278
+ key: '0',
279
+ label: (React.createElement("div", { className: css `
280
+ max-width: 200px;
281
+ width: 200px;
282
+
283
+ & p {
284
+ margin: 3px;
285
+ display: block;
286
+ }
287
+ ` },
288
+ React.createElement("p", null,
289
+ React.createElement(Typography.Text, { ellipsis: true, style: {
290
+ width: 200,
291
+ fontWeight: 500,
292
+ fontSize: 14
293
+ } }, userInfo?.companyName || userInfo?.nickName)),
294
+ React.createElement("p", null,
295
+ React.createElement(Typography.Text, { ellipsis: true, style: { width: 200 } },
296
+ "\u8D26\u53F7ID : ",
297
+ userInfo?.id))))
298
+ },
299
+ {
300
+ type: 'divider'
301
+ },
302
+ ...(props?.userMenus || []),
303
+ {
304
+ type: 'divider'
305
+ },
306
+ {
307
+ key: 'EXIT',
308
+ danger: true,
309
+ label: React.createElement("div", { onClick: onLogout }, "\u9000\u51FA\u767B\u5F55")
310
+ }
311
+ ]
312
+ } }, dom));
313
+ }
314
+ }, actionsRender: (headerProps) => {
315
+ if (headerProps.isMobile) {
316
+ return [];
317
+ }
318
+ if (typeof window === 'undefined') {
319
+ return [];
320
+ }
321
+ return props?.headerMenus || [];
322
+ } }, props.children));
323
+ };
324
+ export default Component;
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+ import { FileItemTableProps } from 'beer-assembly/FileItemTable';
3
+ import { DirectorySelectProps } from 'beer-assembly/DirectorySelect';
4
+ export type Handler<T> = {
5
+ ok: (callback: (params: T) => Promise<boolean>, args?: {}, initialValues?: {}) => void;
6
+ };
7
+ type FileItemTableRequest = NonNullable<FileItemTableProps['request']>;
8
+ type DirectoryRequest = NonNullable<DirectorySelectProps['request']>;
9
+ export type NetDiskRequest = FileItemTableRequest & {
10
+ directory: DirectoryRequest;
11
+ };
12
+ export declare class NetDiskModals {
13
+ static useNetDisk(netDiskRequest: NetDiskRequest, fileFormat?: string[], errorMessage?: ReactNode): [Handler<boolean>, ReactNode];
14
+ }
15
+ export {};
@@ -0,0 +1,28 @@
1
+ import React, { useState } from 'react';
2
+ import NetDisk from 'beer-assembly/NetDisk';
3
+ export class NetDiskModals {
4
+ static useNetDisk(netDiskRequest, fileFormat, errorMessage) {
5
+ const [isOpenModal, setIsOpenModal] = useState(false);
6
+ const handler = {
7
+ ok: (_callback) => {
8
+ setIsOpenModal(true);
9
+ }
10
+ };
11
+ return [handler, React.createElement(React.Fragment, null,
12
+ React.createElement(NetDisk, { open: isOpenModal, onCancel: () => setIsOpenModal(false), tableProps: {
13
+ request: {
14
+ ...netDiskRequest
15
+ },
16
+ directoryProps: {
17
+ request: {
18
+ ...netDiskRequest.directory
19
+ }
20
+ },
21
+ uploadFormat: fileFormat || ['xls', 'xlsx', 'doc', 'docx', 'pdf'],
22
+ uploadSize: 20,
23
+ uploadFormatMessage: errorMessage || React.createElement(React.Fragment, null,
24
+ "\u62B1\u6B49\uFF0C\u6587\u4EF6\u683C\u5F0F\u4E0D\u53D7\u652F\u6301\uFF0C\u8BF7\u4E0A\u4F20",
25
+ React.createElement("span", { style: { fontWeight: 500 } }, "\u6587\u6863\u6587\u4EF6"))
26
+ } }))];
27
+ }
28
+ }
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ export type Handler<T> = {
3
+ ok: (callback: (params: T) => Promise<boolean>, args?: {}, initialValues?: {}) => void;
4
+ };
5
+ export declare class UserModals {
6
+ static useResetPassword(): [Handler<string>, ReactNode];
7
+ }
package/UserModals.js ADDED
@@ -0,0 +1,39 @@
1
+ import React, { useRef, useState } from 'react';
2
+ import { Form, Input, Modal } from 'antd';
3
+ import { Promises } from './promises';
4
+ export class UserModals {
5
+ static useResetPassword() {
6
+ const [form] = Form.useForm();
7
+ const [isOpenModal, setIsOpenModal] = useState(false);
8
+ const callbackRef = useRef(undefined);
9
+ const onConfirm = async () => {
10
+ if (!await Promises.result(form?.validateFields())) {
11
+ return false;
12
+ }
13
+ if (callbackRef.current) {
14
+ if (await callbackRef.current?.(form.getFieldsValue())) {
15
+ setIsOpenModal(false);
16
+ }
17
+ }
18
+ else {
19
+ setIsOpenModal(false);
20
+ }
21
+ return true;
22
+ };
23
+ const handler = {
24
+ ok: (callback) => {
25
+ form.resetFields();
26
+ setIsOpenModal(true);
27
+ callbackRef.current = callback;
28
+ }
29
+ };
30
+ return [handler, React.createElement(React.Fragment, null,
31
+ React.createElement(Modal, { title: "\u91CD\u7F6E\u5BC6\u7801", width: 380, open: isOpenModal, onOk: () => onConfirm(), onCancel: () => setIsOpenModal(false), styles: { body: { padding: '12px 0' } } },
32
+ React.createElement(Form, { form: form, labelCol: { span: 5 } },
33
+ React.createElement(Form.Item, { name: "password", style: { margin: 0 }, rules: [{
34
+ required: true,
35
+ message: '请输入密码'
36
+ }] },
37
+ React.createElement(Input.Password, { placeholder: "\u65B0\u5BC6\u7801" })))))];
38
+ }
39
+ }
@@ -0,0 +1,33 @@
1
+ import { Slider, SliderCodeToken } from 'beer-assembly/SliderCode';
2
+ import React from 'react';
3
+ export declare type AuthPasswordProps = {
4
+ /**
5
+ * HTML 协议.
6
+ */
7
+ protocol: string;
8
+ /**
9
+ * 请求滑块验证码.
10
+ */
11
+ requestSlider: () => Promise<Slider>;
12
+ /**
13
+ * 滑块验证码样式.
14
+ */
15
+ sliderToken: SliderCodeToken;
16
+ /**
17
+ * 登录请求
18
+ * @param code 代码
19
+ * @param slider 滑块
20
+ * @param params 参数
21
+ */
22
+ requestLogin?: (code: string, slider: Slider, params: {
23
+ username: string;
24
+ password: string;
25
+ }) => Promise<boolean>;
26
+ /**
27
+ * 发出错误消息
28
+ * @param message 消息
29
+ */
30
+ onErrorMessage?: (message: string) => void;
31
+ };
32
+ declare const App: (props: AuthPasswordProps) => React.JSX.Element;
33
+ export default App;
@@ -0,0 +1,63 @@
1
+ import { Button, Checkbox, Dropdown, Form, Input } from 'antd';
2
+ import SliderCode from 'beer-assembly/SliderCode';
3
+ import { css } from '@emotion/css';
4
+ import React, { useState } from 'react';
5
+ import { useForm } from 'antd/es/form/Form';
6
+ const App = (props) => {
7
+ const [form] = useForm();
8
+ const [isLoading, setIsLoading] = useState(false);
9
+ const [protocol, setProtocol] = useState(false);
10
+ const onLogin = async () => {
11
+ const result = await form.validateFields();
12
+ if (props?.protocol !== undefined) {
13
+ if (!protocol) {
14
+ props?.onErrorMessage?.('请勾选用户协议');
15
+ return false;
16
+ }
17
+ }
18
+ if (result.username === undefined || result.username.trim() === '') {
19
+ props?.onErrorMessage?.('请输入账号信息');
20
+ return false;
21
+ }
22
+ if (result.password === undefined || result.password.trim() === '') {
23
+ props?.onErrorMessage?.('请输入密码信息');
24
+ return false;
25
+ }
26
+ setIsLoading(true);
27
+ return true;
28
+ };
29
+ return React.createElement(Form, { form: form },
30
+ React.createElement(Form.Item, { name: "username", style: { marginBottom: 12 } },
31
+ React.createElement(Input, { className: "input", maxLength: 32, placeholder: "\u8BF7\u8F93\u5165\u8D26\u53F7", style: { height: 36 } })),
32
+ React.createElement(Form.Item, { name: "password", style: { marginBottom: 12 } },
33
+ React.createElement(Input.Password, { className: "input", maxLength: 32, placeholder: "\u8BF7\u8F93\u5165\u5BC6\u7801", autoComplete: "on", style: { height: 36 } })),
34
+ props?.protocol === undefined ? undefined : React.createElement(Form.Item, { style: { marginBottom: 12 } },
35
+ React.createElement(Checkbox, { style: { fontSize: 13 }, onChange: (e) => {
36
+ setProtocol(e.target.checked);
37
+ } },
38
+ React.createElement("span", { dangerouslySetInnerHTML: { __html: props?.protocol } }))),
39
+ React.createElement(Form.Item, null,
40
+ React.createElement(Dropdown, { placement: "top", arrow: true, destroyPopupOnHide: true, dropdownRender: () => React.createElement(React.Fragment, null,
41
+ React.createElement("div", { style: {
42
+ width: '250px',
43
+ display: 'block',
44
+ marginLeft: '35px'
45
+ } },
46
+ React.createElement(SliderCode, { request: props?.requestSlider, onReceipt: async (code, slider) => {
47
+ const params = form.getFieldsValue();
48
+ const result = (await props?.requestLogin?.(code, slider, params)) || true;
49
+ // 如果处理成功, 关闭Loading
50
+ if (result) {
51
+ setIsLoading(false);
52
+ }
53
+ return result;
54
+ }, token: props?.sliderToken }))), trigger: ['click'], open: isLoading },
55
+ React.createElement("div", null)),
56
+ React.createElement(Button, { type: "primary", className: css `
57
+ width: 100%;
58
+ height: 38px;
59
+ font-size: 14px;
60
+ margin-top: 4px;
61
+ `, loading: isLoading, onClick: onLogin }, "\u767B\u5F55")));
62
+ };
63
+ export default App;
@@ -0,0 +1,53 @@
1
+ import { FC } from 'react';
2
+ import { Slider, SliderCodeToken } from 'beer-assembly/SliderCode';
3
+ declare type AuthStyleProps = {
4
+ /**
5
+ * 主颜色.
6
+ */
7
+ colorPrimary: string;
8
+ /**
9
+ * Logo 图片.
10
+ */
11
+ logo: string;
12
+ /**
13
+ * 侧边栏图片
14
+ */
15
+ sidebar: string;
16
+ /**
17
+ * 描述.
18
+ */
19
+ description: string;
20
+ /**
21
+ * HTML 协议.
22
+ */
23
+ protocol: string;
24
+ /**
25
+ * HTML 关于.
26
+ */
27
+ copyright: string;
28
+ /**
29
+ * 请求滑块验证码.
30
+ */
31
+ requestSlider: () => Promise<Slider>;
32
+ /**
33
+ * 滑块验证码样式.
34
+ */
35
+ sliderToken: SliderCodeToken;
36
+ /**
37
+ * 登录对象.
38
+ * @param params 参数
39
+ */
40
+ systemLogin?: (params: {
41
+ account: string;
42
+ password: string;
43
+ authCode: string;
44
+ code: string;
45
+ }) => Promise<{
46
+ success: boolean;
47
+ message?: string;
48
+ code: string;
49
+ data?: {};
50
+ }>;
51
+ };
52
+ declare const App: FC<AuthStyleProps>;
53
+ export default App;
@@ -0,0 +1,115 @@
1
+ import React, { useState } from 'react';
2
+ import { Alert, ConfigProvider, Tabs, theme } from 'antd';
3
+ import { css } from '@emotion/css';
4
+ import AuthPassword from './AuthPassword';
5
+ import ImageBackground from '../images/assets_background_01.png';
6
+ import { Session } from './session';
7
+ const App = (props) => {
8
+ const { token } = theme.useToken();
9
+ const [errorMessage, setErrorMessage] = useState('');
10
+ const onConfirmLogin = async (code, slider, params) => {
11
+ const result = await props?.systemLogin?.({
12
+ account: params.username.trim(),
13
+ password: params.password.trim(),
14
+ authCode: slider.authCode,
15
+ code
16
+ });
17
+ if (result === undefined) {
18
+ setErrorMessage('登录失败,授权没有配置!');
19
+ return true;
20
+ }
21
+ if (result.success) {
22
+ setErrorMessage('');
23
+ Session.login(result.data);
24
+ }
25
+ else {
26
+ // 如果是1201 则是重新加载验证码
27
+ if (result.code === '1201') {
28
+ return false;
29
+ }
30
+ setErrorMessage(result.message || '');
31
+ }
32
+ return true;
33
+ };
34
+ return React.createElement("div", { className: css `
35
+ width: 100%;
36
+ height: 100vh;
37
+ margin: 0;
38
+ overflow: hidden;
39
+ background: url(${ImageBackground}) no-repeat;
40
+ background-size: cover;
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: center;
44
+ ` }, props?.colorPrimary === undefined ? undefined : React.createElement(ConfigProvider, { theme: {
45
+ token: {
46
+ colorPrimary: props?.colorPrimary || '#0064ff'
47
+ }
48
+ } },
49
+ React.createElement("div", { className: css `
50
+ background: #fff;
51
+ border-radius: ${token.borderRadius + 4}px;
52
+ overflow: hidden;
53
+ display: flex;
54
+ margin-top: -20px;
55
+ height: 410px;
56
+ ` },
57
+ React.createElement("div", { style: {
58
+ width: 400
59
+ } },
60
+ React.createElement("img", { className: css `
61
+ width: 100%;
62
+ display: block;
63
+ `, src: props.sidebar, alt: "" })),
64
+ React.createElement("div", { className: css `
65
+ width: 320px;
66
+ padding: 30px 40px 0 40px;
67
+ ` },
68
+ React.createElement("img", { className: css `
69
+ height: 42px;
70
+ margin: 0 auto 0 auto;
71
+ display: block;
72
+ `, src: props?.logo, alt: "" }),
73
+ React.createElement("p", { className: css `
74
+ font-size: 13px;
75
+ margin: 6px auto 10px auto;
76
+ text-align: center;
77
+ color: rgba(0, 0, 0, 0.45);
78
+ ` }, props.description),
79
+ React.createElement(Tabs, { defaultActiveKey: "1", items: [
80
+ {
81
+ key: '1',
82
+ label: '账号密码登录',
83
+ children: React.createElement("div", { className: css `
84
+ min-height: 200px;
85
+ ` },
86
+ errorMessage !== '' ? React.createElement(Alert, { style: {
87
+ fontSize: '12px',
88
+ marginBottom: '12px',
89
+ color: '#fa2c19',
90
+ padding: '6px 10px',
91
+ fontWeight: '500'
92
+ }, message: errorMessage, type: "error", showIcon: true }) : undefined,
93
+ React.createElement(AuthPassword, { protocol: props?.protocol, requestSlider: props?.requestSlider, sliderToken: props?.sliderToken, requestLogin: onConfirmLogin, onErrorMessage: (message) => setErrorMessage(message) }))
94
+ }
95
+ ] })),
96
+ React.createElement("p", { className: css `
97
+ text-align: center;
98
+ font-size: 12px;
99
+ color: #666;
100
+ position: absolute;
101
+ left: 0;
102
+ right: 0;
103
+ margin-top: 440px;
104
+
105
+ & a {
106
+ color: #666;
107
+ text-decoration: none;
108
+ }
109
+
110
+ & a:hover {
111
+ text-decoration: underline;
112
+ }
113
+ `, dangerouslySetInnerHTML: { __html: props?.copyright || '' } }))));
114
+ };
115
+ export default App;
@@ -0,0 +1,49 @@
1
+ import { FC } from 'react';
2
+ import { Slider, SliderCodeToken } from 'beer-assembly/SliderCode';
3
+ declare type AuthStyleProps = {
4
+ /**
5
+ * 主颜色.
6
+ */
7
+ colorPrimary: string;
8
+ /**
9
+ * Logo 图片.
10
+ */
11
+ logo: string;
12
+ /**
13
+ * 描述.
14
+ */
15
+ description: string;
16
+ /**
17
+ * HTML 协议.
18
+ */
19
+ protocol: string;
20
+ /**
21
+ * HTML 关于.
22
+ */
23
+ copyright: string;
24
+ /**
25
+ * 请求滑块验证码.
26
+ */
27
+ requestSlider: () => Promise<Slider>;
28
+ /**
29
+ * 滑块验证码样式.
30
+ */
31
+ sliderToken: SliderCodeToken;
32
+ /**
33
+ * 登录对象.
34
+ * @param params 参数
35
+ */
36
+ systemLogin?: (params: {
37
+ account: string;
38
+ password: string;
39
+ authCode: string;
40
+ code: string;
41
+ }) => Promise<{
42
+ success: boolean;
43
+ message?: string;
44
+ code: string;
45
+ data?: {};
46
+ }>;
47
+ };
48
+ declare const App: FC<AuthStyleProps>;
49
+ export default App;
@@ -0,0 +1,108 @@
1
+ import React, { useState } from 'react';
2
+ import { Alert, ConfigProvider, Tabs, theme } from 'antd';
3
+ import { css } from '@emotion/css';
4
+ import ImageBackground from '../images/assets_background_01.png';
5
+ import { Session } from './session';
6
+ import AuthPassword from './AuthPassword';
7
+ const App = (props) => {
8
+ const { token } = theme.useToken();
9
+ const [errorMessage, setErrorMessage] = useState('');
10
+ const onConfirmLogin = async (code, slider, params) => {
11
+ const result = await props?.systemLogin?.({
12
+ account: params.username.trim(),
13
+ password: params.password.trim(),
14
+ authCode: slider.authCode,
15
+ code
16
+ });
17
+ if (result === undefined) {
18
+ setErrorMessage('登录失败,授权没有配置!');
19
+ return false;
20
+ }
21
+ if (result.success) {
22
+ setErrorMessage('');
23
+ Session.login(result.data);
24
+ }
25
+ else {
26
+ // 如果是1201 则是重新加载验证码
27
+ if (result.code === '1201') {
28
+ return false;
29
+ }
30
+ setErrorMessage(result.message || '');
31
+ }
32
+ return true;
33
+ };
34
+ return React.createElement("div", { className: css `
35
+ width: 100%;
36
+ height: 100vh;
37
+ margin: 0;
38
+ overflow: hidden;
39
+ background: url(${ImageBackground}) no-repeat;
40
+ background-size: cover;
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: center;
44
+ ` }, props?.colorPrimary === undefined ? undefined : React.createElement(ConfigProvider, { theme: {
45
+ token: {
46
+ colorPrimary: props?.colorPrimary || '#0064ff'
47
+ }
48
+ } },
49
+ React.createElement("div", { className: css `
50
+ background: #fff;
51
+ border-radius: ${token.borderRadius + 4}px;
52
+ overflow: hidden;
53
+ display: flex;
54
+ margin-top: -20px;
55
+ height: 410px;
56
+ ` },
57
+ React.createElement("div", { className: css `
58
+ width: 320px;
59
+ padding: 30px 40px 0 40px;
60
+ ` },
61
+ React.createElement("img", { className: css `
62
+ height: 42px;
63
+ margin: 0 auto 0 auto;
64
+ display: block;
65
+ `, src: props.logo, alt: "" }),
66
+ React.createElement("p", { className: css `
67
+ font-size: 13px;
68
+ margin: 6px auto 10px auto;
69
+ text-align: center;
70
+ color: rgba(0, 0, 0, 0.45);
71
+ ` }, props.description),
72
+ React.createElement(Tabs, { defaultActiveKey: "1", items: [
73
+ {
74
+ key: '1',
75
+ label: '账号密码登录',
76
+ children: React.createElement("div", { className: css `
77
+ min-height: 200px;
78
+ ` },
79
+ errorMessage !== '' ? React.createElement(Alert, { style: {
80
+ fontSize: '12px',
81
+ marginBottom: '12px',
82
+ color: '#fa2c19',
83
+ padding: '6px 10px',
84
+ fontWeight: '500'
85
+ }, message: errorMessage, type: "error", showIcon: true }) : undefined,
86
+ React.createElement(AuthPassword, { protocol: props?.protocol, requestSlider: props?.requestSlider, sliderToken: props?.sliderToken, requestLogin: onConfirmLogin, onErrorMessage: (message) => setErrorMessage(message) }))
87
+ }
88
+ ] })),
89
+ React.createElement("p", { className: css `
90
+ text-align: center;
91
+ font-size: 12px;
92
+ color: #666;
93
+ position: absolute;
94
+ left: 0;
95
+ right: 0;
96
+ margin-top: 440px;
97
+
98
+ & a {
99
+ color: #666;
100
+ text-decoration: none;
101
+ }
102
+
103
+ & a:hover {
104
+ text-decoration: underline;
105
+ }
106
+ `, dangerouslySetInnerHTML: { __html: props?.copyright || '' } }))));
107
+ };
108
+ export default App;
@@ -0,0 +1,31 @@
1
+ import { FC } from 'react';
2
+ declare type AuthThirdPartyAuthProps = {
3
+ /**
4
+ * Logo
5
+ */
6
+ logo: string;
7
+ /**
8
+ * 描述
9
+ */
10
+ description: string;
11
+ /**
12
+ * 用户信息
13
+ */
14
+ userInfo?: {
15
+ /**
16
+ * 获取用户信息是否成功
17
+ */
18
+ status: boolean;
19
+ /**
20
+ * 头像地址
21
+ */
22
+ avatar: string;
23
+ /**
24
+ * 昵称
25
+ */
26
+ nickName: string;
27
+ };
28
+ onConfirm?: () => void;
29
+ };
30
+ declare const App: FC<AuthThirdPartyAuthProps>;
31
+ export default App;
@@ -0,0 +1,96 @@
1
+ import React from 'react';
2
+ import { css } from '@emotion/css';
3
+ import { Button, ConfigProvider, theme } from 'antd';
4
+ import ImageBackground from '../images/assets_background_01.png';
5
+ import ImageAvatar from './avatar.png';
6
+ const App = (props) => {
7
+ const { token } = theme.useToken();
8
+ return React.createElement("div", { className: css `
9
+ width: 100%;
10
+ height: 100vh;
11
+ margin: 0;
12
+ overflow: hidden;
13
+ background: url(${ImageBackground}) no-repeat;
14
+ background-size: cover;
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ ` },
19
+ React.createElement(ConfigProvider, { theme: {
20
+ token: {
21
+ colorPrimary: '#B22222'
22
+ }
23
+ } },
24
+ React.createElement("div", { className: css `
25
+ width: 280px;
26
+ min-height: 400px;
27
+ margin: 0 auto;
28
+ background: #fff;
29
+ border-radius: ${token.borderRadius + 4}px;
30
+ overflow: hidden;
31
+ padding: 30px 48px 35px 48px;
32
+ ` },
33
+ React.createElement("img", { className: css `
34
+ height: 32px;
35
+ margin: 0 auto 0 auto;
36
+ display: block;
37
+ `, src: props.logo, alt: "" }),
38
+ React.createElement("p", { className: css `
39
+ font-size: 13px;
40
+ margin: 8px auto 10px auto;
41
+ text-align: center;
42
+ color: rgba(0, 0, 0, 0.45);
43
+ ` }, props.description),
44
+ React.createElement("div", { className: css `
45
+ border-bottom: 1px solid #eee;
46
+ margin-top: 20px;
47
+ margin-bottom: 25px;
48
+ ` }),
49
+ React.createElement("div", { className: css `
50
+ width: 140px;
51
+ height: 140px;
52
+ background: #eee;
53
+ border-radius: 10px;
54
+ margin: auto;
55
+ overflow: hidden;
56
+ ` }, !props?.userInfo?.status ? undefined
57
+ : React.createElement("img", { className: css `
58
+ width: 100%;
59
+ height: 100%;
60
+ `, src: props?.userInfo?.avatar === '' ? ImageAvatar : props?.userInfo?.avatar, alt: "avatar" })),
61
+ React.createElement("p", { className: css `
62
+ font-weight: 600;
63
+ font-size: 16px;
64
+ text-align: center;
65
+ margin: auto;
66
+ display: block;
67
+ padding: 15px 0 20px 0;
68
+ ` }, props?.userInfo?.status ? props?.userInfo?.nickName : '连接中 ...'),
69
+ React.createElement(Button, { type: "primary", className: css `
70
+ width: 100%;
71
+ height: 38px;
72
+ font-size: 14px;
73
+ margin-top: 4px;
74
+ `, onClick: props?.onConfirm, disabled: !props?.userInfo?.status }, "\u8FDB\u5165\u6570\u636E\u4E2D\u53F0"),
75
+ /wxwork/i.test(navigator.userAgent) ? React.createElement("p", { className: css `
76
+ margin-top: 40px;
77
+ color: #999;
78
+ font-size: 13px;
79
+ text-align: center;
80
+ line-height: 1.56;
81
+ ` },
82
+ "\u60A8\u53EF\u4EE5\u5728",
83
+ React.createElement("span", { style: {
84
+ fontWeight: 500,
85
+ color: '#666',
86
+ margin: '0 2px'
87
+ } }, "\u53F3\u4E0A\u89D2"),
88
+ "\u9009\u62E9",
89
+ React.createElement("span", { style: {
90
+ fontWeight: 500,
91
+ color: '#666',
92
+ margin: '0 2px'
93
+ } }, "\u5728\u6D4F\u89C8\u5668\u6253\u5F00"),
94
+ "\u4EE5\u514D\u767B\u5F55\uFF0C\u65B9\u4FBF\u5FEB\u6377\u5730\u8BBF\u95EE\u6211\u4EEC\u7684\u670D\u52A1\u3002") : undefined)));
95
+ };
96
+ export default App;
@@ -0,0 +1,7 @@
1
+ export declare class Session {
2
+ /**
3
+ * 写入会话缓存.
4
+ * @param userInfo 用户信息.
5
+ */
6
+ static login(userInfo?: {}): void;
7
+ }
@@ -0,0 +1,15 @@
1
+ import Utils from 'beer-network/utils';
2
+ export class Session {
3
+ /**
4
+ * 写入会话缓存.
5
+ * @param userInfo 用户信息.
6
+ */
7
+ static login(userInfo) {
8
+ if (userInfo === undefined) {
9
+ return;
10
+ }
11
+ localStorage.setItem('login_user', JSON.stringify(userInfo));
12
+ const goto = Utils.getParam('goto');
13
+ window.location.replace(goto || '/home');
14
+ }
15
+ }
@@ -0,0 +1,14 @@
1
+ export declare class Config {
2
+ static colors: {
3
+ primary: string;
4
+ success: string;
5
+ danger: string;
6
+ warning: string;
7
+ info: string;
8
+ light: string;
9
+ };
10
+ static loadingText: string[];
11
+ static goodMorning: string[];
12
+ static goodAfternoon: string[];
13
+ static goodEvening: string[];
14
+ }
@@ -0,0 +1,78 @@
1
+ export class Config {
2
+ }
3
+ Config.colors = {
4
+ primary: '#108ee9',
5
+ success: '#389e0d',
6
+ danger: '#cf1322',
7
+ warning: '#faad14',
8
+ info: '#0958d9',
9
+ light: '#999'
10
+ };
11
+ Config.loadingText = [
12
+ '请稍候,正在加载数据...',
13
+ '系统准备中,请稍等...',
14
+ '准备您的体验,马上回来...',
15
+ '系统正在整理文件...',
16
+ '在与未来建立联系...',
17
+ '正在构建您的旅程...',
18
+ '数据正在装载,请耐心等待...',
19
+ '读取档案中,请稍候...',
20
+ '正在开启您的应用...',
21
+ '加载中,请稍后...',
22
+ '系统正在同步,请耐心等候...',
23
+ '正在准备您的界面...',
24
+ '系统正在激活中...',
25
+ '正在处理中,请稍后...',
26
+ '一切都在准备中,马上见...',
27
+ '正在初始化设置...',
28
+ '在计算最优路径...',
29
+ '数据加载中,稍等片刻...',
30
+ '正在准备资源...',
31
+ '正在收集信息,请稍候...',
32
+ '在构建数字世界...',
33
+ '载入中,请稍等...',
34
+ '正在启动服务...',
35
+ '数据处理中,请稍后...',
36
+ '正在连接网络...',
37
+ '在获取最新信息...',
38
+ '加载模块中,请耐心等候...',
39
+ '系统优化中,请稍后...',
40
+ '正在初始化,请稍等...',
41
+ '快要完成了,谢谢您的耐心...'
42
+ ];
43
+ Config.goodMorning = [
44
+ '早安!愿您拥有愉快的一天。',
45
+ '早上好!开启新的一天。',
46
+ '早晨的阳光给你带来美好的一天。',
47
+ '愿您今天充满活力,早上好!',
48
+ '早安!新的一天,新的希望。',
49
+ '早上好!一起迎接新的开始。',
50
+ '早晨的微风让您的心情更加愉快。',
51
+ '早上好!迎接美好的一天。',
52
+ '早安!享受这美好的清晨。',
53
+ '早上好!愿您有个美好的一天。'
54
+ ];
55
+ Config.goodAfternoon = [
56
+ '下午好!下午的时光给您带来温暖。',
57
+ '愿您度过一个愉快的下午。',
58
+ '下午好!保持积极的心态。',
59
+ '下午的阳光洒满大地,祝您心情愉悦。',
60
+ '下午好!希望今天的一切都顺利。',
61
+ '祝您度过一个轻松的下午。',
62
+ '下午好!享受这片刻的宁静。',
63
+ '下午是小憩的好时光,祝您下午愉快。',
64
+ '下午好!愿您今天过得顺利。',
65
+ '下午是忙碌中的小憩时光,祝您愉快。'
66
+ ];
67
+ Config.goodEvening = [
68
+ '晚上好!愿您度过一个愉快的夜晚。',
69
+ '夜幕降临,祝您晚上愉快。',
70
+ '晚上好!希望您有一个美好的夜晚。',
71
+ '在星光下,愿您心情愉悦。',
72
+ '晚上好!祝您一晚安宁。',
73
+ '夜晚的宁静带给您舒适的感觉。',
74
+ '愿您度过一个平静的夜晚,晚上好!',
75
+ '晚上好!请享受这宁静的夜晚。',
76
+ '在星光的陪伴下,祝您晚安。',
77
+ '晚上好!愿您有个温馨的夜晚。'
78
+ ];
File without changes
@@ -0,0 +1,9 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="28" height="23" fill="none" viewBox="0 0 28 23" x="150" y="130" data-name="spacearea" data-svg-id="ea31b1f100">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 22.5A2.25 2.25 0 0 1 0 20.25V2.583A2.25 2.25 0 0 1 2.25.333h7.083l2.334 2.334H25.75A2.25 2.25 0 0 1 28 4.917V20.25a2.25 2.25 0 0 1-2.25 2.25H2.25z" fill="url(#g)"/>
3
+ <defs>
4
+ <linearGradient id="g" x1="-13.917" y1="11.351" x2="7.53" y2="38.443" gradientUnits="userSpaceOnUse">
5
+ <stop stop-color="#6BBEFE"/>
6
+ <stop offset=".999" stop-color="#59ABFE"/>
7
+ </linearGradient>
8
+ </defs>
9
+ </svg>
package/icon/empty.svg ADDED
@@ -0,0 +1,43 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="130" height="80">
2
+ <defs>
3
+ <linearGradient x1="52.348%" y1="74.611%" x2="52.348%" y2="-17.635%" id="a">
4
+ <stop stop-color="#DEDEDE" stop-opacity="0" offset="0%"/>
5
+ <stop stop-color="#A9A9A9" stop-opacity=".3" offset="100%"/>
6
+ </linearGradient>
7
+ <linearGradient x1="44.79%" y1="100%" x2="44.79%" y2="0%" id="b">
8
+ <stop stop-color="#FFF" stop-opacity="0" offset="0%"/>
9
+ <stop stop-color="#96A1C5" stop-opacity=".373" offset="100%"/>
10
+ </linearGradient>
11
+ <linearGradient x1="50%" y1="100%" x2="50%" y2="-19.675%" id="c">
12
+ <stop stop-color="#FFF" stop-opacity="0" offset="0%"/>
13
+ <stop stop-color="#919191" stop-opacity=".15" offset="100%"/>
14
+ </linearGradient>
15
+ <linearGradient x1="50%" y1="0%" x2="50%" y2="44.95%" id="d">
16
+ <stop stop-color="#5389F5" offset="0%"/>
17
+ <stop stop-color="#416FDC" offset="100%"/>
18
+ </linearGradient>
19
+ <linearGradient x1="63.345%" y1="100%" x2="63.345%" y2="-5.316%" id="e">
20
+ <stop stop-color="#DCE9FF" offset="0%"/>
21
+ <stop stop-color="#B6CFFF" offset="100%"/>
22
+ </linearGradient>
23
+ <linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="f">
24
+ <stop stop-color="#7CA5F7" offset="0%"/>
25
+ <stop stop-color="#C4D6FC" offset="100%"/>
26
+ </linearGradient>
27
+ </defs>
28
+ <g transform="translate(-1.866 .364)" fill="none" fill-rule="evenodd">
29
+ <path d="M27.94 14.864c1.326-4.192 2.56-6.802 3.7-7.831 3.157-2.848 7.522-1.298 8.45-1.076 3.26.782 2.2-4.364 4.997-5.41 1.864-.697 3.397.155 4.6 2.556C50.752.863 52.375-.163 54.556.02c3.272.277 4.417 11.328 8.913 8.909 4.497-2.42 10.01-2.973 12.365.623.509.778.704-.429 4.166-4.55C83.462.88 86.914-.936 93.996 1.464c3.22 1.09 5.868 4.045 7.947 8.864 0 6.878 5.06 10.95 15.178 12.213 15.179 1.895 3.397 18.214-15.178 22.993-18.576 4.78-61.343 7.36-84.551-4.716C1.92 32.769 5.436 24.117 27.939 14.864z"
30
+ fill="url(#a)" opacity=".8"/>
31
+ <ellipse fill="url(#b)" cx="66" cy="69.166" rx="27.987" ry="6.478"/>
32
+ <path d="M113.25 77.249c-21.043 5.278-92.87-.759-100.515-3.516-3.721-1.343-7.075-3.868-10.061-7.576a2.822 2.822 0 0 1 2.198-4.593h125.514c2.605 6.938-3.107 12.166-17.136 15.685z"
33
+ fill="url(#c)" opacity=".675"/>
34
+ <g fill-rule="nonzero">
35
+ <path d="M43.396 12.098L33.825.906a2.434 2.434 0 0 0-1.837-.86h-20.58c-.706 0-1.377.324-1.837.86L0 12.098v6.144h43.396v-6.144z"
36
+ fill="url(#d)" transform="translate(44.08 39.707)"/>
37
+ <path d="M40.684 18.468L32.307 8.72a2.136 2.136 0 0 0-1.622-.725H12.711c-.617 0-1.22.256-1.622.725l-8.377 9.748v5.354h37.972v-5.354z"
38
+ fill="url(#e)" transform="translate(44.08 39.707)"/>
39
+ <path d="M43.396 25.283c0 .853-.384 1.62-.99 2.134l-.123.1a2.758 2.758 0 0 1-1.67.56H2.784c-.342 0-.669-.062-.971-.176l-.15-.06A2.802 2.802 0 0 1 0 25.282V12.165h10.529c1.163 0 2.1.957 2.1 2.118v.015c0 1.162.948 2.099 2.111 2.099h13.916a2.113 2.113 0 0 0 2.111-2.107c0-1.166.938-2.125 2.1-2.125h10.53z"
40
+ fill="url(#f)" transform="translate(44.08 39.707)"/>
41
+ </g>
42
+ </g>
43
+ </svg>
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "beer-assembly-biz",
3
+ "private": false,
4
+ "version": "1.1.1-alpha.1",
5
+ "scripts": {
6
+ "pub-w": "tsc && copy package.json .\\dist\\package.json && npm publish ./dist",
7
+ "pub-m": "tsc && cp -a src/icon ./dist && cp -a src/fonts ./dist && cp package.json ./dist/package.json && npm publish ./dist"
8
+ },
9
+ "dependencies": {
10
+ "@ant-design/icons": "^5.2.6",
11
+ "@ant-design/pro-components": "^2.6.49",
12
+ "@emotion/css": "^11.11.2",
13
+ "antd": "^5.10.0",
14
+ "beer-network": "^1.1.1-alpha.14",
15
+ "beer-assembly": "^1.1.1-alpha.57",
16
+ "dayjs": "^1.11.13",
17
+ "history": "^5.3.0",
18
+ "lodash": "^4.17.21",
19
+ "react": "^18.2.0",
20
+ "react-dom": "^18.2.0",
21
+ "react-router-dom": "^6.15.0"
22
+ },
23
+ "devDependencies": {
24
+ "@babel/eslint-parser": "^7.22.15",
25
+ "@types/lodash": "^4.17.1",
26
+ "@types/react": "^18.2.46",
27
+ "@types/react-dom": "^18.2.18",
28
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
29
+ "@typescript-eslint/parser": "^6.0.0",
30
+ "eslint": "^8.45.0",
31
+ "eslint-config-airbnb": "^19.0.4",
32
+ "eslint-config-ali": "^14.0.2",
33
+ "eslint-plugin-import": "^2.28.1",
34
+ "eslint-plugin-react": "^7.33.2",
35
+ "eslint-plugin-react-hooks": "^4.6.0",
36
+ "eslint-plugin-react-refresh": "^0.4.3",
37
+ "typescript": "^5.4.5"
38
+ }
39
+ }
package/promises.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export declare class Promises {
2
+ /**
3
+ * 获取异步任务结果
4
+ * @param promise 任务
5
+ */
6
+ static result(promise: Promise<any>): Promise<boolean>;
7
+ }
package/promises.js ADDED
@@ -0,0 +1,12 @@
1
+ export class Promises {
2
+ /**
3
+ * 获取异步任务结果
4
+ * @param promise 任务
5
+ */
6
+ static async result(promise) {
7
+ return new Promise(resolve => {
8
+ promise?.catch(() => resolve(false))
9
+ .then(() => resolve(true));
10
+ });
11
+ }
12
+ }