@titaui/pc 1.7.25 → 1.7.29
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/lib/components/common-share/index.js +7 -3
- package/lib/components/common-share/publishMblog.js +4 -2
- package/lib/components/nav-top/components/user-message/components/inform/inform-item.js +7 -1
- package/lib/components/nav-top/components/user-message/index.js +9 -0
- package/lib/components/nav-top/index.js +2 -3
- package/lib/components/weekly-report/card.js +36 -40
- package/lib/components/weekly-report/img/close.svg +22 -0
- package/lib/components/weekly-report/index.css +25 -5
- package/lib/components/weekly-report/index.js +106 -16
- package/lib/components/weekly-report/interface.js +5 -0
- package/lib/components/weekly-report/statistics.js +6 -9
- package/lib/pages/new-okr-list/index.js +2 -2
- package/package.json +1 -1
- package/src/components/cascader/index.scss +1 -1
- package/src/components/common-share/index.tsx +6 -2
- package/src/components/common-share/publishMblog.tsx +3 -1
- package/src/components/nav-top/components/user-message/components/inform/inform-item.tsx +5 -1
- package/src/components/nav-top/components/user-message/index.tsx +6 -1
- package/src/components/nav-top/index.tsx +1 -2
- package/src/components/weekly-report/card.tsx +127 -95
- package/src/components/weekly-report/img/close.svg +22 -0
- package/src/components/weekly-report/index.scss +25 -5
- package/src/components/weekly-report/index.tsx +89 -24
- package/src/components/weekly-report/interface.ts +31 -0
- package/src/components/weekly-report/statistics.tsx +7 -6
- package/src/pages/new-okr-list/index.tsx +2 -2
- package/yarn-error.log +15894 -0
|
@@ -10,9 +10,10 @@ interface Props {
|
|
|
10
10
|
uid: string;
|
|
11
11
|
shareComponent: any;
|
|
12
12
|
shareImage?:string
|
|
13
|
+
defaultContent?:string
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
const ShareContent = function({ closeModal, getModalRef, uid,shareComponent,shareImage }: Props) {
|
|
16
|
+
const ShareContent = function({ closeModal, getModalRef, uid,shareComponent,shareImage,defaultContent }: Props) {
|
|
16
17
|
const [showPublish, setShowPublish] = useState(false);
|
|
17
18
|
useEffect(() => {
|
|
18
19
|
if(shareImage){
|
|
@@ -33,6 +34,7 @@ const ShareContent = function({ closeModal, getModalRef, uid,shareComponent,shar
|
|
|
33
34
|
closeModal={closeModal}
|
|
34
35
|
key='publish'
|
|
35
36
|
uid={uid}
|
|
37
|
+
defaultContent={defaultContent}
|
|
36
38
|
/>
|
|
37
39
|
)}
|
|
38
40
|
</Queue>
|
|
@@ -58,8 +60,9 @@ interface ShareProps {
|
|
|
58
60
|
visible:boolean;
|
|
59
61
|
onClose: () => void
|
|
60
62
|
shareComponent: (share:(img:string) => void) => any
|
|
63
|
+
defaultContent?:string
|
|
61
64
|
}
|
|
62
|
-
const OkrShare: React.FC<ShareProps> = ({ uid,visible,onClose,shareComponent }) => {
|
|
65
|
+
const OkrShare: React.FC<ShareProps> = ({ uid,visible,onClose,shareComponent,defaultContent }) => {
|
|
63
66
|
const [shareImage,setShareImage] = useState<string>()
|
|
64
67
|
const modalRef = useRef<any>();
|
|
65
68
|
|
|
@@ -80,6 +83,7 @@ const OkrShare: React.FC<ShareProps> = ({ uid,visible,onClose,shareComponent })
|
|
|
80
83
|
getModalRef={() => modalRef.current.getRef()}
|
|
81
84
|
uid={uid}
|
|
82
85
|
shareImage={shareImage}
|
|
86
|
+
defaultContent={defaultContent}
|
|
83
87
|
shareComponent={shareComponent(setShareImage)}
|
|
84
88
|
/>
|
|
85
89
|
) : null}
|
|
@@ -13,6 +13,7 @@ interface Props {
|
|
|
13
13
|
getModalRef: Function;
|
|
14
14
|
closeModal: Function;
|
|
15
15
|
uid: any;
|
|
16
|
+
defaultContent?:string
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
function PublishMblog({
|
|
@@ -20,6 +21,7 @@ function PublishMblog({
|
|
|
20
21
|
getModalRef,
|
|
21
22
|
closeModal,
|
|
22
23
|
uid,
|
|
24
|
+
defaultContent="秀一秀我的 OKR"
|
|
23
25
|
}: Props): ReactElement {
|
|
24
26
|
const [file, setFile] = useState({ url: "", pending: true });
|
|
25
27
|
const [status, setStatus] = useState(0);
|
|
@@ -43,7 +45,7 @@ function PublishMblog({
|
|
|
43
45
|
>
|
|
44
46
|
<MBlog
|
|
45
47
|
autoResizing={false}
|
|
46
|
-
defaultContent=
|
|
48
|
+
defaultContent={defaultContent}
|
|
47
49
|
submitStatus={status}
|
|
48
50
|
commentsTypeKey={"share-okr" + loginUserId + uid}
|
|
49
51
|
autoFocus
|
|
@@ -38,7 +38,11 @@ const Inform = (props) => {
|
|
|
38
38
|
// // @ts-ignore
|
|
39
39
|
// Talent.app.vent.trigger("global-daily-detail-pull-screen", feedId);
|
|
40
40
|
// }
|
|
41
|
-
|
|
41
|
+
if(messageType == 135){
|
|
42
|
+
const redisKey = item.content.match(/redisKey=(\S*?)"/g)[1]
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
Talent.app.vent.trigger("open-weekly-report-modal", redisKey);
|
|
45
|
+
}
|
|
42
46
|
// 处理合并的消息
|
|
43
47
|
const isMessageMerging = messageType == 13018 || messageType == 30362 || messageType == 131;
|
|
44
48
|
if (!isMessageMerging) {
|
|
@@ -81,7 +81,9 @@ const UserMessage = () => {
|
|
|
81
81
|
const blessIndicator = indicators.filter((item) => {
|
|
82
82
|
return item.type === 'mZhufu';
|
|
83
83
|
});
|
|
84
|
-
|
|
84
|
+
const weeklyReportIndicator = indicators.filter((item) => {
|
|
85
|
+
return item.type === 'mWeekStatisticIndicator';
|
|
86
|
+
});
|
|
85
87
|
if (blessIndicator.length === 1) {
|
|
86
88
|
const userInfo = getUserInfo();
|
|
87
89
|
const options = {
|
|
@@ -92,6 +94,9 @@ const UserMessage = () => {
|
|
|
92
94
|
// @ts-ignore
|
|
93
95
|
window.util.openGift(options);
|
|
94
96
|
}
|
|
97
|
+
if(weeklyReportIndicator.length){
|
|
98
|
+
window?.Talent.app.vent.trigger('open-weekly-report-modal')
|
|
99
|
+
}
|
|
95
100
|
}
|
|
96
101
|
});
|
|
97
102
|
};
|
|
@@ -11,8 +11,7 @@ import "./index.scss";
|
|
|
11
11
|
import defaultLogo from "./images/logo-white.png";
|
|
12
12
|
import { rpost } from "../../utils/request";
|
|
13
13
|
import Toast from "../toast";
|
|
14
|
-
|
|
15
|
-
const Logo = isLocal() ? getTenantInfo().Logo : defaultLogo;
|
|
14
|
+
const Logo = getTenantInfo().Logo || defaultLogo;
|
|
16
15
|
const hasOKRApp = getBSGlobal("newNavigation").find(
|
|
17
16
|
(item) => item.appId === 113
|
|
18
17
|
);
|
|
@@ -1,124 +1,156 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import
|
|
1
|
+
import React, {
|
|
2
|
+
forwardRef,
|
|
3
|
+
ReactElement,
|
|
4
|
+
useEffect,
|
|
5
|
+
useImperativeHandle,
|
|
6
|
+
useRef,
|
|
7
|
+
useState,
|
|
8
|
+
} from "react";
|
|
9
|
+
import html2Canvas from "html2canvas";
|
|
10
|
+
import Board from "./board";
|
|
11
|
+
import { getLoginUserInfo } from "../../utils/helpers";
|
|
12
|
+
import { drawAvatar } from "./common-painter/darwAvatar";
|
|
13
|
+
import drawName from "./common-painter/drawName";
|
|
14
|
+
import Statistics from "./statistics";
|
|
15
|
+
import { isWx } from "../../utils/bs-global";
|
|
16
|
+
import "./index.scss";
|
|
17
|
+
import { rpost,rget } from "../../utils/request";
|
|
18
|
+
import { IWeeklyReportData } from "./interface";
|
|
11
19
|
|
|
12
|
-
const preCls =
|
|
20
|
+
const preCls = "weekly-report-card";
|
|
13
21
|
|
|
14
|
-
interface Props {
|
|
15
|
-
|
|
16
|
-
return rpost('v1')(`okr/share/getBase64Str`, { toUserId })
|
|
17
|
-
.then(getBase64Str => {
|
|
18
|
-
return getBase64Str.Data;
|
|
19
|
-
})
|
|
22
|
+
interface Props {
|
|
23
|
+
data:IWeeklyReportData
|
|
20
24
|
}
|
|
21
|
-
|
|
25
|
+
const getImageBase64ByUrl = (toUserId) => {
|
|
26
|
+
return rpost("v1")(`okr/share/getBase64Str`, { toUserId }).then(
|
|
27
|
+
(getBase64Str) => {
|
|
28
|
+
return getBase64Str.Data;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
function Card({data}: Props, ref): ReactElement {
|
|
22
33
|
const [avatarSrc, setAvatarSrc] = useState<string>();
|
|
23
|
-
const [nameSrc,setNameSrc] = useState<string>()
|
|
34
|
+
const [nameSrc, setNameSrc] = useState<string>();
|
|
24
35
|
const loginUserInfo = getLoginUserInfo();
|
|
25
|
-
const cardRef = useRef()
|
|
26
|
-
useImperativeHandle(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
})
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
const cardRef = useRef<any>();
|
|
37
|
+
useImperativeHandle(
|
|
38
|
+
ref,
|
|
39
|
+
() => ({
|
|
40
|
+
getImage: async function () {
|
|
41
|
+
return new Promise((res) => {
|
|
42
|
+
let width = 375, //获取dom 宽度
|
|
43
|
+
height = 710, //获取dom 高度
|
|
44
|
+
canvas = document.createElement("canvas"), //创建一个canvas节点
|
|
45
|
+
scale = 2; //定义任意放大倍数 支持小数
|
|
46
|
+
canvas.width = width * scale; //定义canvas 宽度 * 缩放
|
|
47
|
+
canvas.height = height * scale; //定义canvas高度 *缩放
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
canvas.style.width = width + "px";
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
canvas.style.height = height + "px";
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
let opts = {
|
|
54
|
+
backgroundColor: null, // 背景透明
|
|
55
|
+
scale: scale, // 添加的scale 参数
|
|
56
|
+
canvas: canvas, // 自定义 canvas
|
|
57
|
+
logging: false, // 日志开关,便于查看html2canvas的内部执行流程
|
|
58
|
+
width: width, // dom 原始宽度
|
|
59
|
+
height: height,
|
|
60
|
+
useCORS: true, // 【重要】开启跨域配置
|
|
61
|
+
};
|
|
62
|
+
html2Canvas(cardRef.current as any, opts).then((canvas) => {
|
|
63
|
+
let imgUrl = canvas.toDataURL("image/png"); //得到图片的base64编码数据
|
|
64
|
+
res(imgUrl);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
[]
|
|
70
|
+
);
|
|
60
71
|
useEffect(() => {
|
|
61
72
|
if (isWx()) {
|
|
62
|
-
window[
|
|
73
|
+
window["WWOpenData"] &&
|
|
74
|
+
window["WWOpenData"].enableCanvasSharing &&
|
|
75
|
+
window["WWOpenData"].enableCanvasSharing();
|
|
63
76
|
}
|
|
64
77
|
if (loginUserInfo.UserAvatar.HasAvatar) {
|
|
65
|
-
getImageBase64ByUrl(loginUserInfo.Id)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
getImageBase64ByUrl(loginUserInfo.Id)
|
|
79
|
+
.then((data) =>
|
|
80
|
+
drawAvatar(
|
|
81
|
+
{
|
|
82
|
+
name: loginUserInfo.Name,
|
|
83
|
+
userId: loginUserInfo.Id,
|
|
84
|
+
color: loginUserInfo.UserAvatar.Color,
|
|
85
|
+
},
|
|
86
|
+
"data:image/jpeg;base64," + data.obj
|
|
87
|
+
)
|
|
88
|
+
)
|
|
89
|
+
.then(setAvatarSrc);
|
|
90
|
+
} else {
|
|
76
91
|
drawAvatar(
|
|
77
92
|
{
|
|
78
93
|
name: loginUserInfo.Name,
|
|
79
94
|
userId: loginUserInfo.Id,
|
|
80
95
|
color: loginUserInfo.UserAvatar.Color,
|
|
81
96
|
},
|
|
82
|
-
|
|
97
|
+
""
|
|
83
98
|
).then(setAvatarSrc);
|
|
84
99
|
}
|
|
85
|
-
drawName(loginUserInfo.Name,loginUserInfo.Id).then(setNameSrc)
|
|
100
|
+
drawName(loginUserInfo.Name, loginUserInfo.Id).then(setNameSrc);
|
|
86
101
|
return () => {
|
|
87
102
|
if (isWx()) {
|
|
88
|
-
window[
|
|
103
|
+
window["WWOpenData"] &&
|
|
104
|
+
window["WWOpenData"].disableCanvasSharing &&
|
|
105
|
+
window["WWOpenData"].disableCanvasSharing();
|
|
89
106
|
}
|
|
90
|
-
}
|
|
107
|
+
};
|
|
91
108
|
}, []);
|
|
92
109
|
|
|
110
|
+
|
|
111
|
+
|
|
93
112
|
return (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
<div className={preCls + "-content"} ref={cardRef}>
|
|
114
|
+
<img className={preCls + "__title"} src={require("./img/title.png")} />
|
|
115
|
+
<div className={preCls + "__date-range"}>{data.WeekCycle}</div>
|
|
116
|
+
<div className={preCls + "__shadow"} />
|
|
117
|
+
<img className={preCls + "__laba"} src={require("./img/laba.png")} />
|
|
118
|
+
<img className={preCls + "__bofang"} src={require("./img/bofang.png")} />
|
|
119
|
+
<div className={preCls + "__avatar"}>
|
|
120
|
+
<img src={avatarSrc} />
|
|
121
|
+
</div>
|
|
122
|
+
<div className={preCls + "__body"}>
|
|
123
|
+
|
|
124
|
+
<img className={preCls + "__userName"} src={nameSrc} />
|
|
125
|
+
<img
|
|
126
|
+
className={preCls + "__quote"}
|
|
127
|
+
src={require("./img/quote.png")}
|
|
128
|
+
alt=""
|
|
129
|
+
/>
|
|
130
|
+
<div className={preCls + "__text"}>
|
|
131
|
+
{data.Quotations}
|
|
132
|
+
</div>
|
|
133
|
+
<Board percent={Number(data.Complete)} />
|
|
134
|
+
<div className={preCls + "__comparison"}>
|
|
135
|
+
{
|
|
136
|
+
data.Increase != '0' ? <>
|
|
111
137
|
OKR 完成度
|
|
112
|
-
<img
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
138
|
+
<img
|
|
139
|
+
className={preCls + "__direction"}
|
|
140
|
+
src={Number( data.Increase) > 0 ? require("./img/up.png") : require('./img/down.png')}
|
|
141
|
+
alt=""
|
|
142
|
+
/>
|
|
143
|
+
<span style={{ color: Number( data.Increase) > 0 ? "#4DC591" : '#F05E5E'}}>{Math.abs(Number(data.Increase))}%</span>
|
|
144
|
+
</> : ''
|
|
145
|
+
}
|
|
146
|
+
</div>
|
|
147
|
+
<div className={preCls + "__colleague"}>
|
|
148
|
+
{data.PromptLanguage}
|
|
119
149
|
</div>
|
|
120
|
-
<
|
|
150
|
+
<Statistics data={data}/>
|
|
121
151
|
</div>
|
|
152
|
+
<img className={preCls + "__bottom"} src={require("./img/bottom.png")} />
|
|
153
|
+
</div>
|
|
122
154
|
);
|
|
123
155
|
}
|
|
124
156
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>编组 31</title>
|
|
4
|
+
<defs>
|
|
5
|
+
<filter id="filter-1">
|
|
6
|
+
<feColorMatrix in="SourceGraphic" type="matrix" values="0 0 0 0 1.000000 0 0 0 0 1.000000 0 0 0 0 1.000000 0 0 0 1.000000 0"></feColorMatrix>
|
|
7
|
+
</filter>
|
|
8
|
+
</defs>
|
|
9
|
+
<g id="每周推送" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
10
|
+
<g id="暂定-员工视角" transform="translate(-871.000000, -106.000000)">
|
|
11
|
+
<g id="编组-31" transform="translate(871.000000, 106.000000)">
|
|
12
|
+
<circle id="椭圆形" fill-opacity="0.2" fill="#141C28" cx="16" cy="16" r="16"></circle>
|
|
13
|
+
<g id="canceled" transform="translate(7.000000, 7.000000)" filter="url(#filter-1)">
|
|
14
|
+
<g>
|
|
15
|
+
<rect id="矩形" x="0" y="0" width="18" height="18"></rect>
|
|
16
|
+
<path d="M4.20533009,3.14466991 L8.978,7.917 L13.7512716,3.14466991 C14.0175382,2.87840335 14.4342019,2.8541973 14.7278134,3.07205176 L14.8119318,3.14466991 C15.104825,3.43756313 15.104825,3.91243687 14.8119318,4.20533009 L14.8119318,4.20533009 L10.038,8.978 L14.8119318,13.7512716 C15.104825,14.0441649 15.104825,14.5190386 14.8119318,14.8119318 C14.5190386,15.104825 14.0441649,15.104825 13.7512716,14.8119318 L8.978,10.038 L4.20533009,14.8119318 C3.93906352,15.0781984 3.52239984,15.1024044 3.22878835,14.88455 L3.14466991,14.8119318 C2.8517767,14.5190386 2.8517767,14.0441649 3.14466991,13.7512716 L3.14466991,13.7512716 L7.917,8.978 L3.14466991,4.20533009 C2.8517767,3.91243687 2.8517767,3.43756313 3.14466991,3.14466991 C3.43756313,2.8517767 3.91243687,2.8517767 4.20533009,3.14466991 Z" id="形状结合" fill="#444444"></path>
|
|
17
|
+
</g>
|
|
18
|
+
</g>
|
|
19
|
+
</g>
|
|
20
|
+
</g>
|
|
21
|
+
</g>
|
|
22
|
+
</svg>
|
|
@@ -16,6 +16,15 @@
|
|
|
16
16
|
transform: scale(0.9);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
&__close {
|
|
20
|
+
position: absolute;
|
|
21
|
+
right: -42px;
|
|
22
|
+
top: 0;
|
|
23
|
+
width: 32px;
|
|
24
|
+
height: 32px;
|
|
25
|
+
background-image: url('./img/close.svg');
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
19
28
|
&-content {
|
|
20
29
|
display: flex;
|
|
21
30
|
flex-direction: column;
|
|
@@ -48,13 +57,21 @@
|
|
|
48
57
|
border-radius: 12px;
|
|
49
58
|
background-image: url('./img/body.png');
|
|
50
59
|
background-size: 100% 100%;
|
|
60
|
+
background-position-y: -1px;
|
|
51
61
|
}
|
|
52
62
|
&__avatar {
|
|
53
63
|
position: absolute;
|
|
54
|
-
left:
|
|
55
|
-
top:
|
|
56
|
-
border:
|
|
64
|
+
left: 150px;
|
|
65
|
+
top: 135px;
|
|
66
|
+
// border: 2px solid #fff;
|
|
67
|
+
width: 76px;
|
|
68
|
+
height: 76px;
|
|
69
|
+
background-color: #FFF;
|
|
57
70
|
border-radius: 50%;
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
z-index: 2;
|
|
58
75
|
& > img {
|
|
59
76
|
width: 72px;
|
|
60
77
|
height: 72px;
|
|
@@ -84,6 +101,7 @@
|
|
|
84
101
|
margin: 28px 0;
|
|
85
102
|
max-width: 279px;
|
|
86
103
|
text-align: center;
|
|
104
|
+
min-height: 52px;
|
|
87
105
|
}
|
|
88
106
|
&__quote {
|
|
89
107
|
position: absolute;
|
|
@@ -107,8 +125,10 @@
|
|
|
107
125
|
}
|
|
108
126
|
&__undone {
|
|
109
127
|
position: absolute;
|
|
110
|
-
|
|
111
|
-
|
|
128
|
+
left: -3px;
|
|
129
|
+
bottom: 50%;
|
|
130
|
+
width: 160px;
|
|
131
|
+
height: 80px;
|
|
112
132
|
background-color: rgb(234, 241, 254);
|
|
113
133
|
transform-origin: center bottom;
|
|
114
134
|
transform: rotate(90deg);
|
|
@@ -1,50 +1,115 @@
|
|
|
1
|
-
import React, { ReactElement, useRef,useState } from "react";
|
|
1
|
+
import React, { ReactElement, useRef, useState, useEffect } from "react";
|
|
2
|
+
import classnames from 'classnames'
|
|
2
3
|
import RectBtn from "../button/rect-btn";
|
|
3
|
-
import CommonShare from
|
|
4
|
+
import CommonShare from "../common-share";
|
|
4
5
|
import Card from "./card";
|
|
6
|
+
import {rpost,rget, rput, rdelete} from '../../utils/request'
|
|
7
|
+
import {getQueryString,changeQueryString} from '../../utils/tools'
|
|
5
8
|
import "./index.scss";
|
|
6
9
|
|
|
7
|
-
interface Props {
|
|
10
|
+
interface Props {
|
|
11
|
+
data:any
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
const preCls = "weekly-report-card";
|
|
10
15
|
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
const getImageBase64ByUrl = base64 => {
|
|
17
|
+
return rpost('v1')(`/okr/share/imageDownLoadDfs`, { 'SharePicLink': base64 })
|
|
18
|
+
.then(res => {
|
|
19
|
+
return res.Data;
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function WeeklyReportPreview({ onShare,onClose,data }) {
|
|
24
|
+
const cardRef = useRef<any>();
|
|
25
|
+
|
|
26
|
+
|
|
13
27
|
return (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
28
|
+
<div style={{ position: "relative"}}>
|
|
29
|
+
<div className={classnames("tu-icon-circle",preCls + "__close")} onClick={onClose}/>
|
|
30
|
+
<div style={{ position: "absolute", left: "-99999999px" }}>
|
|
31
|
+
<Card data={data} ref={cardRef} />
|
|
17
32
|
</div>
|
|
18
33
|
<div className={preCls + "-wrapper"}>
|
|
19
|
-
<Card />
|
|
34
|
+
<Card data={data}/>
|
|
20
35
|
</div>
|
|
21
36
|
<div className={preCls + "__button-container"}>
|
|
22
37
|
<RectBtn
|
|
23
38
|
className={preCls + "__download"}
|
|
24
39
|
onClick={async () => {
|
|
25
|
-
const img = await cardRef
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
const img = await cardRef?.current?.getImage();
|
|
41
|
+
const url = await getImageBase64ByUrl(img.split(',')[1])
|
|
42
|
+
let a = document.createElement('a');
|
|
43
|
+
a.href = url.obj;
|
|
44
|
+
a.download = 'okr.png';
|
|
45
|
+
a.click()
|
|
31
46
|
}}
|
|
32
47
|
>
|
|
33
48
|
下载图片
|
|
34
49
|
</RectBtn>
|
|
35
|
-
<RectBtn
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
50
|
+
<RectBtn
|
|
51
|
+
className={preCls + "__share"}
|
|
52
|
+
onClick={async () => {
|
|
53
|
+
const img = await cardRef.current.getImage();
|
|
54
|
+
onShare(img);
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
分享到动态
|
|
58
|
+
</RectBtn>
|
|
39
59
|
</div>
|
|
40
|
-
|
|
41
|
-
)
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
42
62
|
}
|
|
43
63
|
|
|
44
|
-
function WeeklyReportModal({}: Props)
|
|
45
|
-
const [visible,setVisible] = useState<boolean>()
|
|
64
|
+
function WeeklyReportModal({}: Props) {
|
|
65
|
+
const [visible, setVisible] = useState<boolean>(!!getQueryString().redisKey);
|
|
66
|
+
const [redisKey, setRedisKey] = useState<string>(getQueryString().redisKey||null)
|
|
67
|
+
const [data,setData] = useState<any>()
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
window?.Talent?.app.vent.off('open-weekly-report-modal')
|
|
70
|
+
window?.Talent?.app.vent.on('open-weekly-report-modal',(redisKey)=>{
|
|
71
|
+
if(visible) return;
|
|
72
|
+
setRedisKey(redisKey)
|
|
73
|
+
setVisible(true)
|
|
74
|
+
})
|
|
75
|
+
return () => window?.Talent?.app.vent.off('open-weekly-report-modal')
|
|
76
|
+
}, [])
|
|
77
|
+
|
|
78
|
+
useEffect(()=>{
|
|
79
|
+
if(!visible) return
|
|
80
|
+
const current = new Date()
|
|
81
|
+
const dateTimeTicks=(current.getFullYear()+'/'+(current.getMonth()+1)+'/'+current.getDate())
|
|
82
|
+
let param = `redisKey=${redisKey||null}&dateTimeTicks=${dateTimeTicks||null}`
|
|
83
|
+
if(data) {
|
|
84
|
+
setData(null)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
rget('v1')('okr/wwsummary/get?'+param).then(res => {
|
|
88
|
+
if(res.Code == 1){
|
|
89
|
+
setData(res.Data)
|
|
90
|
+
}else {
|
|
91
|
+
setVisible(false)
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
},[redisKey,visible])
|
|
95
|
+
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if(!!getQueryString().redisKey){
|
|
98
|
+
location.replace(decodeURIComponent(location.href).replace(/&?redisKey=\S*(&|$)/g,''))
|
|
99
|
+
}
|
|
100
|
+
if(visible){
|
|
101
|
+
rdelete('v1')('Indicator/Clear?message_type=0&indicator_type=15')
|
|
102
|
+
}
|
|
103
|
+
},[visible])
|
|
104
|
+
if(!data) return null;
|
|
46
105
|
return (
|
|
47
|
-
<CommonShare
|
|
106
|
+
<CommonShare
|
|
107
|
+
uid={new Date().getTime()}
|
|
108
|
+
visible={visible}
|
|
109
|
+
onClose={() => setVisible(false)}
|
|
110
|
+
defaultContent="Show 一下我这周的努力~"
|
|
111
|
+
shareComponent={(onShare) => <WeeklyReportPreview onShare={onShare} onClose={() => setVisible(false)} data={data}/>}
|
|
112
|
+
/>
|
|
48
113
|
);
|
|
49
114
|
}
|
|
50
115
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
export interface IWeeklyReportData {
|
|
3
|
+
WeekCycle: string;
|
|
4
|
+
Lnteraction: string;
|
|
5
|
+
LoveTopNum: string;
|
|
6
|
+
LoveNum: string;
|
|
7
|
+
TaskNum: string;
|
|
8
|
+
PromptLanguage: string;
|
|
9
|
+
Increase: string;
|
|
10
|
+
Quotations: string;
|
|
11
|
+
Complete: string;
|
|
12
|
+
User: User;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface User {
|
|
16
|
+
UserId: number;
|
|
17
|
+
Name: string;
|
|
18
|
+
Avatar: Avatar;
|
|
19
|
+
UserMark?: any;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface Avatar {
|
|
23
|
+
Original: string;
|
|
24
|
+
Small: string;
|
|
25
|
+
Medium: string;
|
|
26
|
+
Big: string;
|
|
27
|
+
Large: string;
|
|
28
|
+
Normal: string;
|
|
29
|
+
HasAvatar: boolean;
|
|
30
|
+
Color?: any;
|
|
31
|
+
}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react'
|
|
2
2
|
import classnames from 'classnames'
|
|
3
|
+
import { IWeeklyReportData } from './interface'
|
|
3
4
|
|
|
4
5
|
interface Props {
|
|
5
|
-
|
|
6
|
+
data:IWeeklyReportData
|
|
6
7
|
}
|
|
7
8
|
const preCls = 'weekly-report-card__statistics'
|
|
8
|
-
function Statistics({}: Props): ReactElement {
|
|
9
|
+
function Statistics({data}: Props): ReactElement {
|
|
9
10
|
return (
|
|
10
11
|
<div className={preCls}>
|
|
11
12
|
<div className={classnames(preCls+'__item',preCls+'__finish')}>
|
|
12
|
-
<div className={preCls+'__num'}>
|
|
13
|
+
<div className={preCls+'__num'}>{data.TaskNum}</div>
|
|
13
14
|
<div className={preCls+'__text'}>完成任务</div>
|
|
14
15
|
</div>
|
|
15
16
|
<div className={classnames(preCls+'__item',preCls+'__praise')}>
|
|
16
|
-
<div className={preCls+'__num'}>
|
|
17
|
+
<div className={preCls+'__num'}>{data.LoveNum}</div>
|
|
17
18
|
<div className={preCls+'__text'}>获得点赞</div>
|
|
18
|
-
<div className={preCls+'__tips'}>
|
|
19
|
+
{data.LoveTopNum && data.LoveTopNum != '0' && <div className={preCls+'__tips'}>Top{data.LoveTopNum}</div>}
|
|
19
20
|
</div>
|
|
20
21
|
<div className={classnames(preCls+'__item',preCls+'__communication')}>
|
|
21
|
-
<div className={preCls+'__num'}>
|
|
22
|
+
<div className={preCls+'__num'}>{data.Lnteraction}</div>
|
|
22
23
|
<div className={preCls+'__text'}>参与互动</div>
|
|
23
24
|
</div>
|
|
24
25
|
</div>
|