@titaui/pc 1.7.35 → 1.7.36

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.
@@ -21,6 +21,7 @@
21
21
  .form-field-dropdown--vertical .form-field-dropdown__label {
22
22
  width: 56px;
23
23
  margin-right: 20px;
24
+ white-space: nowrap;
24
25
  }
25
26
 
26
27
  .form-field-dropdown--horizontal {
@@ -21,6 +21,8 @@ var _constant = require("../../constant");
21
21
 
22
22
  var _drawerManager = _interopRequireDefault(require("../../../../../drawer-manager"));
23
23
 
24
+ var _tools = require("../../../../../../utils/tools");
25
+
24
26
  require("./index.css");
25
27
 
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -69,17 +71,13 @@ var Inform = function Inform(props) {
69
71
  if (objType === _constant.EObjType.Remind) {
70
72
  window.Talent.app.vent.trigger('global-daily-detail-pull-screen', objId);
71
73
  return;
72
- } // 日报
73
- // if () {
74
- // // @ts-ignore
75
- // Talent.app.vent.trigger("global-daily-detail-pull-screen", feedId);
76
- // }
77
-
74
+ }
78
75
 
79
76
  if (messageType == 135) {
80
- var redisKey = item.content.match(/redisKey=(\S*?)"/g)[1]; // @ts-ignore
77
+ var redisKey = item.content.match(/redisKey=(\S*?)"/)[1]; // @ts-ignore
81
78
 
82
79
  Talent.app.vent.trigger("open-weekly-report-modal", redisKey);
80
+ return;
83
81
  } // 处理合并的消息
84
82
 
85
83
 
@@ -87,70 +85,43 @@ var Inform = function Inform(props) {
87
85
 
88
86
  if (!isMessageMerging) {
89
87
  if (messageType === _constant.informType.details) {
90
- window.open("".concat(_constant.apiServer, "/u/").concat(_constant.userId, "/Home#more/taskinfo?Id=").concat(item.objId), '_blank');
88
+ (0, _tools.openPage)("".concat(_constant.apiServer, "/u/").concat(_constant.userId, "/Home#more/taskinfo?Id=").concat(item.objId));
91
89
  return;
92
- } else if (item.objId && objType !== 8) {
90
+ } else if (objId && objType !== 8) {
93
91
  window.open("".concat(_constant.apiServer, "/u/").concat(_constant.userId, "/Home#work?work_id=").concat(item.objId));
94
92
  return;
95
93
  } else if (messageType === _constant.informType.todayJob) {
96
94
  window.open("".concat(_constant.apiServer, "/u/").concat(_constant.userId, "/Home#plan?tag_id=0&tag_type=0&filter=1"));
97
95
  return;
98
- } else if (messageType === _constant.informType.daily) {
99
- var str = item.content.slice(0, 18);
100
- var Year = str.slice(4, 8);
101
- var Month = '';
102
- var Day = '';
103
- var Week = '';
104
-
105
- if (isNaN(parseInt(str.charAt(10)))) {
106
- Month = str.slice(9, 10);
107
- Week = str.slice(12, 13);
108
-
109
- if (isNaN(parseInt(str.charAt(12)))) {
110
- Day = str.slice(11, 12);
111
- } else {
112
- Day = str.slice(11, 13);
113
- }
114
- } else {
115
- Month = str.slice(9, 11);
116
- Week = str.slice(13, 14);
117
-
118
- if (isNaN(parseInt(str.charAt(13)))) {
119
- Day = str.slice(12, 13);
120
- } else {
121
- Day = str.slice(12, 14);
122
- }
123
- }
96
+ } else if (objType === 0) {
97
+ var str = item.content.match(/[a-zA-z0-9%]+./g);
124
98
 
125
- if (str.indexOf('日报') !== -1) {
126
- window.open("".concat(_constant.apiServer, "/u/").concat(_constant.userId, "/Home#/daily?to_user_id=").concat(_constant.userId, "&group_id=9&tag_type=1&date=").concat(Year, "/").concat(Month, "/").concat(Day, "&tag_id=").concat(parseInt(Month) + 1, "&dailyType=1"));
127
- return;
128
- } else if (str.indexOf('月报') !== -1) {
129
- window.open("".concat(_constant.apiServer, "/u/").concat(_constant.userId, "/Home#/daily?to_user_id=").concat(_constant.userId, "&group_id=9&tag_type=1&date=").concat(Year, "/").concat(Month, "/01&tag_id=").concat(parseInt(Month) + 1, "&dailyType=3"));
130
- return;
131
- } else {
132
- window.open("".concat(_constant.apiServer, "/u/").concat(_constant.userId, "/Home#/daily?to_user_id=").concat(_constant.userId, "&group_id=9&tag_type=1&date=").concat(Year, "/").concat(Month, "/").concat(parseInt(Week) * 7, "&tag_id=").concat(parseInt(Month) + 1, "&dailyType=2"));
133
- return;
99
+ if (str.indexOf("href=") !== -1) {
100
+ var url = str.slice(str.indexOf('href=') + 1, str.indexOf('a>')).join("");
101
+ (0, _tools.openPage)("https://".concat(url));
134
102
  }
103
+
104
+ return;
135
105
  } else if (item.objUrl) {
136
106
  window.open(item.objUrl);
137
107
  return;
138
- } else if (item.objType === _constant.informType.Okr) {
139
- var url = item.content.match(/(http[s]?:\/\/([\w-]+.)+([:\d+])?(\/[\w-\.\/\?%&=]*))/g);
140
- window.open(url, '_blank');
108
+ } else if (objType === _constant.informType.Okr) {
109
+ var _url = item.content.match(/(http[s]?:\/\/([\w-]+.)+([:\d+])?(\/[\w-\.\/\?%&=]*))/g);
110
+
111
+ (0, _tools.openPage)(_url);
141
112
  return;
142
- } else if (item.objType === _constant.informType.okrRemind) {
113
+ } else if (objType === _constant.informType.okrRemind) {
143
114
  window.open("".concat(_constant.apiServer, "/u/").concat(_constant.userId, "/Home#/work?iTalentNavCode=tita-work&work_id=").concat(objId));
144
115
  return;
145
116
  } else {
146
117
  var reg = /href='.*?(?=')/g;
147
- var _url = '';
118
+ var _url2 = '';
148
119
  item.content.replace(reg, function ($0) {
149
- _url = $0.slice(6);
120
+ _url2 = $0.slice(6);
150
121
  });
151
122
 
152
- if (_url) {
153
- window.open(_url, '_blank');
123
+ if (_url2) {
124
+ (0, _tools.openPage)(_url2);
154
125
  return;
155
126
  }
156
127
  }
@@ -173,6 +173,7 @@ function Card(_ref, ref) {
173
173
  }
174
174
  };
175
175
  }, []);
176
+ var increase = Number(data.Increase);
176
177
  return /*#__PURE__*/_react["default"].createElement("div", {
177
178
  className: preCls + "-content",
178
179
  ref: cardRef
@@ -211,15 +212,15 @@ function Card(_ref, ref) {
211
212
  percent: Number(data.Complete)
212
213
  }), /*#__PURE__*/_react["default"].createElement("div", {
213
214
  className: preCls + "__comparison"
214
- }, "OKR \u5B8C\u6210\u5EA6", data.Increase != '0' ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, " ", /*#__PURE__*/_react["default"].createElement("img", {
215
+ }, "OKR \u5B8C\u6210\u5EA6", increase != 0 && !isNaN(increase) ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, " ", /*#__PURE__*/_react["default"].createElement("img", {
215
216
  className: preCls + "__direction",
216
- src: Number(data.Increase) > 0 ? require("./img/up.png") : require("./img/down.png"),
217
+ src: increase > 0 ? require("./img/up.png") : require("./img/down.png"),
217
218
  alt: ""
218
219
  }), /*#__PURE__*/_react["default"].createElement("span", {
219
220
  style: {
220
- color: Number(data.Increase) > 0 ? "#4DC591" : '#F05E5E'
221
+ color: increase > 0 ? "#4DC591" : '#F05E5E'
221
222
  }
222
- }, Math.abs(Number(data.Increase)), "%")) : ''), /*#__PURE__*/_react["default"].createElement("div", {
223
+ }, Math.abs(increase), "%")) : ''), /*#__PURE__*/_react["default"].createElement("div", {
223
224
  className: preCls + "__colleague"
224
225
  }, data.PromptLanguage), /*#__PURE__*/_react["default"].createElement(_statistics["default"], {
225
226
  data: data
@@ -8,10 +8,12 @@ exports.getQueryString = getQueryString;
8
8
  exports.highLightWord = exports.hexToRgba = exports.getUrlForUserPage = void 0;
9
9
  exports.htmlDecodeByRegExp = htmlDecodeByRegExp;
10
10
  exports.htmlEncodeByRegExp = htmlEncodeByRegExp;
11
- exports.unHighLight = void 0;
11
+ exports.unHighLight = exports.openPage = void 0;
12
12
 
13
13
  var _platform = require("./platform");
14
14
 
15
+ var _openData = require("./open-data");
16
+
15
17
  function htmlEncodeByRegExp(str) {
16
18
  if (!str) return "";
17
19
  var htmlString = {
@@ -206,4 +208,14 @@ var getUrlForUserPage = function getUrlForUserPage(options) {
206
208
  return homeCenter;
207
209
  };
208
210
 
209
- exports.getUrlForUserPage = getUrlForUserPage;
211
+ exports.getUrlForUserPage = getUrlForUserPage;
212
+
213
+ var openPage = function openPage(url) {
214
+ if ((0, _openData.isPlatform)("dd")) {
215
+ window.open(url, "_self");
216
+ } else {
217
+ window.open(url, "_blank");
218
+ }
219
+ };
220
+
221
+ exports.openPage = openPage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.7.35",
3
+ "version": "1.7.36",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "src/index.js",
@@ -16,6 +16,7 @@
16
16
  &__label {
17
17
  width: 56px;
18
18
  margin-right: 20px;
19
+ white-space: nowrap;
19
20
  }
20
21
  }
21
22
  }
@@ -1,4 +1,4 @@
1
- import React, { useRef } from 'react';
1
+ import React, { useRef} from 'react';
2
2
  import classNames from 'classnames';
3
3
  import Avatar from '../../../../../../components/avatar';
4
4
  import TooltipText from '../../../../../tooltip/tooltip-text';
@@ -6,6 +6,7 @@ import { htmlToText, deleteText } from '../../utils';
6
6
  import { userId, apiServer, informType } from '../../constant';
7
7
  import { EObjType } from '../../constant';
8
8
  import drawerManager from '../../../../../drawer-manager';
9
+ import { openPage } from '../../../../../../utils/tools';
9
10
  import './index.scss';
10
11
 
11
12
  const preCls = 'titaui-user-message-msg-inform';
@@ -14,7 +15,7 @@ const Inform = (props) => {
14
15
  const { item, onItemClick, informs } = props;
15
16
  const domRef = useRef<any>();
16
17
 
17
- const handleItemClick = () => {
18
+ const handleItemClick = () => {
18
19
  onItemClick && onItemClick(false);
19
20
  const { objType, objId, messageType } = item;
20
21
  if (objType === EObjType.Kr) {
@@ -33,81 +34,39 @@ const Inform = (props) => {
33
34
  window.Talent.app.vent.trigger('global-daily-detail-pull-screen', objId);
34
35
  return;
35
36
  }
36
- // 日报
37
- // if () {
38
- // // @ts-ignore
39
- // Talent.app.vent.trigger("global-daily-detail-pull-screen", feedId);
40
- // }
41
37
  if(messageType == 135){
42
- const redisKey = item.content.match(/redisKey=(\S*?)"/g)[1]
38
+ const redisKey = item.content.match(/redisKey=(\S*?)"/)[1]
43
39
  // @ts-ignore
44
40
  Talent.app.vent.trigger("open-weekly-report-modal", redisKey);
41
+ return;
45
42
  }
46
43
  // 处理合并的消息
47
44
  const isMessageMerging = messageType == 13018 || messageType == 30362 || messageType == 131;
48
45
  if (!isMessageMerging) {
49
46
  if (messageType === informType.details) {
50
- window.open(`${apiServer}/u/${userId}/Home#more/taskinfo?Id=${item.objId}`, '_blank');
47
+ openPage(`${apiServer}/u/${userId}/Home#more/taskinfo?Id=${item.objId}`)
51
48
  return;
52
- } else if (item.objId && objType !== 8) {
49
+ } else if (objId && objType !== 8) {
53
50
  window.open(`${apiServer}/u/${userId}/Home#work?work_id=${item.objId}`);
54
51
  return;
55
52
  } else if (messageType === informType.todayJob) {
56
53
  window.open(`${apiServer}/u/${userId}/Home#plan?tag_id=0&tag_type=0&filter=1`);
57
54
  return;
58
- } else if (messageType === informType.daily) {
59
- const str = item.content.slice(0, 18);
60
- const Year = str.slice(4, 8);
61
- let Month = '';
62
- let Day = '';
63
- let Week = '';
64
- if (isNaN(parseInt(str.charAt(10)))) {
65
- Month = str.slice(9, 10);
66
- Week = str.slice(12, 13);
67
- if (isNaN(parseInt(str.charAt(12)))) {
68
- Day = str.slice(11, 12);
69
- } else {
70
- Day = str.slice(11, 13);
71
- }
72
- } else {
73
- Month = str.slice(9, 11);
74
- Week = str.slice(13, 14);
75
- if (isNaN(parseInt(str.charAt(13)))) {
76
- Day = str.slice(12, 13);
77
- } else {
78
- Day = str.slice(12, 14);
79
- }
80
- }
81
- if (str.indexOf('日报') !== -1) {
82
- window.open(
83
- `${apiServer}/u/${userId}/Home#/daily?to_user_id=${userId}&group_id=9&tag_type=1&date=${Year}/${Month}/${Day}&tag_id=${parseInt(
84
- Month
85
- ) + 1}&dailyType=1`
86
- );
87
- return;
88
- } else if (str.indexOf('月报') !== -1) {
89
- window.open(
90
- `${apiServer}/u/${userId}/Home#/daily?to_user_id=${userId}&group_id=9&tag_type=1&date=${Year}/${Month}/01&tag_id=${parseInt(
91
- Month
92
- ) + 1}&dailyType=3`
93
- );
94
- return;
95
- } else {
96
- window.open(
97
- `${apiServer}/u/${userId}/Home#/daily?to_user_id=${userId}&group_id=9&tag_type=1&date=${Year}/${Month}/${parseInt(
98
- Week
99
- ) * 7}&tag_id=${parseInt(Month) + 1}&dailyType=2`
100
- );
101
- return;
102
- }
55
+ } else if ( objType === 0) {
56
+ let str = item.content.match(/[a-zA-z0-9%]+./g);
57
+ if(str.indexOf("href=") !== -1) {
58
+ let url = str.slice(str.indexOf('href=') + 1, str.indexOf('a>')).join("");
59
+ openPage(`https://${url}`)
60
+ }
61
+ return;
103
62
  } else if (item.objUrl) {
104
63
  window.open(item.objUrl);
105
64
  return;
106
- } else if (item.objType === informType.Okr) {
65
+ } else if (objType === informType.Okr) {
107
66
  let url = item.content.match(/(http[s]?:\/\/([\w-]+.)+([:\d+])?(\/[\w-\.\/\?%&=]*))/g);
108
- window.open(url, '_blank');
67
+ openPage(url)
109
68
  return;
110
- } else if(item.objType === informType.okrRemind) {
69
+ } else if(objType === informType.okrRemind) {
111
70
  window.open(`${apiServer}/u/${userId}/Home#/work?iTalentNavCode=tita-work&work_id=${objId}`);
112
71
  return;
113
72
  } else {
@@ -117,7 +76,7 @@ const Inform = (props) => {
117
76
  url = $0.slice(6);
118
77
  })
119
78
  if(url) {
120
- window.open(url, '_blank');
79
+ openPage(url)
121
80
  return;
122
81
  }
123
82
  }
@@ -167,6 +126,7 @@ const Inform = (props) => {
167
126
  Talent.app.vent.trigger('openReactScreenPush', options);
168
127
  };
169
128
 
129
+
170
130
  return (
171
131
  <li
172
132
  className={classNames(`${preCls}__item`, {
@@ -9,7 +9,7 @@ const preCls = 'titaui-user-message-msg-todos';
9
9
  const TodoItem: FC<any> = (props) => {
10
10
  const { item, onItemClick, todos } = props;
11
11
 
12
- const handleTodosClick = (item) => {
12
+ const handleTodosClick = (item) => {
13
13
  onItemClick && onItemClick(false);
14
14
  if (item.objType === 7) {
15
15
  window.Talent.app.vent.trigger('global-pull-screen', item.objId, 'task');
@@ -107,7 +107,7 @@ function Card({data}: Props, ref): ReactElement {
107
107
  };
108
108
  }, []);
109
109
 
110
-
110
+ const increase = Number(data.Increase)
111
111
 
112
112
  return (
113
113
  <div className={preCls + "-content"} ref={cardRef}>
@@ -135,12 +135,12 @@ function Card({data}: Props, ref): ReactElement {
135
135
 
136
136
  OKR 完成度
137
137
  {
138
- data.Increase != '0' ? <> <img
138
+ increase != 0 && !isNaN(increase) ? <> <img
139
139
  className={preCls + "__direction"}
140
- src={Number( data.Increase) > 0 ? require("./img/up.png") : require('./img/down.png')}
140
+ src={increase > 0 ? require("./img/up.png") : require('./img/down.png')}
141
141
  alt=""
142
142
  />
143
- <span style={{ color: Number( data.Increase) > 0 ? "#4DC591" : '#F05E5E'}}>{Math.abs(Number(data.Increase))}%</span></> : ''
143
+ <span style={{ color: increase > 0 ? "#4DC591" : '#F05E5E'}}>{Math.abs(increase)}%</span></> : ''
144
144
  }
145
145
 
146
146
  </div>
@@ -1,4 +1,5 @@
1
1
  import { isDD, isFeishu } from "./platform";
2
+ import { isPlatform } from "./open-data";
2
3
 
3
4
  export function htmlEncodeByRegExp(str) {
4
5
  if (!str) return "";
@@ -191,3 +192,12 @@ export const getUrlForUserPage = (options) => {
191
192
  );
192
193
  return homeCenter;
193
194
  };
195
+
196
+
197
+ export const openPage = (url) => {
198
+ if(isPlatform("dd")) {
199
+ window.open(url, "_self");
200
+ } else {
201
+ window.open(url, "_blank");
202
+ }
203
+ }