@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.
- package/package.json +2 -2
- package/es/@types/index.d.ts +0 -620
- package/es/CardTag/index.d.ts +0 -3
- package/es/CardTag/index.js +0 -18
- package/es/ChatMessageItem/index.d.ts +0 -17
- package/es/ChatMessageItem/index.js +0 -130
- package/es/ChatMessageItem/index.less +0 -108
- package/es/ChatMessageList/index.d.ts +0 -26
- package/es/ChatMessageList/index.js +0 -56
- package/es/ChatMessageList/index.less +0 -33
- package/es/GoodsCard/index.d.ts +0 -14
- package/es/GoodsCard/index.js +0 -93
- package/es/GoodsCard/index.less +0 -49
- package/es/GoodsOrderCard/index.d.ts +0 -17
- package/es/GoodsOrderCard/index.js +0 -161
- package/es/GoodsOrderCard/index.less +0 -81
- package/es/Icon/index.d.ts +0 -8
- package/es/Icon/index.js +0 -11
- package/es/ParseSession/index.d.ts +0 -21
- package/es/ParseSession/index.js +0 -454
- package/es/ParseSession/index.less +0 -181
- package/es/api/index.d.ts +0 -29
- package/es/api/index.js +0 -48
- package/es/common/const/index.d.ts +0 -46
- package/es/common/const/index.js +0 -82
- package/es/common/utils/index.d.ts +0 -33
- package/es/common/utils/index.js +0 -169
- package/es/index.d.ts +0 -25
- package/es/index.js +0 -76
- package/es/styles/extends.less +0 -50
- package/es/styles/index.less +0 -35
- package/es/styles/vars.less +0 -8
- package/es/utils/index.d.ts +0 -14
- package/es/utils/index.js +0 -50
- package/lib/@types/index.d.ts +0 -620
- package/lib/CardTag/index.d.ts +0 -3
- package/lib/CardTag/index.js +0 -25
- package/lib/ChatMessageItem/index.d.ts +0 -17
- package/lib/ChatMessageItem/index.js +0 -136
- package/lib/ChatMessageItem/index.less +0 -108
- package/lib/ChatMessageList/index.d.ts +0 -26
- package/lib/ChatMessageList/index.js +0 -63
- package/lib/ChatMessageList/index.less +0 -33
- package/lib/GoodsCard/index.d.ts +0 -14
- package/lib/GoodsCard/index.js +0 -103
- package/lib/GoodsCard/index.less +0 -49
- package/lib/GoodsOrderCard/index.d.ts +0 -17
- package/lib/GoodsOrderCard/index.js +0 -169
- package/lib/GoodsOrderCard/index.less +0 -81
- package/lib/Icon/index.d.ts +0 -8
- package/lib/Icon/index.js +0 -18
- package/lib/ParseSession/index.d.ts +0 -21
- package/lib/ParseSession/index.js +0 -456
- package/lib/ParseSession/index.less +0 -181
- package/lib/api/index.d.ts +0 -29
- package/lib/api/index.js +0 -55
- package/lib/common/const/index.d.ts +0 -46
- package/lib/common/const/index.js +0 -88
- package/lib/common/utils/index.d.ts +0 -33
- package/lib/common/utils/index.js +0 -183
- package/lib/index.d.ts +0 -25
- package/lib/index.js +0 -85
- package/lib/styles/extends.less +0 -50
- package/lib/styles/index.less +0 -35
- package/lib/styles/vars.less +0 -8
- package/lib/utils/index.d.ts +0 -14
- package/lib/utils/index.js +0 -56
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import "antd/es/avatar/style";
|
|
2
|
-
import _Avatar from "antd/es/avatar";
|
|
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
|
-
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; }
|
|
5
|
-
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; }
|
|
6
|
-
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; }
|
|
7
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
-
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); }
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import dayjs from 'dayjs';
|
|
11
|
-
import classNames from 'classnames';
|
|
12
|
-
import ParseSession from '../ParseSession';
|
|
13
|
-
import Icon from '../Icon';
|
|
14
|
-
import { defaultAvatar, imMsgTypes, msgEventTypes } from '../common/const';
|
|
15
|
-
import { paserAttach } from '../common/utils';
|
|
16
|
-
import './index.less';
|
|
17
|
-
var ChatMessageItem = function ChatMessageItem(_ref) {
|
|
18
|
-
var h5 = _ref.h5,
|
|
19
|
-
msg = _ref.msg,
|
|
20
|
-
prefix = _ref.prefix,
|
|
21
|
-
_ref$myAccount = _ref.myAccount,
|
|
22
|
-
myAccount = _ref$myAccount === void 0 ? '' : _ref$myAccount,
|
|
23
|
-
keyword = _ref.keyword,
|
|
24
|
-
_ref$accountInfo = _ref.accountInfo,
|
|
25
|
-
accountInfo = _ref$accountInfo === void 0 ? {} : _ref$accountInfo,
|
|
26
|
-
isSessionEnd = _ref.isSessionEnd,
|
|
27
|
-
recordSession = _ref.recordSession;
|
|
28
|
-
var paserMsg = _objectSpread(_objectSpread({}, msg), {}, {
|
|
29
|
-
attach: paserAttach(msg.attach || {})
|
|
30
|
-
});
|
|
31
|
-
var from = paserMsg.from,
|
|
32
|
-
_paserMsg$attach = paserMsg.attach,
|
|
33
|
-
attach = _paserMsg$attach === void 0 ? {} : _paserMsg$attach,
|
|
34
|
-
idClient = paserMsg.idClient,
|
|
35
|
-
time = paserMsg.time,
|
|
36
|
-
type = paserMsg.type,
|
|
37
|
-
flow = paserMsg.flow;
|
|
38
|
-
var isRecall = ['recall'].includes(type);
|
|
39
|
-
var isEvent = [imMsgTypes.event].includes(attach === null || attach === void 0 ? void 0 : attach.type);
|
|
40
|
-
var isTip = [imMsgTypes.tip].includes(attach === null || attach === void 0 ? void 0 : attach.type);
|
|
41
|
-
var isNotification = type === 'notification';
|
|
42
|
-
var isSelf = myAccount ? from === myAccount : flow === 'out';
|
|
43
|
-
var renderMsgDate = function renderMsgDate() {
|
|
44
|
-
var date = dayjs(time);
|
|
45
|
-
var isCurrentDay = date.isSame(dayjs(), 'day');
|
|
46
|
-
var isCurrentYear = date.isSame(dayjs(), 'year');
|
|
47
|
-
// eslint-disable-next-line no-nested-ternary
|
|
48
|
-
return isCurrentDay ? date.format('HH:mm:ss') : isCurrentYear ? date.format('MM-DD HH:mm:ss') : date.format('YYYY-MM-DD HH:mm:ss');
|
|
49
|
-
};
|
|
50
|
-
var renderRecallMsg = function renderRecallMsg() {
|
|
51
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
52
|
-
key: idClient,
|
|
53
|
-
className: "".concat(prefix, "-tip")
|
|
54
|
-
}, "".concat(isSelf ? '您' : '用户', "\u64A4\u56DE\u4E86\u4E00\u6761\u4FE1\u606F"));
|
|
55
|
-
};
|
|
56
|
-
var renderEventMsg = function renderEventMsg() {
|
|
57
|
-
var _attach$content;
|
|
58
|
-
var isCloseEvent = [msgEventTypes.csClose, msgEventTypes.sysClose, msgEventTypes.userClose].includes((_attach$content = attach.content) === null || _attach$content === void 0 ? void 0 : _attach$content.eventType);
|
|
59
|
-
return attach.content.tips ? /*#__PURE__*/React.createElement("div", {
|
|
60
|
-
key: idClient,
|
|
61
|
-
className: classNames("".concat(prefix, "-tip"), {
|
|
62
|
-
'is-close': isCloseEvent
|
|
63
|
-
})
|
|
64
|
-
}, /*#__PURE__*/React.createElement("span", null, attach.content.tips)) : /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
65
|
-
};
|
|
66
|
-
var renderTipMsg = function renderTipMsg() {
|
|
67
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
68
|
-
key: idClient,
|
|
69
|
-
className: "".concat(prefix, "-tip")
|
|
70
|
-
}, /*#__PURE__*/React.createElement("span", null, attach.content));
|
|
71
|
-
};
|
|
72
|
-
function renderCenterMsg() {
|
|
73
|
-
if (isRecall) return renderRecallMsg();
|
|
74
|
-
if (isTip) return renderTipMsg();
|
|
75
|
-
if (isEvent) return renderEventMsg();
|
|
76
|
-
if (isNotification) {
|
|
77
|
-
/*#__PURE__*/React.createElement(ParseSession, {
|
|
78
|
-
msg: paserMsg,
|
|
79
|
-
prefix: "".concat(prefix)
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
function renderContent() {
|
|
85
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
86
|
-
className: "".concat(prefix, "-box")
|
|
87
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
88
|
-
className: classNames("".concat(prefix, "-date"), _defineProperty({}, "".concat(prefix, "-date-self"), isSelf))
|
|
89
|
-
}, renderMsgDate()), /*#__PURE__*/React.createElement("div", {
|
|
90
|
-
className: "".concat(prefix, "-body"),
|
|
91
|
-
style: {
|
|
92
|
-
background: [imMsgTypes.video, imMsgTypes.order, imMsgTypes.product].includes(attach.type) ? 'transparent' : ''
|
|
93
|
-
}
|
|
94
|
-
}, /*#__PURE__*/React.createElement(ParseSession, {
|
|
95
|
-
h5: h5,
|
|
96
|
-
keyword: keyword,
|
|
97
|
-
msg: paserMsg,
|
|
98
|
-
prefix: "".concat(prefix),
|
|
99
|
-
recordSession: recordSession,
|
|
100
|
-
isSessionEnd: isSessionEnd
|
|
101
|
-
})), isSelf && myAccount && /*#__PURE__*/React.createElement("span", {
|
|
102
|
-
className: classNames("".concat(prefix, "-read"), {
|
|
103
|
-
isRead: msg.readByOtherUser
|
|
104
|
-
})
|
|
105
|
-
}, msg.readByOtherUser ? '已读' : '未读'));
|
|
106
|
-
}
|
|
107
|
-
return renderCenterMsg() || /*#__PURE__*/React.createElement("div", {
|
|
108
|
-
className: classNames(prefix, {
|
|
109
|
-
self: isSelf,
|
|
110
|
-
h5: h5
|
|
111
|
-
})
|
|
112
|
-
}, [imMsgTypes.chatrecord].includes(attach.type) ? /*#__PURE__*/React.createElement(_Avatar, {
|
|
113
|
-
size: 36,
|
|
114
|
-
style: {
|
|
115
|
-
backgroundColor: '#2c6bff',
|
|
116
|
-
verticalAlign: 'middle'
|
|
117
|
-
},
|
|
118
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
119
|
-
type: 'icon-kefu',
|
|
120
|
-
style: {
|
|
121
|
-
fontSize: 24,
|
|
122
|
-
color: '#fff'
|
|
123
|
-
}
|
|
124
|
-
})
|
|
125
|
-
}) : /*#__PURE__*/React.createElement(_Avatar, {
|
|
126
|
-
size: 36,
|
|
127
|
-
src: accountInfo.avatar || defaultAvatar
|
|
128
|
-
}), renderContent());
|
|
129
|
-
};
|
|
130
|
-
export 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,56 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ChatMessageItem from '../ChatMessageItem';
|
|
3
|
-
import { debounce } from '../utils';
|
|
4
|
-
import './index.less';
|
|
5
|
-
var LOADING_STATUS = {
|
|
6
|
-
loading: '加载中...',
|
|
7
|
-
nomore: '没有更多了~'
|
|
8
|
-
};
|
|
9
|
-
var LOAD_LIMIT = 15;
|
|
10
|
-
var ChatMessageList = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
11
|
-
var h5 = _ref.h5,
|
|
12
|
-
msgs = _ref.msgs,
|
|
13
|
-
_ref$onScrollTop = _ref.onScrollTop,
|
|
14
|
-
onScrollTop = _ref$onScrollTop === void 0 ? function () {} : _ref$onScrollTop,
|
|
15
|
-
_ref$loadingStarus = _ref.loadingStarus,
|
|
16
|
-
loadingStarus = _ref$loadingStarus === void 0 ? '' : _ref$loadingStarus,
|
|
17
|
-
myAccount = _ref.myAccount,
|
|
18
|
-
style = _ref.style,
|
|
19
|
-
recordSession = _ref.recordSession,
|
|
20
|
-
_ref$accountsMap = _ref.accountsMap,
|
|
21
|
-
accountsMap = _ref$accountsMap === void 0 ? {} : _ref$accountsMap,
|
|
22
|
-
_ref$isSessionEnd = _ref.isSessionEnd,
|
|
23
|
-
isSessionEnd = _ref$isSessionEnd === void 0 ? false : _ref$isSessionEnd;
|
|
24
|
-
var prefixCls = "chart-messages";
|
|
25
|
-
var onScrollHandler = debounce(function (e) {
|
|
26
|
-
var scrollElRef = ref;
|
|
27
|
-
if (!(scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current)) return;
|
|
28
|
-
var isTop = scrollElRef.current.scrollTop < 20;
|
|
29
|
-
isTop && (onScrollTop === null || onScrollTop === void 0 ? void 0 : onScrollTop(e));
|
|
30
|
-
}, 200);
|
|
31
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
32
|
-
className: prefixCls,
|
|
33
|
-
style: style || {}
|
|
34
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
35
|
-
ref: ref,
|
|
36
|
-
className: "".concat(prefixCls, "-content scrollmini"),
|
|
37
|
-
onScroll: onScrollHandler
|
|
38
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
39
|
-
className: "".concat(prefixCls, "-status")
|
|
40
|
-
}, msgs.length < LOAD_LIMIT || !LOADING_STATUS[loadingStarus] ? null : LOADING_STATUS[loadingStarus]), msgs.map(function (msg) {
|
|
41
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
42
|
-
id: msg.idServer,
|
|
43
|
-
key: msg.idServer
|
|
44
|
-
}, /*#__PURE__*/React.createElement(ChatMessageItem, {
|
|
45
|
-
h5: h5,
|
|
46
|
-
keyword: '',
|
|
47
|
-
myAccount: myAccount,
|
|
48
|
-
prefix: "".concat(prefixCls, "-item"),
|
|
49
|
-
msg: msg,
|
|
50
|
-
isSessionEnd: isSessionEnd,
|
|
51
|
-
recordSession: recordSession,
|
|
52
|
-
accountInfo: accountsMap[msg.from] || {}
|
|
53
|
-
}));
|
|
54
|
-
})));
|
|
55
|
-
});
|
|
56
|
-
export 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
|
-
}
|
package/es/GoodsCard/index.d.ts
DELETED
|
@@ -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;
|
package/es/GoodsCard/index.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
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."); }
|
|
3
|
-
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); }
|
|
4
|
-
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; }
|
|
5
|
-
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; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
8
|
-
import { cardTagMap, fallbackImg } from '../common/const';
|
|
9
|
-
import CardTag from '../CardTag';
|
|
10
|
-
import { ImContext } from '..';
|
|
11
|
-
import { fitUrl } from '../GoodsOrderCard';
|
|
12
|
-
import './index.less';
|
|
13
|
-
var OrderCard = function OrderCard(props) {
|
|
14
|
-
var _props$prefix = props.prefix,
|
|
15
|
-
prefix = _props$prefix === void 0 ? 'chart-messages-item' : _props$prefix,
|
|
16
|
-
content = props.content;
|
|
17
|
-
var productId = content.productId,
|
|
18
|
-
relationId = content.relationId,
|
|
19
|
-
relationType = content.relationType;
|
|
20
|
-
var _useState = useState({}),
|
|
21
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
-
data = _useState2[0],
|
|
23
|
-
setData = _useState2[1];
|
|
24
|
-
var _useContext = useContext(ImContext),
|
|
25
|
-
api = _useContext.api;
|
|
26
|
-
useEffect(function () {
|
|
27
|
-
if (productId) {
|
|
28
|
-
api.getProductById({
|
|
29
|
-
productId: productId,
|
|
30
|
-
relationId: relationId,
|
|
31
|
-
relationType: relationType
|
|
32
|
-
}).then(function (_ref) {
|
|
33
|
-
var data = _ref.data;
|
|
34
|
-
setData(data || {});
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}, [productId]);
|
|
38
|
-
function onCardClick() {
|
|
39
|
-
// 现金
|
|
40
|
-
// https://cash.koudaiqifu.cn/1002855/product/product_info/87764307
|
|
41
|
-
// 积分
|
|
42
|
-
// https://jifen.koudaiqifu.cn/1003406/product/product_info/87799942
|
|
43
|
-
// https://jifen.koudaiqifu.cn/pcweb/goodsDetail/87876999
|
|
44
|
-
// 卡券
|
|
45
|
-
// http://cardjs.ufuly.cn/index.html#/8JmeYWGzdyI=/productDetail/87752904
|
|
46
|
-
// 1 积分 6 现金 7 礼包卡券
|
|
47
|
-
if (data.applicationId === 7) {
|
|
48
|
-
var _data$siteUrl;
|
|
49
|
-
if ((_data$siteUrl = data.siteUrl) === null || _data$siteUrl === void 0 ? void 0 : _data$siteUrl.includes('/display')) {
|
|
50
|
-
var url = fitUrl(data.siteUrl).replace('/display', "/productDetail/".concat(productId));
|
|
51
|
-
window.open(url, '_blank');
|
|
52
|
-
}
|
|
53
|
-
} else if (data.siteUrl) {
|
|
54
|
-
window.open("".concat(fitUrl(data.siteUrl), "/product/product_info/").concat(productId), '_blank');
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
var formatPrice = useMemo(function () {
|
|
58
|
-
if (data.priceType === 2) {
|
|
59
|
-
if (data.priceRangeMin && data.priceRangeMax) {
|
|
60
|
-
return "".concat(data.priceRangeMin, "-").concat(data.priceRangeMax, "\u5143");
|
|
61
|
-
}
|
|
62
|
-
return "".concat(data.price, "\u5143");
|
|
63
|
-
}
|
|
64
|
-
if (data.priceType === 1) {
|
|
65
|
-
var currencyStr = data.currencyStr || '积分';
|
|
66
|
-
if (data.minIntegralPrice && data.maxIntegralPrice && data.minIntegralPrice !== data.maxIntegralPrice) {
|
|
67
|
-
return "".concat(data.minIntegralPrice, "-").concat(data.maxIntegralPrice).concat(currencyStr);
|
|
68
|
-
}
|
|
69
|
-
return "".concat(data.integralPrice).concat(currencyStr);
|
|
70
|
-
}
|
|
71
|
-
return '';
|
|
72
|
-
}, [data]);
|
|
73
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
74
|
-
className: "".concat(prefix, "-goods"),
|
|
75
|
-
onClick: function onClick() {
|
|
76
|
-
return onCardClick();
|
|
77
|
-
}
|
|
78
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
79
|
-
className: "".concat(prefix, "-goods-info")
|
|
80
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
81
|
-
className: "".concat(prefix, "-goods-info-img"),
|
|
82
|
-
style: {
|
|
83
|
-
background: "url(".concat(data.pic || fallbackImg, ") 0 0 / cover no-repeat")
|
|
84
|
-
}
|
|
85
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
86
|
-
className: "".concat(prefix, "-goods-info-right")
|
|
87
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
88
|
-
className: "one-line-text"
|
|
89
|
-
}, data.title), data.applicationId === 7 ? null : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
90
|
-
className: "".concat(prefix, "-goods-info-price")
|
|
91
|
-
}, formatPrice)), /*#__PURE__*/React.createElement("div", null, data.supplierType && cardTagMap[data.supplierType] && /*#__PURE__*/React.createElement(CardTag, cardTagMap[data.supplierType])))));
|
|
92
|
-
};
|
|
93
|
-
export default OrderCard;
|
package/es/GoodsCard/index.less
DELETED
|
@@ -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;
|