@titaui/pc 1.9.66 → 1.9.67
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.
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
.part-notice {
|
|
2
|
+
margin-left: 16px;
|
|
3
|
+
height: 36px;
|
|
4
|
+
background: #fcedd4;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
font-size: 12px;
|
|
8
|
+
font-weight: 400;
|
|
9
|
+
color: #3f4755;
|
|
10
|
+
line-height: 18px;
|
|
11
|
+
position: relative;
|
|
12
|
+
padding: 0 12px;
|
|
13
|
+
margin-bottom: 10px;
|
|
14
|
+
margin-top: 16px;
|
|
15
|
+
border-radius: 12px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.part-notice > .tu-icon-tishi {
|
|
19
|
+
color: #f0a326;
|
|
20
|
+
margin-right: 8px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.part-notice__link {
|
|
24
|
+
color: #f6bd16;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.part-notice__close {
|
|
29
|
+
color: #f6bd16;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
font-size: 16px;
|
|
32
|
+
position: absolute;
|
|
33
|
+
right: 12px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.part-notice__image {
|
|
37
|
+
width: 16px;
|
|
38
|
+
height: 16px;
|
|
39
|
+
margin-right: 8px;
|
|
40
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _localStorage = require("../../utils/local-storage");
|
|
13
|
+
|
|
14
|
+
require("./index.css");
|
|
15
|
+
|
|
16
|
+
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); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
+
|
|
22
|
+
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."); }
|
|
23
|
+
|
|
24
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
25
|
+
|
|
26
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
27
|
+
|
|
28
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
29
|
+
|
|
30
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
|
|
32
|
+
var preCls = "part-notice";
|
|
33
|
+
var storage = new _localStorage.LocalStorage();
|
|
34
|
+
|
|
35
|
+
var PartNotice = function PartNotice(_ref) {
|
|
36
|
+
var storageName = _ref.storageName,
|
|
37
|
+
text = _ref.text,
|
|
38
|
+
link = _ref.link;
|
|
39
|
+
|
|
40
|
+
var _useState = (0, _react.useState)(function () {
|
|
41
|
+
var stopTaking = storage.getItem(storageName);
|
|
42
|
+
|
|
43
|
+
if (stopTaking !== null && stopTaking !== void 0 && stopTaking.date) {
|
|
44
|
+
var oldDate = new Date(stopTaking === null || stopTaking === void 0 ? void 0 : stopTaking.date).getDate();
|
|
45
|
+
var newDate = new Date().getDate();
|
|
46
|
+
|
|
47
|
+
if (newDate > oldDate) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return true;
|
|
55
|
+
}),
|
|
56
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
57
|
+
visible = _useState2[0],
|
|
58
|
+
setVisible = _useState2[1];
|
|
59
|
+
|
|
60
|
+
var handleClose = (0, _react.useCallback)(function () {
|
|
61
|
+
setVisible(false);
|
|
62
|
+
storage.setItem(storageName, {
|
|
63
|
+
bol: false,
|
|
64
|
+
date: new Date()
|
|
65
|
+
});
|
|
66
|
+
}, []);
|
|
67
|
+
|
|
68
|
+
var handleOpenLink = function handleOpenLink() {
|
|
69
|
+
window.open(link, "_target");
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
if (!visible) return /*#__PURE__*/_react["default"].createElement("span", null);
|
|
73
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
74
|
+
className: "".concat(preCls)
|
|
75
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
76
|
+
className: "tu-icon-tishi"
|
|
77
|
+
}), text, /*#__PURE__*/_react["default"].createElement("span", {
|
|
78
|
+
className: "".concat(preCls, "__link"),
|
|
79
|
+
onClick: handleOpenLink
|
|
80
|
+
}, "\u4E86\u89E3\u8BE6\u60C5"), /*#__PURE__*/_react["default"].createElement("span", {
|
|
81
|
+
className: "tu-icon-close ".concat(preCls, "__close"),
|
|
82
|
+
onClick: handleClose
|
|
83
|
+
}));
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
PartNotice.defaultProps = {
|
|
87
|
+
storageName: "partNotice"
|
|
88
|
+
};
|
|
89
|
+
var _default = PartNotice;
|
|
90
|
+
exports["default"] = _default;
|
package/lib/index.js
CHANGED
|
@@ -303,6 +303,12 @@ Object.defineProperty(exports, "Pagination", {
|
|
|
303
303
|
return _pagination["default"];
|
|
304
304
|
}
|
|
305
305
|
});
|
|
306
|
+
Object.defineProperty(exports, "PartNotice", {
|
|
307
|
+
enumerable: true,
|
|
308
|
+
get: function get() {
|
|
309
|
+
return _partNotice["default"];
|
|
310
|
+
}
|
|
311
|
+
});
|
|
306
312
|
Object.defineProperty(exports, "PasswordInput", {
|
|
307
313
|
enumerable: true,
|
|
308
314
|
get: function get() {
|
|
@@ -528,8 +534,6 @@ Object.defineProperty(exports, "upload", {
|
|
|
528
534
|
|
|
529
535
|
require("./index.css");
|
|
530
536
|
|
|
531
|
-
var _stopTakingModal = _interopRequireDefault(require("./components/stop-taking-modal"));
|
|
532
|
-
|
|
533
537
|
var _dialog = _interopRequireDefault(require("./components/dialog"));
|
|
534
538
|
|
|
535
539
|
var _switch = _interopRequireDefault(require("./components/switch"));
|
|
@@ -644,6 +648,8 @@ var _okrcaseLibraryCard = _interopRequireDefault(require("./components/okrcase-l
|
|
|
644
648
|
|
|
645
649
|
var _operationRecords = _interopRequireDefault(require("./components/operation-records"));
|
|
646
650
|
|
|
651
|
+
var _partNotice = _interopRequireDefault(require("./components/part-notice"));
|
|
652
|
+
|
|
647
653
|
var _pagination = _interopRequireDefault(require("./components/pagination"));
|
|
648
654
|
|
|
649
655
|
var _passwordInput = _interopRequireDefault(require("./components/password-input"));
|
package/package.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.part-notice {
|
|
2
|
+
margin-left: 16px;
|
|
3
|
+
height: 36px;
|
|
4
|
+
background: #fcedd4;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
font-size: 12px;
|
|
8
|
+
font-weight: 400;
|
|
9
|
+
color: #3f4755;
|
|
10
|
+
line-height: 18px;
|
|
11
|
+
position: relative;
|
|
12
|
+
padding: 0 12px;
|
|
13
|
+
margin-bottom: 10px;
|
|
14
|
+
margin-top: 16px;
|
|
15
|
+
border-radius: 12px;
|
|
16
|
+
|
|
17
|
+
> .tu-icon-tishi {
|
|
18
|
+
color: #f0a326;
|
|
19
|
+
margin-right: 8px;
|
|
20
|
+
}
|
|
21
|
+
&__link {
|
|
22
|
+
color: #f6bd16;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
}
|
|
25
|
+
&__close {
|
|
26
|
+
color: #f6bd16;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
position: absolute;
|
|
30
|
+
right: 12px;
|
|
31
|
+
}
|
|
32
|
+
&__image {
|
|
33
|
+
width: 16px;
|
|
34
|
+
height: 16px;
|
|
35
|
+
margin-right: 8px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { FC, useState, useCallback } from "react";
|
|
2
|
+
import { LocalStorage } from "../../utils/local-storage";
|
|
3
|
+
import "./index.scss";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
text: any;
|
|
7
|
+
link: string;
|
|
8
|
+
storageName?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const preCls = "part-notice";
|
|
12
|
+
const storage = new LocalStorage();
|
|
13
|
+
|
|
14
|
+
const PartNotice: FC<Props> = ({ storageName, text, link }) => {
|
|
15
|
+
const [visible, setVisible] = useState(() => {
|
|
16
|
+
const stopTaking: any = storage.getItem(storageName);
|
|
17
|
+
if (stopTaking?.date) {
|
|
18
|
+
const oldDate = new Date(stopTaking?.date).getDate();
|
|
19
|
+
const newDate = new Date().getDate();
|
|
20
|
+
if (newDate > oldDate) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const handleClose = useCallback(() => {
|
|
29
|
+
setVisible(false);
|
|
30
|
+
storage.setItem(storageName, { bol: false, date: new Date() });
|
|
31
|
+
}, []);
|
|
32
|
+
|
|
33
|
+
const handleOpenLink = () => {
|
|
34
|
+
window.open(link, "_target");
|
|
35
|
+
};
|
|
36
|
+
if (!visible) return <span />;
|
|
37
|
+
return (
|
|
38
|
+
<div className={`${preCls}`}>
|
|
39
|
+
<span className="tu-icon-tishi" />
|
|
40
|
+
{text}
|
|
41
|
+
<span className={`${preCls}__link`} onClick={handleOpenLink}>了解详情</span>
|
|
42
|
+
<span className={`tu-icon-close ${preCls}__close`} onClick={handleClose} />
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
PartNotice.defaultProps = {
|
|
47
|
+
storageName: "partNotice",
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default PartNotice;
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "./index.scss";
|
|
2
|
-
import { default as StopTakingModal } from "./components/stop-taking-modal";
|
|
3
2
|
|
|
4
3
|
export { default as Dialog } from "./components/dialog";
|
|
5
4
|
export { default as Switch } from "./components/switch";
|
|
@@ -58,6 +57,7 @@ export { default as OkrShare } from "./components/okr-share";
|
|
|
58
57
|
export { default as OkrcaseLibrary } from "./components/okrcase-library";
|
|
59
58
|
export { default as OkrcaseLibraryCard } from "./components/okrcase-library-card";
|
|
60
59
|
export { default as OperationRecords } from "./components/operation-records";
|
|
60
|
+
export { default as PartNotice } from "./components/part-notice";
|
|
61
61
|
export { default as Pagination } from "./components/pagination";
|
|
62
62
|
export { default as PasswordInput } from "./components/password-input";
|
|
63
63
|
export { default as PhotoCard } from "./components/photo-card";
|