@fle-ui/plus-im-record 0.0.6-beta.0 → 0.0.8-beta.0

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.
Files changed (67) hide show
  1. package/package.json +2 -2
  2. package/es/@types/index.d.ts +0 -620
  3. package/es/CardTag/index.d.ts +0 -3
  4. package/es/CardTag/index.js +0 -18
  5. package/es/ChatMessageItem/index.d.ts +0 -17
  6. package/es/ChatMessageItem/index.js +0 -130
  7. package/es/ChatMessageItem/index.less +0 -108
  8. package/es/ChatMessageList/index.d.ts +0 -26
  9. package/es/ChatMessageList/index.js +0 -56
  10. package/es/ChatMessageList/index.less +0 -33
  11. package/es/GoodsCard/index.d.ts +0 -14
  12. package/es/GoodsCard/index.js +0 -93
  13. package/es/GoodsCard/index.less +0 -49
  14. package/es/GoodsOrderCard/index.d.ts +0 -17
  15. package/es/GoodsOrderCard/index.js +0 -161
  16. package/es/GoodsOrderCard/index.less +0 -81
  17. package/es/Icon/index.d.ts +0 -8
  18. package/es/Icon/index.js +0 -11
  19. package/es/ParseSession/index.d.ts +0 -21
  20. package/es/ParseSession/index.js +0 -454
  21. package/es/ParseSession/index.less +0 -181
  22. package/es/api/index.d.ts +0 -29
  23. package/es/api/index.js +0 -48
  24. package/es/common/const/index.d.ts +0 -46
  25. package/es/common/const/index.js +0 -82
  26. package/es/common/utils/index.d.ts +0 -33
  27. package/es/common/utils/index.js +0 -169
  28. package/es/index.d.ts +0 -25
  29. package/es/index.js +0 -76
  30. package/es/styles/extends.less +0 -50
  31. package/es/styles/index.less +0 -35
  32. package/es/styles/vars.less +0 -8
  33. package/es/utils/index.d.ts +0 -14
  34. package/es/utils/index.js +0 -50
  35. package/lib/@types/index.d.ts +0 -620
  36. package/lib/CardTag/index.d.ts +0 -3
  37. package/lib/CardTag/index.js +0 -25
  38. package/lib/ChatMessageItem/index.d.ts +0 -17
  39. package/lib/ChatMessageItem/index.js +0 -136
  40. package/lib/ChatMessageItem/index.less +0 -108
  41. package/lib/ChatMessageList/index.d.ts +0 -26
  42. package/lib/ChatMessageList/index.js +0 -63
  43. package/lib/ChatMessageList/index.less +0 -33
  44. package/lib/GoodsCard/index.d.ts +0 -14
  45. package/lib/GoodsCard/index.js +0 -103
  46. package/lib/GoodsCard/index.less +0 -49
  47. package/lib/GoodsOrderCard/index.d.ts +0 -17
  48. package/lib/GoodsOrderCard/index.js +0 -169
  49. package/lib/GoodsOrderCard/index.less +0 -81
  50. package/lib/Icon/index.d.ts +0 -8
  51. package/lib/Icon/index.js +0 -18
  52. package/lib/ParseSession/index.d.ts +0 -21
  53. package/lib/ParseSession/index.js +0 -456
  54. package/lib/ParseSession/index.less +0 -181
  55. package/lib/api/index.d.ts +0 -29
  56. package/lib/api/index.js +0 -55
  57. package/lib/common/const/index.d.ts +0 -46
  58. package/lib/common/const/index.js +0 -88
  59. package/lib/common/utils/index.d.ts +0 -33
  60. package/lib/common/utils/index.js +0 -183
  61. package/lib/index.d.ts +0 -25
  62. package/lib/index.js +0 -85
  63. package/lib/styles/extends.less +0 -50
  64. package/lib/styles/index.less +0 -35
  65. package/lib/styles/vars.less +0 -8
  66. package/lib/utils/index.d.ts +0 -14
  67. package/lib/utils/index.js +0 -56
@@ -1,136 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _antd = require("antd");
9
- var _dayjs = _interopRequireDefault(require("dayjs"));
10
- var _classnames = _interopRequireDefault(require("classnames"));
11
- var _ParseSession = _interopRequireDefault(require("../ParseSession"));
12
- var _Icon = _interopRequireDefault(require("../Icon"));
13
- var _const = require("../common/const");
14
- var _utils = require("../common/utils");
15
- require("./index.less");
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
18
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
20
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
22
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
23
- var ChatMessageItem = function ChatMessageItem(_ref) {
24
- var h5 = _ref.h5,
25
- msg = _ref.msg,
26
- prefix = _ref.prefix,
27
- _ref$myAccount = _ref.myAccount,
28
- myAccount = _ref$myAccount === void 0 ? '' : _ref$myAccount,
29
- keyword = _ref.keyword,
30
- _ref$accountInfo = _ref.accountInfo,
31
- accountInfo = _ref$accountInfo === void 0 ? {} : _ref$accountInfo,
32
- isSessionEnd = _ref.isSessionEnd,
33
- recordSession = _ref.recordSession;
34
- var paserMsg = _objectSpread(_objectSpread({}, msg), {}, {
35
- attach: (0, _utils.paserAttach)(msg.attach || {})
36
- });
37
- var from = paserMsg.from,
38
- _paserMsg$attach = paserMsg.attach,
39
- attach = _paserMsg$attach === void 0 ? {} : _paserMsg$attach,
40
- idClient = paserMsg.idClient,
41
- time = paserMsg.time,
42
- type = paserMsg.type,
43
- flow = paserMsg.flow;
44
- var isRecall = ['recall'].includes(type);
45
- var isEvent = [_const.imMsgTypes.event].includes(attach === null || attach === void 0 ? void 0 : attach.type);
46
- var isTip = [_const.imMsgTypes.tip].includes(attach === null || attach === void 0 ? void 0 : attach.type);
47
- var isNotification = type === 'notification';
48
- var isSelf = myAccount ? from === myAccount : flow === 'out';
49
- var renderMsgDate = function renderMsgDate() {
50
- var date = (0, _dayjs.default)(time);
51
- var isCurrentDay = date.isSame((0, _dayjs.default)(), 'day');
52
- var isCurrentYear = date.isSame((0, _dayjs.default)(), 'year');
53
- // eslint-disable-next-line no-nested-ternary
54
- return isCurrentDay ? date.format('HH:mm:ss') : isCurrentYear ? date.format('MM-DD HH:mm:ss') : date.format('YYYY-MM-DD HH:mm:ss');
55
- };
56
- var renderRecallMsg = function renderRecallMsg() {
57
- return /*#__PURE__*/_react.default.createElement("div", {
58
- key: idClient,
59
- className: "".concat(prefix, "-tip")
60
- }, "".concat(isSelf ? '您' : '用户', "\u64A4\u56DE\u4E86\u4E00\u6761\u4FE1\u606F"));
61
- };
62
- var renderEventMsg = function renderEventMsg() {
63
- var _attach$content;
64
- var isCloseEvent = [_const.msgEventTypes.csClose, _const.msgEventTypes.sysClose, _const.msgEventTypes.userClose].includes((_attach$content = attach.content) === null || _attach$content === void 0 ? void 0 : _attach$content.eventType);
65
- return attach.content.tips ? /*#__PURE__*/_react.default.createElement("div", {
66
- key: idClient,
67
- className: (0, _classnames.default)("".concat(prefix, "-tip"), {
68
- 'is-close': isCloseEvent
69
- })
70
- }, /*#__PURE__*/_react.default.createElement("span", null, attach.content.tips)) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
71
- };
72
- var renderTipMsg = function renderTipMsg() {
73
- return /*#__PURE__*/_react.default.createElement("div", {
74
- key: idClient,
75
- className: "".concat(prefix, "-tip")
76
- }, /*#__PURE__*/_react.default.createElement("span", null, attach.content));
77
- };
78
- function renderCenterMsg() {
79
- if (isRecall) return renderRecallMsg();
80
- if (isTip) return renderTipMsg();
81
- if (isEvent) return renderEventMsg();
82
- if (isNotification) {
83
- /*#__PURE__*/_react.default.createElement(_ParseSession.default, {
84
- msg: paserMsg,
85
- prefix: "".concat(prefix)
86
- });
87
- }
88
- return null;
89
- }
90
- function renderContent() {
91
- return /*#__PURE__*/_react.default.createElement("div", {
92
- className: "".concat(prefix, "-box")
93
- }, /*#__PURE__*/_react.default.createElement("div", {
94
- className: (0, _classnames.default)("".concat(prefix, "-date"), _defineProperty({}, "".concat(prefix, "-date-self"), isSelf))
95
- }, renderMsgDate()), /*#__PURE__*/_react.default.createElement("div", {
96
- className: "".concat(prefix, "-body"),
97
- style: {
98
- background: [_const.imMsgTypes.video, _const.imMsgTypes.order, _const.imMsgTypes.product].includes(attach.type) ? 'transparent' : ''
99
- }
100
- }, /*#__PURE__*/_react.default.createElement(_ParseSession.default, {
101
- h5: h5,
102
- keyword: keyword,
103
- msg: paserMsg,
104
- prefix: "".concat(prefix),
105
- recordSession: recordSession,
106
- isSessionEnd: isSessionEnd
107
- })), isSelf && myAccount && /*#__PURE__*/_react.default.createElement("span", {
108
- className: (0, _classnames.default)("".concat(prefix, "-read"), {
109
- isRead: msg.readByOtherUser
110
- })
111
- }, msg.readByOtherUser ? '已读' : '未读'));
112
- }
113
- return renderCenterMsg() || /*#__PURE__*/_react.default.createElement("div", {
114
- className: (0, _classnames.default)(prefix, {
115
- self: isSelf,
116
- h5: h5
117
- })
118
- }, [_const.imMsgTypes.chatrecord].includes(attach.type) ? /*#__PURE__*/_react.default.createElement(_antd.Avatar, {
119
- size: 36,
120
- style: {
121
- backgroundColor: '#2c6bff',
122
- verticalAlign: 'middle'
123
- },
124
- icon: /*#__PURE__*/_react.default.createElement(_Icon.default, {
125
- type: 'icon-kefu',
126
- style: {
127
- fontSize: 24,
128
- color: '#fff'
129
- }
130
- })
131
- }) : /*#__PURE__*/_react.default.createElement(_antd.Avatar, {
132
- size: 36,
133
- src: accountInfo.avatar || _const.defaultAvatar
134
- }), renderContent());
135
- };
136
- var _default = exports.default = ChatMessageItem;
@@ -1,108 +0,0 @@
1
- @prefix: chart-messages-item;
2
-
3
- .tipText() {
4
- text-align: center;
5
- font-size: 12px;
6
- color: #999;
7
- padding: 8px 56px;
8
- span {
9
- display: inline-block;
10
- padding: 3px 8px;
11
- border-radius: 4px;
12
- background-color: #fff;
13
- }
14
- }
15
-
16
- // 对话
17
- .@{prefix} {
18
- display: flex;
19
- padding: 8px;
20
- // margin-bottom: 16px;
21
- .ant-avatar {
22
- border-radius: 50%;
23
- margin-top: 20px;
24
- margin-right: 8px;
25
- }
26
-
27
- &-recall {
28
- .tipText();
29
- }
30
-
31
- &-tip {
32
- .tipText();
33
- display: flex;
34
- justify-content: center;
35
- align-items: center;
36
- &.is-close {
37
- &::before,
38
- &::after {
39
- display: block;
40
- flex: 1;
41
- content: '';
42
- height: 1px;
43
- width: 100%;
44
- background-color: #ddd;
45
- }
46
- }
47
- span {
48
- margin: 0 10px;
49
- flex-shrink: 0;
50
- }
51
- }
52
-
53
- &-box {
54
- position: relative;
55
- display: flex;
56
- flex-direction: column;
57
- align-items: flex-start;
58
- }
59
-
60
- &-body {
61
- position: relative;
62
- word-break: break-all;
63
- word-wrap: break-word;
64
- white-space: break-spaces;
65
- overflow: hidden;
66
- max-width: 375px;
67
- min-width: 50px;
68
- border-radius: 2px 6px 6px 6px;
69
- background: #fff;
70
- }
71
- &-read {
72
- display: block;
73
- border-radius: 50%;
74
- font-size: 12px;
75
- color: #aaa;
76
- transform: scale(0.85);
77
- }
78
- &-date {
79
- font-size: 12px;
80
- color: #aaa;
81
- margin-bottom: 4px;
82
- }
83
- }
84
- // 对话-自己
85
- .@{prefix}.self {
86
- flex-direction: row-reverse;
87
-
88
- .ant-avatar {
89
- margin-right: 0;
90
- margin-left: 12px;
91
- }
92
-
93
- .@{prefix}-box {
94
- align-items: flex-end;
95
- }
96
-
97
- .@{prefix}-body {
98
- border-radius: 6px 2px 6px 6px;
99
- background: #dbe6ff;
100
- }
101
- }
102
-
103
- // 对话-H5
104
- .@{prefix}.h5 {
105
- .@{prefix}-body {
106
- max-width: 270px;
107
- }
108
- }
@@ -1,26 +0,0 @@
1
- import React, { UIEventHandler } from 'react';
2
- import { IMMessage } from '../@types';
3
- import './index.less';
4
- declare const LOADING_STATUS: any;
5
- export type LoadingStatus = keyof typeof LOADING_STATUS | undefined;
6
- export interface ChatMessageListProps {
7
- h5?: boolean;
8
- msgs: IMMessage[];
9
- myAccount?: string;
10
- loadingStarus?: LoadingStatus;
11
- onScrollTop?: UIEventHandler<HTMLDivElement>;
12
- accountsMap?: Record<string, {
13
- accid: string;
14
- nickname: string;
15
- avatar: string;
16
- }>;
17
- style?: React.CSSProperties;
18
- isSessionEnd?: boolean;
19
- recordSession?: {
20
- relationId: string | number;
21
- accid: string;
22
- relationType?: number;
23
- };
24
- }
25
- declare const ChatMessageList: React.ForwardRefExoticComponent<ChatMessageListProps & React.RefAttributes<HTMLDivElement>>;
26
- export default ChatMessageList;
@@ -1,63 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _ChatMessageItem = _interopRequireDefault(require("../ChatMessageItem"));
9
- var _utils = require("../utils");
10
- require("./index.less");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- var LOADING_STATUS = {
13
- loading: '加载中...',
14
- nomore: '没有更多了~'
15
- };
16
- var LOAD_LIMIT = 15;
17
- var ChatMessageList = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
18
- var h5 = _ref.h5,
19
- msgs = _ref.msgs,
20
- _ref$onScrollTop = _ref.onScrollTop,
21
- onScrollTop = _ref$onScrollTop === void 0 ? function () {} : _ref$onScrollTop,
22
- _ref$loadingStarus = _ref.loadingStarus,
23
- loadingStarus = _ref$loadingStarus === void 0 ? '' : _ref$loadingStarus,
24
- myAccount = _ref.myAccount,
25
- style = _ref.style,
26
- recordSession = _ref.recordSession,
27
- _ref$accountsMap = _ref.accountsMap,
28
- accountsMap = _ref$accountsMap === void 0 ? {} : _ref$accountsMap,
29
- _ref$isSessionEnd = _ref.isSessionEnd,
30
- isSessionEnd = _ref$isSessionEnd === void 0 ? false : _ref$isSessionEnd;
31
- var prefixCls = "chart-messages";
32
- var onScrollHandler = (0, _utils.debounce)(function (e) {
33
- var scrollElRef = ref;
34
- if (!(scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current)) return;
35
- var isTop = scrollElRef.current.scrollTop < 20;
36
- isTop && (onScrollTop === null || onScrollTop === void 0 ? void 0 : onScrollTop(e));
37
- }, 200);
38
- return /*#__PURE__*/_react.default.createElement("div", {
39
- className: prefixCls,
40
- style: style || {}
41
- }, /*#__PURE__*/_react.default.createElement("div", {
42
- ref: ref,
43
- className: "".concat(prefixCls, "-content scrollmini"),
44
- onScroll: onScrollHandler
45
- }, /*#__PURE__*/_react.default.createElement("div", {
46
- className: "".concat(prefixCls, "-status")
47
- }, msgs.length < LOAD_LIMIT || !LOADING_STATUS[loadingStarus] ? null : LOADING_STATUS[loadingStarus]), msgs.map(function (msg) {
48
- return /*#__PURE__*/_react.default.createElement("div", {
49
- id: msg.idServer,
50
- key: msg.idServer
51
- }, /*#__PURE__*/_react.default.createElement(_ChatMessageItem.default, {
52
- h5: h5,
53
- keyword: '',
54
- myAccount: myAccount,
55
- prefix: "".concat(prefixCls, "-item"),
56
- msg: msg,
57
- isSessionEnd: isSessionEnd,
58
- recordSession: recordSession,
59
- accountInfo: accountsMap[msg.from] || {}
60
- }));
61
- })));
62
- });
63
- var _default = exports.default = ChatMessageList;
@@ -1,33 +0,0 @@
1
- @prefix: chart;
2
-
3
- .@{prefix}-messages {
4
- flex: 1;
5
- position: relative;
6
- overflow: hidden;
7
- display: flex;
8
- flex-direction: column;
9
- padding-bottom: constant(safe-area-inset-bottom);
10
- padding-bottom: env(safe-area-inset-bottom);
11
- line-height: 1.2;
12
- background-color: #f7f7f7;
13
-
14
- &-input {
15
- padding: 16px;
16
- border-bottom: 1px solid #fff;
17
- }
18
-
19
- &-status {
20
- display: flex;
21
- align-items: center;
22
- justify-content: center;
23
- color: #ddd;
24
- padding: 5px;
25
- }
26
-
27
- &-content {
28
- flex: 1;
29
- width: 100%;
30
- overflow: auto;
31
- position: relative;
32
- }
33
- }
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import './index.less';
3
- declare const OrderCard: React.FC<{
4
- prefix?: string;
5
- suspend?: boolean;
6
- onSend?: Function;
7
- onClose?: Function;
8
- content: {
9
- productId: any;
10
- relationId?: any;
11
- relationType?: any;
12
- };
13
- }>;
14
- export default OrderCard;
@@ -1,103 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireWildcard(require("react"));
9
- var _const = require("../common/const");
10
- var _CardTag = _interopRequireDefault(require("../CardTag"));
11
- var _ = require("..");
12
- var _GoodsOrderCard = require("../GoodsOrderCard");
13
- require("./index.less");
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
18
- 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."); }
19
- 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); }
20
- 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; }
21
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
22
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
- var OrderCard = function OrderCard(props) {
24
- var _props$prefix = props.prefix,
25
- prefix = _props$prefix === void 0 ? 'chart-messages-item' : _props$prefix,
26
- content = props.content;
27
- var productId = content.productId,
28
- relationId = content.relationId,
29
- relationType = content.relationType;
30
- var _useState = (0, _react.useState)({}),
31
- _useState2 = _slicedToArray(_useState, 2),
32
- data = _useState2[0],
33
- setData = _useState2[1];
34
- var _useContext = (0, _react.useContext)(_.ImContext),
35
- api = _useContext.api;
36
- (0, _react.useEffect)(function () {
37
- if (productId) {
38
- api.getProductById({
39
- productId: productId,
40
- relationId: relationId,
41
- relationType: relationType
42
- }).then(function (_ref) {
43
- var data = _ref.data;
44
- setData(data || {});
45
- });
46
- }
47
- }, [productId]);
48
- function onCardClick() {
49
- // 现金
50
- // https://cash.koudaiqifu.cn/1002855/product/product_info/87764307
51
- // 积分
52
- // https://jifen.koudaiqifu.cn/1003406/product/product_info/87799942
53
- // https://jifen.koudaiqifu.cn/pcweb/goodsDetail/87876999
54
- // 卡券
55
- // http://cardjs.ufuly.cn/index.html#/8JmeYWGzdyI=/productDetail/87752904
56
- // 1 积分 6 现金 7 礼包卡券
57
- if (data.applicationId === 7) {
58
- var _data$siteUrl;
59
- if ((_data$siteUrl = data.siteUrl) === null || _data$siteUrl === void 0 ? void 0 : _data$siteUrl.includes('/display')) {
60
- var url = (0, _GoodsOrderCard.fitUrl)(data.siteUrl).replace('/display', "/productDetail/".concat(productId));
61
- window.open(url, '_blank');
62
- }
63
- } else if (data.siteUrl) {
64
- window.open("".concat((0, _GoodsOrderCard.fitUrl)(data.siteUrl), "/product/product_info/").concat(productId), '_blank');
65
- }
66
- }
67
- var formatPrice = (0, _react.useMemo)(function () {
68
- if (data.priceType === 2) {
69
- if (data.priceRangeMin && data.priceRangeMax) {
70
- return "".concat(data.priceRangeMin, "-").concat(data.priceRangeMax, "\u5143");
71
- }
72
- return "".concat(data.price, "\u5143");
73
- }
74
- if (data.priceType === 1) {
75
- var currencyStr = data.currencyStr || '积分';
76
- if (data.minIntegralPrice && data.maxIntegralPrice && data.minIntegralPrice !== data.maxIntegralPrice) {
77
- return "".concat(data.minIntegralPrice, "-").concat(data.maxIntegralPrice).concat(currencyStr);
78
- }
79
- return "".concat(data.integralPrice).concat(currencyStr);
80
- }
81
- return '';
82
- }, [data]);
83
- return /*#__PURE__*/_react.default.createElement("div", {
84
- className: "".concat(prefix, "-goods"),
85
- onClick: function onClick() {
86
- return onCardClick();
87
- }
88
- }, /*#__PURE__*/_react.default.createElement("div", {
89
- className: "".concat(prefix, "-goods-info")
90
- }, /*#__PURE__*/_react.default.createElement("div", {
91
- className: "".concat(prefix, "-goods-info-img"),
92
- style: {
93
- background: "url(".concat(data.pic || _const.fallbackImg, ") 0 0 / cover no-repeat")
94
- }
95
- }), /*#__PURE__*/_react.default.createElement("div", {
96
- className: "".concat(prefix, "-goods-info-right")
97
- }, /*#__PURE__*/_react.default.createElement("div", {
98
- className: "one-line-text"
99
- }, data.title), data.applicationId === 7 ? null : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
100
- className: "".concat(prefix, "-goods-info-price")
101
- }, formatPrice)), /*#__PURE__*/_react.default.createElement("div", null, data.supplierType && _const.cardTagMap[data.supplierType] && /*#__PURE__*/_react.default.createElement(_CardTag.default, _const.cardTagMap[data.supplierType])))));
102
- };
103
- var _default = exports.default = OrderCard;
@@ -1,49 +0,0 @@
1
- @prefix: chart-messages-item;
2
-
3
- .@{prefix}-goods {
4
- width: 272px;
5
- padding-bottom: 2px;
6
- &-info {
7
- display: flex;
8
- flex-flow: row;
9
- padding: 12px;
10
- cursor: pointer;
11
- border-radius: 4px;
12
- background-color: #fff;
13
- &-img {
14
- flex-shrink: 0;
15
- border-radius: 3px;
16
- width: 72px;
17
- height: 72px;
18
- margin-right: 6px;
19
- overflow: hidden;
20
- object-fit: fill;
21
- }
22
- img {
23
- width: 100%;
24
- object-fit: contain;
25
- }
26
-
27
- &-right {
28
- flex: 1;
29
- overflow: hidden;
30
- }
31
-
32
- &-price {
33
- font-size: 12px;
34
- font-weight: 600;
35
- color: #e10b19;
36
- }
37
- }
38
-
39
- &-tip {
40
- margin-top: 5px;
41
- height: 24px;
42
- padding-left: 5px;
43
- line-height: 24px;
44
- background: rgba(225, 11, 25, 0.06);
45
- border-radius: 4px;
46
- color: #e10b19;
47
- font-size: 12px;
48
- }
49
- }
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import './index.less';
3
- export declare function fitUrl(url: string): string;
4
- declare const GoodsOrderCard: React.FC<{
5
- prefix?: string;
6
- suspend?: boolean;
7
- onSend?: Function;
8
- onClose?: Function;
9
- orderSn?: any;
10
- orderId?: any;
11
- recordSession?: {
12
- relationId: string | number;
13
- accid: string;
14
- relationType?: number;
15
- };
16
- }>;
17
- export default GoodsOrderCard;