|
|
@ -18,8 +18,7 @@ import { getInfo } from 'react-mediainfo';
|
|
|
|
|
|
|
|
|
|
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
|
|
|
|
|
|
|
|
|
const uuid = uuidv4();
|
|
|
|
let uuid = uuidv4();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -223,9 +222,10 @@ const CourseList: React.FC = () => {
|
|
|
|
hideInSearch: true,
|
|
|
|
hideInSearch: true,
|
|
|
|
hideInDescriptions: true,
|
|
|
|
hideInDescriptions: true,
|
|
|
|
renderFormItem: (item, { defaultRender, ...rest }, form) => (
|
|
|
|
renderFormItem: (item, { defaultRender, ...rest }, form) => (
|
|
|
|
console.log('item.initialValue',item.initialValue),
|
|
|
|
// console.log('item.initialValue',item.initialValue),
|
|
|
|
console.log('dfeededed',item.initialValue ?item.initialValue.length===undefined? [item.initialValue].map(i=>({...i, url:'/dsideal_yy/html/' + i.url})):item.initialValue.map(i=>({...i, url:'/dsideal_yy/html/' + i.url})) : []),
|
|
|
|
// console.log('dfeededed',item.initialValue ?item.initialValue.length===undefined? [item.initialValue].map(i=>({...i, url:'/dsideal_yy/html/' + i.url})):item.initialValue.map(i=>({...i, url:'/dsideal_yy/html/' + i.url})) : []),
|
|
|
|
|
|
|
|
// console.log('uuid0000000000000',uuid),
|
|
|
|
|
|
|
|
// console.log('uploadFileExt000000000000',uploadFileExt),
|
|
|
|
// item.initialValue.length===undefined?
|
|
|
|
// item.initialValue.length===undefined?
|
|
|
|
<Upload
|
|
|
|
<Upload
|
|
|
|
accept='.mp4'
|
|
|
|
accept='.mp4'
|
|
|
@ -234,14 +234,12 @@ const CourseList: React.FC = () => {
|
|
|
|
beforeUpload={async (file) => {
|
|
|
|
beforeUpload={async (file) => {
|
|
|
|
/** 获取视频文件信息 */
|
|
|
|
/** 获取视频文件信息 */
|
|
|
|
const {media: {track:[General, Video, Audio]}} = await getInfo(file)
|
|
|
|
const {media: {track:[General, Video, Audio]}} = await getInfo(file)
|
|
|
|
console.log('media',General,Video,Audio)
|
|
|
|
// console.log('media',General,Video,Audio)
|
|
|
|
if(Video.Format !== 'AVC' || Audio.Format !== 'AAC'){
|
|
|
|
if(Video.Format !== 'AVC' || Audio.Format !== 'AAC'){
|
|
|
|
message.error('视频编码格式不正确(视频采用AVC,音频采用AAC)')
|
|
|
|
message.error('视频编码格式不正确(视频采用AVC,音频采用AAC)')
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log('filename', file?.name)
|
|
|
|
|
|
|
|
// 获取文件名
|
|
|
|
// 获取文件名
|
|
|
|
SetUploadFileName(file?.name);
|
|
|
|
|
|
|
|
// 获取最后一个.的位置
|
|
|
|
// 获取最后一个.的位置
|
|
|
|
const index = file?.name.lastIndexOf(".");
|
|
|
|
const index = file?.name.lastIndexOf(".");
|
|
|
|
// 获取后缀
|
|
|
|
// 获取后缀
|
|
|
@ -250,9 +248,6 @@ const CourseList: React.FC = () => {
|
|
|
|
onRemove={()=>{
|
|
|
|
onRemove={()=>{
|
|
|
|
//createFormRef?.current?.setFieldsValue({attachment_json: ""})
|
|
|
|
//createFormRef?.current?.setFieldsValue({attachment_json: ""})
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
// this.setState({ fileList });
|
|
|
|
|
|
|
|
// console.log(999,fileList)
|
|
|
|
|
|
|
|
// }}
|
|
|
|
|
|
|
|
data={{
|
|
|
|
data={{
|
|
|
|
name: uploadFileName,
|
|
|
|
name: uploadFileName,
|
|
|
|
chunk: 0,
|
|
|
|
chunk: 0,
|
|
|
@ -264,11 +259,11 @@ const CourseList: React.FC = () => {
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<Button icon={<UploadOutlined />}>上传视频</Button>
|
|
|
|
<Button icon={<UploadOutlined />}>上传视频</Button>
|
|
|
|
</Upload>
|
|
|
|
</Upload>
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
formItemProps: {
|
|
|
|
formItemProps: {
|
|
|
|
// 参照 https://ant.design/components/form-cn/#Rule
|
|
|
|
// 参照 https://ant.design/components/form-cn/#Rule
|
|
|
|
getValueFromEvent:(e: any)=>{
|
|
|
|
getValueFromEvent:(e: any)=>{
|
|
|
|
console.log('Upload event:', e);
|
|
|
|
|
|
|
|
if (Array.isArray(e)) {
|
|
|
|
if (Array.isArray(e)) {
|
|
|
|
return e;
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -334,6 +329,7 @@ const CourseList: React.FC = () => {
|
|
|
|
<a
|
|
|
|
<a
|
|
|
|
key="update"
|
|
|
|
key="update"
|
|
|
|
onClick={async() => {
|
|
|
|
onClick={async() => {
|
|
|
|
|
|
|
|
uuid = uuidv4();
|
|
|
|
const info= await viewCourse({course_id:record.course_id});
|
|
|
|
const info= await viewCourse({course_id:record.course_id});
|
|
|
|
setCurrentRow(info.data);
|
|
|
|
setCurrentRow(info.data);
|
|
|
|
handleUpdateModalVisible(true);
|
|
|
|
handleUpdateModalVisible(true);
|
|
|
@ -378,7 +374,6 @@ const CourseList: React.FC = () => {
|
|
|
|
const handleAdd = async (fields: TableListItem) => {
|
|
|
|
const handleAdd = async (fields: TableListItem) => {
|
|
|
|
const info= await saveCourse({ ...fields });
|
|
|
|
const info= await saveCourse({ ...fields });
|
|
|
|
|
|
|
|
|
|
|
|
console.log('info---',info);
|
|
|
|
|
|
|
|
if(info.code!==2000){
|
|
|
|
if(info.code!==2000){
|
|
|
|
message.warning(info.msg);
|
|
|
|
message.warning(info.msg);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -410,7 +405,6 @@ const CourseList: React.FC = () => {
|
|
|
|
const info= await saveCourse({
|
|
|
|
const info= await saveCourse({
|
|
|
|
...fields,
|
|
|
|
...fields,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
console.log('info---',info)
|
|
|
|
|
|
|
|
if(info.code!==2000){
|
|
|
|
if(info.code!==2000){
|
|
|
|
message.warning(info.msg);
|
|
|
|
message.warning(info.msg);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -447,6 +441,7 @@ const CourseList: React.FC = () => {
|
|
|
|
type="primary"
|
|
|
|
type="primary"
|
|
|
|
key="primary"
|
|
|
|
key="primary"
|
|
|
|
onClick={() => {
|
|
|
|
onClick={() => {
|
|
|
|
|
|
|
|
uuid = uuidv4();
|
|
|
|
handleCreateModalVisible(true);
|
|
|
|
handleCreateModalVisible(true);
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
>
|
|
|
@ -520,7 +515,7 @@ const CourseList: React.FC = () => {
|
|
|
|
footer={null}
|
|
|
|
footer={null}
|
|
|
|
centered
|
|
|
|
centered
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{console.log('currentRow',currentRow)}
|
|
|
|
{/*{console.log('currentRow',currentRow)}*/}
|
|
|
|
{currentRow?.course_id && (
|
|
|
|
{currentRow?.course_id && (
|
|
|
|
<Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={14}>
|
|
|
|
<Col span={14}>
|
|
|
@ -627,6 +622,7 @@ const CourseList: React.FC = () => {
|
|
|
|
formRef={createFormRef}
|
|
|
|
formRef={createFormRef}
|
|
|
|
layout="horizontal"
|
|
|
|
layout="horizontal"
|
|
|
|
layoutType="Form"
|
|
|
|
layoutType="Form"
|
|
|
|
|
|
|
|
preserve={false}
|
|
|
|
labelCol={{ span: 8 }}
|
|
|
|
labelCol={{ span: 8 }}
|
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
|
onFinish={async (values: any) => {
|
|
|
|
onFinish={async (values: any) => {
|
|
|
@ -680,11 +676,10 @@ const CourseList: React.FC = () => {
|
|
|
|
formRef={updateFormRef}
|
|
|
|
formRef={updateFormRef}
|
|
|
|
layout="horizontal"
|
|
|
|
layout="horizontal"
|
|
|
|
layoutType="Form"
|
|
|
|
layoutType="Form"
|
|
|
|
|
|
|
|
preserve={false}
|
|
|
|
labelCol={{ span: 8 }}
|
|
|
|
labelCol={{ span: 8 }}
|
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
|
onFinish={async (values: any) => {
|
|
|
|
onFinish={async (values: any) => {
|
|
|
|
console.log('values',values)
|
|
|
|
|
|
|
|
console.log('currentRow',currentRow)
|
|
|
|
|
|
|
|
await handleUpdate({
|
|
|
|
await handleUpdate({
|
|
|
|
...values,
|
|
|
|
...values,
|
|
|
|
attachment_json: `[{"img":"", "name": "${values?.attachment_json[0]?.name}", "url": "down/Syzx/${uuid?.substr(0, 2)}/${uuid}.mp4"}]`,
|
|
|
|
attachment_json: `[{"img":"", "name": "${values?.attachment_json[0]?.name}", "url": "down/Syzx/${uuid?.substr(0, 2)}/${uuid}.mp4"}]`,
|
|
|
|