dev-v2
Joe 8 months ago
parent 25a02bae71
commit ff9f78feb4

@ -54,7 +54,6 @@
"@dnd-kit/sortable": "^8.0.0", "@dnd-kit/sortable": "^8.0.0",
"@dnd-kit/utilities": "^3.2.2", "@dnd-kit/utilities": "^3.2.2",
"@umijs/route-utils": "^2.2.2", "@umijs/route-utils": "^2.2.2",
"aliyun-aliplayer": "^2.29.1",
"antd": "^5.2.2", "antd": "^5.2.2",
"antd-img-crop": "^4.23.0", "antd-img-crop": "^4.23.0",
"braft-editor": "^2.3.9", "braft-editor": "^2.3.9",

@ -1,7 +1,6 @@
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import { Button, Slider, Select, Space, Card } from 'antd'; import { Button, Slider, Select, Space, Card } from 'antd';
import { PauseCircleOutlined, PlayCircleOutlined, ExpandOutlined } from '@ant-design/icons'; import { PauseCircleOutlined, PlayCircleOutlined, ExpandOutlined } from '@ant-design/icons';
import 'aliyun-aliplayer/build/skins/default/aliplayer-min.css';
interface AliPlayerProps { interface AliPlayerProps {
vid: string; vid: string;
@ -25,8 +24,11 @@ const AliPlayer: React.FC<AliPlayerProps> = ({
// 初始化播放器 // 初始化播放器
useEffect(() => { useEffect(() => {
const link = document.createElement('link');
const script = document.createElement('script'); 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 = () => { script.onload = () => {
if (containerRef.current) { if (containerRef.current) {
playerRef.current = new (window as any).Aliplayer({ playerRef.current = new (window as any).Aliplayer({
@ -51,12 +53,14 @@ const AliPlayer: React.FC<AliPlayerProps> = ({
}); });
} }
}; };
document.head.appendChild(link);
document.head.appendChild(script); document.head.appendChild(script);
return () => { return () => {
if (playerRef.current) { if (playerRef.current) {
playerRef.current.dispose(); playerRef.current.dispose();
} }
document.head.removeChild(link);
document.head.removeChild(script); document.head.removeChild(script);
}; };
}, [vid, playAuth]); }, [vid, playAuth]);

@ -512,19 +512,23 @@ const Detail: React.FC<any> = () => {
onFinish={async (value: any) => { onFinish={async (value: any) => {
if (params.id) { if (params.id) {
let pbcVideoAddress = "" let pbcVideoAddress = ""
let pbcVideoDuration = ""
if (value.pbcVideoAddress && value.pbcVideoAddress.length > 0) { if (value.pbcVideoAddress && value.pbcVideoAddress.length > 0) {
if (value.pbcVideoAddress[0].uid === '-1') { if (value.pbcVideoAddress[0].uid === '-1') {
pbcVideoAddress = value.pbcVideoAddress[0].url || ''; pbcVideoAddress = value.pbcVideoAddress[0].url || '';
pbcVideoDuration = stepFormValues1.pbcVideoDuration || ''
} }
if ( if (
value.pbcVideoAddress[0].response && value.pbcVideoAddress[0].response &&
value.pbcVideoAddress[0].response.retcode value.pbcVideoAddress[0].response.retcode
) { ) {
pbcVideoAddress = fileType === '1' ? value.pbcVideoAddress[0].response.data.videoId : value.pbcVideoAddress[0].response.data; 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({ await addOrUpdateVideoUsingPost({
...stepFormValues1, ...stepFormValues1,
pbcVideoDuration,
pbcVideoName: value.pbcVideoName, pbcVideoName: value.pbcVideoName,
pbcFileType: value.pbcFileType, pbcFileType: value.pbcFileType,
pbcVideoAddress pbcVideoAddress

Loading…
Cancel
Save