@cqsjjb/course-res-design 0.0.8 → 0.1.0-beta.1

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/Designable.js CHANGED
@@ -14,17 +14,19 @@ export const Designable = ({
14
14
  const iframeRef = useRef(null);
15
15
 
16
16
  // 计算 iframe 的 src
17
- const iframeSrc = src || `${host}/course-res-design/setting`;
17
+ const iframeSrc = src || `${host}/res-design/setting`;
18
18
 
19
19
  // 处理 iframe 加载完成
20
20
  const handleIframeLoad = () => {
21
21
  // iframe 加载完成后发送 postMessage
22
- if (iframeRef.current?.contentWindow) {
23
- iframeRef.current.contentWindow.postMessage({
24
- type: EVENT_OPEN_COURSE_RES_DESIGN,
25
- data: data || {}
26
- }, new URL(iframeSrc).origin);
27
- }
22
+ setTimeout(() => {
23
+ if (iframeRef.current?.contentWindow) {
24
+ iframeRef.current.contentWindow.postMessage({
25
+ type: EVENT_OPEN_COURSE_RES_DESIGN,
26
+ data: data || {}
27
+ }, new URL(iframeSrc).origin);
28
+ }
29
+ }, 0);
28
30
  };
29
31
 
30
32
  // 监听来自 iframe 的关闭消息
package/Preview.js CHANGED
@@ -276,7 +276,7 @@ export default class FormPreview extends React.Component {
276
276
  }
277
277
  }, /*#__PURE__*/React.createElement(QRCode, {
278
278
  size: 180,
279
- value: `${getApiHost()}/course-res-design/previewH5?courseId=${courseInfo?.id || ''}`
279
+ value: `${getApiHost()}/res-design/previewH5?courseId=${courseInfo?.id || ''}`
280
280
  }))),
281
281
  trigger: "click",
282
282
  placement: "leftTop"
@@ -363,7 +363,8 @@ export default class FormPreview extends React.Component {
363
363
  style: {
364
364
  borderRadius: '10px'
365
365
  },
366
- courseInfo: courseInfo
366
+ courseInfo: courseInfo,
367
+ apiBaseName: this.props.apiBaseName
367
368
  })), /*#__PURE__*/React.createElement("div", {
368
369
  className: "course-preview__item-video-info"
369
370
  }, /*#__PURE__*/React.createElement("a", null, "\u89C6\u9891\u65F6\u957F\uFF1A", secondToFormat(Number(item.resourceTotalIden))), courseInfo?.hourRuleId ? /*#__PURE__*/React.createElement("a", null, "\u53C2\u8003\u5B66\u65F6\uFF1A", item.resourceHour || '--', "\u5B66\u65F6") : '', /*#__PURE__*/React.createElement("a", null, "\u8BD5\u770B\u5206\u949F\uFF1A", item.auditionTime || '--'), JSON.parse(item.testExamJson || '[]')?.length > 0 && /*#__PURE__*/React.createElement("a", {
package/PreviewVideo.js CHANGED
@@ -171,6 +171,7 @@ const PreviewVideo = ({
171
171
  }, /*#__PURE__*/React.createElement(VideoPlayer, {
172
172
  id: fileId,
173
173
  src: resourceUrl,
174
+ apiBaseName: apiBaseName,
174
175
  courseInfo: courseInfo
175
176
  })));
176
177
  };
package/VideoPlayer.js CHANGED
@@ -8,6 +8,7 @@ const VideoPlayer = props => {
8
8
  src,
9
9
  id,
10
10
  courseInfo,
11
+ apiBaseName,
11
12
  ...rest
12
13
  } = props;
13
14
  const [tracks, setTracks] = useState([]);
@@ -17,7 +18,8 @@ const VideoPlayer = props => {
17
18
  if (id && courseInfo.sourceEnum !== 'OUT') {
18
19
  getResUrlAction({
19
20
  fileId: id,
20
- courseId: courseInfo?.id
21
+ courseId: courseInfo?.id,
22
+ apiBaseName: apiBaseName
21
23
  }).then(res => {
22
24
  if (res.data) {
23
25
  setNewSrc(res.data?.map((item, index) => {
@@ -44,7 +46,8 @@ const VideoPlayer = props => {
44
46
  if (id) {
45
47
  getVideoCaption({
46
48
  fileId: id,
47
- courseId: courseInfo?.id
49
+ courseId: courseInfo?.id,
50
+ apiBaseName: apiBaseName
48
51
  }).then(res => {
49
52
  if (res.data?.length) {
50
53
  setTracks(res.data.map((item, index) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cqsjjb/course-res-design",
3
- "version": "0.0.8",
3
+ "version": "0.1.0-beta.1",
4
4
  "description": "课程资源设计组件库",
5
5
  "main": "index.js",
6
6
  "author": "jiaoxiwei",
@@ -11,6 +11,6 @@
11
11
  "dependencies": {
12
12
  "axios": "^1.12.2",
13
13
  "@cqsjjb/web-video-player": "^1.0.0",
14
- "@cqsjjb/jjb-cloud-component": "^0.0.8"
14
+ "@cqsjjb/jjb-cloud-component": "^0.0.9"
15
15
  }
16
16
  }