@titaui/pc 1.13.8 → 1.13.10-beta.10

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.
@@ -108,7 +108,7 @@ function Inform(props) {
108
108
  } // 处理合并的消息
109
109
 
110
110
 
111
- var isMessageMerging = [83, 94, 95, 96, 97, 98, 99, 100, 131, 136, 13018, 30362].includes(messageType);
111
+ var isMessageMerging = [83, 94, 95, 96, 97, 98, 99, 100, 131, 136, 180, 13018, 30362].includes(messageType);
112
112
 
113
113
  if (!isMessageMerging) {
114
114
  if (messageType === _constant.informType.details) {
@@ -217,7 +217,7 @@ function Inform(props) {
217
217
  } else if (Number(messageType) > 93 && Number(messageType) <= 100) {
218
218
  // OKR 仪表盘消息提醒
219
219
  notificationType = "okr-dashBoard";
220
- } else if (messageType == 131 || messageType == 136) {
220
+ } else if ([131, 136, 180].includes(Number(messageType))) {
221
221
  notificationType = "performance";
222
222
  content = item.content;
223
223
  }
@@ -18,6 +18,8 @@ exports.htmlToText = htmlToText;
18
18
 
19
19
  var deleteText = function deleteText(text) {
20
20
  var last = text.trim().slice(-4);
21
+ var pattern = /(查看详情|Details)(?!.*\1)/;
22
+ text = text.replace(pattern, '');
21
23
 
22
24
  if (last === "查看任务") {
23
25
  text = text.trim().slice(0, -4);
@@ -170,6 +170,42 @@
170
170
  color: #ffffff;
171
171
  }
172
172
 
173
+ .titaui-nav-top__invite-guide {
174
+ background-image: url("./images/invite-bkg.jpg"), url("./images/invite-person.jpg") !important;
175
+ background-repeat: no-repeat,no-repeat !important;
176
+ background-size: 87px 104px, 92px 53px !important;
177
+ background-position: 0% 0%,100% 100% !important;
178
+ }
179
+
180
+ .titaui-nav-top__invite-guide-content {
181
+ display: flex;
182
+ align-items: flex-start;
183
+ }
184
+
185
+ .titaui-nav-top__invite-guide-content-waring {
186
+ width: 18px;
187
+ margin-right: 6px;
188
+ }
189
+
190
+ .titaui-nav-top__invite-guide-content-point {
191
+ width: 14px;
192
+ margin-right: 8px;
193
+ }
194
+
195
+ .titaui-nav-top__invite-guide-content-title {
196
+ font-size: 14px;
197
+ color: #FFFFFF;
198
+ font-weight: 600;
199
+ line-height: 22px;
200
+ }
201
+
202
+ .titaui-nav-top__invite-guide-content-subTitle {
203
+ margin-top: 8px;
204
+ font-size: 12px;
205
+ color: #FFFFFF;
206
+ line-height: 22px;
207
+ }
208
+
173
209
  .titaui-nav-top__app-guide-content {
174
210
  color: #fff;
175
211
  margin-bottom: 8px;
@@ -45,9 +45,13 @@ var _interface = require("../../components/help-card/interface");
45
45
 
46
46
  var _request2 = require("./request.apis");
47
47
 
48
- require("./index.css");
48
+ var _auth = require("../../utils/auth");
49
+
50
+ var _invitePoint = _interopRequireDefault(require("./images/invite-point.png"));
49
51
 
50
- var _excluded = ["hasSetting"];
52
+ var _inviteTanhao = _interopRequireDefault(require("./images/invite-tanhao.png"));
53
+
54
+ require("./index.css");
51
55
 
52
56
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
53
57
 
@@ -57,10 +61,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
57
61
 
58
62
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
59
63
 
60
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
61
-
62
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
63
-
64
64
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
65
65
 
66
66
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -73,12 +73,13 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
73
73
 
74
74
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
75
75
 
76
+ var Role = new _auth.MyRole();
76
77
  var Logo = (0, _utils.getLogo)();
77
- var newNavigation = (0, _bsGlobal.getBSGlobal)("newNavigation") || [];
78
+ var newNavigation = (0, _bsGlobal.getBSGlobal)('newNavigation') || [];
78
79
  var hasOKRApp = newNavigation.find(function (item) {
79
80
  return item.appId === 113;
80
81
  });
81
- var preCls = "titaui-nav-top";
82
+ var preCls = 'titaui-nav-top';
82
83
 
83
84
  var NavTop = function NavTop() {
84
85
  var _classNames4;
@@ -93,7 +94,7 @@ var NavTop = function NavTop() {
93
94
  menu = _useState2[0],
94
95
  setMenu = _useState2[1];
95
96
 
96
- var versionInfo = (0, _bsGlobal.getBSGlobal)("tenantAuthentication");
97
+ var versionInfo = (0, _bsGlobal.getBSGlobal)('tenantAuthentication');
97
98
 
98
99
  var _useState3 = (0, _react.useState)(-1),
99
100
  _useState4 = _slicedToArray(_useState3, 2),
@@ -140,44 +141,90 @@ var NavTop = function NavTop() {
140
141
  bookDemoVisible = _useState20[0],
141
142
  setBookDemoVisible = _useState20[1];
142
143
 
143
- var ua = navigator.userAgent.toLowerCase();
144
- var showWxInvite = (0, _bsGlobal.getTenantInfo)().mainCorpId && ua.indexOf("micromessenger") !== -1;
144
+ var _useState21 = (0, _react.useState)(true),
145
+ _useState22 = _slicedToArray(_useState21, 2),
146
+ inviteVisible = _useState22[0],
147
+ setInviteVisible = _useState22[1];
148
+
149
+ var _useState23 = (0, _react.useState)(true),
150
+ _useState24 = _slicedToArray(_useState23, 2),
151
+ inviteAuth = _useState24[0],
152
+ setInviteAuth = _useState24[1];
153
+
154
+ var ua = navigator.userAgent.toLowerCase(); // const showWxInvite = getTenantInfo().mainCorpId && ua.indexOf("micromessenger") !== -1;
155
+
156
+ var showWxInvite = (0, _bsGlobal.getTenantInfo)().Source === 860 && ua.indexOf("micromessenger") !== -1;
145
157
  var openWxInvite = (0, _react.useCallback)(function () {
146
- if (window.WeixinJSBridge !== undefined) {
147
- window.WeixinJSBridge.invoke("selectPrivilegedContact", {
148
- fromDepartmentId: -1,
149
- // 必填,表示打开的通讯录从指定的部门开始展示,-1表示自己所在部门开始, 0表示从最上层开始
150
- mode: "multi",
151
- // 必填,选择模式,single表示单选,multi表示多选
152
- selectedContextContact: 0 // 是否勾选当前环境的参与者。例如在群+号聊天附件栏打开,默认勾选当前群成员。
153
-
154
- }, function (res) {
155
- if (res.err_msg === "selectPrivilegedContact:ok") {
156
- var selectedTicket = res.result.selectedTicket.replace(/['"]/g, ""); // 已选的集合Ticket
157
-
158
- (0, _request.rpost)("v1")("wx/send/templateMessage?selectedTickets=".concat(selectedTicket)).then(function () {
159
- _toast["default"].Success("邀请成功");
160
- })["catch"](function () {
161
- _toast["default"].Error("邀请失败");
162
- });
163
- } else {// console.log(res);
164
- }
165
- });
158
+ console.log(123, '我点击了');
159
+
160
+ if (Role.isSuperManager) {
161
+ if (window.WeixinJSBridge !== undefined) {
162
+ console.log(345, '我开始点击调用了');
163
+ window.WeixinJSBridge.invoke('openAppManage', {}, function (res) {
164
+ console.log(678, res.err_msg);
165
+
166
+ if (res.err_msg == 'openAppManage:ok') {// 调用成功
167
+ }
168
+
169
+ if (res.err_msg == "openAppManage:fail_no permission") {
170
+ // 调用人身份不符合
171
+ console.log(999, res.err_msg, inviteVisible);
172
+
173
+ if (!inviteVisible) {
174
+ setInviteVisible(true);
175
+ }
176
+
177
+ setInviteAuth(false);
178
+ }
179
+
180
+ if (res.err_msg == 'openAppManage:fail:unknown app') {// 应用信息获取失败
181
+ }
182
+
183
+ if (res.err_msg == 'openAppManage:fail:unsupported app type') {// 应用类型不符合要求
184
+ }
185
+
186
+ if (res.err_msg == 'openAppManage:fail') {// 其它错误
187
+ }
188
+ });
189
+ }
190
+ } else {
191
+ if (window.WeixinJSBridge !== undefined) {
192
+ console.log(777, '普通员工调用');
193
+ window.WeixinJSBridge.invoke('selectPrivilegedContact', {
194
+ fromDepartmentId: -1,
195
+ // 必填,表示打开的通讯录从指定的部门开始展示,-1表示自己所在部门开始, 0表示从最上层开始
196
+ mode: 'multi',
197
+ // 必填,选择模式,single表示单选,multi表示多选
198
+ selectedContextContact: 0 // 是否勾选当前环境的参与者。例如在群+号聊天附件栏打开,默认勾选当前群成员。
199
+
200
+ }, function (res) {
201
+ if (res.err_msg === 'selectPrivilegedContact:ok') {
202
+ var selectedTicket = res.result.selectedTicket.replace(/['"]/g, ''); // 已选的集合Ticket
203
+
204
+ (0, _request.rpost)('v1')("wx/send/templateMessage?selectedTickets=".concat(selectedTicket)).then(function () {
205
+ _toast["default"].Success('邀请成功');
206
+ })["catch"](function () {
207
+ _toast["default"].Error('邀请失败');
208
+ });
209
+ } else {// console.log(res);
210
+ }
211
+ });
212
+ }
166
213
  }
167
- }, []);
214
+ }, [inviteVisible]);
168
215
 
169
216
  var handleHashChange = function handleHashChange() {
170
217
  setAppCenterVisible(false);
171
- var hash = window.location.hash.split("?")[0] || "";
218
+ var hash = window.location.hash.split('?')[0] || '';
172
219
 
173
220
  if (hash) {
174
221
  var activeMenu = menu.find(function (item) {
175
222
  var _item$href$split, _item$href$split$;
176
223
 
177
- return hash.includes((_item$href$split = item.href.split("#")) === null || _item$href$split === void 0 ? void 0 : (_item$href$split$ = _item$href$split[1]) === null || _item$href$split$ === void 0 ? void 0 : _item$href$split$.split("?")[0]);
224
+ return hash.includes((_item$href$split = item.href.split('#')) === null || _item$href$split === void 0 ? void 0 : (_item$href$split$ = _item$href$split[1]) === null || _item$href$split$ === void 0 ? void 0 : _item$href$split$.split('?')[0]);
178
225
  });
179
226
 
180
- if (hash.includes("homepage")) {
227
+ if (hash.includes('homepage')) {
181
228
  setActiveMenuId(99999);
182
229
  return;
183
230
  }
@@ -192,9 +239,9 @@ var NavTop = function NavTop() {
192
239
 
193
240
  (0, _react.useEffect)(function () {
194
241
  handleHashChange();
195
- window.addEventListener("hashchange", handleHashChange);
242
+ window.addEventListener('hashchange', handleHashChange);
196
243
  return function () {
197
- window.removeEventListener("hashchange", handleHashChange);
244
+ window.removeEventListener('hashchange', handleHashChange);
198
245
  };
199
246
  }, [menu]);
200
247
  (0, _react.useEffect)(function () {
@@ -217,6 +264,10 @@ var NavTop = function NavTop() {
217
264
  }
218
265
  }, [appCenterVisible]);
219
266
 
267
+ var handleCloseInviteGuide = function handleCloseInviteGuide() {
268
+ setInviteVisible(false);
269
+ };
270
+
220
271
  var handleCloseSummaryGuide = function handleCloseSummaryGuide() {
221
272
  setSummaryGuideVisible(false);
222
273
  var loginUserId = BSGlobal.loginUserInfo.Id;
@@ -278,9 +329,39 @@ var NavTop = function NavTop() {
278
329
  }
279
330
  };
280
331
 
332
+ var renderInviteContent = (0, _react.useCallback)(function () {
333
+ var title = '你没有权限,快去联系企业微信超级管理员操';
334
+ if (!inviteAuth) return /*#__PURE__*/_react["default"].createElement("div", {
335
+ className: "".concat(preCls, "__invite-guide-content")
336
+ }, /*#__PURE__*/_react["default"].createElement("img", {
337
+ src: _inviteTanhao["default"],
338
+ alt: "",
339
+ className: "".concat(preCls, "__invite-guide-content-waring")
340
+ }), /*#__PURE__*/_react["default"].createElement("div", {
341
+ className: "".concat(preCls, "__invite-guide-content-right")
342
+ }, /*#__PURE__*/_react["default"].createElement("div", {
343
+ className: "".concat(preCls, "__invite-guide-content-title")
344
+ }, title)));
345
+ title = Role.isSuperManager ? '点击这里进入企业微信后台,添加公司员工,体验更多功能' : '邀请同事一起体验吧';
346
+ var subtitle = '试用 7 天内成功邀请 3 人加入,即可免费开启试用 OKR 案例库';
347
+ return /*#__PURE__*/_react["default"].createElement("div", {
348
+ className: "".concat(preCls, "__invite-guide-content")
349
+ }, /*#__PURE__*/_react["default"].createElement("img", {
350
+ src: _invitePoint["default"],
351
+ alt: "",
352
+ className: "".concat(preCls, "__invite-guide-content-point")
353
+ }), /*#__PURE__*/_react["default"].createElement("div", {
354
+ className: "".concat(preCls, "__invite-guide-content-right")
355
+ }, /*#__PURE__*/_react["default"].createElement("div", {
356
+ className: "".concat(preCls, "__invite-guide-content-title")
357
+ }, title), /*#__PURE__*/_react["default"].createElement("div", {
358
+ className: "".concat(preCls, "__invite-guide-content-subTitle")
359
+ }, subtitle)));
360
+ }, [inviteAuth]);
361
+
281
362
  var isHasOkr = function isHasOkr() {
282
363
  //判断是否安装了OKR
283
- var okrIndex = window.BSGlobal.WebHead.AppHead.findIndex(function (item) {
364
+ var okrIndex = (0, _bsGlobal.getBSGlobal)('WebHead').AppHead.findIndex(function (item) {
284
365
  return item.AppId === '113';
285
366
  });
286
367
 
@@ -292,12 +373,14 @@ var NavTop = function NavTop() {
292
373
  };
293
374
 
294
375
  (0, _react.useEffect)(function () {
376
+ var version = (0, _bsGlobal.getBSGlobal)('tenantAuthentication').Version;
377
+ if (localStorage.getItem("cycle_setting_stop_show".concat((0, _bsGlobal.getUserInfo)().Id)) === 'true') return;
378
+ localStorage.removeItem("OKR_CYCLE_SETTING");
295
379
  (0, _request2.getCycleSetting)().then(function (res) {
296
- var hasSetting = res.hasSetting,
297
- onthers = _objectWithoutProperties(res, _excluded);
380
+ localStorage.setItem("OKR_CYCLE_SETTING", JSON.stringify(res || {}));
381
+ var hasSetting = res.hasSetting;
298
382
 
299
- if (isHasOkr() && !hasSetting) {
300
- console.log(hasSetting, '66666666633');
383
+ if (version === 1 && isHasOkr() && !hasSetting) {
301
384
  setOkrGuideVisible(true);
302
385
  }
303
386
  });
@@ -332,7 +415,7 @@ var NavTop = function NavTop() {
332
415
  onClickClose: handleCloseSummaryGuide,
333
416
  width: 197
334
417
  }, /*#__PURE__*/_react["default"].createElement("span", {
335
- className: (0, _classnames["default"])("".concat(preCls, "__left-app-center"), "document-mouse-event-ignore", _defineProperty({}, "".concat(preCls, "__left-app-center--active"), appCenterVisible)),
418
+ className: (0, _classnames["default"])("".concat(preCls, "__left-app-center"), 'document-mouse-event-ignore', _defineProperty({}, "".concat(preCls, "__left-app-center--active"), appCenterVisible)),
336
419
  onClick: function onClick() {
337
420
  return setAppCenterVisible(!appCenterVisible);
338
421
  }
@@ -343,7 +426,24 @@ var NavTop = function NavTop() {
343
426
  }, /*#__PURE__*/_react["default"].createElement(_menu["default"], {
344
427
  menus: menu,
345
428
  activeMenuId: activeMenuId
346
- })), hasOKRApp && /*#__PURE__*/_react["default"].createElement("div", {
429
+ })), showWxInvite && /*#__PURE__*/_react["default"].createElement(_guideTip["default"], {
430
+ visible: inviteVisible,
431
+ content: renderInviteContent(),
432
+ type: inviteAuth ? 'default' : 'button',
433
+ popupPlacement: "bottom",
434
+ classnames: inviteAuth ? "".concat(preCls, "__invite-guide") : '',
435
+ onClickClose: handleCloseInviteGuide,
436
+ popupAlign: {
437
+ offset: [0, 5]
438
+ },
439
+ zIndex: 1000,
440
+ width: 308
441
+ }, /*#__PURE__*/_react["default"].createElement("div", {
442
+ className: "".concat(preCls, "__invite"),
443
+ onClick: openWxInvite
444
+ }, /*#__PURE__*/_react["default"].createElement("i", {
445
+ className: (0, _classnames["default"])('tu-icon-add-people', "".concat(preCls, "__invite-icon"))
446
+ }))), hasOKRApp && /*#__PURE__*/_react["default"].createElement("div", {
347
447
  className: (0, _classnames["default"])("".concat(preCls, "__left-home"), (_classNames4 = {}, _defineProperty(_classNames4, "".concat(preCls, "__left-home--active"), activeMenuId === 99999), _defineProperty(_classNames4, "".concat(preCls, "__left-home--hover"), hasOKRApp), _classNames4))
348
448
  }, /*#__PURE__*/_react["default"].createElement("a", {
349
449
  href: "#homepage"
@@ -351,12 +451,7 @@ var NavTop = function NavTop() {
351
451
  alt: "home-img",
352
452
  src: _home["default"],
353
453
  className: "".concat(preCls, "__left-home-img")
354
- }))), showWxInvite && /*#__PURE__*/_react["default"].createElement("div", {
355
- className: "".concat(preCls, "__invite"),
356
- onClick: openWxInvite
357
- }, /*#__PURE__*/_react["default"].createElement("i", {
358
- className: (0, _classnames["default"])("tu-icon-add-people", "".concat(preCls, "__invite-icon"))
359
- })), /*#__PURE__*/_react["default"].createElement("div", {
454
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
360
455
  className: "".concat(preCls, "__msg")
361
456
  }, /*#__PURE__*/_react["default"].createElement(_userMessage["default"], null)), versionInfo.Version === 1 && /*#__PURE__*/_react["default"].createElement("div", {
362
457
  className: "".concat(preCls, "__version")
@@ -33,7 +33,7 @@ var _picker = _interopRequireDefault(require("../picker"));
33
33
 
34
34
  var _pickerTrigger = _interopRequireDefault(require("./components/picker-trigger"));
35
35
 
36
- var _excluded = ["onChange", "format", "values", "picker", "children", "popupPlacement", "direction", "onPopupVisibleChange", "visible", "canEmpty"];
36
+ var _excluded = ["onChange", "format", "values", "picker", "children", "popupPlacement", "direction", "onPopupVisibleChange", "visible", "canEmpty", "className"];
37
37
 
38
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
39
39
 
@@ -72,6 +72,7 @@ var RangePicker = function RangePicker(props) {
72
72
  visible = _props$visible === void 0 ? false : _props$visible,
73
73
  _props$canEmpty = props.canEmpty,
74
74
  canEmpty = _props$canEmpty === void 0 ? true : _props$canEmpty,
75
+ className = props.className,
75
76
  restProps = _objectWithoutProperties(props, _excluded);
76
77
 
77
78
  var initValues = (0, _react.useCallback)(function () {
@@ -204,7 +205,7 @@ var RangePicker = function RangePicker(props) {
204
205
  return !!v;
205
206
  }).length !== 2;
206
207
  return /*#__PURE__*/_react["default"].createElement("div", {
207
- className: _utils.PickerRangesClass
208
+ className: (0, _classnames["default"])(_utils.PickerRangesClass, className)
208
209
  }, /*#__PURE__*/_react["default"].createElement(_placeholder["default"], {
209
210
  viewDate: viewDate,
210
211
  onChange: setViewDate,
@@ -140,7 +140,6 @@ function PageLayout(props) {
140
140
  errorLevel: _errorLevel["default"].P0,
141
141
  errorTag: "\u7533\u8BF7\u9884\u7EA6\u6F14\u793A\u5F02\u5E38"
142
142
  }, /*#__PURE__*/_react["default"].createElement(_bookDemo["default"].BookDemoPC, {
143
- autoShow: true,
144
143
  visible: false,
145
144
  type: getBookDemoVersion()
146
145
  })));
@@ -27,8 +27,6 @@ var _list = _interopRequireDefault(require("./list"));
27
27
 
28
28
  var _loading = _interopRequireDefault(require("./loading"));
29
29
 
30
- var _initCycleSetting = _interopRequireDefault(require("./init-cycle-setting"));
31
-
32
30
  var _bsGlobal = require("../../utils/bs-global");
33
31
 
34
32
  var _tools = require("../../utils/tools");
@@ -365,9 +363,7 @@ var NewOkrList = function NewOkrList(props) {
365
363
  cycleType: query.cycleType,
366
364
  yqmNum: query.yqmNum
367
365
  }
368
- })), /*#__PURE__*/_react["default"].createElement(_initCycleSetting["default"], {
369
- SetCycleModal: SetCycleModal
370
- }), !loading && /*#__PURE__*/_react["default"].createElement("div", {
366
+ })), !loading && /*#__PURE__*/_react["default"].createElement("div", {
371
367
  className: "okr-list__check-filter-tips"
372
368
  }, (0, _getLocale.getLocale)("OKR_MyO_Text_CanfindOKR"), /*#__PURE__*/_react["default"].createElement("span", {
373
369
  className: "okr-list__check-filter-btn",
@@ -9,8 +9,6 @@ exports.parseTag = exports.parseStringV2 = exports.parseString = exports.parseOp
9
9
 
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
 
12
- var Sentry = _interopRequireWildcard(require("@sentry/browser"));
13
-
14
12
  var _bsGlobal = require("./bs-global");
15
13
 
16
14
  var _openDataPainter = require("../components/open-data-painter");
@@ -35,6 +33,7 @@ var WX_SOURCE = 860;
35
33
  var WX_UA_STR = 'micromessenger';
36
34
  var FEISHU_SOURCE = 862;
37
35
  var DINGTALK_SOURCE = 861;
36
+ var ignorePIds = [-1, 0, 10000];
38
37
 
39
38
  var getSource = function getSource() {
40
39
  return (0, _bsGlobal.getBSGlobal)('tenantInfo').Source;
@@ -76,32 +75,59 @@ function openData() {
76
75
  var _getBSGlobal;
77
76
 
78
77
  // 企业微信租户 && 非自建应用
79
- if (getSource() === WX_SOURCE && ((_getBSGlobal = (0, _bsGlobal.getBSGlobal)('tenantInfo')) === null || _getBSGlobal === void 0 ? void 0 : _getBSGlobal.corpCreateType) !== 2 || getUA().includes(WX_UA_STR)) {
78
+ if ((getSource() === WX_SOURCE || getUA().includes(WX_UA_STR)) && ((_getBSGlobal = (0, _bsGlobal.getBSGlobal)('tenantInfo')) === null || _getBSGlobal === void 0 ? void 0 : _getBSGlobal.corpCreateType) !== 2 // 2:自建应用
79
+ ) {
80
80
  // 企业微信初始化失败
81
- if (!window.WWOpenData && !window.top.WWOpenData) {
82
- return function (p) {
83
- if (p.name == undefined || p.id == undefined) {
84
- try {
85
- (0, _helpers.errorLog)(1, JSON.stringify({
86
- errorType: 'WWOpenData is undefined',
87
- pName: p.name == undefined ? 'undefined' : p.name,
88
- pId: p.id == undefined ? 'undefined' : p.id,
89
- pType: p.type
90
- }));
91
- } catch (e) {
92
- console.log(e);
93
- }
94
- }
95
-
96
- return p.name || p.id || null;
97
- };
98
- }
99
-
81
+ // if (!window.WWOpenData && !window.top.WWOpenData) {
82
+ // return (p) => {
83
+ // if (p.name == undefined || p.id == undefined) {
84
+ // try {
85
+ // errorLog(1, JSON.stringify({
86
+ // errorType: 'WWOpenData is undefined',
87
+ // pName: p.name == undefined ? 'undefined' : p.name,
88
+ // pId: p.id == undefined ? 'undefined' : p.id,
89
+ // pType: p.type,
90
+ // }))
91
+ // } catch (e) {
92
+ // console.log(e)
93
+ // }
94
+ // }
95
+ // return p.name || p.id || null
96
+ // }
97
+ // }
100
98
  return function (p) {
101
99
  var pId = p.id,
102
100
  pName = p.name,
103
101
  pCorpId = p.corpId,
104
102
  pType = p.type;
103
+ (0, _react.useEffect)(function () {
104
+ var openId = pCorpId || getOpenId(pId, pType);
105
+
106
+ if (!openId) {
107
+ if (pId !== undefined && !ignorePIds.includes(pId)) {
108
+ try {
109
+ // BSGlobal
110
+ var openIds;
111
+
112
+ if (pType === 'userName') {
113
+ openIds = (0, _bsGlobal.getBSGlobal)('openIds');
114
+ } else if (pType === 'departmentName') {
115
+ openIds = (0, _bsGlobal.getBSGlobal)('openDepartmentIds');
116
+ }
117
+
118
+ (0, _helpers.errorLog)(1, JSON.stringify({
119
+ errorType: 'openId 不存在',
120
+ pName: pName === undefined ? 'undefined' : pName,
121
+ pId: pId === undefined ? 'undefined' : pId,
122
+ pType: pType,
123
+ openIds: openIds
124
+ }));
125
+ } catch (e) {
126
+ console.log(e);
127
+ }
128
+ }
129
+ }
130
+ }, [pId, pName]);
105
131
 
106
132
  if (pId === undefined && pCorpId === undefined) {
107
133
  return pName || null;
@@ -111,40 +137,21 @@ function openData() {
111
137
  var openId = pCorpId || getOpenId(pId, pType);
112
138
 
113
139
  if (!openId) {
114
- if (pId) {
115
- try {
116
- // BSGlobal
117
- var openIds;
118
-
119
- if (pType === 'userName') {
120
- openIds = (0, _bsGlobal.getBSGlobal)('openIds');
121
- } else if (pType === 'departmentName') {
122
- openIds = (0, _bsGlobal.getBSGlobal)('openDepartmentIds');
123
- }
124
-
125
- (0, _helpers.errorLog)(1, JSON.stringify({
126
- errorType: 'openId 不存在',
127
- pName: pName == undefined ? 'undefined' : pName,
128
- pId: pId == undefined ? 'undefined' : pId,
129
- pType: pType,
130
- openIds: openIds
131
- }));
132
- } catch (e) {
133
- console.log(e);
134
- }
135
-
136
- Sentry.withScope(function (scope) {
137
- scope.setTag('error-level', 'P1');
138
- scope.setTag('error-type', '企业微信openData调用失败');
139
- scope.setExtra('fail_type', pType);
140
- scope.setExtra('p_id', pId);
141
- scope.setExtra('p_name', pName);
142
- scope.setExtra('corp_id', pCorpId);
143
- scope.setExtra('open_id', getOpenId(pId, pType));
144
- p.callFunc && scope.setExtra('fail_callFunc', p.callFunc);
145
- p.extra && scope.setExtra('fail_extra', p.extra);
146
- Sentry.captureException(new Error('企业微信openData调用失败'), scope);
147
- });
140
+ if (pId !== undefined && !ignorePIds.includes(pId)) {// Sentry.withScope((scope) => {
141
+ // scope.setTag('error-level', 'P1')
142
+ // scope.setTag('error-type', '企业微信openData调用失败')
143
+ // scope.setExtra('fail_type', pType)
144
+ // scope.setExtra('p_id', pId)
145
+ // scope.setExtra('p_name', pName)
146
+ // scope.setExtra('corp_id', pCorpId)
147
+ // scope.setExtra('open_id', getOpenId(pId, pType))
148
+ // p.callFunc && scope.setExtra('fail_callFunc', p.callFunc)
149
+ // p.extra && scope.setExtra('fail_extra', p.extra)
150
+ // Sentry.captureException(
151
+ // new Error('企业微信openData调用失败'),
152
+ // scope,
153
+ // )
154
+ // })
148
155
  }
149
156
 
150
157
  return pName || pId || null;
@@ -156,7 +163,7 @@ function openData() {
156
163
 
157
164
  // @ts-ignore
158
165
  (_ref = window.WWOpenData && window.WWOpenData || window.top.WWOpenData) === null || _ref === void 0 ? void 0 : _ref.bind(ref.current);
159
- }, []);
166
+ }, [pId, pName]);
160
167
  return /*#__PURE__*/_react["default"].createElement("div", {
161
168
  style: {
162
169
  display: 'inline',
@@ -164,14 +171,11 @@ function openData() {
164
171
  overflow: 'hidden',
165
172
  textOverflow: 'ellipsis'
166
173
  }
167
- },
168
- /*#__PURE__*/
169
- // @ts-ignore
170
- _react["default"].createElement("ww-open-data", {
174
+ }, (window.WWOpenData || window.top.WWOpenData) && /*#__PURE__*/_react["default"].createElement("ww-open-data", {
171
175
  ref: ref,
172
176
  type: pType,
173
177
  openid: openId
174
- }), /*#__PURE__*/_react["default"].createElement("div", {
178
+ }), !window.WWOpenData && !window.top.WWOpenData && (pName || pId), /*#__PURE__*/_react["default"].createElement("div", {
175
179
  style: {
176
180
  position: 'absolute',
177
181
  top: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.13.8",
3
+ "version": "1.13.10-beta.10",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "lib/index.js",