@fle-ui/plus-im-record 0.0.8-beta.0 → 0.0.8-beta.3
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.
- package/es/@types/index.d.ts +620 -0
- package/es/CardTag/index.d.ts +3 -0
- package/es/CardTag/index.js +18 -0
- package/es/ChatMessageItem/index.d.ts +15 -0
- package/es/ChatMessageItem/index.js +130 -0
- package/es/ChatMessageItem/index.less +108 -0
- package/es/ChatMessageList/index.d.ts +29 -0
- package/es/ChatMessageList/index.js +66 -0
- package/es/ChatMessageList/index.less +34 -0
- package/es/GoodsCard/index.d.ts +15 -0
- package/es/GoodsCard/index.js +95 -0
- package/es/GoodsCard/index.less +49 -0
- package/es/GoodsOrderCard/index.d.ts +14 -0
- package/es/GoodsOrderCard/index.js +161 -0
- package/es/GoodsOrderCard/index.less +81 -0
- package/es/Icon/index.d.ts +8 -0
- package/es/Icon/index.js +11 -0
- package/es/ParseSession/AudioPlayer.d.ts +14 -0
- package/es/ParseSession/AudioPlayer.js +89 -0
- package/es/ParseSession/audioAndVideoTool.d.ts +3 -0
- package/es/ParseSession/audioAndVideoTool.js +21 -0
- package/es/ParseSession/index.d.ts +15 -0
- package/es/ParseSession/index.js +492 -0
- package/es/ParseSession/index.less +226 -0
- package/es/api/index.d.ts +30 -0
- package/es/api/index.js +48 -0
- package/es/audioAndVideoTool.d.ts +3 -0
- package/es/audioAndVideoTool.js +21 -0
- package/es/common/const/index.d.ts +46 -0
- package/es/common/const/index.js +82 -0
- package/es/common/utils/index.d.ts +33 -0
- package/es/common/utils/index.js +169 -0
- package/es/index.d.ts +38 -0
- package/es/index.js +111 -0
- package/es/styles/extends.less +50 -0
- package/es/styles/index.less +35 -0
- package/es/styles/vars.less +8 -0
- package/es/utils/index.d.ts +14 -0
- package/es/utils/index.js +50 -0
- package/lib/@types/index.d.ts +620 -0
- package/lib/CardTag/index.d.ts +3 -0
- package/lib/CardTag/index.js +25 -0
- package/lib/ChatMessageItem/index.d.ts +15 -0
- package/lib/ChatMessageItem/index.js +136 -0
- package/lib/ChatMessageItem/index.less +108 -0
- package/lib/ChatMessageList/index.d.ts +29 -0
- package/lib/ChatMessageList/index.js +76 -0
- package/lib/ChatMessageList/index.less +34 -0
- package/lib/GoodsCard/index.d.ts +15 -0
- package/lib/GoodsCard/index.js +105 -0
- package/lib/GoodsCard/index.less +49 -0
- package/lib/GoodsOrderCard/index.d.ts +14 -0
- package/lib/GoodsOrderCard/index.js +169 -0
- package/lib/GoodsOrderCard/index.less +81 -0
- package/lib/Icon/index.d.ts +8 -0
- package/lib/Icon/index.js +18 -0
- package/lib/ParseSession/AudioPlayer.d.ts +14 -0
- package/lib/ParseSession/AudioPlayer.js +98 -0
- package/lib/ParseSession/audioAndVideoTool.d.ts +3 -0
- package/lib/ParseSession/audioAndVideoTool.js +27 -0
- package/lib/ParseSession/index.d.ts +15 -0
- package/lib/ParseSession/index.js +494 -0
- package/lib/ParseSession/index.less +226 -0
- package/lib/api/index.d.ts +30 -0
- package/lib/api/index.js +55 -0
- package/lib/audioAndVideoTool.d.ts +3 -0
- package/lib/audioAndVideoTool.js +27 -0
- package/lib/common/const/index.d.ts +46 -0
- package/lib/common/const/index.js +88 -0
- package/lib/common/utils/index.d.ts +33 -0
- package/lib/common/utils/index.js +183 -0
- package/lib/index.d.ts +38 -0
- package/lib/index.js +119 -0
- package/lib/styles/extends.less +50 -0
- package/lib/styles/index.less +35 -0
- package/lib/styles/vars.less +8 -0
- package/lib/utils/index.d.ts +14 -0
- package/lib/utils/index.js +56 -0
- package/package.json +2 -2
|
@@ -0,0 +1,136 @@
|
|
|
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;
|
|
@@ -0,0 +1,108 @@
|
|
|
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: 276px;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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 RecordSession {
|
|
7
|
+
relationId?: string | number;
|
|
8
|
+
accid?: string;
|
|
9
|
+
relationType?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ChatMessageListProps {
|
|
12
|
+
searchValue?: string;
|
|
13
|
+
h5?: boolean;
|
|
14
|
+
msgs: IMMessage[];
|
|
15
|
+
myAccount?: string;
|
|
16
|
+
loadingStarus?: LoadingStatus;
|
|
17
|
+
onScrollTop?: UIEventHandler<HTMLDivElement>;
|
|
18
|
+
onScrollBottom?: UIEventHandler<HTMLDivElement>;
|
|
19
|
+
accountsMap?: Record<string, {
|
|
20
|
+
accid: string;
|
|
21
|
+
nickname: string;
|
|
22
|
+
avatar: string;
|
|
23
|
+
}>;
|
|
24
|
+
style?: React.CSSProperties;
|
|
25
|
+
isSessionEnd?: boolean;
|
|
26
|
+
recordSession?: RecordSession;
|
|
27
|
+
}
|
|
28
|
+
declare const ChatMessageList: React.ForwardRefExoticComponent<ChatMessageListProps & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
+
export default ChatMessageList;
|
|
@@ -0,0 +1,76 @@
|
|
|
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 _ChatMessageItem = _interopRequireDefault(require("../ChatMessageItem"));
|
|
10
|
+
var _utils = require("../utils");
|
|
11
|
+
require("./index.less");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
var LOADING_STATUS = {
|
|
16
|
+
loading: '加载中...',
|
|
17
|
+
nomore: '没有更多了~'
|
|
18
|
+
};
|
|
19
|
+
var LOAD_LIMIT = 15;
|
|
20
|
+
var ChatMessageList = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
21
|
+
var searchValue = _ref.searchValue,
|
|
22
|
+
h5 = _ref.h5,
|
|
23
|
+
msgs = _ref.msgs,
|
|
24
|
+
onScrollTop = _ref.onScrollTop,
|
|
25
|
+
onScrollBottom = _ref.onScrollBottom,
|
|
26
|
+
_ref$loadingStarus = _ref.loadingStarus,
|
|
27
|
+
loadingStarus = _ref$loadingStarus === void 0 ? '' : _ref$loadingStarus,
|
|
28
|
+
myAccount = _ref.myAccount,
|
|
29
|
+
style = _ref.style,
|
|
30
|
+
recordSession = _ref.recordSession,
|
|
31
|
+
_ref$accountsMap = _ref.accountsMap,
|
|
32
|
+
accountsMap = _ref$accountsMap === void 0 ? {} : _ref$accountsMap,
|
|
33
|
+
_ref$isSessionEnd = _ref.isSessionEnd,
|
|
34
|
+
isSessionEnd = _ref$isSessionEnd === void 0 ? false : _ref$isSessionEnd;
|
|
35
|
+
var prefixCls = "chart-messages";
|
|
36
|
+
var onScrollHandler = (0, _utils.debounce)(function (e) {
|
|
37
|
+
var scrollElRef = ref;
|
|
38
|
+
if (!(scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current)) return;
|
|
39
|
+
var isBottom = scrollElRef.current.scrollTop >= scrollElRef.current.scrollHeight - scrollElRef.current.clientHeight - 20;
|
|
40
|
+
var isTop = scrollElRef.current.scrollTop < 20;
|
|
41
|
+
isTop && (onScrollTop === null || onScrollTop === void 0 ? void 0 : onScrollTop(e));
|
|
42
|
+
isBottom && (onScrollBottom === null || onScrollBottom === void 0 ? void 0 : onScrollBottom(e));
|
|
43
|
+
}, 200);
|
|
44
|
+
var filteredMsgs = (0, _react.useMemo)(function () {
|
|
45
|
+
return msgs.filter(function (msg) {
|
|
46
|
+
var _msg$attach, _msg$attach2;
|
|
47
|
+
return ((_msg$attach = msg.attach) === null || _msg$attach === void 0 ? void 0 : _msg$attach.type) === 'text' && (((_msg$attach2 = msg.attach) === null || _msg$attach2 === void 0 ? void 0 : _msg$attach2.content) || '').indexOf(searchValue) > -1;
|
|
48
|
+
});
|
|
49
|
+
}, [msgs, searchValue]);
|
|
50
|
+
var messagesToRender = searchValue ? filteredMsgs : msgs;
|
|
51
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
52
|
+
className: prefixCls,
|
|
53
|
+
style: style || {}
|
|
54
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
+
ref: ref,
|
|
56
|
+
className: "".concat(prefixCls, "-content scrollmini"),
|
|
57
|
+
onScroll: onScrollHandler
|
|
58
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
59
|
+
className: "".concat(prefixCls, "-status")
|
|
60
|
+
}, msgs.length < LOAD_LIMIT || !LOADING_STATUS[loadingStarus] ? null : LOADING_STATUS[loadingStarus]), messagesToRender.map(function (msg) {
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
62
|
+
id: msg.idServer,
|
|
63
|
+
key: msg.idServer
|
|
64
|
+
}, /*#__PURE__*/_react.default.createElement(_ChatMessageItem.default, {
|
|
65
|
+
h5: h5,
|
|
66
|
+
keyword: searchValue || '',
|
|
67
|
+
myAccount: myAccount,
|
|
68
|
+
prefix: "".concat(prefixCls, "-item"),
|
|
69
|
+
msg: msg,
|
|
70
|
+
isSessionEnd: isSessionEnd,
|
|
71
|
+
recordSession: recordSession,
|
|
72
|
+
accountInfo: accountsMap[msg.from] || {}
|
|
73
|
+
}));
|
|
74
|
+
})));
|
|
75
|
+
});
|
|
76
|
+
var _default = exports.default = ChatMessageList;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@prefix: chart;
|
|
2
|
+
|
|
3
|
+
.@{prefix}-messages {
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
position: relative;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
padding-bottom: constant(safe-area-inset-bottom);
|
|
11
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
12
|
+
line-height: 1.2;
|
|
13
|
+
background-color: #f7f7f7;
|
|
14
|
+
|
|
15
|
+
&-input {
|
|
16
|
+
padding: 16px;
|
|
17
|
+
border-bottom: 1px solid #fff;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&-status {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
color: #ddd;
|
|
25
|
+
padding: 5px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&-content {
|
|
29
|
+
flex: 1;
|
|
30
|
+
width: 100%;
|
|
31
|
+
overflow: auto;
|
|
32
|
+
position: relative;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
orderProductId?: number;
|
|
13
|
+
};
|
|
14
|
+
}>;
|
|
15
|
+
export default OrderCard;
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
orderProductId = content.orderProductId;
|
|
31
|
+
var _useState = (0, _react.useState)({}),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
data = _useState2[0],
|
|
34
|
+
setData = _useState2[1];
|
|
35
|
+
var _useContext = (0, _react.useContext)(_.ImContext),
|
|
36
|
+
api = _useContext.api;
|
|
37
|
+
(0, _react.useEffect)(function () {
|
|
38
|
+
if (productId) {
|
|
39
|
+
api.getProductById({
|
|
40
|
+
productId: productId,
|
|
41
|
+
relationId: relationId,
|
|
42
|
+
relationType: relationType,
|
|
43
|
+
orderProductId: orderProductId
|
|
44
|
+
}).then(function (_ref) {
|
|
45
|
+
var data = _ref.data;
|
|
46
|
+
setData(data || {});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}, [productId]);
|
|
50
|
+
function onCardClick() {
|
|
51
|
+
// 现金
|
|
52
|
+
// https://cash.koudaiqifu.cn/1002855/product/product_info/87764307
|
|
53
|
+
// 积分
|
|
54
|
+
// https://jifen.koudaiqifu.cn/1003406/product/product_info/87799942
|
|
55
|
+
// https://jifen.koudaiqifu.cn/pcweb/goodsDetail/87876999
|
|
56
|
+
// 卡券
|
|
57
|
+
// http://cardjs.ufuly.cn/index.html#/8JmeYWGzdyI=/productDetail/87752904
|
|
58
|
+
// 1 积分 6 现金 7 礼包卡券
|
|
59
|
+
if (data.applicationId === 7) {
|
|
60
|
+
var _data$siteUrl;
|
|
61
|
+
if ((_data$siteUrl = data.siteUrl) === null || _data$siteUrl === void 0 ? void 0 : _data$siteUrl.includes('/display')) {
|
|
62
|
+
var url = (0, _GoodsOrderCard.fitUrl)(data.siteUrl).replace('/display', "/productDetail/".concat(productId));
|
|
63
|
+
window.open(url, '_blank');
|
|
64
|
+
}
|
|
65
|
+
} else if (data.siteUrl) {
|
|
66
|
+
window.open("".concat((0, _GoodsOrderCard.fitUrl)(data.siteUrl), "/product/product_info/").concat(productId), '_blank');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
var formatPrice = (0, _react.useMemo)(function () {
|
|
70
|
+
if (data.priceType === 2) {
|
|
71
|
+
if (data.priceRangeMin && data.priceRangeMax) {
|
|
72
|
+
return "".concat(data.priceRangeMin, "-").concat(data.priceRangeMax, "\u5143");
|
|
73
|
+
}
|
|
74
|
+
return "".concat(data.price, "\u5143");
|
|
75
|
+
}
|
|
76
|
+
if (data.priceType === 1) {
|
|
77
|
+
var currencyStr = data.currencyStr || '积分';
|
|
78
|
+
if (data.minIntegralPrice && data.maxIntegralPrice && data.minIntegralPrice !== data.maxIntegralPrice) {
|
|
79
|
+
return "".concat(data.minIntegralPrice, "-").concat(data.maxIntegralPrice).concat(currencyStr);
|
|
80
|
+
}
|
|
81
|
+
return "".concat(data.integralPrice).concat(currencyStr);
|
|
82
|
+
}
|
|
83
|
+
return '';
|
|
84
|
+
}, [data]);
|
|
85
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
86
|
+
className: "".concat(prefix, "-goods"),
|
|
87
|
+
onClick: function onClick() {
|
|
88
|
+
return onCardClick();
|
|
89
|
+
}
|
|
90
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
+
className: "".concat(prefix, "-goods-info")
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
93
|
+
className: "".concat(prefix, "-goods-info-img"),
|
|
94
|
+
style: {
|
|
95
|
+
background: "url(".concat(data.pic || _const.fallbackImg, ") 0 0 / cover no-repeat")
|
|
96
|
+
}
|
|
97
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
98
|
+
className: "".concat(prefix, "-goods-info-right")
|
|
99
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
100
|
+
className: "one-line-text"
|
|
101
|
+
}, data.title), data.applicationId === 7 ? null : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
102
|
+
className: "".concat(prefix, "-goods-info-price")
|
|
103
|
+
}, formatPrice)), /*#__PURE__*/_react.default.createElement("div", null, data.supplierType && _const.cardTagMap[data.supplierType] && /*#__PURE__*/_react.default.createElement(_CardTag.default, _const.cardTagMap[data.supplierType])))));
|
|
104
|
+
};
|
|
105
|
+
var _default = exports.default = OrderCard;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@prefix: chart-messages-item;
|
|
2
|
+
|
|
3
|
+
.@{prefix}-goods {
|
|
4
|
+
max-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
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RecordSession } from '../ChatMessageList';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export declare function fitUrl(url: string): string;
|
|
5
|
+
declare const GoodsOrderCard: React.FC<{
|
|
6
|
+
prefix?: string;
|
|
7
|
+
suspend?: boolean;
|
|
8
|
+
onSend?: Function;
|
|
9
|
+
onClose?: Function;
|
|
10
|
+
orderSn?: any;
|
|
11
|
+
orderId?: any;
|
|
12
|
+
recordSession?: RecordSession;
|
|
13
|
+
}>;
|
|
14
|
+
export default GoodsOrderCard;
|