cfel-base-components 2.6.0 → 2.6.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "2.6.0",
3
+ "version": "2.6.2",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -15,6 +15,12 @@
15
15
  },
16
16
  "author": "",
17
17
  "license": "ISC",
18
+ "config": {
19
+ "registry": "https://registry.npmjs.org/"
20
+ },
21
+ "publishConfig": {
22
+ "registry": "https://registry.npmjs.org/"
23
+ },
18
24
  "devDependencies": {
19
25
  "@babel/cli": "^7.22.5",
20
26
  "@babel/core": "^7.22.5",
@@ -1,5 +1,5 @@
1
1
  import axios, { AxiosRequestHeaders } from 'axios'
2
- import { notification } from 'antd'
2
+ import { Modal, notification } from 'antd'
3
3
 
4
4
  let UMI_APP_BASEURL: any = window.location.origin || process.env
5
5
  const instance = axios.create({ baseURL: UMI_APP_BASEURL })
@@ -61,7 +61,24 @@ instance.interceptors.response.use(
61
61
  notification.error({
62
62
  message: response?.data?.errorMsg || CodeMessage[status] || '服务暂不可用,请检查网络',
63
63
  })
64
-
64
+ // 如果后端在非2xx响应中也返回了业务 errorCode,处理 PRODUCT_NOT_REGISTRY
65
+ const respData = response?.data || {}
66
+ if (respData && respData.errorCode === 'PRODUCT_NOT_REGISTRY') {
67
+ if (typeof (window as any).showProductNotRegisteredOverlay === 'function') {
68
+ ;(window as any).showProductNotRegisteredOverlay({
69
+ onAction: () => {},
70
+ })
71
+ } else {
72
+ if (!(window as any).__PRODUCT_NOT_REGISTRY_SHOWN__) {
73
+ ;(window as any).__PRODUCT_NOT_REGISTRY_SHOWN__ = true
74
+ Modal.warning({
75
+ title: '产品未开通',
76
+ content: '当前产品未开通或产品编码错误,请联系管理员或检查产品编码。',
77
+ okText: '知道了',
78
+ })
79
+ }
80
+ }
81
+ }
65
82
  if (status === 401) {
66
83
  }
67
84
 
@@ -0,0 +1,83 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { Button } from 'antd'
3
+
4
+ type OverlayOptions = {
5
+ title?: string
6
+ message?: string
7
+ actionText?: string
8
+ onAction?: () => void
9
+ }
10
+
11
+ export default function ProductOverlay() {
12
+ const [visible, setVisible] = useState(false)
13
+ const [options, setOptions] = useState<OverlayOptions | null>(null)
14
+
15
+ useEffect(() => {
16
+ // 挂载全局方法,供外部调用
17
+ ;(window as any).showProductNotRegisteredOverlay = (opts?: OverlayOptions) => {
18
+ setOptions({
19
+ title: opts?.title || '产品未开通',
20
+ message: opts?.message || '当前产品未开通或产品编码错误,请联系管理员或检查产品编码。',
21
+ actionText: opts?.actionText || '关闭',
22
+ onAction: opts?.onAction,
23
+ })
24
+ setVisible(true)
25
+ }
26
+ ;(window as any).hideProductNotRegisteredOverlay = () => {
27
+ setVisible(false)
28
+ setOptions(null)
29
+ }
30
+
31
+ return () => {
32
+ // 卸载全局方法
33
+ try {
34
+ delete (window as any).showProductNotRegisteredOverlay
35
+ delete (window as any).hideProductNotRegisteredOverlay
36
+ } catch (e) {}
37
+ }
38
+ }, [])
39
+
40
+ if (!visible) return null
41
+
42
+ return (
43
+ <div
44
+ style={{
45
+ position: 'fixed',
46
+ left: 0,
47
+ top: 0,
48
+ right: 0,
49
+ bottom: 0,
50
+ background: 'rgba(0,0,0,0.6)',
51
+ zIndex: 99999,
52
+ display: 'flex',
53
+ alignItems: 'center',
54
+ justifyContent: 'center',
55
+ }}
56
+ >
57
+ <div
58
+ style={{
59
+ width: 520,
60
+ background: '#fff',
61
+ borderRadius: 8,
62
+ padding: 24,
63
+ boxShadow: '0 4px 24px rgba(0,0,0,0.2)',
64
+ textAlign: 'center',
65
+ }}
66
+ >
67
+ <h3 style={{ marginBottom: 12 }}>{options?.title}</h3>
68
+ <div style={{ color: '#666', marginBottom: 18 }}>{options?.message}</div>
69
+ <div style={{ display: 'flex', justifyContent: 'center', gap: 12 }}>
70
+ <Button
71
+ onClick={() => {
72
+ setVisible(false)
73
+ if (options?.onAction) options.onAction()
74
+ }}
75
+ type="primary"
76
+ >
77
+ {options?.actionText}
78
+ </Button>
79
+ </div>
80
+ </div>
81
+ </div>
82
+ )
83
+ }
@@ -6,8 +6,6 @@ ul {
6
6
  margin: 0;
7
7
  }
8
8
 
9
-
10
-
11
9
  .ant-popover-inner {
12
10
  padding: 8px !important;
13
11
  }
@@ -107,9 +105,7 @@ ul {
107
105
  scale: 1.25;
108
106
  background: #788bb1;
109
107
  border-radius: 2px;
110
- transition:
111
- background 0.3s cubic-bezier(0.645, 0.045, 0.355, 1),
112
- transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
108
+ transition: background 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
113
109
  content: '';
114
110
  }
115
111
 
@@ -521,9 +517,7 @@ body {
521
517
 
522
518
  .search {
523
519
  height: 40px;
524
- box-shadow:
525
- inset 0px 2px 1px 0px rgba(0, 0, 0, 0.05),
526
- inset 0px -2px 0px 0px rgba(255, 255, 255, 0.3);
520
+ box-shadow: inset 0px 2px 1px 0px rgba(0, 0, 0, 0.05), inset 0px -2px 0px 0px rgba(255, 255, 255, 0.3);
527
521
  border-radius: 10px;
528
522
  backdrop-filter: blur(10px);
529
523
  position: relative;
@@ -593,9 +587,7 @@ body {
593
587
  .search-mobile-console {
594
588
  width: 40px;
595
589
  height: 40px;
596
- box-shadow:
597
- inset 0px 2px 1px 0px rgba(0, 0, 0, 0.05),
598
- inset 0px -2px 0px 0px rgba(255, 255, 255, 0.3);
590
+ box-shadow: inset 0px 2px 1px 0px rgba(0, 0, 0, 0.05), inset 0px -2px 0px 0px rgba(255, 255, 255, 0.3);
599
591
  border-radius: 10px;
600
592
  backdrop-filter: blur(10px);
601
593
  padding-top: 11px;
@@ -616,14 +608,7 @@ body {
616
608
  }
617
609
 
618
610
  .layout-side-mask2 {
619
- background: radial-gradient(
620
- 152% 131% at 3% 1%,
621
- #e8e2fa 0%,
622
- #c4d0f3 10%,
623
- #afcaf8 25%,
624
- #89bff6 49%,
625
- #478eed 100%
626
- );
611
+ background: radial-gradient(152% 131% at 3% 1%, #e8e2fa 0%, #c4d0f3 10%, #afcaf8 25%, #89bff6 49%, #478eed 100%);
627
612
  opacity: 0.3;
628
613
  position: absolute;
629
614
  top: 0;
@@ -707,10 +692,6 @@ body {
707
692
  display: flex;
708
693
  justify-content: center;
709
694
  align-items: center;
710
-
711
- &:hover {
712
- background: rgba(0, 0, 0, 0.06);
713
- }
714
695
  }
715
696
  }
716
697
 
@@ -773,9 +754,7 @@ body {
773
754
  box-shadow: inset 0px -1px 0px 0px #edeefd;
774
755
  color: black;
775
756
  border-radius: 16px;
776
- box-shadow:
777
- 0 8px 20px rgba(0, 0, 0, 0.1),
778
- inset 0 1px 0 rgba(255, 255, 255, 0.1);
757
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
779
758
  backdrop-filter: blur(10px);
780
759
  padding: 16px;
781
760
  border: 1px solid rgba(255, 255, 255, 0.08);
package/src/index.tsx CHANGED
@@ -16,6 +16,7 @@ import CpcAccountInfo from './components/universal-pages/cpcAccountInfo' //cpc
16
16
  import CpcRole from './components/universal-pages/cpcRole' //cpc 角色
17
17
  import CpcRoleInfo from './components/universal-pages/cpcRoleInfo' //cpc角色详情
18
18
  import { getUrlParams, downloadFile, timeFormatter } from './utils/index'
19
+
19
20
  export {
20
21
  LiosLayout,
21
22
  LiosLayoutlProps,