@yeeyoon/library 3.7.4 → 3.7.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.
@@ -4,7 +4,7 @@ import styles from './index.less';
|
|
4
4
|
import { LineChart, Line, Tooltip, XAxis } from 'recharts';
|
5
5
|
import PropTypes from 'prop-types';
|
6
6
|
import { QuestionCircleOutlined } from '@ant-design/icons';
|
7
|
-
import { queryOidcUserCardData } from './service';
|
7
|
+
import { queryOidcUserCardData, fetchUserInfo } from './service';
|
8
8
|
|
9
9
|
const defaultHeadUrl =
|
10
10
|
'https://pro-yeeyoon-fm.oss-cn-zhangjiakou.aliyuncs.com/oidc/user_avatar3.png';
|
@@ -13,6 +13,7 @@ function InfoCart(props) {
|
|
13
13
|
const reg = /^(\d{3})\d*(\d{4})$/;
|
14
14
|
const [cardData, setCardData] = useState({});
|
15
15
|
const [chartData, setChartData] = useState([]);
|
16
|
+
const [tenantList, setTenantList] = useState([]);
|
16
17
|
const [projectData] = useState([
|
17
18
|
{
|
18
19
|
title: '贡献数据',
|
@@ -50,6 +51,7 @@ function InfoCart(props) {
|
|
50
51
|
};
|
51
52
|
useEffect(() => {
|
52
53
|
getCardData();
|
54
|
+
getUserInfo();
|
53
55
|
}, [baseMsg.userId, baseMsg.id]);
|
54
56
|
const getCardData = async () => {
|
55
57
|
const resp = await queryOidcUserCardData({
|
@@ -71,6 +73,21 @@ function InfoCart(props) {
|
|
71
73
|
}
|
72
74
|
}
|
73
75
|
};
|
76
|
+
const getUserInfo = async () => {
|
77
|
+
const resp = await fetchUserInfo({
|
78
|
+
id: baseMsg.userId || baseMsg?.id,
|
79
|
+
});
|
80
|
+
const { success, data } = resp;
|
81
|
+
if (success) {
|
82
|
+
if (data.tenants.length > 0) {
|
83
|
+
setTenantList(
|
84
|
+
data.tenants.map((item) => {
|
85
|
+
return item.name;
|
86
|
+
})
|
87
|
+
);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
};
|
74
91
|
return (
|
75
92
|
<div className={styles['info-cart-content']} {...rest}>
|
76
93
|
<div className={styles['info-cart-base']}>
|
@@ -88,46 +105,53 @@ function InfoCart(props) {
|
|
88
105
|
</span>
|
89
106
|
</div>
|
90
107
|
</div>
|
91
|
-
<div className={styles['info-cart-
|
92
|
-
<
|
93
|
-
|
94
|
-
{
|
95
|
-
projectData
|
96
|
-
|
97
|
-
<
|
98
|
-
{item
|
99
|
-
|
100
|
-
|
101
|
-
<
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
{
|
109
|
-
|
110
|
-
|
111
|
-
{
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
108
|
+
<div className={styles['info-cart-bottom']}>
|
109
|
+
<div className={styles['info-cart-project']}>
|
110
|
+
<h4>{cardData.application_name}</h4>
|
111
|
+
<div className={styles['info-cart-data']}>
|
112
|
+
{projectData &&
|
113
|
+
projectData.map((item, index) => (
|
114
|
+
<div className={styles['info-cart-data-item']} key={index}>
|
115
|
+
<span className={styles['info-cart-data-item-title']}>
|
116
|
+
{item.title}
|
117
|
+
{item.tips && (
|
118
|
+
<AntdTooltip title={item.tips}>
|
119
|
+
<QuestionCircleOutlined
|
120
|
+
style={{ fontSize: '14px', marginLeft: '4px' }}
|
121
|
+
/>
|
122
|
+
</AntdTooltip>
|
123
|
+
)}
|
124
|
+
</span>
|
125
|
+
<b style={{ color: '#5e5873', fontSize: '16px' }}>
|
126
|
+
{cardData[item.number] || 0}
|
127
|
+
</b>
|
128
|
+
<span style={{ color: '#6E6B7B', fontSize: '12px' }}>
|
129
|
+
{item.updateTitle}
|
130
|
+
{cardData[item.updateNumber] || 0}
|
131
|
+
</span>
|
132
|
+
</div>
|
133
|
+
))}
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
<div className={styles['info-cart-form']}>
|
137
|
+
<p>贡献数据(最近30天)</p>
|
138
|
+
<LineChart width={288} height={70} data={chartData}>
|
139
|
+
<Line
|
140
|
+
type="monotone"
|
141
|
+
dataKey="贡献数据数"
|
142
|
+
stroke="#7367F0"
|
143
|
+
strokeWidth="2"
|
144
|
+
dot={false}
|
145
|
+
/>
|
146
|
+
<Tooltip cursor={false} />
|
147
|
+
<XAxis dataKey="name" style={{ display: 'none' }} />
|
148
|
+
</LineChart>
|
149
|
+
</div>
|
150
|
+
<div className={styles['info-cart-company']}>
|
151
|
+
<h4>所属公司</h4>
|
152
|
+
{tenantList.length > 0 &&
|
153
|
+
tenantList.map((item, index) => <p key={index}>{item}</p>)}
|
116
154
|
</div>
|
117
|
-
</div>
|
118
|
-
<div className={styles['info-cart-form']}>
|
119
|
-
<p>贡献数据(最近30天)</p>
|
120
|
-
<LineChart width={288} height={70} data={chartData}>
|
121
|
-
<Line
|
122
|
-
type="monotone"
|
123
|
-
dataKey="贡献数据数"
|
124
|
-
stroke="#7367F0"
|
125
|
-
strokeWidth="2"
|
126
|
-
dot={false}
|
127
|
-
/>
|
128
|
-
<Tooltip cursor={false} />
|
129
|
-
<XAxis dataKey="name" style={{ display: 'none' }} />
|
130
|
-
</LineChart>
|
131
155
|
</div>
|
132
156
|
</div>
|
133
157
|
);
|
@@ -4,8 +4,7 @@
|
|
4
4
|
.info-cart-base {
|
5
5
|
display: flex;
|
6
6
|
width: 320px;
|
7
|
-
padding
|
8
|
-
border-bottom: 1px solid #eeeeee;
|
7
|
+
padding: 5px 0 23px 0;
|
9
8
|
.info-cart-np {
|
10
9
|
display: flex;
|
11
10
|
flex-direction: column;
|
@@ -16,44 +15,64 @@
|
|
16
15
|
}
|
17
16
|
}
|
18
17
|
}
|
19
|
-
.info-cart-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
.info-cart-
|
27
|
-
|
28
|
-
|
18
|
+
.info-cart-bottom {
|
19
|
+
background-color: #f4f4f4;
|
20
|
+
height: 450px;
|
21
|
+
overflow-x: scroll;
|
22
|
+
padding: 0 20px;
|
23
|
+
margin: 0 -20px -20px -20px;
|
24
|
+
border-radius: 6px;
|
25
|
+
.info-cart-project {
|
26
|
+
margin-top: 24px;
|
27
|
+
h4 {
|
28
|
+
margin-bottom: 16px;
|
29
|
+
color: #5e5873;
|
30
|
+
font-size: 14px;
|
31
|
+
font-weight: 600;
|
32
|
+
}
|
33
|
+
.info-cart-data {
|
29
34
|
display: flex;
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
&-item {
|
36
|
+
display: flex;
|
37
|
+
flex-direction: column;
|
38
|
+
align-items: flex-start;
|
39
|
+
justify-content: center;
|
40
|
+
width: 96px;
|
41
|
+
margin-right: 16px;
|
42
|
+
&-title {
|
43
|
+
color: #5e5873;
|
44
|
+
}
|
45
|
+
b {
|
46
|
+
margin: 14px 0 6px 0;
|
47
|
+
}
|
37
48
|
}
|
38
|
-
|
39
|
-
margin:
|
49
|
+
:last-child {
|
50
|
+
margin-right: 0;
|
40
51
|
}
|
41
52
|
}
|
42
|
-
|
43
|
-
|
53
|
+
}
|
54
|
+
.info-cart-form {
|
55
|
+
width: 320px;
|
56
|
+
height: 126px;
|
57
|
+
margin-top: 24px;
|
58
|
+
border-radius: 4px;
|
59
|
+
p {
|
60
|
+
margin-bottom: 16px;
|
61
|
+
color: #6e6b7b;
|
44
62
|
}
|
45
63
|
}
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
64
|
+
.info-cart-company {
|
65
|
+
border-top: 1px dashed #BABFC7;
|
66
|
+
color: #5E5873;
|
67
|
+
padding-top: 24px;
|
68
|
+
h4 {
|
69
|
+
color: #5E5873;
|
70
|
+
margin-bottom: 16px;
|
71
|
+
font-size: 14px;
|
72
|
+
font-weight: 600;
|
73
|
+
}
|
74
|
+
|
57
75
|
}
|
58
76
|
}
|
77
|
+
|
59
78
|
}
|
@@ -8,3 +8,11 @@ export async function queryOidcUserCardData(params) {
|
|
8
8
|
method: 'post',
|
9
9
|
});
|
10
10
|
}
|
11
|
+
// 获取用户信息
|
12
|
+
export async function fetchUserInfo(params) {
|
13
|
+
return request('/findOidcUser', {
|
14
|
+
prefix: `${API_IAM}/api/oidc/v1/oidcuser`,
|
15
|
+
method: 'post',
|
16
|
+
data: params,
|
17
|
+
});
|
18
|
+
}
|
@@ -10,6 +10,8 @@ const TenantSelector = (props) => {
|
|
10
10
|
tenantId,
|
11
11
|
tenantIdChangeCb,
|
12
12
|
appId,
|
13
|
+
isSharePlatform,
|
14
|
+
shareTenantIdList,
|
13
15
|
// handleException,
|
14
16
|
} = props;
|
15
17
|
const [options, setOptions] = useState([]);
|
@@ -35,6 +37,11 @@ const TenantSelector = (props) => {
|
|
35
37
|
value: item.id,
|
36
38
|
});
|
37
39
|
});
|
40
|
+
if (isSharePlatform) {
|
41
|
+
tenantList = tenantList.filter((item) =>
|
42
|
+
shareTenantIdList.includes(item.value)
|
43
|
+
);
|
44
|
+
}
|
38
45
|
setOptions(tenantList);
|
39
46
|
}
|
40
47
|
};
|
@@ -64,8 +71,9 @@ const TenantSelector = (props) => {
|
|
64
71
|
// }
|
65
72
|
}}
|
66
73
|
onSelect={(value, option) => {
|
67
|
-
|
68
|
-
|
74
|
+
const { label } = option;
|
75
|
+
setValue(label);
|
76
|
+
tenantIdChangeCb && tenantIdChangeCb(value, label, option);
|
69
77
|
}}
|
70
78
|
/>
|
71
79
|
);
|
@@ -76,6 +84,8 @@ TenantSelector.propTypes = {
|
|
76
84
|
appId: PropTypes.string,
|
77
85
|
tenantIdChangeCb: PropTypes.func,
|
78
86
|
handleException: PropTypes.func,
|
87
|
+
shareTenantIdList: PropTypes.array,
|
88
|
+
isSharePlatform: PropTypes.bool,
|
79
89
|
};
|
80
90
|
|
81
91
|
export default TenantSelector;
|