@titaui/pc 1.7.25 → 1.7.26
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/index.js +9 -0
- package/lib/components/weekly-report/card.js +24 -28
- package/lib/components/weekly-report/img/close.svg +22 -0
- package/lib/components/weekly-report/index.css +11 -0
- package/lib/components/weekly-report/index.js +99 -15
- package/lib/pages/new-okr-list/header/filter.js +1 -0
- package/lib/pages/new-okr-list/index.js +2 -2
- package/package.json +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/index.tsx +6 -1
- package/src/components/weekly-report/card.tsx +121 -96
- package/src/components/weekly-report/img/close.svg +22 -0
- package/src/components/weekly-report/index.scss +10 -0
- package/src/components/weekly-report/index.tsx +86 -22
- package/src/pages/new-okr-list/header/filter.tsx +1 -0
- package/src/pages/new-okr-list/index.tsx +2 -2
|
@@ -40,7 +40,8 @@ var ShareContent = function ShareContent(_ref) {
|
|
|
40
40
|
getModalRef = _ref.getModalRef,
|
|
41
41
|
uid = _ref.uid,
|
|
42
42
|
shareComponent = _ref.shareComponent,
|
|
43
|
-
shareImage = _ref.shareImage
|
|
43
|
+
shareImage = _ref.shareImage,
|
|
44
|
+
defaultContent = _ref.defaultContent;
|
|
44
45
|
|
|
45
46
|
var _useState = (0, _react.useState)(false),
|
|
46
47
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -61,7 +62,8 @@ var ShareContent = function ShareContent(_ref) {
|
|
|
61
62
|
getModalRef: getModalRef,
|
|
62
63
|
closeModal: closeModal,
|
|
63
64
|
key: "publish",
|
|
64
|
-
uid: uid
|
|
65
|
+
uid: uid,
|
|
66
|
+
defaultContent: defaultContent
|
|
65
67
|
}));
|
|
66
68
|
};
|
|
67
69
|
|
|
@@ -69,7 +71,8 @@ var OkrShare = function OkrShare(_ref2) {
|
|
|
69
71
|
var uid = _ref2.uid,
|
|
70
72
|
visible = _ref2.visible,
|
|
71
73
|
onClose = _ref2.onClose,
|
|
72
|
-
shareComponent = _ref2.shareComponent
|
|
74
|
+
shareComponent = _ref2.shareComponent,
|
|
75
|
+
defaultContent = _ref2.defaultContent;
|
|
73
76
|
|
|
74
77
|
var _useState3 = (0, _react.useState)(),
|
|
75
78
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
@@ -96,6 +99,7 @@ var OkrShare = function OkrShare(_ref2) {
|
|
|
96
99
|
},
|
|
97
100
|
uid: uid,
|
|
98
101
|
shareImage: shareImage,
|
|
102
|
+
defaultContent: defaultContent,
|
|
99
103
|
shareComponent: shareComponent(setShareImage)
|
|
100
104
|
}) : null));
|
|
101
105
|
};
|
|
@@ -55,7 +55,9 @@ function PublishMblog(_ref) {
|
|
|
55
55
|
var base64 = _ref.base64,
|
|
56
56
|
getModalRef = _ref.getModalRef,
|
|
57
57
|
closeModal = _ref.closeModal,
|
|
58
|
-
uid = _ref.uid
|
|
58
|
+
uid = _ref.uid,
|
|
59
|
+
_ref$defaultContent = _ref.defaultContent,
|
|
60
|
+
defaultContent = _ref$defaultContent === void 0 ? "秀一秀我的 OKR" : _ref$defaultContent;
|
|
59
61
|
|
|
60
62
|
var _useState = (0, _react.useState)({
|
|
61
63
|
url: "",
|
|
@@ -95,7 +97,7 @@ function PublishMblog(_ref) {
|
|
|
95
97
|
}
|
|
96
98
|
}, /*#__PURE__*/_react["default"].createElement(_mblog["default"], {
|
|
97
99
|
autoResizing: false,
|
|
98
|
-
defaultContent:
|
|
100
|
+
defaultContent: defaultContent,
|
|
99
101
|
submitStatus: status,
|
|
100
102
|
commentsTypeKey: "share-okr" + loginUserId + uid,
|
|
101
103
|
autoFocus: true,
|
|
@@ -153,6 +153,9 @@ var UserMessage = function UserMessage() {
|
|
|
153
153
|
var blessIndicator = indicators.filter(function (item) {
|
|
154
154
|
return item.type === 'mZhufu';
|
|
155
155
|
});
|
|
156
|
+
var weeklyReportIndicator = indicators.filter(function (item) {
|
|
157
|
+
return item.type === 'mWeekStatisticIndicator';
|
|
158
|
+
});
|
|
156
159
|
|
|
157
160
|
if (blessIndicator.length === 1) {
|
|
158
161
|
var userInfo = (0, _bsGlobal.getUserInfo)();
|
|
@@ -164,6 +167,12 @@ var UserMessage = function UserMessage() {
|
|
|
164
167
|
|
|
165
168
|
window.util.openGift(options);
|
|
166
169
|
}
|
|
170
|
+
|
|
171
|
+
if (weeklyReportIndicator.length) {
|
|
172
|
+
var _window;
|
|
173
|
+
|
|
174
|
+
(_window = window) === null || _window === void 0 ? void 0 : _window.Talent.app.vent.trigger('open-weekly-report-modal');
|
|
175
|
+
}
|
|
167
176
|
}
|
|
168
177
|
});
|
|
169
178
|
};
|
|
@@ -51,10 +51,10 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
51
51
|
|
|
52
52
|
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure undefined"); }
|
|
53
53
|
|
|
54
|
-
var preCls =
|
|
54
|
+
var preCls = "weekly-report-card";
|
|
55
55
|
|
|
56
56
|
var getImageBase64ByUrl = function getImageBase64ByUrl(toUserId) {
|
|
57
|
-
return (0, _request.rpost)(
|
|
57
|
+
return (0, _request.rpost)("v1")("okr/share/getBase64Str", {
|
|
58
58
|
toUserId: toUserId
|
|
59
59
|
}).then(function (getBase64Str) {
|
|
60
60
|
return getBase64Str.Data;
|
|
@@ -85,12 +85,8 @@ function Card(_ref, ref) {
|
|
|
85
85
|
switch (_context.prev = _context.next) {
|
|
86
86
|
case 0:
|
|
87
87
|
return _context.abrupt("return", new Promise(function (res) {
|
|
88
|
-
var
|
|
89
|
-
//需要截图的包裹的(原生的)DOM 对象
|
|
90
|
-
// @ts-ignore
|
|
91
|
-
width = 375,
|
|
88
|
+
var width = 375,
|
|
92
89
|
//获取dom 宽度
|
|
93
|
-
// @ts-ignore
|
|
94
90
|
height = 710,
|
|
95
91
|
//获取dom 高度
|
|
96
92
|
canvas = document.createElement("canvas"),
|
|
@@ -128,7 +124,7 @@ function Card(_ref, ref) {
|
|
|
128
124
|
|
|
129
125
|
};
|
|
130
126
|
(0, _html2canvas["default"])(cardRef.current, opts).then(function (canvas) {
|
|
131
|
-
var imgUrl = canvas.toDataURL(
|
|
127
|
+
var imgUrl = canvas.toDataURL("image/png"); //得到图片的base64编码数据
|
|
132
128
|
|
|
133
129
|
//得到图片的base64编码数据
|
|
134
130
|
res(imgUrl);
|
|
@@ -153,7 +149,7 @@ function Card(_ref, ref) {
|
|
|
153
149
|
}, []);
|
|
154
150
|
(0, _react.useEffect)(function () {
|
|
155
151
|
if ((0, _bsGlobal.isWx)()) {
|
|
156
|
-
window[
|
|
152
|
+
window["WWOpenData"] && window["WWOpenData"].enableCanvasSharing && window["WWOpenData"].enableCanvasSharing();
|
|
157
153
|
}
|
|
158
154
|
|
|
159
155
|
if (loginUserInfo.UserAvatar.HasAvatar) {
|
|
@@ -162,70 +158,70 @@ function Card(_ref, ref) {
|
|
|
162
158
|
name: loginUserInfo.Name,
|
|
163
159
|
userId: loginUserInfo.Id,
|
|
164
160
|
color: loginUserInfo.UserAvatar.Color
|
|
165
|
-
},
|
|
161
|
+
}, "data:image/jpeg;base64," + data.obj);
|
|
166
162
|
}).then(setAvatarSrc);
|
|
167
163
|
} else {
|
|
168
164
|
(0, _darwAvatar.drawAvatar)({
|
|
169
165
|
name: loginUserInfo.Name,
|
|
170
166
|
userId: loginUserInfo.Id,
|
|
171
167
|
color: loginUserInfo.UserAvatar.Color
|
|
172
|
-
},
|
|
168
|
+
}, "").then(setAvatarSrc);
|
|
173
169
|
}
|
|
174
170
|
|
|
175
171
|
(0, _drawName["default"])(loginUserInfo.Name, loginUserInfo.Id).then(setNameSrc);
|
|
176
172
|
return function () {
|
|
177
173
|
if ((0, _bsGlobal.isWx)()) {
|
|
178
|
-
window[
|
|
174
|
+
window["WWOpenData"] && window["WWOpenData"].disableCanvasSharing && window["WWOpenData"].disableCanvasSharing();
|
|
179
175
|
}
|
|
180
176
|
};
|
|
181
177
|
}, []);
|
|
182
178
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
183
|
-
className: preCls +
|
|
179
|
+
className: preCls + "-content",
|
|
184
180
|
ref: cardRef
|
|
185
181
|
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
186
|
-
className: preCls +
|
|
182
|
+
className: preCls + "__title",
|
|
187
183
|
src: require("./img/title.png")
|
|
188
184
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
189
|
-
className: preCls +
|
|
185
|
+
className: preCls + "__date-range"
|
|
190
186
|
}, "6\u67087\u65E5-6\u670811\u65E5"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
191
|
-
className: preCls +
|
|
187
|
+
className: preCls + "__shadow"
|
|
192
188
|
}), /*#__PURE__*/_react["default"].createElement("img", {
|
|
193
|
-
className: preCls +
|
|
189
|
+
className: preCls + "__laba",
|
|
194
190
|
src: require("./img/laba.png")
|
|
195
191
|
}), /*#__PURE__*/_react["default"].createElement("img", {
|
|
196
|
-
className: preCls +
|
|
192
|
+
className: preCls + "__bofang",
|
|
197
193
|
src: require("./img/bofang.png")
|
|
198
194
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
199
|
-
className: preCls +
|
|
195
|
+
className: preCls + "__body"
|
|
200
196
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
201
|
-
className: preCls +
|
|
197
|
+
className: preCls + "__avatar"
|
|
202
198
|
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
203
199
|
src: avatarSrc
|
|
204
200
|
})), /*#__PURE__*/_react["default"].createElement("img", {
|
|
205
|
-
className: preCls +
|
|
201
|
+
className: preCls + "__userName",
|
|
206
202
|
src: nameSrc
|
|
207
203
|
}), /*#__PURE__*/_react["default"].createElement("img", {
|
|
208
|
-
className: preCls +
|
|
204
|
+
className: preCls + "__quote",
|
|
209
205
|
src: require("./img/quote.png"),
|
|
210
206
|
alt: ""
|
|
211
207
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
212
|
-
className: preCls +
|
|
208
|
+
className: preCls + "__text"
|
|
213
209
|
}, "\u575A\u6301\u6BCF\u5468\u53CD\u9988\u624D\u662F\u771F\u6B63\u7684\u4F18\u79C0\u771F\u6B63\u7684\u4F18\u79C0"), /*#__PURE__*/_react["default"].createElement(_board["default"], {
|
|
214
210
|
percent: 80
|
|
215
211
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
216
|
-
className: preCls +
|
|
212
|
+
className: preCls + "__comparison"
|
|
217
213
|
}, "OKR \u5B8C\u6210\u5EA6", /*#__PURE__*/_react["default"].createElement("img", {
|
|
218
|
-
className: preCls +
|
|
214
|
+
className: preCls + "__direction",
|
|
219
215
|
src: require("./img/up.png"),
|
|
220
216
|
alt: ""
|
|
221
217
|
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
222
218
|
style: {
|
|
223
|
-
color:
|
|
219
|
+
color: "#4DC591"
|
|
224
220
|
}
|
|
225
221
|
}, "20%")), /*#__PURE__*/_react["default"].createElement("div", {
|
|
226
|
-
className: preCls +
|
|
222
|
+
className: preCls + "__colleague"
|
|
227
223
|
}, "\u606D\u559C\u8D85\u8D8A\u4E86 ", /*#__PURE__*/_react["default"].createElement("span", null, "80%"), " \u7684\u540C\u4E8B"), /*#__PURE__*/_react["default"].createElement(_statistics["default"], null)), /*#__PURE__*/_react["default"].createElement("img", {
|
|
228
|
-
className: preCls +
|
|
224
|
+
className: preCls + "__bottom",
|
|
229
225
|
src: require("./img/bottom.png")
|
|
230
226
|
}));
|
|
231
227
|
}
|
|
@@ -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,16 @@
|
|
|
16
16
|
transform: scale(0.9);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
.weekly-report-card__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
|
+
}
|
|
28
|
+
|
|
19
29
|
.weekly-report-card-content {
|
|
20
30
|
display: flex;
|
|
21
31
|
flex-direction: column;
|
|
@@ -51,6 +61,7 @@
|
|
|
51
61
|
border-radius: 12px;
|
|
52
62
|
background-image: url("./img/body.png");
|
|
53
63
|
background-size: 100% 100%;
|
|
64
|
+
background-position-y: -1px;
|
|
54
65
|
}
|
|
55
66
|
|
|
56
67
|
.weekly-report-card__avatar {
|
|
@@ -9,12 +9,18 @@ exports["default"] = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
12
14
|
var _rectBtn = _interopRequireDefault(require("../button/rect-btn"));
|
|
13
15
|
|
|
14
16
|
var _commonShare = _interopRequireDefault(require("../common-share"));
|
|
15
17
|
|
|
16
18
|
var _card = _interopRequireDefault(require("./card"));
|
|
17
19
|
|
|
20
|
+
var _request = require("../../utils/request");
|
|
21
|
+
|
|
22
|
+
var _tools = require("../../utils/tools");
|
|
23
|
+
|
|
18
24
|
require("./index.css");
|
|
19
25
|
|
|
20
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -43,13 +49,30 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
43
49
|
|
|
44
50
|
var preCls = "weekly-report-card";
|
|
45
51
|
|
|
52
|
+
var getImageBase64ByUrl = function getImageBase64ByUrl(base64) {
|
|
53
|
+
return (0, _request.rpost)('v1')("/okr/share/imageDownLoadDfs", {
|
|
54
|
+
'SharePicLink': base64
|
|
55
|
+
}).then(function (res) {
|
|
56
|
+
return res.Data;
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
46
60
|
function WeeklyReportPreview(_ref) {
|
|
47
|
-
var onShare = _ref.onShare
|
|
61
|
+
var onShare = _ref.onShare,
|
|
62
|
+
onClose = _ref.onClose,
|
|
63
|
+
data = _ref.data;
|
|
48
64
|
var cardRef = (0, _react.useRef)();
|
|
49
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
65
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
66
|
+
style: {
|
|
67
|
+
position: "relative"
|
|
68
|
+
}
|
|
69
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
70
|
+
className: (0, _classnames["default"])("tu-icon-circle", preCls + "__close"),
|
|
71
|
+
onClick: onClose
|
|
72
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
50
73
|
style: {
|
|
51
74
|
position: "absolute",
|
|
52
|
-
left: "-
|
|
75
|
+
left: "-99999999px"
|
|
53
76
|
}
|
|
54
77
|
}, /*#__PURE__*/_react["default"].createElement(_card["default"], {
|
|
55
78
|
ref: cardRef
|
|
@@ -60,23 +83,29 @@ function WeeklyReportPreview(_ref) {
|
|
|
60
83
|
}, /*#__PURE__*/_react["default"].createElement(_rectBtn["default"], {
|
|
61
84
|
className: preCls + "__download",
|
|
62
85
|
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
63
|
-
var
|
|
86
|
+
var _cardRef$current;
|
|
87
|
+
|
|
88
|
+
var img, url, a;
|
|
64
89
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
65
90
|
while (1) {
|
|
66
91
|
switch (_context.prev = _context.next) {
|
|
67
92
|
case 0:
|
|
68
93
|
_context.next = 2;
|
|
69
|
-
return cardRef.current.getImage();
|
|
94
|
+
return cardRef === null || cardRef === void 0 ? void 0 : (_cardRef$current = cardRef.current) === null || _cardRef$current === void 0 ? void 0 : _cardRef$current.getImage();
|
|
70
95
|
|
|
71
96
|
case 2:
|
|
72
97
|
img = _context.sent;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
ele.width = 375;
|
|
76
|
-
ele.style = "position:fixed;z-index:100000;top:0";
|
|
77
|
-
document.body.appendChild(ele);
|
|
98
|
+
_context.next = 5;
|
|
99
|
+
return getImageBase64ByUrl(img.split(',')[1]);
|
|
78
100
|
|
|
79
|
-
case
|
|
101
|
+
case 5:
|
|
102
|
+
url = _context.sent;
|
|
103
|
+
a = document.createElement('a');
|
|
104
|
+
a.href = url.obj;
|
|
105
|
+
a.download = 'okr.png';
|
|
106
|
+
a.click();
|
|
107
|
+
|
|
108
|
+
case 10:
|
|
80
109
|
case "end":
|
|
81
110
|
return _context.stop();
|
|
82
111
|
}
|
|
@@ -111,20 +140,75 @@ function WeeklyReportPreview(_ref) {
|
|
|
111
140
|
function WeeklyReportModal(_ref4) {
|
|
112
141
|
_objectDestructuringEmpty(_ref4);
|
|
113
142
|
|
|
114
|
-
var _useState = (0, _react.useState)(),
|
|
143
|
+
var _useState = (0, _react.useState)(!!(0, _tools.getQueryString)().redisKey),
|
|
115
144
|
_useState2 = _slicedToArray(_useState, 2),
|
|
116
145
|
visible = _useState2[0],
|
|
117
146
|
setVisible = _useState2[1];
|
|
118
147
|
|
|
148
|
+
var _useState3 = (0, _react.useState)(),
|
|
149
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
150
|
+
redisKey = _useState4[0],
|
|
151
|
+
setRedisKey = _useState4[1];
|
|
152
|
+
|
|
153
|
+
var _useState5 = (0, _react.useState)(),
|
|
154
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
155
|
+
data = _useState6[0],
|
|
156
|
+
setData = _useState6[1];
|
|
157
|
+
|
|
158
|
+
(0, _react.useEffect)(function () {
|
|
159
|
+
var _window, _window$Talent, _window2, _window2$Talent;
|
|
160
|
+
|
|
161
|
+
(_window = window) === null || _window === void 0 ? void 0 : (_window$Talent = _window.Talent) === null || _window$Talent === void 0 ? void 0 : _window$Talent.app.vent.off('open-weekly-report-modal');
|
|
162
|
+
(_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Talent = _window2.Talent) === null || _window2$Talent === void 0 ? void 0 : _window2$Talent.app.vent.on('open-weekly-report-modal', function (redisKey) {
|
|
163
|
+
setRedisKey(redisKey);
|
|
164
|
+
setVisible(true);
|
|
165
|
+
});
|
|
166
|
+
return function () {
|
|
167
|
+
var _window3, _window3$Talent;
|
|
168
|
+
|
|
169
|
+
return (_window3 = window) === null || _window3 === void 0 ? void 0 : (_window3$Talent = _window3.Talent) === null || _window3$Talent === void 0 ? void 0 : _window3$Talent.app.vent.off('open-weekly-report-modal');
|
|
170
|
+
};
|
|
171
|
+
}, []);
|
|
172
|
+
(0, _react.useEffect)(function () {
|
|
173
|
+
var param = '';
|
|
174
|
+
|
|
175
|
+
if (data) {
|
|
176
|
+
setData(null);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (redisKey) {
|
|
180
|
+
param = 'redisKey=' + redisKey;
|
|
181
|
+
} else {
|
|
182
|
+
var current = new Date();
|
|
183
|
+
param = 'dateTimeTicks=' + (current.getFullYear() + '/' + (current.getMonth() + 1) + '/' + current.getDate());
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
(0, _request.rget)('v1')('okr/wwsummary/get?' + param).then(function (res) {});
|
|
187
|
+
}, [redisKey]);
|
|
188
|
+
(0, _react.useEffect)(function () {
|
|
189
|
+
if (!!(0, _tools.getQueryString)().redisKey) {
|
|
190
|
+
location.replace(decodeURIComponent(location.href).replace(/&?redisKey=\S*(&|$)/g, ''));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (visible) {
|
|
194
|
+
(0, _request.rpost)('vi')('Indicator/Clear?message_type=0&indicator_type=15');
|
|
195
|
+
}
|
|
196
|
+
}, [visible]);
|
|
197
|
+
if (!data) return null;
|
|
119
198
|
return /*#__PURE__*/_react["default"].createElement(_commonShare["default"], {
|
|
120
|
-
uid:
|
|
121
|
-
visible:
|
|
199
|
+
uid: new Date().getTime(),
|
|
200
|
+
visible: visible,
|
|
122
201
|
onClose: function onClose() {
|
|
123
202
|
return setVisible(false);
|
|
124
203
|
},
|
|
204
|
+
defaultContent: "Show \u4E00\u4E0B\u6211\u8FD9\u5468\u7684\u52AA\u529B\uFF5E",
|
|
125
205
|
shareComponent: function shareComponent(onShare) {
|
|
126
206
|
return /*#__PURE__*/_react["default"].createElement(WeeklyReportPreview, {
|
|
127
|
-
onShare: onShare
|
|
207
|
+
onShare: onShare,
|
|
208
|
+
onClose: function onClose() {
|
|
209
|
+
return setVisible(false);
|
|
210
|
+
},
|
|
211
|
+
data: data
|
|
128
212
|
});
|
|
129
213
|
}
|
|
130
214
|
});
|
|
@@ -71,6 +71,7 @@ var Filter = function Filter(props) {
|
|
|
71
71
|
setFilterNum = _useState4[1];
|
|
72
72
|
|
|
73
73
|
var _useState5 = (0, _react.useState)(function () {
|
|
74
|
+
debugger;
|
|
74
75
|
var routerData = (0, _tools.getQueryString)();
|
|
75
76
|
var annualNum = routerData.annualNum,
|
|
76
77
|
cycleType = routerData.cycleType,
|
|
@@ -91,7 +91,7 @@ var NewOkrList = function NewOkrList(props) {
|
|
|
91
91
|
targetSort: ""
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
-
var filterCycle = function
|
|
94
|
+
var filterCycle = function () {
|
|
95
95
|
var routerData = (0, _tools.getQueryString)();
|
|
96
96
|
var annualNum = routerData.annualNum,
|
|
97
97
|
cycleType = routerData.cycleType,
|
|
@@ -110,7 +110,7 @@ var NewOkrList = function NewOkrList(props) {
|
|
|
110
110
|
cycleType: "2",
|
|
111
111
|
yqmNum: "".concat((0, _moment["default"])().quarter())
|
|
112
112
|
};
|
|
113
|
-
};
|
|
113
|
+
}();
|
|
114
114
|
|
|
115
115
|
var showWorkExecution = (0, _bsGlobal.getBSGlobal)("OkrAdvancedSetting").KRSetting.ShowWorkExecution;
|
|
116
116
|
|
package/package.json
CHANGED
|
@@ -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
|
|
@@ -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
|
};
|
|
@@ -1,124 +1,149 @@
|
|
|
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";
|
|
11
18
|
|
|
12
|
-
const preCls =
|
|
19
|
+
const preCls = "weekly-report-card";
|
|
13
20
|
|
|
14
|
-
interface Props {
|
|
15
|
-
const getImageBase64ByUrl = toUserId => {
|
|
16
|
-
return rpost('v1')(`okr/share/getBase64Str`, { toUserId })
|
|
17
|
-
.then(getBase64Str => {
|
|
18
|
-
return getBase64Str.Data;
|
|
19
|
-
})
|
|
21
|
+
interface Props {
|
|
20
22
|
}
|
|
21
|
-
|
|
23
|
+
const getImageBase64ByUrl = (toUserId) => {
|
|
24
|
+
return rpost("v1")(`okr/share/getBase64Str`, { toUserId }).then(
|
|
25
|
+
(getBase64Str) => {
|
|
26
|
+
return getBase64Str.Data;
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
function Card({}: Props, ref): ReactElement {
|
|
22
31
|
const [avatarSrc, setAvatarSrc] = useState<string>();
|
|
23
|
-
const [nameSrc,setNameSrc] = useState<string>()
|
|
32
|
+
const [nameSrc, setNameSrc] = useState<string>();
|
|
24
33
|
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
|
-
|
|
34
|
+
const cardRef = useRef<any>();
|
|
35
|
+
useImperativeHandle(
|
|
36
|
+
ref,
|
|
37
|
+
() => ({
|
|
38
|
+
getImage: async function () {
|
|
39
|
+
return new Promise((res) => {
|
|
40
|
+
let width = 375, //获取dom 宽度
|
|
41
|
+
height = 710, //获取dom 高度
|
|
42
|
+
canvas = document.createElement("canvas"), //创建一个canvas节点
|
|
43
|
+
scale = 2; //定义任意放大倍数 支持小数
|
|
44
|
+
canvas.width = width * scale; //定义canvas 宽度 * 缩放
|
|
45
|
+
canvas.height = height * scale; //定义canvas高度 *缩放
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
canvas.style.width = width + "px";
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
canvas.style.height = height + "px";
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
let opts = {
|
|
52
|
+
backgroundColor: null, // 背景透明
|
|
53
|
+
scale: scale, // 添加的scale 参数
|
|
54
|
+
canvas: canvas, // 自定义 canvas
|
|
55
|
+
logging: false, // 日志开关,便于查看html2canvas的内部执行流程
|
|
56
|
+
width: width, // dom 原始宽度
|
|
57
|
+
height: height,
|
|
58
|
+
useCORS: true, // 【重要】开启跨域配置
|
|
59
|
+
};
|
|
60
|
+
html2Canvas(cardRef.current as any, opts).then((canvas) => {
|
|
61
|
+
let imgUrl = canvas.toDataURL("image/png"); //得到图片的base64编码数据
|
|
62
|
+
res(imgUrl);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
67
|
+
[]
|
|
68
|
+
);
|
|
60
69
|
useEffect(() => {
|
|
61
70
|
if (isWx()) {
|
|
62
|
-
window[
|
|
71
|
+
window["WWOpenData"] &&
|
|
72
|
+
window["WWOpenData"].enableCanvasSharing &&
|
|
73
|
+
window["WWOpenData"].enableCanvasSharing();
|
|
63
74
|
}
|
|
64
75
|
if (loginUserInfo.UserAvatar.HasAvatar) {
|
|
65
|
-
getImageBase64ByUrl(loginUserInfo.Id)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
getImageBase64ByUrl(loginUserInfo.Id)
|
|
77
|
+
.then((data) =>
|
|
78
|
+
drawAvatar(
|
|
79
|
+
{
|
|
80
|
+
name: loginUserInfo.Name,
|
|
81
|
+
userId: loginUserInfo.Id,
|
|
82
|
+
color: loginUserInfo.UserAvatar.Color,
|
|
83
|
+
},
|
|
84
|
+
"data:image/jpeg;base64," + data.obj
|
|
85
|
+
)
|
|
86
|
+
)
|
|
87
|
+
.then(setAvatarSrc);
|
|
88
|
+
} else {
|
|
76
89
|
drawAvatar(
|
|
77
90
|
{
|
|
78
91
|
name: loginUserInfo.Name,
|
|
79
92
|
userId: loginUserInfo.Id,
|
|
80
93
|
color: loginUserInfo.UserAvatar.Color,
|
|
81
94
|
},
|
|
82
|
-
|
|
95
|
+
""
|
|
83
96
|
).then(setAvatarSrc);
|
|
84
97
|
}
|
|
85
|
-
drawName(loginUserInfo.Name,loginUserInfo.Id).then(setNameSrc)
|
|
98
|
+
drawName(loginUserInfo.Name, loginUserInfo.Id).then(setNameSrc);
|
|
86
99
|
return () => {
|
|
87
100
|
if (isWx()) {
|
|
88
|
-
window[
|
|
101
|
+
window["WWOpenData"] &&
|
|
102
|
+
window["WWOpenData"].disableCanvasSharing &&
|
|
103
|
+
window["WWOpenData"].disableCanvasSharing();
|
|
89
104
|
}
|
|
90
|
-
}
|
|
105
|
+
};
|
|
91
106
|
}, []);
|
|
92
107
|
|
|
108
|
+
|
|
109
|
+
|
|
93
110
|
return (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
111
|
+
<div className={preCls + "-content"} ref={cardRef}>
|
|
112
|
+
<img className={preCls + "__title"} src={require("./img/title.png")} />
|
|
113
|
+
<div className={preCls + "__date-range"}>6月7日-6月11日</div>
|
|
114
|
+
<div className={preCls + "__shadow"} />
|
|
115
|
+
<img className={preCls + "__laba"} src={require("./img/laba.png")} />
|
|
116
|
+
<img className={preCls + "__bofang"} src={require("./img/bofang.png")} />
|
|
117
|
+
<div className={preCls + "__body"}>
|
|
118
|
+
<div className={preCls + "__avatar"}>
|
|
119
|
+
<img src={avatarSrc} />
|
|
120
|
+
</div>
|
|
121
|
+
<img className={preCls + "__userName"} src={nameSrc} />
|
|
122
|
+
<img
|
|
123
|
+
className={preCls + "__quote"}
|
|
124
|
+
src={require("./img/quote.png")}
|
|
125
|
+
alt=""
|
|
126
|
+
/>
|
|
127
|
+
<div className={preCls + "__text"}>
|
|
128
|
+
坚持每周反馈才是真正的优秀真正的优秀
|
|
129
|
+
</div>
|
|
130
|
+
<Board percent={80} />
|
|
131
|
+
<div className={preCls + "__comparison"}>
|
|
132
|
+
OKR 完成度
|
|
133
|
+
<img
|
|
134
|
+
className={preCls + "__direction"}
|
|
135
|
+
src={require("./img/up.png")}
|
|
136
|
+
alt=""
|
|
137
|
+
/>
|
|
138
|
+
<span style={{ color: "#4DC591" }}>20%</span>
|
|
139
|
+
</div>
|
|
140
|
+
<div className={preCls + "__colleague"}>
|
|
141
|
+
恭喜超越了 <span>80%</span> 的同事
|
|
119
142
|
</div>
|
|
120
|
-
<
|
|
143
|
+
<Statistics />
|
|
121
144
|
</div>
|
|
145
|
+
<img className={preCls + "__bottom"} src={require("./img/bottom.png")} />
|
|
146
|
+
</div>
|
|
122
147
|
);
|
|
123
148
|
}
|
|
124
149
|
|
|
@@ -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,6 +57,7 @@
|
|
|
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;
|
|
@@ -1,18 +1,33 @@
|
|
|
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} 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
|
-
|
|
28
|
+
<div style={{ position: "relative"}}>
|
|
29
|
+
<div className={classnames("tu-icon-circle",preCls + "__close")} onClick={onClose}/>
|
|
30
|
+
<div style={{ position: "absolute", left: "-99999999px" }}>
|
|
16
31
|
<Card ref={cardRef} />
|
|
17
32
|
</div>
|
|
18
33
|
<div className={preCls + "-wrapper"}>
|
|
@@ -22,29 +37,78 @@ function WeeklyReportPreview({onShare}){
|
|
|
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>()
|
|
67
|
+
const [data,setData] = useState<any>()
|
|
68
|
+
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
window?.Talent?.app.vent.off('open-weekly-report-modal')
|
|
71
|
+
window?.Talent?.app.vent.on('open-weekly-report-modal',(redisKey)=>{
|
|
72
|
+
setRedisKey(redisKey)
|
|
73
|
+
setVisible(true)
|
|
74
|
+
})
|
|
75
|
+
return () => window?.Talent?.app.vent.off('open-weekly-report-modal')
|
|
76
|
+
}, [])
|
|
77
|
+
|
|
78
|
+
useEffect(()=>{
|
|
79
|
+
let param = ''
|
|
80
|
+
if(data) {
|
|
81
|
+
setData(null)
|
|
82
|
+
}
|
|
83
|
+
if(redisKey){
|
|
84
|
+
param = 'redisKey='+redisKey
|
|
85
|
+
}else {
|
|
86
|
+
const current = new Date()
|
|
87
|
+
param = 'dateTimeTicks='+(current.getFullYear()+'/'+(current.getMonth()+1)+'/'+current.getDate())
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
rget('v1')('okr/wwsummary/get?'+param).then(res => {
|
|
91
|
+
|
|
92
|
+
})
|
|
93
|
+
},[redisKey])
|
|
94
|
+
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if(!!getQueryString().redisKey){
|
|
97
|
+
location.replace(decodeURIComponent(location.href).replace(/&?redisKey=\S*(&|$)/g,''))
|
|
98
|
+
}
|
|
99
|
+
if(visible){
|
|
100
|
+
rpost('vi')('Indicator/Clear?message_type=0&indicator_type=15')
|
|
101
|
+
}
|
|
102
|
+
},[visible])
|
|
103
|
+
if(!data) return null;
|
|
46
104
|
return (
|
|
47
|
-
<CommonShare
|
|
105
|
+
<CommonShare
|
|
106
|
+
uid={new Date().getTime()}
|
|
107
|
+
visible={visible}
|
|
108
|
+
onClose={() => setVisible(false)}
|
|
109
|
+
defaultContent="Show 一下我这周的努力~"
|
|
110
|
+
shareComponent={(onShare) => <WeeklyReportPreview onShare={onShare} onClose={() => setVisible(false)} data={data}/>}
|
|
111
|
+
/>
|
|
48
112
|
);
|
|
49
113
|
}
|
|
50
114
|
|
|
@@ -33,7 +33,7 @@ const NewOkrList = (props) => {
|
|
|
33
33
|
targetCategory: "",
|
|
34
34
|
targetSort: "",
|
|
35
35
|
};
|
|
36
|
-
const filterCycle: any = () =>{
|
|
36
|
+
const filterCycle: any = (() =>{
|
|
37
37
|
const routerData = getQueryString()
|
|
38
38
|
const {annualNum,cycleType,yqmNum} = routerData
|
|
39
39
|
if(!!annualNum&&!!cycleType&&!!yqmNum){
|
|
@@ -44,7 +44,7 @@ const NewOkrList = (props) => {
|
|
|
44
44
|
cycleType: "2",
|
|
45
45
|
yqmNum: `${moment().quarter()}`,
|
|
46
46
|
};
|
|
47
|
-
}
|
|
47
|
+
})()
|
|
48
48
|
|
|
49
49
|
const showWorkExecution =
|
|
50
50
|
getBSGlobal("OkrAdvancedSetting").KRSetting.ShowWorkExecution;
|