@titaui/pc 1.15.7 → 1.15.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.
@@ -162,14 +162,57 @@
162
162
 
163
163
  .titaui-nav-top__invite {
164
164
  margin-right: 24px;
165
- width: 20px;
166
- height: 20px;
165
+ width: 28px !important;
166
+ height: 28px !important;
167
+ border-radius: 4px !important;
167
168
  cursor: pointer;
168
169
  display: inline-flex;
170
+ align-items: center;
171
+ justify-content: center;
169
172
  font-size: 20px;
170
173
  color: #ffffff;
171
174
  }
172
175
 
176
+ .titaui-nav-top__invite:hover {
177
+ background-color: rgba(255, 255, 255, 0.2);
178
+ }
179
+
180
+ .titaui-nav-top__invite-guide {
181
+ background-image: url("./images/invite-bkg.jpg"), url("./images/invite-person.jpg") !important;
182
+ background-repeat: no-repeat,no-repeat !important;
183
+ background-size: 87px 104px, 92px 53px !important;
184
+ background-position: 0% 0%,100% 100% !important;
185
+ }
186
+
187
+ .titaui-nav-top__invite-guide-content {
188
+ display: flex;
189
+ align-items: flex-start;
190
+ }
191
+
192
+ .titaui-nav-top__invite-guide-content-waring {
193
+ width: 18px;
194
+ margin-right: 6px;
195
+ }
196
+
197
+ .titaui-nav-top__invite-guide-content-point {
198
+ width: 14px;
199
+ margin-right: 8px;
200
+ }
201
+
202
+ .titaui-nav-top__invite-guide-content-title {
203
+ font-size: 14px;
204
+ color: #FFFFFF;
205
+ font-weight: 600;
206
+ line-height: 22px;
207
+ }
208
+
209
+ .titaui-nav-top__invite-guide-content-subTitle {
210
+ margin-top: 8px;
211
+ font-size: 12px;
212
+ color: #FFFFFF;
213
+ line-height: 22px;
214
+ }
215
+
173
216
  .titaui-nav-top__app-guide-content {
174
217
  color: #fff;
175
218
  margin-bottom: 8px;
@@ -45,8 +45,18 @@ var _interface = require("../../components/help-card/interface");
45
45
 
46
46
  var _request2 = require("./request.apis");
47
47
 
48
+ var _auth = require("../../utils/auth");
49
+
50
+ var _invitePoint = _interopRequireDefault(require("./images/invite-point.png"));
51
+
52
+ var _tooltip = _interopRequireDefault(require("../tooltip"));
53
+
54
+ var _inviteTanhao = _interopRequireDefault(require("./images/invite-tanhao.png"));
55
+
48
56
  require("./index.css");
49
57
 
58
+ var _getBSGlobal, _getBSGlobal2;
59
+
50
60
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
51
61
 
52
62
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -67,12 +77,15 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
67
77
 
68
78
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
69
79
 
80
+ var Role = new _auth.MyRole();
81
+ var isTry = ((_getBSGlobal = (0, _bsGlobal.getBSGlobal)('tenantAuthentication')) === null || _getBSGlobal === void 0 ? void 0 : _getBSGlobal.Version) === 1;
82
+ var staffCount = (_getBSGlobal2 = (0, _bsGlobal.getBSGlobal)('tenantInfo')) === null || _getBSGlobal2 === void 0 ? void 0 : _getBSGlobal2.StaffCount;
70
83
  var Logo = (0, _utils.getLogo)();
71
- var newNavigation = (0, _bsGlobal.getBSGlobal)("newNavigation") || [];
84
+ var newNavigation = (0, _bsGlobal.getBSGlobal)('newNavigation') || [];
72
85
  var hasOKRApp = newNavigation.find(function (item) {
73
86
  return item.appId === 113;
74
87
  });
75
- var preCls = "titaui-nav-top";
88
+ var preCls = 'titaui-nav-top';
76
89
 
77
90
  var NavTop = function NavTop() {
78
91
  var _classNames4;
@@ -87,7 +100,7 @@ var NavTop = function NavTop() {
87
100
  menu = _useState2[0],
88
101
  setMenu = _useState2[1];
89
102
 
90
- var versionInfo = (0, _bsGlobal.getBSGlobal)("tenantAuthentication");
103
+ var versionInfo = (0, _bsGlobal.getBSGlobal)('tenantAuthentication');
91
104
 
92
105
  var _useState3 = (0, _react.useState)(-1),
93
106
  _useState4 = _slicedToArray(_useState3, 2),
@@ -134,25 +147,57 @@ var NavTop = function NavTop() {
134
147
  bookDemoVisible = _useState20[0],
135
148
  setBookDemoVisible = _useState20[1];
136
149
 
150
+ var _useState21 = (0, _react.useState)(true),
151
+ _useState22 = _slicedToArray(_useState21, 2),
152
+ inviteVisible = _useState22[0],
153
+ setInviteVisible = _useState22[1];
154
+
155
+ var _useState23 = (0, _react.useState)(true),
156
+ _useState24 = _slicedToArray(_useState23, 2),
157
+ inviteAuth = _useState24[0],
158
+ setInviteAuth = _useState24[1];
159
+
137
160
  var ua = navigator.userAgent.toLowerCase();
138
- var showWxInvite = (0, _bsGlobal.getTenantInfo)().mainCorpId && ua.indexOf("micromessenger") !== -1;
161
+ var showWxInvite = (0, _bsGlobal.getTenantInfo)().mainCorpId && ua.indexOf('micromessenger') !== -1;
162
+ var showMangeAdd = !(0, _bsGlobal.getTenantInfo)().mainCorpId && ua.indexOf('micromessenger') !== -1 && isTry && Role.isSuperManager; // const canShowInvite = getTenantInfo().mainCorpId || Role.isSuperManager
163
+ // const showWxInvite =
164
+ // getTenantInfo().Source === 860 &&
165
+ // ua.indexOf('micromessenger') !== -1 &&
166
+ // isTry && canShowInvite
167
+
168
+ var manageAdd = (0, _react.useCallback)(function () {
169
+ if (window.WeixinJSBridge !== undefined) {
170
+ window.WeixinJSBridge.invoke('openAppManage', {}, function (res) {
171
+ console.log(res.err_msg);
172
+
173
+ if (res.err_msg == 'openAppManage:ok') {// 调用成功
174
+ } else {
175
+ if (!inviteVisible) {
176
+ setInviteVisible(true);
177
+ }
178
+
179
+ setInviteAuth(false);
180
+ }
181
+ });
182
+ }
183
+ }, [inviteVisible]);
139
184
  var openWxInvite = (0, _react.useCallback)(function () {
140
185
  if (window.WeixinJSBridge !== undefined) {
141
- window.WeixinJSBridge.invoke("selectPrivilegedContact", {
186
+ window.WeixinJSBridge.invoke('selectPrivilegedContact', {
142
187
  fromDepartmentId: -1,
143
188
  // 必填,表示打开的通讯录从指定的部门开始展示,-1表示自己所在部门开始, 0表示从最上层开始
144
- mode: "multi",
189
+ mode: 'multi',
145
190
  // 必填,选择模式,single表示单选,multi表示多选
146
191
  selectedContextContact: 0 // 是否勾选当前环境的参与者。例如在群+号聊天附件栏打开,默认勾选当前群成员。
147
192
 
148
193
  }, function (res) {
149
- if (res.err_msg === "selectPrivilegedContact:ok") {
150
- var selectedTicket = res.result.selectedTicket.replace(/['"]/g, ""); // 已选的集合Ticket
194
+ if (res.err_msg === 'selectPrivilegedContact:ok') {
195
+ var selectedTicket = res.result.selectedTicket.replace(/['"]/g, ''); // 已选的集合Ticket
151
196
 
152
- (0, _request.rpost)("v1")("wx/send/templateMessage?selectedTickets=".concat(selectedTicket)).then(function () {
153
- _toast["default"].Success("邀请成功");
197
+ (0, _request.rpost)('v1')("wx/send/templateMessage?selectedTickets=".concat(selectedTicket)).then(function () {
198
+ _toast["default"].Success('邀请成功');
154
199
  })["catch"](function () {
155
- _toast["default"].Error("邀请失败");
200
+ _toast["default"].Error('邀请失败');
156
201
  });
157
202
  } else {// console.log(res);
158
203
  }
@@ -162,16 +207,16 @@ var NavTop = function NavTop() {
162
207
 
163
208
  var handleHashChange = function handleHashChange() {
164
209
  setAppCenterVisible(false);
165
- var hash = window.location.hash.split("?")[0] || "";
210
+ var hash = window.location.hash.split('?')[0] || '';
166
211
 
167
212
  if (hash) {
168
213
  var activeMenu = menu.find(function (item) {
169
214
  var _item$href$split, _item$href$split$;
170
215
 
171
- 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]);
216
+ 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]);
172
217
  });
173
218
 
174
- if (hash.includes("homepage")) {
219
+ if (hash.includes('homepage')) {
175
220
  setActiveMenuId(99999);
176
221
  return;
177
222
  }
@@ -186,9 +231,9 @@ var NavTop = function NavTop() {
186
231
 
187
232
  (0, _react.useEffect)(function () {
188
233
  handleHashChange();
189
- window.addEventListener("hashchange", handleHashChange);
234
+ window.addEventListener('hashchange', handleHashChange);
190
235
  return function () {
191
- window.removeEventListener("hashchange", handleHashChange);
236
+ window.removeEventListener('hashchange', handleHashChange);
192
237
  };
193
238
  }, [menu]);
194
239
  (0, _react.useEffect)(function () {
@@ -211,6 +256,14 @@ var NavTop = function NavTop() {
211
256
  }
212
257
  }, [appCenterVisible]);
213
258
 
259
+ var handleCloseInviteGuide = function handleCloseInviteGuide() {
260
+ setInviteVisible(false);
261
+
262
+ if (!inviteAuth) {
263
+ setInviteAuth(true);
264
+ }
265
+ };
266
+
214
267
  var handleCloseSummaryGuide = function handleCloseSummaryGuide() {
215
268
  setSummaryGuideVisible(false);
216
269
  var loginUserId = BSGlobal.loginUserInfo.Id;
@@ -272,6 +325,36 @@ var NavTop = function NavTop() {
272
325
  }
273
326
  };
274
327
 
328
+ var renderInviteContent = (0, _react.useCallback)(function () {
329
+ var title = '你没有权限,快去联系企业微信超级管理员操';
330
+ if (!inviteAuth) return /*#__PURE__*/_react["default"].createElement("div", {
331
+ className: "".concat(preCls, "__invite-guide-content")
332
+ }, /*#__PURE__*/_react["default"].createElement("img", {
333
+ src: _inviteTanhao["default"],
334
+ alt: "",
335
+ className: "".concat(preCls, "__invite-guide-content-waring")
336
+ }), /*#__PURE__*/_react["default"].createElement("div", {
337
+ className: "".concat(preCls, "__invite-guide-content-right")
338
+ }, /*#__PURE__*/_react["default"].createElement("div", {
339
+ className: "".concat(preCls, "__invite-guide-content-title")
340
+ }, title)));
341
+ title = showMangeAdd ? '点击这里进入企业微信后台,添加公司员工,体验更多功能' : '邀请同事一起体验吧';
342
+ var subtitle = '试用 7 天内成功邀请 3 人加入,即可免费开启试用 OKR 案例库';
343
+ return /*#__PURE__*/_react["default"].createElement("div", {
344
+ className: "".concat(preCls, "__invite-guide-content")
345
+ }, /*#__PURE__*/_react["default"].createElement("img", {
346
+ src: _invitePoint["default"],
347
+ alt: "",
348
+ className: "".concat(preCls, "__invite-guide-content-point")
349
+ }), /*#__PURE__*/_react["default"].createElement("div", {
350
+ className: "".concat(preCls, "__invite-guide-content-right")
351
+ }, /*#__PURE__*/_react["default"].createElement("div", {
352
+ className: "".concat(preCls, "__invite-guide-content-title")
353
+ }, title), /*#__PURE__*/_react["default"].createElement("div", {
354
+ className: "".concat(preCls, "__invite-guide-content-subTitle")
355
+ }, subtitle)));
356
+ }, [inviteAuth]);
357
+
275
358
  var isHasOkr = function isHasOkr() {
276
359
  //判断是否安装了OKR
277
360
  var okrIndex = (0, _bsGlobal.getBSGlobal)('WebHead').AppHead.findIndex(function (item) {
@@ -288,9 +371,9 @@ var NavTop = function NavTop() {
288
371
  (0, _react.useEffect)(function () {
289
372
  var version = (0, _bsGlobal.getBSGlobal)('tenantAuthentication').Version;
290
373
  if (localStorage.getItem("cycle_setting_stop_show".concat((0, _bsGlobal.getUserInfo)().Id)) === 'true') return;
291
- localStorage.removeItem("OKR_CYCLE_SETTING");
374
+ localStorage.removeItem('OKR_CYCLE_SETTING');
292
375
  (0, _request2.getCycleSetting)().then(function (res) {
293
- localStorage.setItem("OKR_CYCLE_SETTING", JSON.stringify(res || {}));
376
+ localStorage.setItem('OKR_CYCLE_SETTING', JSON.stringify(res || {}));
294
377
  var hasSetting = res.hasSetting;
295
378
 
296
379
  if (version === 1 && isHasOkr() && !hasSetting) {
@@ -328,7 +411,7 @@ var NavTop = function NavTop() {
328
411
  onClickClose: handleCloseSummaryGuide,
329
412
  width: 197
330
413
  }, /*#__PURE__*/_react["default"].createElement("span", {
331
- className: (0, _classnames["default"])("".concat(preCls, "__left-app-center"), "document-mouse-event-ignore", _defineProperty({}, "".concat(preCls, "__left-app-center--active"), appCenterVisible)),
414
+ className: (0, _classnames["default"])("".concat(preCls, "__left-app-center"), 'document-mouse-event-ignore', _defineProperty({}, "".concat(preCls, "__left-app-center--active"), appCenterVisible)),
332
415
  onClick: function onClick() {
333
416
  return setAppCenterVisible(!appCenterVisible);
334
417
  }
@@ -339,7 +422,63 @@ var NavTop = function NavTop() {
339
422
  }, /*#__PURE__*/_react["default"].createElement(_menu["default"], {
340
423
  menus: menu,
341
424
  activeMenuId: activeMenuId
342
- })), hasOKRApp && /*#__PURE__*/_react["default"].createElement("div", {
425
+ })), showWxInvite && (staffCount > 3 ? /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
426
+ overlay: '邀请同事',
427
+ placement: "bottom",
428
+ align: {
429
+ offset: [0, 5]
430
+ }
431
+ }, /*#__PURE__*/_react["default"].createElement("div", {
432
+ className: "".concat(preCls, "__invite"),
433
+ onClick: openWxInvite
434
+ }, /*#__PURE__*/_react["default"].createElement("i", {
435
+ className: (0, _classnames["default"])('tu-icon-add-people', "".concat(preCls, "__invite-icon"))
436
+ }))) : /*#__PURE__*/_react["default"].createElement(_guideTip["default"], {
437
+ visible: inviteVisible,
438
+ content: renderInviteContent(),
439
+ type: inviteAuth ? 'default' : 'button',
440
+ popupPlacement: "bottom",
441
+ classnames: inviteAuth ? "".concat(preCls, "__invite-guide") : '',
442
+ onClickClose: handleCloseInviteGuide,
443
+ popupAlign: {
444
+ offset: [0, 5]
445
+ },
446
+ zIndex: 1000,
447
+ width: 308
448
+ }, /*#__PURE__*/_react["default"].createElement("div", {
449
+ className: "".concat(preCls, "__invite"),
450
+ onClick: openWxInvite
451
+ }, /*#__PURE__*/_react["default"].createElement("i", {
452
+ className: (0, _classnames["default"])('tu-icon-add-people', "".concat(preCls, "__invite-icon"))
453
+ })))), showMangeAdd && (staffCount > 3 && inviteAuth ? /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
454
+ overlay: '添加员工',
455
+ placement: "bottom",
456
+ align: {
457
+ offset: [0, 5]
458
+ }
459
+ }, /*#__PURE__*/_react["default"].createElement("div", {
460
+ className: "".concat(preCls, "__invite"),
461
+ onClick: manageAdd
462
+ }, /*#__PURE__*/_react["default"].createElement("i", {
463
+ className: (0, _classnames["default"])('tu-icon-add-people', "".concat(preCls, "__invite-icon"))
464
+ }))) : /*#__PURE__*/_react["default"].createElement(_guideTip["default"], {
465
+ visible: inviteVisible,
466
+ content: renderInviteContent(),
467
+ type: inviteAuth ? 'default' : 'button',
468
+ popupPlacement: "bottom",
469
+ classnames: inviteAuth ? "".concat(preCls, "__invite-guide") : '',
470
+ onClickClose: handleCloseInviteGuide,
471
+ popupAlign: {
472
+ offset: [0, 5]
473
+ },
474
+ zIndex: 1000,
475
+ width: 308
476
+ }, /*#__PURE__*/_react["default"].createElement("div", {
477
+ className: "".concat(preCls, "__invite"),
478
+ onClick: manageAdd
479
+ }, /*#__PURE__*/_react["default"].createElement("i", {
480
+ className: (0, _classnames["default"])('tu-icon-add-people', "".concat(preCls, "__invite-icon"))
481
+ })))), hasOKRApp && /*#__PURE__*/_react["default"].createElement("div", {
343
482
  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))
344
483
  }, /*#__PURE__*/_react["default"].createElement("a", {
345
484
  href: "#homepage"
@@ -347,12 +486,7 @@ var NavTop = function NavTop() {
347
486
  alt: "home-img",
348
487
  src: _home["default"],
349
488
  className: "".concat(preCls, "__left-home-img")
350
- }))), showWxInvite && /*#__PURE__*/_react["default"].createElement("div", {
351
- className: "".concat(preCls, "__invite"),
352
- onClick: openWxInvite
353
- }, /*#__PURE__*/_react["default"].createElement("i", {
354
- className: (0, _classnames["default"])("tu-icon-add-people", "".concat(preCls, "__invite-icon"))
355
- })), /*#__PURE__*/_react["default"].createElement("div", {
489
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
356
490
  className: "".concat(preCls, "__msg")
357
491
  }, /*#__PURE__*/_react["default"].createElement(_userMessage["default"], null)), versionInfo.Version === 1 && /*#__PURE__*/_react["default"].createElement("div", {
358
492
  className: "".concat(preCls, "__version")
@@ -277,7 +277,7 @@ function OKRCases(props) {
277
277
  setIsNextPageEmpty(false); // 每当一级菜单改变,获取二级菜单
278
278
 
279
279
  navList.map(function (item) {
280
- if (item.orderNumber === activeNavId) {
280
+ if (item.id === activeNavId) {
281
281
  var navSecondList = item.subLabel;
282
282
 
283
283
  if (activeNavId === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.15.7",
3
+ "version": "1.15.10",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "lib/index.js",