@titaui/pc 1.15.4 → 1.15.5

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.
@@ -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,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,44 +147,72 @@ var NavTop = function NavTop() {
134
147
  bookDemoVisible = _useState20[0],
135
148
  setBookDemoVisible = _useState20[1];
136
149
 
137
- var ua = navigator.userAgent.toLowerCase();
138
- var showWxInvite = (0, _bsGlobal.getTenantInfo)().mainCorpId && ua.indexOf("micromessenger") !== -1;
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
+
160
+ var ua = navigator.userAgent.toLowerCase(); // const showWxInvite = getTenantInfo().mainCorpId && ua.indexOf("micromessenger") !== -1;
161
+
162
+ var showWxInvite = (0, _bsGlobal.getTenantInfo)().Source === 860 && ua.indexOf('micromessenger') !== -1 && isTry;
139
163
  var openWxInvite = (0, _react.useCallback)(function () {
140
- if (window.WeixinJSBridge !== undefined) {
141
- window.WeixinJSBridge.invoke("selectPrivilegedContact", {
142
- fromDepartmentId: -1,
143
- // 必填,表示打开的通讯录从指定的部门开始展示,-1表示自己所在部门开始, 0表示从最上层开始
144
- mode: "multi",
145
- // 必填,选择模式,single表示单选,multi表示多选
146
- selectedContextContact: 0 // 是否勾选当前环境的参与者。例如在群+号聊天附件栏打开,默认勾选当前群成员。
147
-
148
- }, function (res) {
149
- if (res.err_msg === "selectPrivilegedContact:ok") {
150
- var selectedTicket = res.result.selectedTicket.replace(/['"]/g, ""); // 已选的集合Ticket
151
-
152
- (0, _request.rpost)("v1")("wx/send/templateMessage?selectedTickets=".concat(selectedTicket)).then(function () {
153
- _toast["default"].Success("邀请成功");
154
- })["catch"](function () {
155
- _toast["default"].Error("邀请失败");
156
- });
157
- } else {// console.log(res);
158
- }
159
- });
164
+ if (Role.isSuperManager) {
165
+ if (window.WeixinJSBridge !== undefined) {
166
+ window.WeixinJSBridge.invoke('openAppManage', {}, function (res) {
167
+ console.log(res.err_msg);
168
+
169
+ if (res.err_msg == 'openAppManage:ok') {// 调用成功
170
+ } else {
171
+ if (!inviteVisible) {
172
+ setInviteVisible(true);
173
+ }
174
+
175
+ setInviteAuth(false);
176
+ }
177
+ });
178
+ }
179
+ } else {
180
+ if (window.WeixinJSBridge !== undefined) {
181
+ window.WeixinJSBridge.invoke('selectPrivilegedContact', {
182
+ fromDepartmentId: -1,
183
+ // 必填,表示打开的通讯录从指定的部门开始展示,-1表示自己所在部门开始, 0表示从最上层开始
184
+ mode: 'multi',
185
+ // 必填,选择模式,single表示单选,multi表示多选
186
+ selectedContextContact: 0 // 是否勾选当前环境的参与者。例如在群+号聊天附件栏打开,默认勾选当前群成员。
187
+
188
+ }, function (res) {
189
+ if (res.err_msg === 'selectPrivilegedContact:ok') {
190
+ var selectedTicket = res.result.selectedTicket.replace(/['"]/g, ''); // 已选的集合Ticket
191
+
192
+ (0, _request.rpost)('v1')("wx/send/templateMessage?selectedTickets=".concat(selectedTicket)).then(function () {
193
+ _toast["default"].Success('邀请成功');
194
+ })["catch"](function () {
195
+ _toast["default"].Error('邀请失败');
196
+ });
197
+ } else {// console.log(res);
198
+ }
199
+ });
200
+ }
160
201
  }
161
- }, []);
202
+ }, [inviteVisible]);
162
203
 
163
204
  var handleHashChange = function handleHashChange() {
164
205
  setAppCenterVisible(false);
165
- var hash = window.location.hash.split("?")[0] || "";
206
+ var hash = window.location.hash.split('?')[0] || '';
166
207
 
167
208
  if (hash) {
168
209
  var activeMenu = menu.find(function (item) {
169
210
  var _item$href$split, _item$href$split$;
170
211
 
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]);
212
+ 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
213
  });
173
214
 
174
- if (hash.includes("homepage")) {
215
+ if (hash.includes('homepage')) {
175
216
  setActiveMenuId(99999);
176
217
  return;
177
218
  }
@@ -186,9 +227,9 @@ var NavTop = function NavTop() {
186
227
 
187
228
  (0, _react.useEffect)(function () {
188
229
  handleHashChange();
189
- window.addEventListener("hashchange", handleHashChange);
230
+ window.addEventListener('hashchange', handleHashChange);
190
231
  return function () {
191
- window.removeEventListener("hashchange", handleHashChange);
232
+ window.removeEventListener('hashchange', handleHashChange);
192
233
  };
193
234
  }, [menu]);
194
235
  (0, _react.useEffect)(function () {
@@ -211,6 +252,10 @@ var NavTop = function NavTop() {
211
252
  }
212
253
  }, [appCenterVisible]);
213
254
 
255
+ var handleCloseInviteGuide = function handleCloseInviteGuide() {
256
+ setInviteVisible(false);
257
+ };
258
+
214
259
  var handleCloseSummaryGuide = function handleCloseSummaryGuide() {
215
260
  setSummaryGuideVisible(false);
216
261
  var loginUserId = BSGlobal.loginUserInfo.Id;
@@ -272,6 +317,36 @@ var NavTop = function NavTop() {
272
317
  }
273
318
  };
274
319
 
320
+ var renderInviteContent = (0, _react.useCallback)(function () {
321
+ var title = '你没有权限,快去联系企业微信超级管理员操';
322
+ if (!inviteAuth) return /*#__PURE__*/_react["default"].createElement("div", {
323
+ className: "".concat(preCls, "__invite-guide-content")
324
+ }, /*#__PURE__*/_react["default"].createElement("img", {
325
+ src: _inviteTanhao["default"],
326
+ alt: "",
327
+ className: "".concat(preCls, "__invite-guide-content-waring")
328
+ }), /*#__PURE__*/_react["default"].createElement("div", {
329
+ className: "".concat(preCls, "__invite-guide-content-right")
330
+ }, /*#__PURE__*/_react["default"].createElement("div", {
331
+ className: "".concat(preCls, "__invite-guide-content-title")
332
+ }, title)));
333
+ title = Role.isSuperManager ? '点击这里进入企业微信后台,添加公司员工,体验更多功能' : '邀请同事一起体验吧';
334
+ var subtitle = '试用 7 天内成功邀请 3 人加入,即可免费开启试用 OKR 案例库';
335
+ return /*#__PURE__*/_react["default"].createElement("div", {
336
+ className: "".concat(preCls, "__invite-guide-content")
337
+ }, /*#__PURE__*/_react["default"].createElement("img", {
338
+ src: _invitePoint["default"],
339
+ alt: "",
340
+ className: "".concat(preCls, "__invite-guide-content-point")
341
+ }), /*#__PURE__*/_react["default"].createElement("div", {
342
+ className: "".concat(preCls, "__invite-guide-content-right")
343
+ }, /*#__PURE__*/_react["default"].createElement("div", {
344
+ className: "".concat(preCls, "__invite-guide-content-title")
345
+ }, title), /*#__PURE__*/_react["default"].createElement("div", {
346
+ className: "".concat(preCls, "__invite-guide-content-subTitle")
347
+ }, subtitle)));
348
+ }, [inviteAuth]);
349
+
275
350
  var isHasOkr = function isHasOkr() {
276
351
  //判断是否安装了OKR
277
352
  var okrIndex = (0, _bsGlobal.getBSGlobal)('WebHead').AppHead.findIndex(function (item) {
@@ -288,9 +363,9 @@ var NavTop = function NavTop() {
288
363
  (0, _react.useEffect)(function () {
289
364
  var version = (0, _bsGlobal.getBSGlobal)('tenantAuthentication').Version;
290
365
  if (localStorage.getItem("cycle_setting_stop_show".concat((0, _bsGlobal.getUserInfo)().Id)) === 'true') return;
291
- localStorage.removeItem("OKR_CYCLE_SETTING");
366
+ localStorage.removeItem('OKR_CYCLE_SETTING');
292
367
  (0, _request2.getCycleSetting)().then(function (res) {
293
- localStorage.setItem("OKR_CYCLE_SETTING", JSON.stringify(res || {}));
368
+ localStorage.setItem('OKR_CYCLE_SETTING', JSON.stringify(res || {}));
294
369
  var hasSetting = res.hasSetting;
295
370
 
296
371
  if (version === 1 && isHasOkr() && !hasSetting) {
@@ -328,7 +403,7 @@ var NavTop = function NavTop() {
328
403
  onClickClose: handleCloseSummaryGuide,
329
404
  width: 197
330
405
  }, /*#__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)),
406
+ className: (0, _classnames["default"])("".concat(preCls, "__left-app-center"), 'document-mouse-event-ignore', _defineProperty({}, "".concat(preCls, "__left-app-center--active"), appCenterVisible)),
332
407
  onClick: function onClick() {
333
408
  return setAppCenterVisible(!appCenterVisible);
334
409
  }
@@ -339,7 +414,35 @@ var NavTop = function NavTop() {
339
414
  }, /*#__PURE__*/_react["default"].createElement(_menu["default"], {
340
415
  menus: menu,
341
416
  activeMenuId: activeMenuId
342
- })), hasOKRApp && /*#__PURE__*/_react["default"].createElement("div", {
417
+ })), showWxInvite && (staffCount > 3 ? /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
418
+ overlay: Role.isSuperManager ? '添加员工' : '邀请同事',
419
+ placement: "bottom",
420
+ align: {
421
+ offset: [0, 5]
422
+ }
423
+ }, /*#__PURE__*/_react["default"].createElement("div", {
424
+ className: "".concat(preCls, "__invite"),
425
+ onClick: openWxInvite
426
+ }, /*#__PURE__*/_react["default"].createElement("i", {
427
+ className: (0, _classnames["default"])('tu-icon-add-people', "".concat(preCls, "__invite-icon"))
428
+ }))) : /*#__PURE__*/_react["default"].createElement(_guideTip["default"], {
429
+ visible: inviteVisible,
430
+ content: renderInviteContent(),
431
+ type: inviteAuth ? 'default' : 'button',
432
+ popupPlacement: "bottom",
433
+ classnames: inviteAuth ? "".concat(preCls, "__invite-guide") : '',
434
+ onClickClose: handleCloseInviteGuide,
435
+ popupAlign: {
436
+ offset: [0, 5]
437
+ },
438
+ zIndex: 1000,
439
+ width: 308
440
+ }, /*#__PURE__*/_react["default"].createElement("div", {
441
+ className: "".concat(preCls, "__invite"),
442
+ onClick: openWxInvite
443
+ }, /*#__PURE__*/_react["default"].createElement("i", {
444
+ className: (0, _classnames["default"])('tu-icon-add-people', "".concat(preCls, "__invite-icon"))
445
+ })))), hasOKRApp && /*#__PURE__*/_react["default"].createElement("div", {
343
446
  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
447
  }, /*#__PURE__*/_react["default"].createElement("a", {
345
448
  href: "#homepage"
@@ -347,12 +450,7 @@ var NavTop = function NavTop() {
347
450
  alt: "home-img",
348
451
  src: _home["default"],
349
452
  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", {
453
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
356
454
  className: "".concat(preCls, "__msg")
357
455
  }, /*#__PURE__*/_react["default"].createElement(_userMessage["default"], null)), versionInfo.Version === 1 && /*#__PURE__*/_react["default"].createElement("div", {
358
456
  className: "".concat(preCls, "__version")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.15.4",
3
+ "version": "1.15.5",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "lib/index.js",