diff --git a/package.json b/package.json index d463192..0b5400b 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,6 @@ "@dnd-kit/sortable": "^8.0.0", "@dnd-kit/utilities": "^3.2.2", "@umijs/route-utils": "^2.2.2", - "aliyun-aliplayer": "^2.29.1", "antd": "^5.2.2", "antd-img-crop": "^4.23.0", "braft-editor": "^2.3.9", diff --git a/src/components/AliPlayer/index.tsx b/src/components/AliPlayer/index.tsx index 7f25d36..5362d1a 100644 --- a/src/components/AliPlayer/index.tsx +++ b/src/components/AliPlayer/index.tsx @@ -1,7 +1,6 @@ import React, { useEffect, useRef, useState } from 'react'; import { Button, Slider, Select, Space, Card } from 'antd'; import { PauseCircleOutlined, PlayCircleOutlined, ExpandOutlined } from '@ant-design/icons'; -import 'aliyun-aliplayer/build/skins/default/aliplayer-min.css'; interface AliPlayerProps { vid: string; @@ -25,8 +24,11 @@ const AliPlayer: React.FC = ({ // 初始化播放器 useEffect(() => { + const link = document.createElement('link'); const script = document.createElement('script'); - script.src = 'https://g.alicdn.com/apsara-media-box/imp-web-player/2.25.1/aliplayer-min.js'; + link.rel = "stylesheet" + link.href = 'https://g.alicdn.com/apsara-media-box/imp-web-player/2.29.1/skins/default/aliplayer-min.css' + script.src = 'https://g.alicdn.com/apsara-media-box/imp-web-player/2.29.1/aliplayer-min.js'; script.onload = () => { if (containerRef.current) { playerRef.current = new (window as any).Aliplayer({ @@ -51,12 +53,14 @@ const AliPlayer: React.FC = ({ }); } }; + document.head.appendChild(link); document.head.appendChild(script); return () => { if (playerRef.current) { playerRef.current.dispose(); } + document.head.removeChild(link); document.head.removeChild(script); }; }, [vid, playAuth]); diff --git a/src/pages/TrainingClasses/detail.tsx b/src/pages/TrainingClasses/detail.tsx index 2b4e7d1..6e76710 100644 --- a/src/pages/TrainingClasses/detail.tsx +++ b/src/pages/TrainingClasses/detail.tsx @@ -512,19 +512,23 @@ const Detail: React.FC = () => { onFinish={async (value: any) => { if (params.id) { let pbcVideoAddress = "" + let pbcVideoDuration = "" if (value.pbcVideoAddress && value.pbcVideoAddress.length > 0) { if (value.pbcVideoAddress[0].uid === '-1') { pbcVideoAddress = value.pbcVideoAddress[0].url || ''; + pbcVideoDuration = stepFormValues1.pbcVideoDuration || '' } if ( value.pbcVideoAddress[0].response && value.pbcVideoAddress[0].response.retcode ) { pbcVideoAddress = fileType === '1' ? value.pbcVideoAddress[0].response.data.videoId : value.pbcVideoAddress[0].response.data; + pbcVideoDuration = fileType === '1' ? value.pbcVideoAddress[0].response.data.duration : ''; } } await addOrUpdateVideoUsingPost({ ...stepFormValues1, + pbcVideoDuration, pbcVideoName: value.pbcVideoName, pbcFileType: value.pbcFileType, pbcVideoAddress