@myun/gimi-chat 0.9.32 → 0.9.33
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.
|
@@ -12,7 +12,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
12
12
|
*/
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import Icon from '@douyinfe/semi-icons';
|
|
15
|
-
var scriptUrl = '//at.alicdn.com/t/c/
|
|
15
|
+
var scriptUrl = '//at.alicdn.com/t/c/font_3429456_6axceqaxg7s.js';
|
|
16
16
|
|
|
17
17
|
// Load iconfont script
|
|
18
18
|
if (typeof document !== 'undefined' && scriptUrl) {
|
|
@@ -8,19 +8,63 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
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; }
|
|
9
9
|
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; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
-
import React, { useState } from 'react';
|
|
11
|
+
import React, { useMemo, useState } from 'react';
|
|
12
12
|
import { knowledgeConstants } from "../../constants";
|
|
13
|
-
import { Toast } from '@douyinfe/semi-ui';
|
|
13
|
+
import { Popover, Toast } from '@douyinfe/semi-ui';
|
|
14
14
|
import styles from "./index.module.css";
|
|
15
15
|
import { useAppSelector } from "../../store/hooks";
|
|
16
16
|
import { useContext } from 'react';
|
|
17
17
|
import ChatContext from "../templates/chatContext";
|
|
18
|
-
import ShadowLoading from "../shadow-loading";
|
|
19
18
|
import { useTranslation } from 'react-i18next';
|
|
19
|
+
import useKnowledgeService from "../../hooks/useKnowledgeService";
|
|
20
|
+
import ClassList from "../knowledge-trace/classList";
|
|
21
|
+
import AiLoading from "../ai-loading";
|
|
22
|
+
import ShadowLoading from "../shadow-loading";
|
|
23
|
+
var Empty = function Empty() {
|
|
24
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
style: {
|
|
26
|
+
margin: '30px auto',
|
|
27
|
+
textAlign: 'center'
|
|
28
|
+
}
|
|
29
|
+
}, "\u6682\u65E0\u6570\u636E");
|
|
30
|
+
};
|
|
20
31
|
var ProductTag = function ProductTag(_ref) {
|
|
21
32
|
var value = _ref.value;
|
|
22
33
|
var _useTranslation = useTranslation(),
|
|
23
34
|
t = _useTranslation.t;
|
|
35
|
+
var _useState = useState(false),
|
|
36
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
+
showPanel = _useState2[0],
|
|
38
|
+
setShowPanel = _useState2[1];
|
|
39
|
+
|
|
40
|
+
// hover 弹层所需:拉取课程列表 (与多课程/视频一致)
|
|
41
|
+
var _useKnowledgeService = useKnowledgeService({
|
|
42
|
+
showPanel: showPanel,
|
|
43
|
+
kowledgeTrace: [{
|
|
44
|
+
type: 'product',
|
|
45
|
+
resources: [{
|
|
46
|
+
id: String(value)
|
|
47
|
+
}]
|
|
48
|
+
}]
|
|
49
|
+
}),
|
|
50
|
+
productList = _useKnowledgeService.productList,
|
|
51
|
+
isLoading = _useKnowledgeService.isLoading;
|
|
52
|
+
var hoverPanelContent = useMemo(function () {
|
|
53
|
+
if (isLoading) return /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
style: {
|
|
55
|
+
padding: '30px'
|
|
56
|
+
}
|
|
57
|
+
}, /*#__PURE__*/React.createElement(AiLoading, null));
|
|
58
|
+
return productList !== null && productList !== void 0 && productList.length ? /*#__PURE__*/React.createElement(ClassList, {
|
|
59
|
+
list: productList,
|
|
60
|
+
hiddenTitle: true
|
|
61
|
+
}) : /*#__PURE__*/React.createElement(Empty, null);
|
|
62
|
+
}, [productList, isLoading]);
|
|
63
|
+
var onVisibleChange = React.useCallback(function (visible) {
|
|
64
|
+
setShowPanel(visible);
|
|
65
|
+
}, []);
|
|
66
|
+
|
|
67
|
+
// ===== 原有 click 跳转逻辑 (保留) =====
|
|
24
68
|
var platform = useAppSelector(function (state) {
|
|
25
69
|
return state.gimiMenu.platform;
|
|
26
70
|
});
|
|
@@ -28,10 +72,10 @@ var ProductTag = function ProductTag(_ref) {
|
|
|
28
72
|
apiService = _useContext.apiService;
|
|
29
73
|
var _ref2 = apiService,
|
|
30
74
|
checkProductType = _ref2.checkProductType;
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
checking =
|
|
34
|
-
setChecking =
|
|
75
|
+
var _useState3 = useState(false),
|
|
76
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
77
|
+
checking = _useState4[0],
|
|
78
|
+
setChecking = _useState4[1];
|
|
35
79
|
var handleIconClick = /*#__PURE__*/function () {
|
|
36
80
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
37
81
|
var courseId, productType, res, _res$result;
|
|
@@ -51,7 +95,7 @@ var ProductTag = function ProductTag(_ref) {
|
|
|
51
95
|
}
|
|
52
96
|
return _context.abrupt("return", Toast.error(t('course.noValidCourse')));
|
|
53
97
|
case 5:
|
|
54
|
-
productType = 'single';
|
|
98
|
+
productType = 'single';
|
|
55
99
|
_context.prev = 6;
|
|
56
100
|
setChecking(true);
|
|
57
101
|
_context.next = 10;
|
|
@@ -98,6 +142,12 @@ var ProductTag = function ProductTag(_ref) {
|
|
|
98
142
|
style: {
|
|
99
143
|
display: 'inline-block'
|
|
100
144
|
}
|
|
145
|
+
}, /*#__PURE__*/React.createElement(Popover, {
|
|
146
|
+
content: hoverPanelContent,
|
|
147
|
+
visible: showPanel,
|
|
148
|
+
onVisibleChange: onVisibleChange,
|
|
149
|
+
className: "knowledgeHoverPanel",
|
|
150
|
+
position: "bottomLeft"
|
|
101
151
|
}, /*#__PURE__*/React.createElement("div", {
|
|
102
152
|
className: styles.icon_btn,
|
|
103
153
|
onClick: handleIconClick
|
|
@@ -111,6 +161,6 @@ var ProductTag = function ProductTag(_ref) {
|
|
|
111
161
|
}), /*#__PURE__*/React.createElement("span", null, t('course.viewCourse')), /*#__PURE__*/React.createElement(ShadowLoading, {
|
|
112
162
|
loading: checking,
|
|
113
163
|
text: t('common.pleaseWait')
|
|
114
|
-
})));
|
|
164
|
+
}))));
|
|
115
165
|
};
|
|
116
166
|
export default ProductTag;
|