@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,169 @@
|
|
|
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
|
+
exports.fitUrl = fitUrl;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _icons = require("@ant-design/icons");
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
13
|
+
var _CardTag = _interopRequireDefault(require("../CardTag"));
|
|
14
|
+
var _antd = require("antd");
|
|
15
|
+
var _const = require("../common/const");
|
|
16
|
+
var _utils = require("../common/utils");
|
|
17
|
+
var _ = require("..");
|
|
18
|
+
require("./index.less");
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
+
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); }
|
|
21
|
+
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; }
|
|
22
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
24
|
+
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."); }
|
|
25
|
+
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); }
|
|
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
|
+
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; } }
|
|
28
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
+
var ORDER_STATUS_MAP = {
|
|
30
|
+
1: {
|
|
31
|
+
text: '待付款'
|
|
32
|
+
},
|
|
33
|
+
2: {
|
|
34
|
+
text: '待发货'
|
|
35
|
+
},
|
|
36
|
+
3: {
|
|
37
|
+
text: '已发货'
|
|
38
|
+
},
|
|
39
|
+
4: {
|
|
40
|
+
text: '已完成'
|
|
41
|
+
},
|
|
42
|
+
5: {
|
|
43
|
+
text: '已关闭'
|
|
44
|
+
},
|
|
45
|
+
6: {
|
|
46
|
+
text: '售后'
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
function fitUrl(url) {
|
|
50
|
+
if (!url) return '';
|
|
51
|
+
return url.startsWith('http') ? url : "http://".concat(url);
|
|
52
|
+
}
|
|
53
|
+
var GoodsOrderCard = function GoodsOrderCard(props) {
|
|
54
|
+
var _ref2, _ORDER_STATUS_MAP$dat;
|
|
55
|
+
var _useContext = (0, _react.useContext)(_.ImContext),
|
|
56
|
+
api = _useContext.api;
|
|
57
|
+
var _props$prefix = props.prefix,
|
|
58
|
+
prefix = _props$prefix === void 0 ? 'chart-messages-item' : _props$prefix,
|
|
59
|
+
_props$suspend = props.suspend,
|
|
60
|
+
suspend = _props$suspend === void 0 ? false : _props$suspend,
|
|
61
|
+
_props$orderSn = props.orderSn,
|
|
62
|
+
orderSn = _props$orderSn === void 0 ? '' : _props$orderSn,
|
|
63
|
+
orderId = props.orderId,
|
|
64
|
+
recordSession = props.recordSession;
|
|
65
|
+
var relationId = recordSession === null || recordSession === void 0 ? void 0 : recordSession.relationId;
|
|
66
|
+
var relationType = recordSession === null || recordSession === void 0 ? void 0 : recordSession.relationType;
|
|
67
|
+
var accid = recordSession === null || recordSession === void 0 ? void 0 : recordSession.accid;
|
|
68
|
+
var _useState = (0, _react.useState)({}),
|
|
69
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
70
|
+
data = _useState2[0],
|
|
71
|
+
setData = _useState2[1];
|
|
72
|
+
(0, _react.useEffect)(function () {
|
|
73
|
+
if (orderId || orderSn) {
|
|
74
|
+
api.getCSOrder({
|
|
75
|
+
orderSn: orderSn,
|
|
76
|
+
orderId: Number(orderId) || orderId,
|
|
77
|
+
accid: accid,
|
|
78
|
+
relationId: relationId,
|
|
79
|
+
relationType: relationType
|
|
80
|
+
}).then(function (_ref) {
|
|
81
|
+
var data = _ref.data;
|
|
82
|
+
setData(data || {});
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}, [orderSn, orderId, relationId, accid]);
|
|
86
|
+
function onCardClick() {
|
|
87
|
+
// 现金
|
|
88
|
+
// https://cash.koudaiqifu.cn/1002855/order/order_detail?order_id=12128707
|
|
89
|
+
// 积分
|
|
90
|
+
// https://jifen.koudaiqifu.cn/1003408/order/order_detail?order_id=12128708
|
|
91
|
+
// 卡券
|
|
92
|
+
// http://cardjs.ufuly.cn/index.html#/8JmeYWGzdyI=/exchangeHistory
|
|
93
|
+
if (data.applicationId === 7) {
|
|
94
|
+
if (data.siteUrl) {
|
|
95
|
+
window.open(fitUrl(data.siteUrl), '_blank');
|
|
96
|
+
}
|
|
97
|
+
} else if (data.siteUrl) {
|
|
98
|
+
window.open("".concat(fitUrl(data.siteUrl), "/order/order_detail?order_id=").concat(data.orderId), '_blank');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function formatOrderPrice() {
|
|
102
|
+
var price = '';
|
|
103
|
+
if (data.applicationId === 6) {
|
|
104
|
+
price = "".concat(data.totalPrice || 0, "\u5143");
|
|
105
|
+
}
|
|
106
|
+
if (Number(data.totalScore) > 0 && Number(data.totalPrice) > 0) {
|
|
107
|
+
price = "".concat(data.totalPrice, "\u5143+").concat(data.totalScore).concat(data.currencyStr || '积分');
|
|
108
|
+
} else if (Number(data.totalScore) > 0) {
|
|
109
|
+
price = "".concat(data.totalScore).concat(data.currencyStr);
|
|
110
|
+
} else if (Number(data.totalPrice) > 0) {
|
|
111
|
+
price = "".concat(data.totalPrice, "\u5143");
|
|
112
|
+
}
|
|
113
|
+
if (price) {
|
|
114
|
+
price = "\uFF0C\u5408\u8BA1".concat(price);
|
|
115
|
+
}
|
|
116
|
+
return price;
|
|
117
|
+
}
|
|
118
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
119
|
+
className: (0, _classnames.default)("".concat(prefix, "-order"), {
|
|
120
|
+
suspend: suspend
|
|
121
|
+
}),
|
|
122
|
+
onClick: function onClick() {
|
|
123
|
+
return onCardClick();
|
|
124
|
+
}
|
|
125
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
126
|
+
className: "".concat(prefix, "-order-info")
|
|
127
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
128
|
+
className: "".concat(prefix, "-order-info-img"),
|
|
129
|
+
style: {
|
|
130
|
+
background: "url(".concat(data.pic || _const.fallbackImg, ") 0 0 / cover no-repeat")
|
|
131
|
+
}
|
|
132
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
133
|
+
className: "".concat(prefix, "-order-info-right")
|
|
134
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
135
|
+
className: "".concat(prefix, "-order-info-title")
|
|
136
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
137
|
+
className: "one-line-text"
|
|
138
|
+
}, "\u8BA2\u5355\u7F16\u53F7: ", data.orderSn), /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
|
|
139
|
+
title: "\u590D\u5236"
|
|
140
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
141
|
+
type: "icon-fuzhi",
|
|
142
|
+
onClick: function onClick(e) {
|
|
143
|
+
e.stopPropagation();
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
(0, _utils.copyText)(data.orderSn).then(function () {
|
|
146
|
+
_antd.message.success('复制成功');
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}))), data.applicationId === 7 ? null : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
150
|
+
className: "".concat(prefix, "-order-info-price")
|
|
151
|
+
}, "\u5171\u8BA1", data.itemCount || 0, "\u4EF6\u5546\u54C1", formatOrderPrice())), /*#__PURE__*/_react.default.createElement("div", {
|
|
152
|
+
className: "".concat(prefix, "-order-info-bottom")
|
|
153
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
154
|
+
className: "".concat(prefix, "-order-info-tags")
|
|
155
|
+
}, Array.isArray(data.tagList) ? data.tagList.map(function (item, idx) {
|
|
156
|
+
if (item.supplierType && _const.cardTagMap[item.supplierType]) {
|
|
157
|
+
return /*#__PURE__*/_react.default.createElement(_CardTag.default, _extends({}, _const.cardTagMap[item.supplierType], {
|
|
158
|
+
key: idx
|
|
159
|
+
}));
|
|
160
|
+
} else {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
}) : null), /*#__PURE__*/_react.default.createElement("div", {
|
|
164
|
+
className: "".concat(prefix, "-order-info-state")
|
|
165
|
+
}, (_ref2 = data.state && ((_ORDER_STATUS_MAP$dat = ORDER_STATUS_MAP[data.state]) === null || _ORDER_STATUS_MAP$dat === void 0 ? void 0 : _ORDER_STATUS_MAP$dat.text)) !== null && _ref2 !== void 0 ? _ref2 : '')))), !suspend && !data.isCurrentSite && /*#__PURE__*/_react.default.createElement("div", {
|
|
166
|
+
className: "".concat(prefix, "-order-tip")
|
|
167
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.ExclamationCircleOutlined, null), "\xA0 \u5F53\u524D\u8BA2\u5355\u5E76\u4E0D\u662F\u672C\u7AD9\u70B9\u5185\u8BA2\u5355\uFF0C\u8BF7\u6838\u5BF9\uFF01"));
|
|
168
|
+
};
|
|
169
|
+
var _default = exports.default = GoodsOrderCard;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
@prefix: chart-messages-item;
|
|
2
|
+
|
|
3
|
+
.@{prefix}-order {
|
|
4
|
+
max-width: 272px;
|
|
5
|
+
padding-bottom: 2px;
|
|
6
|
+
|
|
7
|
+
&-info {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-flow: row;
|
|
10
|
+
padding: 12px;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
background-color: #fff;
|
|
14
|
+
&-img {
|
|
15
|
+
flex-shrink: 0;
|
|
16
|
+
border-radius: 3px;
|
|
17
|
+
width: 72px;
|
|
18
|
+
height: 72px;
|
|
19
|
+
margin-right: 6px;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
object-fit: fill;
|
|
22
|
+
background: url() no-repeat;
|
|
23
|
+
}
|
|
24
|
+
img {
|
|
25
|
+
width: 100%;
|
|
26
|
+
object-fit: contain;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&-right {
|
|
30
|
+
flex: 1;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
}
|
|
33
|
+
&-title {
|
|
34
|
+
display: flex;
|
|
35
|
+
justify-content: space-between;
|
|
36
|
+
align-items: center;
|
|
37
|
+
margin-bottom: 5px;
|
|
38
|
+
|
|
39
|
+
.one-line-text {
|
|
40
|
+
flex: 1;
|
|
41
|
+
padding-right: 3px;
|
|
42
|
+
}
|
|
43
|
+
.anticon {
|
|
44
|
+
color: #aaa;
|
|
45
|
+
}
|
|
46
|
+
.anticon:hover {
|
|
47
|
+
color: #2c6bffff;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&-price {
|
|
52
|
+
font-size: 12px;
|
|
53
|
+
color: #aaa;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&-bottom {
|
|
57
|
+
display: flex;
|
|
58
|
+
}
|
|
59
|
+
&-tags {
|
|
60
|
+
flex: 1;
|
|
61
|
+
}
|
|
62
|
+
&-state {
|
|
63
|
+
margin-bottom: 2px;
|
|
64
|
+
align-self: flex-end;
|
|
65
|
+
font-size: 12px;
|
|
66
|
+
color: #8c8c8c;
|
|
67
|
+
line-height: 16px;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&-tip {
|
|
72
|
+
margin-top: 5px;
|
|
73
|
+
height: 24px;
|
|
74
|
+
padding-left: 5px;
|
|
75
|
+
line-height: 24px;
|
|
76
|
+
background: rgba(225, 11, 25, 0.06);
|
|
77
|
+
border-radius: 4px;
|
|
78
|
+
color: #e10b19;
|
|
79
|
+
font-size: 12px;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 _icons = require("@ant-design/icons");
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
// antd 字体图标
|
|
11
|
+
var IconFont = (0, _icons.createFromIconfontCN)({
|
|
12
|
+
scriptUrl: ['//at.alicdn.com/t/c/font_4411856_i5o5y30jwrr.js' // 小鲤客服
|
|
13
|
+
]
|
|
14
|
+
});
|
|
15
|
+
var Icon = function Icon(props) {
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement(IconFont, props);
|
|
17
|
+
};
|
|
18
|
+
var _default = exports.default = Icon;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface AudioPlayerProps {
|
|
3
|
+
prefix: string;
|
|
4
|
+
msg: {
|
|
5
|
+
idClient: string;
|
|
6
|
+
flow: string;
|
|
7
|
+
};
|
|
8
|
+
url: string;
|
|
9
|
+
dur: number;
|
|
10
|
+
text?: string;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
declare const AudioPlayer: React.FC<AudioPlayerProps>;
|
|
14
|
+
export default AudioPlayer;
|
|
@@ -0,0 +1,98 @@
|
|
|
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 _Icon = _interopRequireDefault(require("../Icon"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
17
|
+
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); }
|
|
18
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
+
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."); }
|
|
20
|
+
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); }
|
|
21
|
+
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; }
|
|
22
|
+
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; } }
|
|
23
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
+
var AudioPlayer = function AudioPlayer(_ref) {
|
|
25
|
+
var prefix = _ref.prefix,
|
|
26
|
+
msg = _ref.msg,
|
|
27
|
+
url = _ref.url,
|
|
28
|
+
dur = _ref.dur,
|
|
29
|
+
text = _ref.text,
|
|
30
|
+
_ref$style = _ref.style,
|
|
31
|
+
style = _ref$style === void 0 ? {} : _ref$style;
|
|
32
|
+
var audioRef = (0, _react.useRef)(null);
|
|
33
|
+
var _useState = (0, _react.useState)(false),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
animationFlag = _useState2[0],
|
|
36
|
+
setAnimationFlag = _useState2[1];
|
|
37
|
+
var pauseAllAudio = function pauseAllAudio() {
|
|
38
|
+
var audio = document.getElementById('fxMessageAudio');
|
|
39
|
+
audio === null || audio === void 0 ? void 0 : audio.pause();
|
|
40
|
+
return audio;
|
|
41
|
+
};
|
|
42
|
+
var pauseAllVideo = function pauseAllVideo() {
|
|
43
|
+
var videoElements = document.getElementsByTagName('video');
|
|
44
|
+
for (var i = 0; i < videoElements.length; i++) {
|
|
45
|
+
if (videoElements[i].id.startsWith('fxMessageVideo-')) {
|
|
46
|
+
videoElements[i].pause();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var handleAudioClick = function handleAudioClick() {
|
|
51
|
+
var _audioRef$current;
|
|
52
|
+
pauseAllVideo();
|
|
53
|
+
var oldAudio = pauseAllAudio();
|
|
54
|
+
var msgId = oldAudio === null || oldAudio === void 0 ? void 0 : oldAudio.getAttribute('msgId');
|
|
55
|
+
if (msgId === msg.idClient) {
|
|
56
|
+
setAnimationFlag(false);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
var audio = new Audio(url);
|
|
60
|
+
audio.id = 'fxMessageAudio';
|
|
61
|
+
audio.setAttribute('msgId', msg.idClient);
|
|
62
|
+
audio.play();
|
|
63
|
+
(_audioRef$current = audioRef.current) === null || _audioRef$current === void 0 ? void 0 : _audioRef$current.appendChild(audio);
|
|
64
|
+
audio.addEventListener('ended', function () {
|
|
65
|
+
var _audio$parentNode;
|
|
66
|
+
setAnimationFlag(false);
|
|
67
|
+
(_audio$parentNode = audio.parentNode) === null || _audio$parentNode === void 0 ? void 0 : _audio$parentNode.removeChild(audio);
|
|
68
|
+
});
|
|
69
|
+
audio.addEventListener('pause', function () {
|
|
70
|
+
var _audio$parentNode2;
|
|
71
|
+
setAnimationFlag(false);
|
|
72
|
+
(_audio$parentNode2 = audio.parentNode) === null || _audio$parentNode2 === void 0 ? void 0 : _audio$parentNode2.removeChild(audio);
|
|
73
|
+
});
|
|
74
|
+
setAnimationFlag(true);
|
|
75
|
+
};
|
|
76
|
+
var duration = Math.floor(dur) || 0;
|
|
77
|
+
var durations = {
|
|
78
|
+
mm: Math.floor(duration / 60),
|
|
79
|
+
ss: duration % 60
|
|
80
|
+
};
|
|
81
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
82
|
+
className: "".concat(prefix, "-audio"),
|
|
83
|
+
ref: audioRef,
|
|
84
|
+
style: _objectSpread({}, style)
|
|
85
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
86
|
+
className: msg.flow === 'in' ? "".concat(prefix, "-audio-in") : "".concat(prefix, "-audio-out"),
|
|
87
|
+
onClick: handleAudioClick
|
|
88
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, ' ', "".concat(durations.mm > 0 ? "".concat(durations.mm, "'") : '', " ").concat(durations.ss, "\"")), /*#__PURE__*/_react.default.createElement("span", {
|
|
89
|
+
className: "".concat(prefix, "-audio-icon")
|
|
90
|
+
}, animationFlag ? /*#__PURE__*/_react.default.createElement("img", {
|
|
91
|
+
src: "https://qa-oss.elebuys.com/tmpdir/202401152050070000640984.gif"
|
|
92
|
+
}) : /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
93
|
+
type: "icon-a-yuyin2"
|
|
94
|
+
}))), text && /*#__PURE__*/_react.default.createElement("div", {
|
|
95
|
+
className: "".concat(prefix, "-audio-audio2text")
|
|
96
|
+
}, text));
|
|
97
|
+
};
|
|
98
|
+
var _default = exports.default = AudioPlayer;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.pauseOtherVideo = exports.pauseAllVideo = exports.pauseAllAudio = void 0;
|
|
7
|
+
var pauseAllAudio = exports.pauseAllAudio = function pauseAllAudio() {
|
|
8
|
+
var audio = document.getElementById('fxMessageAudio');
|
|
9
|
+
audio === null || audio === void 0 ? void 0 : audio.pause();
|
|
10
|
+
return audio;
|
|
11
|
+
};
|
|
12
|
+
var pauseOtherVideo = exports.pauseOtherVideo = function pauseOtherVideo(idClient) {
|
|
13
|
+
var videoElements = document.getElementsByTagName('video');
|
|
14
|
+
for (var i = 0; i < videoElements.length; i++) {
|
|
15
|
+
if (videoElements[i].id !== "fxMessageVideo-".concat(idClient)) {
|
|
16
|
+
videoElements[i].pause();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var pauseAllVideo = exports.pauseAllVideo = function pauseAllVideo() {
|
|
21
|
+
var videoElements = document.getElementsByTagName('video');
|
|
22
|
+
for (var i = 0; i < videoElements.length; i++) {
|
|
23
|
+
if (videoElements[i].id.startsWith('fxMessageVideo-')) {
|
|
24
|
+
videoElements[i].pause();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IMMessage } from '../@types';
|
|
3
|
+
import { RecordSession } from '../ChatMessageList';
|
|
4
|
+
import './index.less';
|
|
5
|
+
export interface IParseSessionProps {
|
|
6
|
+
prefix?: string;
|
|
7
|
+
keyword?: string;
|
|
8
|
+
h5?: boolean;
|
|
9
|
+
msg: IMMessage;
|
|
10
|
+
isSessionEnd?: boolean;
|
|
11
|
+
onChartHistoryClick?: Function;
|
|
12
|
+
recordSession?: RecordSession;
|
|
13
|
+
}
|
|
14
|
+
declare const ParseSession: React.FC<IParseSessionProps>;
|
|
15
|
+
export default ParseSession;
|