@titaui/pc 1.12.90 → 1.12.91-beta.1

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.
@@ -67,10 +67,15 @@ function AppraisalMenus(props) {
67
67
  maxHeight = _useState2[0],
68
68
  setMaxHeight = _useState2[1];
69
69
 
70
- var _useState3 = (0, _react.useState)([]),
70
+ var _useState3 = (0, _react.useState)(true),
71
71
  _useState4 = _slicedToArray(_useState3, 2),
72
- selectedMenuKeys = _useState4[0],
73
- setSelectedMenuKeys = _useState4[1];
72
+ isInitialState = _useState4[0],
73
+ setIsInitialState = _useState4[1];
74
+
75
+ var _useState5 = (0, _react.useState)([]),
76
+ _useState6 = _slicedToArray(_useState5, 2),
77
+ selectedMenuKeys = _useState6[0],
78
+ setSelectedMenuKeys = _useState6[1];
74
79
 
75
80
  var menuRef = (0, _react.useRef)();
76
81
  var flipRef = (0, _react.useRef)({
@@ -79,13 +84,13 @@ function AppraisalMenus(props) {
79
84
  });
80
85
  var okrMenusData = (0, _react.useRef)(_menus.defaultRefObject);
81
86
 
82
- var _useState5 = (0, _react.useState)(function () {
87
+ var _useState7 = (0, _react.useState)(function () {
83
88
  okrMenusData.current = new _menus["default"]();
84
89
  return okrMenusData.current.getMenus();
85
90
  }),
86
- _useState6 = _slicedToArray(_useState5, 2),
87
- menus = _useState6[0],
88
- setMenus = _useState6[1];
91
+ _useState8 = _slicedToArray(_useState7, 2),
92
+ menus = _useState8[0],
93
+ setMenus = _useState8[1];
89
94
 
90
95
  (0, _react.useEffect)(function () {
91
96
  okrMenusData.current = new _menus["default"]();
@@ -96,9 +101,11 @@ function AppraisalMenus(props) {
96
101
  _getQueryString$react = _getQueryString.reactRouterName,
97
102
  reactRouterName = _getQueryString$react === void 0 ? '' : _getQueryString$react;
98
103
 
99
- if (!reactRouterName) {
104
+ if (!reactRouterName && isInitialState) {
100
105
  window.location.href = newMenus[0].data.href;
101
106
  }
107
+
108
+ setIsInitialState(false);
102
109
  }, [history.location.pathname]); // 判断路由高亮菜单
103
110
 
104
111
  (0, _react.useEffect)(function () {
@@ -68,6 +68,11 @@ function InterviewMenus(props) {
68
68
  menus = _useState4[0],
69
69
  setMenus = _useState4[1];
70
70
 
71
+ var _useState5 = (0, _react.useState)(true),
72
+ _useState6 = _slicedToArray(_useState5, 2),
73
+ isInitialState = _useState6[0],
74
+ setIsInitialState = _useState6[1];
75
+
71
76
  var flipRef = (0, _react.useRef)({
72
77
  next: function next() {},
73
78
  goback: function goback() {}
@@ -91,9 +96,11 @@ function InterviewMenus(props) {
91
96
  _getQueryString$react = _getQueryString.reactRouterName,
92
97
  reactRouterName = _getQueryString$react === void 0 ? '' : _getQueryString$react;
93
98
 
94
- if (!reactRouterName) {
99
+ if (!reactRouterName && isInitialState) {
95
100
  window.location.href = newMenus[0].data.href;
96
101
  }
102
+
103
+ setIsInitialState(false);
97
104
  }, [history.location.pathname]);
98
105
  (0, _react.useEffect)(function () {
99
106
  var search = history.location.search;
@@ -111,8 +111,10 @@ function openData(p) {
111
111
 
112
112
  var ref = (0, _react.useRef)(null);
113
113
  (0, _react.useEffect)(function () {
114
+ var _ref;
115
+
114
116
  //@ts-ignore
115
- (window.WWOpenData && window.WWOpenData || window.top.WWOpenData).bind(ref.current);
117
+ (_ref = window.WWOpenData && window.WWOpenData || window.top.WWOpenData) === null || _ref === void 0 ? void 0 : _ref.bind(ref.current);
116
118
  if (!p.id) return;
117
119
  var openId = getOpenId(p.id, p.type);
118
120
 
@@ -353,7 +355,7 @@ var parseStringV2 = function parseStringV2(str) {
353
355
  exports.parseStringV2 = parseStringV2;
354
356
 
355
357
  var parseOpenDataStringToImg = /*#__PURE__*/function () {
356
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(str) {
358
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(str) {
357
359
  var font,
358
360
  reg,
359
361
  strReg,
@@ -427,21 +429,21 @@ var parseOpenDataStringToImg = /*#__PURE__*/function () {
427
429
  }));
428
430
 
429
431
  return function parseOpenDataStringToImg(_x) {
430
- return _ref.apply(this, arguments);
432
+ return _ref2.apply(this, arguments);
431
433
  };
432
434
  }();
433
435
 
434
436
  exports.parseOpenDataStringToImg = parseOpenDataStringToImg;
435
437
 
436
438
  var getCanvasImg = /*#__PURE__*/function () {
437
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(id, type, _ref2) {
439
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(id, type, _ref3) {
438
440
  var lineHeight, fontSize, fontWeight, color, font, canvas, ctx, name, img, _ctx$measureText, width, actualWidth, src;
439
441
 
440
442
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
441
443
  while (1) {
442
444
  switch (_context2.prev = _context2.next) {
443
445
  case 0:
444
- lineHeight = _ref2.lineHeight, fontSize = _ref2.fontSize, fontWeight = _ref2.fontWeight, color = _ref2.color;
446
+ lineHeight = _ref3.lineHeight, fontSize = _ref3.fontSize, fontWeight = _ref3.fontWeight, color = _ref3.color;
445
447
  font = "".concat(fontWeight, " ").concat(fontSize, "px/").concat(lineHeight, "px arial,sans-serif");
446
448
  canvas = document.createElement("canvas");
447
449
  ctx = canvas.getContext("2d");
@@ -488,7 +490,7 @@ var getCanvasImg = /*#__PURE__*/function () {
488
490
  }));
489
491
 
490
492
  return function getCanvasImg(_x2, _x3, _x4) {
491
- return _ref3.apply(this, arguments);
493
+ return _ref4.apply(this, arguments);
492
494
  };
493
495
  }();
494
496
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.12.90",
3
+ "version": "1.12.91-beta.1",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "lib/index.js",